1 c **********************************************************************
2 c This file contains some commonly used macros.
3 c **********************************************************************
7 #beginMacro defineDerivativeMacros(DIM,ORDER,GRIDTYPE)
9 #defineMacro U(cc) u(i1,i2,i3,cc)
10 #defineMacro UU(cc) uu(i1,i2,i3,cc)
14 #If #GRIDTYPE == "rectangular"
15 #defineMacro UX(cc) ux22r(i1,i2,i3,cc)
16 #defineMacro UY(cc) uy22r(i1,i2,i3,cc)
17 #defineMacro UXX(cc) uxx22r(i1,i2,i3,cc)
18 #defineMacro UXY(cc) uxy22r(i1,i2,i3,cc)
19 #defineMacro UYY(cc) uyy22r(i1,i2,i3,cc)
20 #defineMacro ULAP(cc) ulaplacian22r(i1,i2,i3,cc)
21 #Elif #GRIDTYPE == "curvilinear"
22 #defineMacro UX(cc) ux22(i1,i2,i3,cc)
23 #defineMacro UY(cc) uy22(i1,i2,i3,cc)
24 #defineMacro UXX(cc) uxx22(i1,i2,i3,cc)
25 #defineMacro UXY(cc) uxy22(i1,i2,i3,cc)
26 #defineMacro UYY(cc) uyy22(i1,i2,i3,cc)
27 #defineMacro ULAP(cc) ulaplacian22(i1,i2,i3,cc)
29 #defineMacro RXX() rxx22(i1,i2,i3)
30 #defineMacro RXY() rxy22(i1,i2,i3)
31 #defineMacro RYY() ryy22(i1,i2,i3)
32 #defineMacro SXX() sxx22(i1,i2,i3)
33 #defineMacro SXY() sxy22(i1,i2,i3)
34 #defineMacro SYY() syy22(i1,i2,i3)
39 #If #GRIDTYPE == "rectangular"
40 #defineMacro UX(cc) ux42r(i1,i2,i3,cc)
41 #defineMacro UY(cc) uy42r(i1,i2,i3,cc)
42 #defineMacro UXX(cc) uxx42r(i1,i2,i3,cc)
43 #defineMacro UXY(cc) uxy42r(i1,i2,i3,cc)
44 #defineMacro UYY(cc) uyy42r(i1,i2,i3,cc)
45 #defineMacro ULAP(cc) ulaplacian42r(i1,i2,i3,cc)
46 #Elif #GRIDTYPE == "curvilinear"
47 #defineMacro UX(cc) ux42(i1,i2,i3,cc)
48 #defineMacro UY(cc) uy42(i1,i2,i3,cc)
49 #defineMacro UXX(cc) uxx42(i1,i2,i3,cc)
50 #defineMacro UXY(cc) uxy42(i1,i2,i3,cc)
51 #defineMacro UYY(cc) uyy42(i1,i2,i3,cc)
52 #defineMacro ULAP(cc) ulaplacian42(i1,i2,i3,cc)
54 #defineMacro RXX() rxx42(i1,i2,i3)
55 #defineMacro RXY() rxy42(i1,i2,i3)
56 #defineMacro RYY() ryy42(i1,i2,i3)
57 #defineMacro SXX() sxx42(i1,i2,i3)
58 #defineMacro SXY() sxy42(i1,i2,i3)
59 #defineMacro SYY() syy42(i1,i2,i3)
66 #If #GRIDTYPE == "rectangular"
67 #defineMacro UX(cc) ux23r(i1,i2,i3,cc)
68 #defineMacro UY(cc) uy23r(i1,i2,i3,cc)
69 #defineMacro UZ(cc) uz23r(i1,i2,i3,cc)
70 #defineMacro UXX(cc) uxx23r(i1,i2,i3,cc)
71 #defineMacro UXY(cc) uxy23r(i1,i2,i3,cc)
72 #defineMacro UXZ(cc) uxz23r(i1,i2,i3,cc)
73 #defineMacro UYY(cc) uyy23r(i1,i2,i3,cc)
74 #defineMacro UYZ(cc) uyz23r(i1,i2,i3,cc)
75 #defineMacro UZZ(cc) uzz23r(i1,i2,i3,cc)
76 #defineMacro ULAP(cc) ulaplacian23r(i1,i2,i3,cc)
77 #Elif #GRIDTYPE == "curvilinear"
78 #defineMacro UX(cc) ux23(i1,i2,i3,cc)
79 #defineMacro UY(cc) uy23(i1,i2,i3,cc)
80 #defineMacro UZ(cc) uz23(i1,i2,i3,cc)
81 #defineMacro UXX(cc) uxx23(i1,i2,i3,cc)
82 #defineMacro UXY(cc) uxy23(i1,i2,i3,cc)
83 #defineMacro UXZ(cc) uxz23(i1,i2,i3,cc)
84 #defineMacro UYY(cc) uyy23(i1,i2,i3,cc)
85 #defineMacro UYZ(cc) uyz23(i1,i2,i3,cc)
86 #defineMacro UZZ(cc) uzz23(i1,i2,i3,cc)
87 #defineMacro ULAP(cc) ulaplacian23(i1,i2,i3,cc)
89 #defineMacro RXX() rxx23(i1,i2,i3)
90 #defineMacro RXY() rxy23(i1,i2,i3)
91 #defineMacro RXZ() rxz23(i1,i2,i3)
92 #defineMacro RYY() ryy23(i1,i2,i3)
93 #defineMacro RYZ() ryz23(i1,i2,i3)
94 #defineMacro RZZ() rzz23(i1,i2,i3)
96 #defineMacro SXX() sxx23(i1,i2,i3)
97 #defineMacro SXY() sxy23(i1,i2,i3)
98 #defineMacro SXZ() sxz23(i1,i2,i3)
99 #defineMacro SYY() syy23(i1,i2,i3)
100 #defineMacro SYZ() syz23(i1,i2,i3)
101 #defineMacro SZZ() szz23(i1,i2,i3)
103 #defineMacro TXX() txx23(i1,i2,i3)
104 #defineMacro TXY() txy23(i1,i2,i3)
105 #defineMacro TXZ() txz23(i1,i2,i3)
106 #defineMacro TYY() tyy23(i1,i2,i3)
107 #defineMacro TYZ() tyz23(i1,i2,i3)
108 #defineMacro TZZ() tzz23(i1,i2,i3)
116 #If #GRIDTYPE == "rectangular"
117 #defineMacro UX(cc) ux43r(i1,i2,i3,cc)
118 #defineMacro UY(cc) uy43r(i1,i2,i3,cc)
119 #defineMacro UZ(cc) uz43r(i1,i2,i3,cc)
120 #defineMacro UXX(cc) uxx43r(i1,i2,i3,cc)
121 #defineMacro UXY(cc) uxy43r(i1,i2,i3,cc)
122 #defineMacro UXZ(cc) uxz43r(i1,i2,i3,cc)
123 #defineMacro UYY(cc) uyy43r(i1,i2,i3,cc)
124 #defineMacro UYZ(cc) uyz43r(i1,i2,i3,cc)
125 #defineMacro UZZ(cc) uzz43r(i1,i2,i3,cc)
126 #defineMacro ULAP(cc) ulaplacian43r(i1,i2,i3,cc)
127 #Elif #GRIDTYPE == "curvilinear"
128 #defineMacro UX(cc) ux43(i1,i2,i3,cc)
129 #defineMacro UY(cc) uy43(i1,i2,i3,cc)
130 #defineMacro UZ(cc) uz43(i1,i2,i3,cc)
131 #defineMacro UXX(cc) uxx43(i1,i2,i3,cc)
132 #defineMacro UXY(cc) uxy43(i1,i2,i3,cc)
133 #defineMacro UXZ(cc) uxz43(i1,i2,i3,cc)
134 #defineMacro UYY(cc) uyy43(i1,i2,i3,cc)
135 #defineMacro UYZ(cc) uyz43(i1,i2,i3,cc)
136 #defineMacro UZZ(cc) uzz43(i1,i2,i3,cc)
137 #defineMacro ULAP(cc) ulaplacian43(i1,i2,i3,cc)
139 #defineMacro RXX() rxx43(i1,i2,i3)
140 #defineMacro RXY() rxy43(i1,i2,i3)
141 #defineMacro RXZ() rxz43(i1,i2,i3)
142 #defineMacro RYY() ryy43(i1,i2,i3)
143 #defineMacro RYZ() ryz43(i1,i2,i3)
144 #defineMacro RZZ() rzz43(i1,i2,i3)
146 #defineMacro SXX() sxx43(i1,i2,i3)
147 #defineMacro SXY() sxy43(i1,i2,i3)
148 #defineMacro SXZ() sxz43(i1,i2,i3)
149 #defineMacro SYY() syy43(i1,i2,i3)
150 #defineMacro SYZ() syz43(i1,i2,i3)
151 #defineMacro SZZ() szz43(i1,i2,i3)
153 #defineMacro TXX() txx43(i1,i2,i3)
154 #defineMacro TXY() txy43(i1,i2,i3)
155 #defineMacro TXZ() txz43(i1,i2,i3)
156 #defineMacro TYY() tyy43(i1,i2,i3)
157 #defineMacro TYZ() tyz43(i1,i2,i3)
158 #defineMacro TZZ() tzz43(i1,i2,i3)
167 c================================================================
172 c artificialDissipation(
cc) : inline macro
for u,
v,w
173 c artificialDissipationTM(
cc) : inline macro
for "n" or
k or epsilon
174 c================================================================
177 ! By default there is no AD:
178 #defineMacro artificialDissipation(
cc)
179 #defineMacro artificialDissipationTM(
cc)
181 ! 2nd-
order artificial dissipation
184 #defineMacro artificialDissipation(
cc) +adCoeff2*delta22(
cc)
186 #defineMacro artificialDissipation(
cc) +adCoeff2*delta23(
cc)
191 ! 4th-
order artficial dissipation **todo** implicit-line, self-adjoint versions
192 #If #ADTYPE ==
"AD4" || #ADTYPE ==
"AD24"
194 #defineMacro artificialDissipation(
cc) +adCoeff4*delta42(
cc)
196 #defineMacro artificialDissipation(
cc) +adCoeff4*delta43(
cc)
200 ! Both 2nd and 4th
order dissipation
201 #If #ADTYPE ==
"AD24"
203 #defineMacro artificialDissipation(
cc) +adCoeff2*delta22(
cc) + adCoeff4*delta42(
cc)
205 #defineMacro artificialDissipation(
cc) +adCoeff2*delta23(
cc) + adCoeff4*delta43(
cc)
210 ! Define
the ad macro
for the turbulent eddy viscosity equation
211 ! Just base
the coefficient on
the derivatives of that component.
214 #defineMacro artificialDissipationTM(
cc) +( ad21n+cd22n*( abs(
UX(
cc))+abs(
UY(
cc)) ) )*delta22(
cc)
216 #defineMacro artificialDissipationTM(
cc) +( ad21n+cd22n*( abs(
UX(
cc))+abs(
UY(
cc))+abs(
UZ(
cc)) ) )*delta23(
cc)
218 #Elif #ADTYPE ==
"AD4"
220 #defineMacro artificialDissipationTM(
cc) +( ad41n+cd42n*( abs(
UX(
cc))+abs(
UY(
cc)) ) )*delta42(
cc)
222 #defineMacro artificialDissipationTM(
cc) +( ad41n+cd42n*( abs(
UX(
nc))+abs(
UY(
nc))+abs(
UZ(
nc)) ) )*delta43(
cc)
224 #Elif #ADTYPE ==
"AD24"
226 #defineMacro artificialDissipationTM(
cc) +( ad21n+cd22n*( abs(
UX(
cc))+abs(
UY(
cc)) ) )*delta22(
cc)\
227 +( ad41n+cd42n*( abs(
UX(
cc))+abs(
UY(
cc)) ) )*delta42(
cc)
229 #defineMacro artificialDissipationTM(
cc) +( ad21n+cd22n*( abs(
UX(
cc))+abs(
UY(
cc))+abs(
UZ(
cc)) ) )*delta23(
cc)\
230 +( ad41n+cd42n*( abs(
UX(
nc))+abs(
UY(
nc))+abs(
UZ(
nc)) ) )*delta43(
cc)
240 c================================================================
245 c artificialDissipation(
cc) : inline macro
for u,
v,w
246 c artificialDissipationTM(
cc) : inline macro
for "n" or
k or epsilon
247 c================================================================
250 #If #ADTYPE ==
"AD2" || #ADTYPE ==
"AD24"
261 ! Artficial Dissipation **todo** implicit-line, self-adjoint versions
262 #If #ADTYPE ==
"AD4" || #ADTYPE ==
"AD24"
266 adCoeff4 = ad41+cd42*( abs(
UX(
uc))+abs(
UY(
uc))+abs(
UZ(
uc))+\