1 !
This file ins included by insLineSolveNew.bf
3 c Define
the turbulent eddy viscosity and its derivatives
for the BL model
4 #beginMacro defineBLDerivatives(dim,gt)
6 #If #gt == "rectangular"
25 c Define
the turbulent eddy viscosity and its derivatives
26 #beginMacro defineValuesBL(dim,gt)
28 defineBLDerivatives(dim,
gt)
32 c **************************************************************
33 c Macro to compute Baldwin-Lomax Turbulent viscosity
34 c **************************************************************
35 #beginMacro computeBLNuT()
44 !
assign loop variables to correspond to
the boundary
55 n1a=indexRange(side,axis) !-is1 ! boundary is 1 pt outside
59 n2a=indexRange(side,axis) !-
is2
63 n3a=indexRange(side,axis) !-
is3
72 ibb=indexRange(0,axis)
73 ibe=indexRange(1,axis)-1
80 if ( ii3.ge.ktrip .and. ii2.ge.jtrip .and. ii1.ge.itrip ) then
93 ditrip = min((ii3-ktrip),(ii2-jtrip))
95 ditrip = min((ii1-itrip),(ii3-ktrip))
97 ditrip = min((ii1-itrip),(ii2-jtrip))
101 ctrans = (1-exp(-ditrip/3.))**2
103 c write(*,*)
i1,
i2,
i3,ctrans
108 norm(1) = rxi(axis,0)
109 norm(2) = rxi(axis,1)
110 if ( nd.eq.3 )norm(3) = rxi(axis,2)
112 nmag=sqrt(norm(1)*norm(1)+norm(2)*norm(2)+norm(3)*norm(3))
114 norm(1) = norm(1)/nmag
115 norm(2) = norm(2)/nmag
116 norm(3) = norm(3)/nmag
126 ftan(1) = 2*norm(1)*
ux2(uc) + norm(2)*(
ux2(vc)+
uy2(uc))
127 ftan(2) = norm(1)*(
uy2(uc)+
ux2(vc)) + 2*norm(2)*
uy2(vc)
131 ftan(1) = 2*norm(1)*ux2c(uc) + norm(2)*(ux2c(vc)+uy2c(uc))
132 ftan(2) = norm(1)*(uy2c(uc)+ux2c(vc)) + 2*norm(2)*uy2c(vc)
140 ftan(1)=2*norm(1)*
ux2(uc)+norm(2)*(
ux2(vc)+
uy2(uc)) + norm(3)*(
ux2(
wc)+uz2(uc))
142 ftan(2)=norm(1)*(
ux2(vc)+
uy2(uc)) + 2*norm(2)*
uy2(vc) + norm(3)*(
uy2(
wc)+uz2(vc))
144 ftan(3)=norm(1)*(
ux2(
wc)+uz2(uc)) + norm(2)*(
uy2(
wc)+uz2(vc)) + 2*norm(3)*uz2(
wc)
148 ftan(1)=2*norm(1)*ux3c(uc)+ norm(2)*(ux3c(vc)+uy3c(uc)) + norm(3)*(ux3c(
wc)+uz3c(uc))
150 ftan(2)=norm(1)*(ux3c(vc)+uy3c(uc)) + 2*norm(2)*uy3c(vc) + norm(3)*(uy3c(
wc)+uz3c(vc))
152 ftan(3)=norm(1)*(ux3c(
wc)+uz3c(uc)) + norm(2)*(uy3c(
wc)+uz3c(vc)) + 2*norm(3)*uz3c(
wc)
158 fdotn = ftan(1)*norm(1)+ftan(2)*norm(2)+ftan(3)*norm(3)
161 ftan(1) = ftan(1) - norm(1)*fdotn
162 ftan(2) = ftan(2) - norm(2)*fdotn
163 ftan(3) = ftan(3) - norm(3)*fdotn
165 tauw=nu*sqrt(ftan(1)*ftan(1)+ftan(2)*ftan(2)+ftan(3)*ftan(3))
168 yscale = sqrt(tauw)/nu ! assuming density=1 here...
186 vort = abs(
ux2(vc)-
uy2(uc))
192 vort = abs(ux2c(vc)-uy2c(uc))
194 vort = sqrt( (uy3c(
wc)-uz3c(vc))*(uy3c(
wc)-uz3c(vc))- (ux3c(
wc)-uz3c(uc))*(ux3c(
wc)-uz3c(uc))+ (ux3c(vc)-uy3c(uc))*(ux3c(vc)-uy3c(uc)))
199 lmixw = vort* kbl*kbl*
dw(i1,i2,i3)*
dw(i1,i2,i3)*(1.-exp(-
yplus/a0p))**2
201 c write(*,*) "
yplus, vort ",yplus, vort
202 c write(*,*) "
dw, yscale, yplus, lmixw is ",dw(i1,i2,i3)," ",yscale," ",yplus," " ,lmixw
203 magu =
u(i1,i2,i3,uc)*
u(i2,i2,i3,uc) +
u(i1,i2,i3,vc)*
u(i1,i2,i3,vc)
205 if ( nd.eq.3 ) magu = magu +
u(i1,i2,i3,
wc)*
u(i1,i2,i3,
wc)
207 magumax = max(magu,maxumag)
209 if ( (vort*kbl*dw(i1,i2,i3)*(1.-exp(-yplus/a0p))).
gt.lmixmax ) then
212 lmixmax = vort*kbl*dw(i1,i2,i3)*(1.-exp(-yplus/a0p))
214 c write(*,*) "--",
i,ymax,lmixmax,lmix2max
217 u(i1,i2,i3,
nc) = lmixw
221 c now that we know lmixmax, ulmax and maxumag we can compute
the eddy viscosity
223 magumax = sqrt(magumax)
226 c write(*,*) "ymax is ",ymax," lmix2max ",lmix2max
234 vto = alpha*ccp*min(ymax*lmixmax/kbl, cwk*ymax*(maxumag-ulmax)*(maxumag-ulmax)*kbl/lmixmax) / (1+5.5*(dw(i1,i2,i3)*ckleb/ymax)**6)
235 c
vto = alpha*ccp*ymax*lmixmax/kbl/(1+5.5*(dw(i1,i2,i3)*ckleb/ymax)**6)
236 c write(*,*) ymax,dw(i1,i2,i3)
237 c write(*,*) (1+5.5*(dw(i1,i2,i3)*ckleb/ymax)**6)
238 c write(*,*) "i,
j,
k, yplus,
vti,
vto ",i1,i2,i3,dw(i1,i2,i3)*yscale,
u(i1,i2,i3,
nc), vto
240 c write(*,*) yscale*dw(i1,i2,i3),
u(i1,i2,i3,nc),vto,iswitch
241 if ( (iswitch.eq.0 .and. vto.lt.
u(i1,i2,i3,nc)).or. iswitch.
gt.0 ) then
242 c write(*,*) "switched at ",i,
u(i1,i2,i3,nc), vto
245 if ( iswitch.eq.0 ) iswitch = i
248 u(i1,i2,i3,nc) = ctrans*
u(i1,i2,i3,nc)
249 maxvt = max(maxvt,
u(i1,i2,i3,nc))
253 ! smooth
the eddy viscosity
a bit near
the switch from inner to outter solutions
254 do i=max(ibb+1,iswitch-5),min(iswitch+5,
ibe-2)
260 c yes,
the relaxation
coeff. is 1. I'
m just setting it equal to
the neighbors now
261 c yes,
the i+1 node uses
the updated version of
the i node'
s value
262 u(i1,i2,i3,nc) = .5*(
u(i1+io(1),i2+io(2),i3+io(3),nc)+
u(i1-io(1),i2-io(2),i3-io(3),nc))
264 c also, it seems
the region
for this smoothing should increase as
the boundary
265 c layer increases in
order to improve convergence. +- 5 was chosen through trial and
266 c error but could be made
a function of iswitch or ymax
for instance.
285 n1a=indexRange(0,axis)
286 n1b=indexRange(1,axis)
288 n2a=indexRange(0,axis)
289 n2b=indexRange(1,axis)
291 n3a=indexRange(0,axis)
292 n3b=indexRange(1,axis)
300 c write(*,*) "maxvt is ",maxvt