1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
void FirstProjection_MD4(vector<vector<vector<complex<double> > > > &Wx,
vector<vector<vector<complex<double> > > > &Wy,
vector<vector<vector<complex<double> > > > &Wz, const double lx, const double ly,
const double lz, const double theta, const double rad_sup)
{
const size_t nz = Wx.size();
const size_t ny = Wx[0].size();
const size_t nx = Wx[0][0].size();
const double dx = lx/nx;
const double dy = ly/ny;
const double dz = lz/nz;
const double x0 = lx/2.0;
const double y0 = ly/2.0;
const double z0 = lz/2.0;
double z, rleft, rleft2, rleft3,rright, rright2, rright3,xleft,y,xright,xleft1,y1,xright1;
const double R = 10.0;
const double R2 = R*R;
const double R3 = R2*R;
const double mu = 0.04;
const double reg_param = 0.01;
const double cos_theta = cos(theta);
const double sin_theta = sin(theta);
complex<double> wx, wy;
for(size_t k=0; k<nz; k++)
{
z = k*dz -z0;
for(size_t j=0; j<ny; j++)
{
y= j*dy -y0;
for(size_t i=0; i<nx; i++)
{
xleft = i*dx -3*x0/4;
//
xleft1 = xleft*cos_theta -y*sin_theta;
y1 = xleft*sin_theta +y*cos_theta;
//
rleft2 = xleft1*xleft1 + y1*y1 +z*z;
rleft = sqrt(rleft2);
rleft3 = rleft2*rleft;
xright = i*dx -x0/4;
//
xright1 = xright*cos_theta -y*sin_theta;
//
rright2 = xright1*xright1 + y1*y1 +z*z;
rright = sqrt(rright2);
rright3 = rright2*rright;
/*
Rotate the wavefield in the xy-plane
*/
wx = complex<double>(((-mu/(rleft3/R3 +reg_param))*y1/R)+((-mu/(rright3/R3 +reg_param))*y1/R), 0);
wy = complex<double>(((mu/(rleft3/R3 +reg_param))*xleft1/R)+((mu/(rleft3/R3 +reg_param))*xleft1/R), 0);
Wx[k][j][i] = wx*cos_theta +wy*sin_theta;
Wy[k][j][i] = -wx*sin_theta +wy*cos_theta;
Wz[k][j][i] = complex<double>(0, 0);
}
}
}
/*
Set the wavefield outside a radius rad_sup to zero
*/
CircularApertureWF(Wx, 1.0, 1.0, 1.0, 0.5, 0.5, 0.5, rad_sup);
CircularApertureWF(Wy, 1.0, 1.0, 1.0, 0.5, 0.5, 0.5, rad_sup);
CircularApertureWF(Wz, 1.0, 1.0, 1.0, 0.5, 0.5, 0.5, rad_sup);
}
|