6 #beginMacro annulusEigenFunction(OPTION)
15 if( numberOfDimensions==2 )
19 const int n = int(initialConditionParameters[0]+.5);
20 const int m = int(initialConditionParameters[1]+.5);
28 const real
eps=sqrt(REAL_EPSILON);
31 for(
int k=2;
k<=n+1;
k++ )
35 real
r,
gr,
xd,
yd,
zd,
bj,
bjp,
rx,
ry,
theta,
thetax,
thetay;
48 r = sqrt(xd*xd+yd*yd);
67 bjp = -jn(n+1,gr) + n*bj/
gr;
71 uex = (1./
omega)*(omega*ry*bjp*cosn -n*bj*thetay*sinn);
72 uey = -(1./
omega)*(omega*rx*bjp*cosn -n*bj*thetax*sinn);
83 bjp = n==0 ? 0. : pow(.5,
double(n))*pow(gr,n-1.)*( 1. - (gr*
gr)/(4.*np1Factorial) );
89 uex = (1./
omega)*(omega*ry*bjp*cosn -n*bjThetay*sinn);
90 uey = -(1./
omega)*(omega*rx*bjp*cosn -n*bjThetax*sinn);
94 real
sint = sin(omega*t),
cost = cos(omega*t);
96 #If #OPTION == "solution"
103 UMHZ(i1,i2,i3) = bj*cosn*cos(omega*(t-dt));
104 UMEX(i1,i2,i3) = uex*sin(omega*(t-dt));
105 UMEY(i1,i2,i3) = uey*sin(omega*(t-dt));
107 else if( method==sosup )
115 #Elif #OPTION == "error"
116 ERRHZ(i1,i2,i3) =
UHZ(i1,i2,i3) -bj*cosn*cos(omega*t);
117 ERREX(i1,i2,i3) =
UEX(i1,i2,i3) - uex*sin(omega*t);
118 ERREY(i1,i2,i3) =
UEY(i1,i2,i3) - uey*sin(omega*t);
121 errLocal(i1,i2,i3,hzt) =
uLocal(i1,i2,i3,hzt) + omega*bj*cosn*
sint;
122 errLocal(i1,i2,i3,ext) =
uLocal(i1,i2,i3,ext) - omega*uex*
cost;
123 errLocal(i1,i2,i3,eyt) =
uLocal(i1,i2,i3,eyt) - omega*uey*
cost;
126 Overture::abort(
"error");
137 const int n = int(initialConditionParameters[0]+.5);
138 const int m = int(initialConditionParameters[1]+.5);
139 const int k = int(initialConditionParameters[2]+.5);
144 real
omega = sqrt( SQR(k*Pi/cylinderLength) + lambda*lambda );
146 printF(
"***Cylinder: Bessel function soln: n=%i, m=%i, k=%i, lambda=%e, omega=%e (c=%8.2e) [za,zb]=[%4.2f,%4.2f]\n",
147 n,m,k,lambda,omega,c,cylinderAxisStart,cylinderAxisEnd);
149 const real
eps=sqrt(REAL_EPSILON);
152 for(
int k=2; k<=n+1; k++ )
156 real
r,
gr,
xd,
yd,
zd,
bj,
bjp,
rx,
ry,
theta,
thetax,
thetay;
157 real
cosTheta,
sinTheta,
bjThetax,
bjThetay,
uex,
uey,
cosn,
sinn,
sinkz,
coskz,
cost,
sint;
163 zd=(
X(i1,i2,i3,2)-cylinderAxisStart)/cylinderLength;
168 r = sqrt(xd*xd+yd*yd);
189 bjp = -jn(n+1,gr) + n*bj/
gr;
193 uex = -(k*Pi/(cylinderLength*lambda*
lambda))*( lambda*rx*bjp*cosn - n*bj*thetax*
sinn );
194 uey = -(k*Pi/(cylinderLength*lambda*
lambda))*( lambda*ry*bjp*cosn - n*bj*thetay*
sinn );
205 bjp = n==0 ? 0. : pow(.5,
double(n))*pow(gr,n-1.)*( 1. - (gr*
gr)/(4.*np1Factorial) );
211 uex = -(k*Pi/(cylinderLength*lambda*
lambda))*( lambda*rx*bjp*cosn -n*bjThetax*
sinn);
212 uey = -(k*Pi/(cylinderLength*lambda*
lambda))*( lambda*ry*bjp*cosn -n*bjThetay*
sinn);
216 #If #OPTION == "solution"
218 UEX(i1,i2,i3) = uex*sinkz*
cost;
219 UEY(i1,i2,i3) = uey*sinkz*
cost;
220 UEZ(i1,i2,i3) = bj*cosn*coskz*
cost;
222 cost=cos(omega*(t-dt));
225 UMEZ(i1,i2,i3) = bj*cosn*coskz*
cost;
228 #Elif #OPTION == "error"
236 Overture::abort(
"error");