CG
Version 25
Main Page
Namespaces
Classes
Files
File List
File Members
cg.v25
mx
src
planeMaterialInterface.h
Go to the documentation of this file.
1
#beginMacro definePlaneMaterialInterfaceMacros(LANG)
2
3
#If #LANG eq "FORTRAN"
4
c
------------ macros
for
the
plane material
interface
-------------------------
5
6
c
Incident +
reflected
:
7
#defineMacro PMIex(x,y,z,t) (pmc( 0)*cos(twoPi*(pmc(19)*(x-pmc(28))+pmc(20)*(y-pmc(29))+pmc(21)*(z-pmc(30))-pmc(18)*(t))) + \
8
pmc( 1)*cos(twoPi*(pmc(22)*(x-pmc(28))+pmc(23)*(y-pmc(29))+pmc(24)*(z-pmc(30))-pmc(18)*(t))))
9
#defineMacro PMIey(x,y,z,t) (pmc( 2)*cos(twoPi*(pmc(19)*(x-pmc(28))+pmc(20)*(y-pmc(29))+pmc(21)*(z-pmc(30))-pmc(18)*(t))) + \
10
pmc( 3)*cos(twoPi*(pmc(22)*(x-pmc(28))+pmc(23)*(y-pmc(29))+pmc(24)*(z-pmc(30))-pmc(18)*(t))))
11
#defineMacro PMIez(x,y,z,t) (pmc( 4)*cos(twoPi*(pmc(19)*(x-pmc(28))+pmc(20)*(y-pmc(29))+pmc(21)*(z-pmc(30))-pmc(18)*(t))) + \
12
pmc( 5)*cos(twoPi*(pmc(22)*(x-pmc(28))+pmc(23)*(y-pmc(29))+pmc(24)*(z-pmc(30))-pmc(18)*(t))))
13
#defineMacro PMIhx(x,y,z,t) (pmc( 6)*cos(twoPi*(pmc(19)*(x-pmc(28))+pmc(20)*(y-pmc(29))+pmc(21)*(z-pmc(30))-pmc(18)*(t))) + \
14
pmc( 7)*cos(twoPi*(pmc(22)*(x-pmc(28))+pmc(23)*(y-pmc(29))+pmc(24)*(z-pmc(30))-pmc(18)*(t))))
15
#defineMacro PMIhy(x,y,z,t) (pmc( 8)*cos(twoPi*(pmc(19)*(x-pmc(28))+pmc(20)*(y-pmc(29))+pmc(21)*(z-pmc(30))-pmc(18)*(t))) + \
16
pmc( 9)*cos(twoPi*(pmc(22)*(x-pmc(28))+pmc(23)*(y-pmc(29))+pmc(24)*(z-pmc(30))-pmc(18)*(t))))
17
#defineMacro PMIhz(x,y,z,t) (pmc(10)*cos(twoPi*(pmc(19)*(x-pmc(28))+pmc(20)*(y-pmc(29))+pmc(21)*(z-pmc(30))-pmc(18)*(t))) + \
18
pmc(11)*cos(twoPi*(pmc(22)*(x-pmc(28))+pmc(23)*(y-pmc(29))+pmc(24)*(z-pmc(30))-pmc(18)*(t))))
19
20
c
Transmitted:
21
#defineMacro PMITex(x,y,z,t) (pmc(12)*cos(twoPi*(pmc(25)*(x-pmc(28))+pmc(26)*(y-pmc(29))+pmc(27)*(z-pmc(30))-pmc(18)*(t))))
22
#defineMacro PMITey(x,y,z,t) (pmc(13)*cos(twoPi*(pmc(25)*(x-pmc(28))+pmc(26)*(y-pmc(29))+pmc(27)*(z-pmc(30))-pmc(18)*(t))))
23
#defineMacro PMITez(x,y,z,t) (pmc(14)*cos(twoPi*(pmc(25)*(x-pmc(28))+pmc(26)*(y-pmc(29))+pmc(27)*(z-pmc(30))-pmc(18)*(t))))
24
#defineMacro PMIThx(x,y,z,t) (pmc(15)*cos(twoPi*(pmc(25)*(x-pmc(28))+pmc(26)*(y-pmc(29))+pmc(27)*(z-pmc(30))-pmc(18)*(t))))
25
#defineMacro PMIThy(x,y,z,t) (pmc(16)*cos(twoPi*(pmc(25)*(x-pmc(28))+pmc(26)*(y-pmc(29))+pmc(27)*(z-pmc(30))-pmc(18)*(t))))
26
#defineMacro PMIThz(x,y,z,t) (pmc(17)*cos(twoPi*(pmc(25)*(x-pmc(28))+pmc(26)*(y-pmc(29))+pmc(27)*(z-pmc(30))-pmc(18)*(t))))
27
28
#Elif #LANG eq "C"
29
30
#defineMacro PMIex(x,y,z,t) (pmc[ 0]*cos(twoPi*(pmc[19]*(x-pmc[28])+pmc[20]*(y-pmc[29])+pmc[21]*(z-pmc[30])-pmc[18]*(t))) + \
31
pmc[ 1]*cos(twoPi*(pmc[22]*(x-pmc[28])+pmc[23]*(y-pmc[29])+pmc[24]*(z-pmc[30])-pmc[18]*(t))))
32
#defineMacro PMIey(x,y,z,t) (pmc[ 2]*cos(twoPi*(pmc[19]*(x-pmc[28])+pmc[20]*(y-pmc[29])+pmc[21]*(z-pmc[30])-pmc[18]*(t))) + \
33
pmc[ 3]*cos(twoPi*(pmc[22]*(x-pmc[28])+pmc[23]*(y-pmc[29])+pmc[24]*(z-pmc[30])-pmc[18]*(t))))
34
#defineMacro PMIez(x,y,z,t) (pmc[ 4]*cos(twoPi*(pmc[19]*(x-pmc[28])+pmc[20]*(y-pmc[29])+pmc[21]*(z-pmc[30])-pmc[18]*(t))) + \
35
pmc[ 5]*cos(twoPi*(pmc[22]*(x-pmc[28])+pmc[23]*(y-pmc[29])+pmc[24]*(z-pmc[30])-pmc[18]*(t))))
36
#defineMacro PMIhx(x,y,z,t) (pmc[ 6]*cos(twoPi*(pmc[19]*(x-pmc[28])+pmc[20]*(y-pmc[29])+pmc[21]*(z-pmc[30])-pmc[18]*(t))) + \
37
pmc[ 7]*cos(twoPi*(pmc[22]*(x-pmc[28])+pmc[23]*(y-pmc[29])+pmc[24]*(z-pmc[30])-pmc[18]*(t))))
38
#defineMacro PMIhy(x,y,z,t) (pmc[ 8]*cos(twoPi*(pmc[19]*(x-pmc[28])+pmc[20]*(y-pmc[29])+pmc[21]*(z-pmc[30])-pmc[18]*(t))) + \
39
pmc[ 9]*cos(twoPi*(pmc[22]*(x-pmc[28])+pmc[23]*(y-pmc[29])+pmc[24]*(z-pmc[30])-pmc[18]*(t))))
40
#defineMacro PMIhz(x,y,z,t) (pmc[10]*cos(twoPi*(pmc[19]*(x-pmc[28])+pmc[20]*(y-pmc[29])+pmc[21]*(z-pmc[30])-pmc[18]*(t))) + \
41
pmc[11]*cos(twoPi*(pmc[22]*(x-pmc[28])+pmc[23]*(y-pmc[29])+pmc[24]*(z-pmc[30])-pmc[18]*(t))))
42
43
#defineMacro PMITex(x,y,z,t) (pmc[12]*cos(twoPi*(pmc[25]*(x-pmc[28])+pmc[26]*(y-pmc[29])+pmc[27]*(z-pmc[30])-pmc[18]*(t))))
44
#defineMacro PMITey(x,y,z,t) (pmc[13]*cos(twoPi*(pmc[25]*(x-pmc[28])+pmc[26]*(y-pmc[29])+pmc[27]*(z-pmc[30])-pmc[18]*(t))))
45
#defineMacro PMITez(x,y,z,t) (pmc[14]*cos(twoPi*(pmc[25]*(x-pmc[28])+pmc[26]*(y-pmc[29])+pmc[27]*(z-pmc[30])-pmc[18]*(t))))
46
#defineMacro PMIThx(x,y,z,t) (pmc[15]*cos(twoPi*(pmc[25]*(x-pmc[28])+pmc[26]*(y-pmc[29])+pmc[27]*(z-pmc[30])-pmc[18]*(t))))
47
#defineMacro PMIThy(x,y,z,t) (pmc[16]*cos(twoPi*(pmc[25]*(x-pmc[28])+pmc[26]*(y-pmc[29])+pmc[27]*(z-pmc[30])-pmc[18]*(t))))
48
#defineMacro PMIThz(x,y,z,t) (pmc[17]*cos(twoPi*(pmc[25]*(x-pmc[28])+pmc[26]*(y-pmc[29])+pmc[27]*(z-pmc[30])-pmc[18]*(t))))
49
50
51
52
#Else
53
ERROR
54
#End
55
56
#endMacro
57
58
#beginMacro setPlaneMaterialInterfaceMacro(OPTION,J1,J2,J3)
59
// ------------ macro for the plane material interface -------------------------
60
// OPTION: initialCondition, error, boundaryCondition
61
// -----------------------------------------------------------------------------
62
int
i1
,
i2
,
i3
;
63
64
real
tm
=t-dt,
x
,
y
,
z
;
65
66
if
( numberOfDimensions==2 )
67
{
68
z
=0.;
69
if
(
grid
==0 )
70
{
// incident plus reflected wave.
71
FOR_3D
(
i1
,
i2
,
i3
,
J1
,
J2
,
J3
)
72
{
73
x
=
XEP
(
i1
,
i2
,
i3
,0);
74
y
=
XEP
(
i1
,
i2
,
i3
,1);
75
76
real u1 = PMIex(
x
,
y
,
z
,t);
77
real u2 = PMIey(
x
,
y
,
z
,t);
78
real u3 = PMIhz(
x
,
y
,
z
,t);
79
80
#If #OPTION eq "initialCondition"
81
UEX
(
i1
,
i2
,
i3
)= u1;
82
UEY
(
i1
,
i2
,
i3
)= u2;
83
UHZ
(
i1
,
i2
,
i3
)= u3;
84
85
UMEX
(
i1
,
i2
,
i3
)= PMIex(
x
,
y
,
z
,
tm
);
86
UMEY
(
i1
,
i2
,
i3
)= PMIey(
x
,
y
,
z
,
tm
);
87
UMHZ
(
i1
,
i2
,
i3
)= PMIhz(
x
,
y
,
z
,
tm
);
88
#Elif #OPTION eq "error"
89
ERREX
(
i1
,
i2
,
i3
)=
UEX
(
i1
,
i2
,
i3
)-u1;
90
ERREY
(
i1
,
i2
,
i3
)=
UEY
(
i1
,
i2
,
i3
)-u2;
91
ERRHZ
(
i1
,
i2
,
i3
)=
UHZ
(
i1
,
i2
,
i3
)-u3;
92
#Elif #OPTION eq "boundaryCondition"
93
U
(
i1
,
i2
,
i3
,
ex
)= u1;
94
U
(
i1
,
i2
,
i3
,
ey
)= u2;
95
U
(
i1
,
i2
,
i3
,hz)= u3;
96
#End
97
}
98
}
99
else
100
{
101
// transmitted wave
102
FOR_3D
(
i1
,
i2
,
i3
,
J1
,
J2
,
J3
)
103
{
104
x
=
XEP
(
i1
,
i2
,
i3
,0);
105
y
=
XEP
(
i1
,
i2
,
i3
,1);
106
107
real u1 = PMITex(
x
,
y
,
z
,t);
108
real u2 = PMITey(
x
,
y
,
z
,t);
109
real u3 = PMIThz(
x
,
y
,
z
,t);
110
111
#If #OPTION eq "initialCondition"
112
UEX
(
i1
,
i2
,
i3
)= u1;
113
UEY
(
i1
,
i2
,
i3
)= u2;
114
UHZ
(
i1
,
i2
,
i3
)= u3;
115
116
UMEX
(
i1
,
i2
,
i3
)= PMITex(
x
,
y
,
z
,
tm
);
117
UMEY
(
i1
,
i2
,
i3
)= PMITey(
x
,
y
,
z
,
tm
);
118
UMHZ
(
i1
,
i2
,
i3
)= PMIThz(
x
,
y
,
z
,
tm
);
119
#Elif #OPTION eq "error"
120
ERREX
(
i1
,
i2
,
i3
)=
UEX
(
i1
,
i2
,
i3
)-u1;
121
ERREY
(
i1
,
i2
,
i3
)=
UEY
(
i1
,
i2
,
i3
)-u2;
122
ERRHZ
(
i1
,
i2
,
i3
)=
UHZ
(
i1
,
i2
,
i3
)-u3;
123
#Elif #OPTION eq "boundaryCondition"
124
U
(
i1
,
i2
,
i3
,
ex
)= u1;
125
U
(
i1
,
i2
,
i3
,
ey
)= u2;
126
U
(
i1
,
i2
,
i3
,hz)= u3;
127
#End
128
}
129
}
130
}
131
else
// --- 3D --
132
{
133
if
(
grid
==0 )
134
{
// incident plus reflected wave.
135
FOR_3D
(
i1
,
i2
,
i3
,
J1
,
J2
,
J3
)
136
{
137
x
=
XEP
(
i1
,
i2
,
i3
,0);
138
y
=
XEP
(
i1
,
i2
,
i3
,1);
139
z
=
XEP
(
i1
,
i2
,
i3
,2);
140
141
real u1 = PMIex(
x
,
y
,
z
,t);
142
real u2 = PMIey(
x
,
y
,
z
,t);
143
real u3 = PMIez(
x
,
y
,
z
,t);
144
145
#If #OPTION eq "initialCondition"
146
UEX
(
i1
,
i2
,
i3
)= u1;
147
UEY
(
i1
,
i2
,
i3
)= u2;
148
UEZ
(
i1
,
i2
,
i3
)= u3;
149
150
UMEX
(
i1
,
i2
,
i3
)= PMIex(
x
,
y
,
z
,
tm
);
151
UMEY
(
i1
,
i2
,
i3
)= PMIey(
x
,
y
,
z
,
tm
);
152
UMEZ
(
i1
,
i2
,
i3
)= PMIez(
x
,
y
,
z
,
tm
);
153
#Elif #OPTION eq "error"
154
ERREX
(
i1
,
i2
,
i3
)=
UEX
(
i1
,
i2
,
i3
)-u1;
155
ERREY
(
i1
,
i2
,
i3
)=
UEY
(
i1
,
i2
,
i3
)-u2;
156
ERREZ
(
i1
,
i2
,
i3
)=
UEZ
(
i1
,
i2
,
i3
)-u3;
157
#Elif #OPTION eq "boundaryCondition"
158
U
(
i1
,
i2
,
i3
,
ex
)= u1;
159
U
(
i1
,
i2
,
i3
,
ey
)= u2;
160
U
(
i1
,
i2
,
i3
,
ez
)= u3;
161
#End
162
}
163
}
164
else
165
{
166
// transmitted wave
167
FOR_3D
(
i1
,
i2
,
i3
,
J1
,
J2
,
J3
)
168
{
169
x
=
XEP
(
i1
,
i2
,
i3
,0);
170
y
=
XEP
(
i1
,
i2
,
i3
,1);
171
z
=
XEP
(
i1
,
i2
,
i3
,2);
172
173
real u1 = PMITex(
x
,
y
,
z
,t);
174
real u2 = PMITey(
x
,
y
,
z
,t);
175
real u3 = PMITez(
x
,
y
,
z
,t);
176
177
#If #OPTION eq "initialCondition"
178
UEX
(
i1
,
i2
,
i3
)= u1;
179
UEY
(
i1
,
i2
,
i3
)= u2;
180
UEZ
(
i1
,
i2
,
i3
)= u3;
181
182
UMEX
(
i1
,
i2
,
i3
)= PMITex(
x
,
y
,
z
,
tm
);
183
UMEY
(
i1
,
i2
,
i3
)= PMITey(
x
,
y
,
z
,
tm
);
184
UMEZ
(
i1
,
i2
,
i3
)= PMITez(
x
,
y
,
z
,
tm
);
185
#Elif #OPTION eq "error"
186
ERREX
(
i1
,
i2
,
i3
)=
UEX
(
i1
,
i2
,
i3
)-u1;
187
ERREY
(
i1
,
i2
,
i3
)=
UEY
(
i1
,
i2
,
i3
)-u2;
188
ERREZ
(
i1
,
i2
,
i3
)=
UEZ
(
i1
,
i2
,
i3
)-u3;
189
#Elif #OPTION eq "boundaryCondition"
190
U
(
i1
,
i2
,
i3
,
ex
)= u1;
191
U
(
i1
,
i2
,
i3
,
ey
)= u2;
192
U
(
i1
,
i2
,
i3
,
ez
)= u3;
193
#End
194
}
195
}
196
197
198
}
199
200
#endMacro
Generated on Fri Jan 4 2013 10:19:25 for CG by
1.8.3