Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
giadarol committed Nov 22, 2022
1 parent 42d48c7 commit cb5193f
Showing 1 changed file with 2 additions and 43 deletions.
45 changes: 2 additions & 43 deletions xfields/fieldmaps/bigaussian_src/bigaussian.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ void get_Ex_Ey_gauss(
double sigma = 0.5*(sigma_x+sigma_y);
get_transv_field_gauss_round(sigma, 0., 0., x, y, Ex_ptr, Ey_ptr);
}

// elliptical beam
else{
get_transv_field_gauss_ellip(
Expand All @@ -135,48 +135,6 @@ void get_Ex_Ey_gauss(
}


/*gpufun*/ void compute_Gx_Gy(
const double x,
const double y,
const double sigma_x,
const double sigma_y,
const double min_sigma_diff,
const double Ex,
const double Ey,
double* Gx_ptr,
double* Gy_ptr){

double Gx, Gy;

if (fabs(sigma_x-sigma_y) < min_sigma_diff){
const double sigma = 0.5*(sigma_x+sigma_y);
if ((x*x+y*y)<1e-14){
Gx = 1./(8*PI*EPSILON_0*sigma*sigma);
Gy = Gx;
}
else{
Gx = 1/(2.*(x*x+y*y))*(y*Ey-x*Ex+1./(2*PI*EPSILON_0*sigma*sigma)
*x*x*exp(-(x*x+y*y)/(2.*sigma*sigma)));
Gy = 1./(2*(x*x+y*y))*(x*Ex-y*Ey+1./(2*PI*EPSILON_0*sigma*sigma)
*y*y*exp(-(x*x+y*y)/(2.*sigma*sigma)));
}
}
else{

const double Sig_11 = sigma_x*sigma_x;
const double Sig_33 = sigma_y*sigma_y;

Gx =-1./(2*(Sig_11-Sig_33))*(x*Ex+y*Ey+1./(2*PI*EPSILON_0)
*(sigma_y/sigma_x*exp(-x*x/(2*Sig_11)-y*y/(2*Sig_33))-1.));
Gy =1./(2*(Sig_11-Sig_33))*(x*Ex+y*Ey+1./(2*PI*EPSILON_0)*
(sigma_x/sigma_y*exp(-x*x/(2*Sig_11)-y*y/(2*Sig_33))-1.));
}

*Gx_ptr = Gx;
*Gy_ptr = Gy;
}
#endif

#ifndef NOFIELDMAP

#ifndef XFIEDLS_BIGUASSIIAN_H_FIELDMAP
Expand Down Expand Up @@ -212,3 +170,4 @@ void BiGaussianFieldMap_get_dphi_dx_dphi_dy(

#endif
#endif
#endif

0 comments on commit cb5193f

Please sign in to comment.