1 ! --- Macros
for the Spalart-Alamras model
for the line solver ----
2 !
this file is includes by insLineSOlveNew.bf
5 c Define
the turbulent eddy viscosity and its derivatives given chi3=chi^3
6 #beginMacro defineSADerivatives(dim,gt)
8 nuTd= chi3*(chi3+4.*cv1e3)/(chi3+cv1e3)**2
9 #If #
gt ==
"rectangular"
28 c Define
the turbulent eddy viscosity and its derivatives
29 #beginMacro defineValuesSA(dim,gt)
32 defineSADerivatives(dim,
gt)
37 c Macro to define
the set of computations required to compute values
for the SA turbulence model.
38 c used in
the macros below
39 #beginMacro setupSA(dim,gt)
42 fnu1=chi3/( chi3+cv1e3)
43 fnu2=1.-chi/(1.+chi*fnu1)
45 dKappaSq=(dd*
kappa)**2
47 #If #
gt ==
"rectangular"
48 s=abs(
uy2(uc)-
ux2(vc))+ uu(
nc)*fnu2/dKappaSq ! turbulence source term
50 s=abs(uy2c(uc)-ux2c(vc))+ uu(
nc)*fnu2/dKappaSq ! turbulence source term
53 #If #gt == "rectangular"
54 s=uu(
nc)*fnu2/dKappaSq \
57 s=uu(
nc)*fnu2/dKappaSq \
58 +sqrt( (uy3c(uc)-ux3c(vc))**2 + (uz3c(vc)-uy3c(
wc))**2 + (ux3c(
wc)-uz3c(uc))**2 )
61 r= min( uu(
nc)/( s*dKappaSq ), cr0 ) ! r= uu(
nc)/( max( s*dKappaSq, 1.
e-20) )
63 fw=g*( (1.+cw3e6)/(g**6+cw3e6) )**(1./6.)
64 ! We use Newton to linearize
the quadratic term:
y*
y -> 2*
y*y0 - y0**2
65 nSqBydSq=cw1*fw*(uu(
nc)/dd)**2 !
for rhs
66 nBydSqLhs=2.*cw1*fw*(uu(
nc)/dd**2) !
for lhs
69 #If #
gt ==
"rectangular"
77 #If #gt == "rectangular"
89 c Macro
for the SA TM on rectangular grids
90 c Only
the equation
for the turbulence eddy viscosity is done here
91 #beginMacro fillSAEquationsRectangularGrid(dir)
94 $defineArtificialDiffusionCoefficients(2,
dir,
R,SA),\
95 $setupSA(2,rectangular),\
98 bm(
i1,
i2,
i3)= dtScale/dt(
i1,
i2,
i3) +2.*nutb*(dxvsqi(0)+dxvsqi(1)) +cdDiag +nBydSqLhs -
cb1*s,\
100 f(
i1,
i2,
i3,
nc)=
f(
i1,
i2,
i3,
nc)+fsa2d ##
dir(
nc) + nSqBydSq + adE ##
dir(
i1,
i2,
i3,
nc),,)
103 $defineArtificialDiffusionCoefficients(3,
dir,
R,SA),\
104 $setupSA(3,rectangular),\
106 am(
i1,
i2,
i3)= -(uu(uc+dir)+t1)*
dxv2i(dir)-nutb*dxvsqi(dir) -cdm,\
107 bm(i1,i2,
i3)= dtScale/dt(i1,i2,
i3) +2.*nutb*(dxvsqi(0)+dxvsqi(1)+dxvsqi(2)) +cdDiag +nBydSqLhs -
cb1*s,\
108 cm(i1,i2,
i3)= (uu(uc+dir)+t1)*
dxv2i(dir)-nutb*dxvsqi(dir) -cdp,,,,,\
109 f(i1,i2,
i3,
nc)=
f(i1,i2,i3,
nc)+fsa3d
## dir(nc) + nSqBydSq +adE3d ##dir(i1,i2,i3,nc),,)
114 #beginMacro fillSAEquationsCurvilinearGrid(dir)
119 $defineArtificialDiffusionCoefficients(2,dir,C,SA),\
120 $setupSA(2,curvilinear),\
121 t1=(uu(uc)*rxi(dir,0)+uu(vc)*rxi(dir,1)-nutb*(
rxx(dir,0)+rxy(dir,1))\
122 -(1.+
cb2)*
sigmai*(dndx(0)*rxi(dir,0)+dndx(1)*rxi(dir,1)) )*drv2i(dir),\
123 t2=nutb*(rxi(dir,0)**2+rxi(dir,1)**2)*drvsqi(dir),\
124 am(i1,i2,i3)= -t1-t2 -cdm,\
125 bm(i1,i2,i3)= dtScale/dt(i1,i2,i3) +2.*(t2+nutb*(rxi(dirp1,0)**2+rxi(dirp1,1)**2)*drvsqi(dirp1) )\
126 +cdDiag +nBydSqLhs -
cb1*s,\
127 cm(i1,i2,i3)= t1-t2 -cdp,,,,\
128 f(i1,i2,i3,
nc)=
f(i1,i2,i3,
nc)+fsac2d
## dir(nc) + nSqBydSq +adE ##dir(i1,i2,i3,nc),,)
131 $defineArtificialDiffusionCoefficients(3,dir,C,SA),\
132 $setupSA(3,curvilinear),\
133 t1=(uu(uc)*rxi(dir,0)+uu(vc)*rxi(dir,1)+uu(
wc)*rxi(dir,2)\
134 -nutb*(rxx3(dir,0)+rxy3(dir,1)+rxz3(dir,2)) \
135 -(1.+
cb2)*
sigmai*(dndx(0)*rxi(dir,0)+dndx(1)*rxi(dir,1)+dndx(2)*rxi(dir,2)) )*drv2i(dir),\
136 t2=nutb*(rxi(dir,0)**2+rxi(dir,1)**2+rxi(dir,2)**2)*drvsqi(dir), \
137 am(i1,i2,i3)= -t1-t2 -cdm,\
138 bm(i1,i2,i3)= dtScale/dt(i1,i2,i3)\
139 +2.*(t2+nutb*( (rxi(dirp1,0)**2+rxi(dirp1,1)**2+rxi(dirp1,2)**2)*drvsqi(dirp1)+\
140 (rxi(dirp2,0)**2+rxi(dirp2,1)**2+rxi(dirp2,2)**2)*drvsqi(dirp2) ))\
141 +cdDiag +nBydSqLhs -
cb1*s,\
142 cm(i1,i2,i3)= t1-t2 -cdp,,,,\
143 f(i1,i2,i3,
nc)=
f(i1,i2,i3,
nc)+fsac3d ##
dir(
nc) + nSqBydSq +adE3d ##
dir(i1,i2,i3,
nc),,)