1 c **
NOTE: run pml.maple to take
this file and generate
the pml.h file
2 c restart; read
"pml.maple";
3 c ====================================================================================================
5 c OPTION : fullUpdate or partialUpdate
6 c DIM : 2 or 3
space dimensions
7 c ====================================================================================================
8 #beginMacro update4xDIMd(va,wa, m,OPTION)
11 ! (
u(
n+1) - 2*
u +
u(
n-1))/dt^2 = u_tt + (dt^4/12)*u_tttt + ...
13 ! [
u(
n)-
u(
n-1)]/dt = u_t + (dt/2)*u_tt + O(dt^2)
15 ! u_tt = Delta
u - v_x - w
16 ! u_tttt = Delta u_tt - v_xtt - wtt
21 vxx = va xx42r(i1,i2,i3,
m)
22 vxxx= va xxx22r(i1,i2,i3,
m)
23 vxyy= va xyy22r(i1,i2,i3,
m)
26 wx = wa x42r(i1,i2,i3,
m)
27 wxx = wa xx42r(i1,i2,i3,
m)
30 uxx= uxx42r(i1,i2,i3,
m)
31 uxxx=uxxx22r(i1,i2,i3,
m)
32 uxyy=uxyy22r(i1,i2,i3,
m)
34 uxxxx=uxxxx22r(i1,i2,i3,
m)
35 uxxyy=uxxyy22r(i1,i2,i3,
m)
37 uLap = uLaplacian42r(i1,i2,i3,
m)
39 ! --- these change in 3
D ---
41 uyyyy=uyyyy22r(i1,i2,i3,
m)
42 uLapSq=uxxxx +2.*uxxyy +uyyyy
47 uLapSq=uLapSq23r(i1,i2,i3,
m)
48 uxzz=uxzz23r(i1,i2,i3,
m)
49 uxxzz=uxzz23r(i1,i2,i3,
m)
50 vxzz= va xzz23r(i1,i2,i3,
m)
52 uLapx = uxxx+uxyy+uxzz
53 uLapxx= uxxxx+uxxyy+uxxzz
59 ut = (
u(i1,i2,i3,
m)-um(i1,i2,i3,
m))/dt - (.5*dt*csq)*( uLap - vx - w )
60 uxt = (
ux-umx42r(i1,i2,i3,
m))/dt - (.5*dt*csq)*( uLapx - vxx - wx )
61 uxxt= (
uxx-umxx42r(i1,i2,i3,
m))/dt - (.5*dt*csq)*( uLapxx - vxxx - wxx )
62 ! *** uxxxt= (uxxx-umxxx42r(i1,i2,i3,
m))/dt ! only need to first
order in dt
63 ! *** uxyyt= (uxyy-umxyy42r(i1,i2,i3,
m))/dt ! only need to first
order in dt
64 ! *** uxxxxt= (uxxxx-umxxxx42r(i1,i2,i3,
m))/dt ! only need to first
order in dt
65 ! *** uxxyyt= (uxxyy-umxxyy42r(i1,i2,i3,
m))/dt ! only need to first
order in dt
67 vt = sigma1*( -
v +
ux )
68 vxt = sigma1*( -vx +
uxx ) + sigma1x*( -
v +
ux )
69 vxtt = sigma1*( -vxt + uxxt ) + sigma1x*( -
vt +
uxt )
71 wt = sigma1*( -w -vx +
uxx )
72 wtt = sigma1*( -wt -vxt + uxxt )
74 #If #OPTION == "fullUpdate"
75 un(i1,i2,i3,
m)=2.*
u(i1,i2,i3,
m)-um(i1,i2,i3,
m) \
76 + cdtsq*( uLap - vx -w ) \
77 + cdt4Over12*( uLapSq - vLapx - wa Laplacian42r(i1,i2,i3,
m) - vxtt - wtt )
78 #Elif #OPTION ==
"partialUpdate"
79 ! on an edge just add
the other terms
80 un(i1,i2,i3,
m)=un(i1,i2,i3,
m)\
82 + cdt4Over12*( - vLapx - wa Laplacian42r(i1,i2,i3,
m) - vxtt - wtt )
87 ! auxilliary variables
88 ! v_t = sigma1*( -
v + u_x )
89 ! (
v(
n+1)-
v(
n-1))/(2*dt) = v_t + (dt^2/3)*
vttt
90 !
vttt = sigma1*( -v_tt + u_xtt )
92 uxtt = csq*( uLapx - vxx -wx )
93 uxxtt = csq*( uLapxx - vxxx -wxx )
96 ! *** uxttt = csq*( uxxxt +uxyyt - vxxt -wxt )
97 ! *** uxxttt = csq*( uxxxxt+uxxyyt - vxxxt -wxxt )
101 vtttt = 0. ! *** sigma1*( -
vttt + uxttt)
104 ! va
n(i1,i2,i3,
m)=va
m(i1,i2,i3,
m)+(2.*dt)*(
vt + (dt**2/6.)*
vttt )
105 va
n(i1,i2,i3,
m)=va(i1,i2,i3,
m)+(dt)*(
vt + dt*( .5*
vtt + dt*( (1./6.)*
vttt + dt*( (1./24.)*vtttt ) ) ) )
106 ! write(*,'(" i1,i2=",2i3,"
vt,
vtt,
vttt=",3e10.2,"
v,
ux,
uxt,uxtt=",4e10.2)') i1,i2,vt,vtt,vttt,v,ux,uxt,uxtt
108 ! w_t = sigma1*( -w -vx +
uxx )
110 wttt = sigma1*( -wtt -vxtt + uxxtt )
111 wtttt = 0. ! **** sigma1*( -wttt -vxttt + uxxttt )
112 ! wan(i1,i2,i3,
m)=wam(i1,i2,i3,
m)+(2.*dt)*( wt + (dt**2/6.)*wttt )
113 wa
n(i1,i2,i3,
m)=wa(i1,i2,i3,
m)+(dt)*( wt + dt*( .5*wtt + dt*( (1./6.)*wttt + dt*( (1./24.)*wtttt ) ) ) )