3 ! fillEquationsRectangularGridINS
4 ! fillEquationsCurvilinearGridINS
5 ! fillEquationsRectangularGridTemperature
6 ! fillEquationsCurvilinearGridTemperature
9 !
This file is included in insLineSolveNew.bf
12 c ===================================================================================
13 c INS: Incompressible Navier Stokes
15 c====================================================================================
16 #beginMacro fillEquationsRectangularGridINS(dir)
18 ! ****** Incompressible NS, No turbulence model *****
19 if( use4thOrderAD.eq.1 )then
20 write(*,*)
'insLineSolve: 4th order diss not finished'
24 !
set default values
for no 2nd
order artificial diffusion:
30 ! since then macro is valid
for m=uc,vc,
wc)
32 #defineMacro fr2d(m) (uu(m)*dtScale/dt(i1,i2,i3) -uu(vc)*uy2(m)+nu*uyy0(m) \
33 -thermalExpansivity*gravity(m-uc)*u(i1,i2,i3,tc))
34 #defineMacro fr3d(m) (uu(m)*dtScale/dt(i1,i2,i3) -uu(vc)*uy2(m)-uu(wc)*uz2(m)+nu*(uyy0(m)+uzz0(m))\
35 -thermalExpansivity*gravity(m-uc)*u(i1,i2,i3,tc))
37 #defineMacro fr2d(m) (uu(m)*dtScale/dt(i1,i2,i3) -uu(uc)*ux2(m)+nu*uxx0(m) \
38 -thermalExpansivity*gravity(m-uc)*u(i1,i2,i3,tc))
39 #defineMacro fr3d(m) (uu(m)*dtScale/dt(i1,i2,i3) -uu(uc)*ux2(m)-uu(wc)*uz2(m)+nu*(uxx0(m)+uzz0(m)) -\
40 thermalExpansivity*gravity(m-uc)*u(i1,i2,i3,tc))
42 #defineMacro fr2d(m) (0.)
43 #defineMacro fr3d(m) (uu(m)*dtScale/dt(i1,i2,i3) -uu(uc)*ux2(m)-uu(vc)*uy2(m)+nu*(uxx0(m)+uyy0(m)) \
44 -thermalExpansivity*gravity(m-uc)*u(i1,i2,i3,tc))
54 defineArtificialDiffusionCoefficients(2,
dir,
R,)
56 if( computeMatrix.eq.1 )then
58 bm(
i1,
i2,
i3)= dtScale/dt(
i1,
i2,
i3) +2.*nu*(dxvsqi(0)+dxvsqi(1)) +cdDiag
61 if( computeRHS.eq.1 )then
75 if( computeRHS.eq.1 )then
90 defineArtificialDiffusionCoefficients(3,
dir,
R,)
92 if( computeMatrix.eq.1 )then
94 bm(
i1,
i2,
i3)= dtScale/dt(
i1,
i2,
i3) +2.*nu*(dxvsqi(0)+dxvsqi(1)+dxvsqi(2)) +cdDiag
97 if( computeRHS.eq.1 )then
113 if( computeRHS.eq.1 )then
122 stop 888 ! unexpected value
for nd
128 c ===================================================================================
129 c ****** Incompressible NS, No turbulence model *****
131 c====================================================================================
132 #beginMacro fillEquationsCurvilinearGridINS(
dir)
134 if( use4thOrderAD.eq.1 )then
135 write(*,*)
'insLineSolve: 4th order diss not finished'
142 !
INS -
RHS forcing
for curvilinear grids, directions=0,1,2 (do NOT include
grad(p) terms)
144 #defineMacro fc2d(
m) (uu(
m)*dtScale/dt(
i1,
i2,
i3) +\
145 (-uu(uc)*rxi(1,0)-uu(vc)*rxi(1,1)+nu*(
rxx(1,0)+ryy(1,1)))*
us(
m)+\
146 nu*((rxi(1,0)**2+rxi(1,1)**2)*uss0(
m)+\
148 #defineMacro fc3d(
m) (uu(
m)*dtScale/dt(
i1,
i2,
i3) +\
149 (-uu(uc)*rxi(1,0)-uu(vc)*rxi(1,1)-uu(
wc)*rxi(1,2)+nu*(rxx3(1,0)+rxy3(1,1)+rxz3(1,2)))*
us(
m)+\
150 (-uu(uc)*rxi(2,0)-uu(vc)*rxi(2,1)-uu(
wc)*rxi(2,2)+nu*(rxx3(2,0)+rxy3(2,1)+rxz3(2,2)))*
ut(
m)+\
151 nu*( (rxi(1,0)**2+rxi(1,1)**2+rxi(1,2)**2)*uss0(
m)+\
152 (rxi(2,0)**2+rxi(2,1)**2+rxi(2,2)**2)*utt0(
m)+\
153 2.*(rxi(0,0)*rxi(1,0)+rxi(0,1)*rxi(1,1)+rxi(0,2)*rxi(1,2))*urs(
m)+\
154 2.*(rxi(0,0)*rxi(2,0)+rxi(0,1)*rxi(2,1)+rxi(0,2)*rxi(2,2))*urt(
m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,2)))*
us(
m)+\
176 nu*( (rxi(0,0)**2+rxi(0,1)**2+rxi(0,2)**2)*urr0(
m)+\
177 (rxi(1,0)**2+rxi(1,1)**2+rxi(1,2)**2)*uss0(
m)+\
178 2.*(rxi(0,0)*rxi(1,0)+rxi(0,1)*rxi(1,1)+rxi(0,2)*rxi(1,2))*urs(
m)+\
179 2.*(rxi(0,0)*rxi(2,0)+rxi(0,1)*rxi(2,1)+rxi(0,2)*rxi(2,2))*urt(
m)+\
180 2.*(rxi(1,0)*rxi(2,0)+rxi(1,1)*rxi(2,1)+rxi(1,2)*rxi(2,2))*ust(
m)\
184 ! set default values
for no 2nd
order artificial diffusion:
195 defineArtificialDiffusionCoefficients(2,
dir,C,)
197 if( computeMatrix.eq.1 )then
199 t2=nu*(rxi(
dir,0)**2+rxi(
dir,1)**2)*drvsqi(
dir)
201 bm(
i1,
i2,
i3)= dtScale/dt(
i1,
i2,
i3) +2.*(t2+nu*(rxi(dirp1,0)**2+rxi(dirp1,1)**2)*drvsqi(dirp1) )+cdDiag
204 if( computeRHS.eq.1 )then
213 if( computeMatrix.eq.1 )then
218 if( computeRHS.eq.1 )then
232 defineArtificialDiffusionCoefficients(3,
dir,C,)
234 if( computeMatrix.eq.1 )then
236 t2=nu*(rxi(
dir,0)**2+rxi(
dir,1)**2+rxi(
dir,2)**2)*drvsqi(
dir)
239 +2.*(t2+nu*( (rxi(dirp1,0)**2+rxi(dirp1,1)**2+rxi(dirp1,2)**2)*drvsqi(dirp1)+\
240 (rxi(dirp2,0)**2+rxi(dirp2,1)**2+rxi(dirp2,2)**2)*drvsqi(dirp2) )) +cdDiag
243 if( computeRHS.eq.1 )then
254 if( computeMatrix.eq.1 )then
259 if( computeRHS.eq.1 )then
268 stop 222 ! unexpected value
for nd
275 c ===================================================================================
276 c INS: Incompressible Navier Stokes Temperature Equation
278 c====================================================================================
279 #beginMacro fillEquationsRectangularGridTemperature(
dir)
281 ! write(*,*)
'new: fillEquationsRectangularGridTemperature'
283 ! ****** Temperature Equation
for INS *****
284 if( use4thOrderAD.eq.1 )then
285 write(*,*)
'insLineSolve: T : 4th order diss not finished'
289 ! set default values
for no 2nd
order artificial diffusion:
295 #defineMacro frt2d(
m) (uu(
m)*dtScale/dt(
i1,
i2,
i3) -uu(vc)*
uy2(
m)+kThermal*uyy0(
m))
296 #defineMacro frt3d(
m) (uu(
m)*dtScale/dt(
i1,
i2,
i3) -uu(vc)*
uy2(
m)-uu(
wc)*uz2(
m)+kThermal*(uyy0(
m)+uzz0(
m)))
298 #defineMacro frt2d(
m) (uu(
m)*dtScale/dt(
i1,
i2,
i3) -uu(uc)*
ux2(
m)+kThermal*uxx0(
m))
299 #defineMacro frt3d(
m) (uu(
m)*dtScale/dt(
i1,
i2,
i3) -uu(uc)*
ux2(
m)-uu(
wc)*uz2(
m)+kThermal*(uxx0(
m)+uzz0(
m)))
301 #defineMacro frt2d(
m) (0.)
302 #defineMacro frt3d(
m) (uu(
m)*dtScale/dt(
i1,
i2,
i3) -uu(uc)*
ux2(
m)-uu(vc)*
uy2(
m)+kThermal*(uxx0(
m)+uyy0(
m)))
312 defineArtificialDiffusionCoefficients(2,
dir,
R,)
314 if( computeMatrix.eq.1 )then
316 bm(
i1,
i2,
i3)= dtScale/dt(
i1,
i2,
i3) +2.*kThermal*(dxvsqi(0)+dxvsqi(1)) +cdDiag
319 if( computeRHS.eq.1 )then
331 if( computeRHS.eq.1 )then
345 defineArtificialDiffusionCoefficients(3,
dir,
R,)
347 if( computeMatrix.eq.1 )then
349 bm(
i1,
i2,
i3)= dtScale/dt(
i1,
i2,
i3) +2.*kThermal*(dxvsqi(0)+dxvsqi(1)+dxvsqi(2)) +cdDiag
352 if( computeRHS.eq.1 )then
364 if( computeRHS.eq.1 )then
371 stop 888 ! unexpected value
for nd
377 c ===================================================================================
378 c ****** Temperature Equation
for INS *****
380 c====================================================================================
381 #beginMacro fillEquationsCurvilinearGridTemperature(
dir)
383 ! write(*,*)
'new: fillEquationsCurvilinearGridTemperature'
385 if( use4thOrderAD.eq.1 )then
386 write(*,*)
'insLineSolve: T : 4th order diss not finished'
394 #defineMacro fct2d(
m) (uu(
m)*dtScale/dt(
i1,
i2,
i3) +\
395 (-uu(uc)*rxi(1,0)-uu(vc)*rxi(1,1)+kThermal*(
rxx(1,0)+ryy(1,1)))*
us(
m)+\
396 kThermal*((rxi(1,0)**2+rxi(1,1)**2)*uss0(
m)+\
397 2.*(rxi(0,0)*rxi(1,0)+rxi(0,1)*rxi(1,1))*urs(
m)) )
398 #defineMacro fct3d(
m) (uu(
m)*dtScale/dt(
i1,
i2,
i3) +\
399 (-uu(uc)*rxi(1,0)-uu(vc)*rxi(1,1)-uu(
wc)*rxi(1,2)+kThermal*(rxx3(1,0)+rxy3(1,1)+rxz3(1,2)))*
us(
m)+\
400 (-uu(uc)*rxi(2,0)-uu(vc)*rxi(2,1)-uu(
wc)*rxi(2,2)+kThermal*(rxx3(2,0)+rxy3(2,1)+rxz3(2,2)))*
ut(
m)+\
401 kThermal*( (rxi(1,0)**2+rxi(1,1)**2+rxi(1,2)**2)*uss0(
m)+\
402 (rxi(2,0)**2+rxi(2,1)**2+rxi(2,2)**2)*utt0(
m)+\
403 2.*(rxi(0,0)*rxi(1,0)+rxi(0,1)*rxi(1,1)+rxi(0,2)*rxi(1,2))*urs(
m)+\
404 2.*(rxi(0,0)*rxi(2,0)+rxi(0,1)*rxi(2,1)+rxi(0,2)*rxi(2,2))*urt(
m)+\
405 2.*(rxi(1,0)*rxi(2,0)+rxi(1,1)*rxi(2,1)+rxi(1,2)*rxi(2,2))*ust(
m)\
408 #defineMacro fct2d(
m) (uu(
m)*dtScale/dt(
i1,
i2,
i3) +\
409 (-uu(uc)*rxi(0,0)-uu(vc)*rxi(0,1)+kThermal*(
rxx(0,0)+ryy(0,1)))*
ur(
m)+\
410 kThermal*((rxi(0,0)**2+rxi(0,1)**2)*urr0(
m)+\
411 2.*(rxi(0,0)*rxi(1,0)+rxi(0,1)*rxi(1,1))*urs(
m)) )
412 #defineMacro fct3d(
m) (uu(
m)*dtScale/dt(
i1,
i2,
i3) +\
413 (-uu(uc)*rxi(0,0)-uu(vc)*rxi(0,1)-uu(
wc)*rxi(0,2)+kThermal*(rxx3(0,0)+rxy3(0,1)+rxz3(0,2)))*
ur(
m)+\
414 (-uu(uc)*rxi(2,0)-uu(vc)*rxi(2,1)-uu(
wc)*rxi(2,2)+kThermal*(rxx3(2,0)+rxy3(2,1)+rxz3(2,2)))*
ut(
m)+\
415 kThermal*( (rxi(0,0)**2+rxi(0,1)**2+rxi(0,2)**2)*urr0(
m)+\
416 (rxi(2,0)**2+rxi(2,1)**2+rxi(2,2)**2)*utt0(
m)+\
417 2.*(rxi(0,0)*rxi(1,0)+rxi(0,1)*rxi(1,1)+rxi(0,2)*rxi(1,2))*urs(
m)+\
418 2.*(rxi(0,0)*rxi(2,0)+rxi(0,1)*rxi(2,1)+rxi(0,2)*rxi(2,2))*urt(
m)+\
419 2.*(rxi(1,0)*rxi(2,0)+rxi(1,1)*rxi(2,1)+rxi(1,2)*rxi(2,2))*ust(
m)\
422 #defineMacro fct2d(
m) (0.)
423 #defineMacro fct3d(
m) (uu(
m)*dtScale/dt(
i1,
i2,
i3) +\
424 (-uu(uc)*rxi(0,0)-uu(vc)*rxi(0,1)-uu(
wc)*rxi(0,2)+kThermal*(rxx3(0,0)+rxy3(0,1)+rxz3(0,2)))*
ur(
m)+\
425 (-uu(uc)*rxi(1,0)-uu(vc)*rxi(1,1)-uu(
wc)*rxi(1,2)+kThermal*(rxx3(1,0)+rxy3(1,1)+rxz3(1,2)))*
us(
m)+\
426 kThermal*( (rxi(0,0)**2+rxi(0,1)**2+rxi(0,2)**2)*urr0(
m)+\
427 (rxi(1,0)**2+rxi(1,1)**2+rxi(1,2)**2)*uss0(
m)+\
428 2.*(rxi(0,0)*rxi(1,0)+rxi(0,1)*rxi(1,1)+rxi(0,2)*rxi(1,2))*urs(
m)+\
429 2.*(rxi(0,0)*rxi(2,0)+rxi(0,1)*rxi(2,1)+rxi(0,2)*rxi(2,2))*urt(
m)+\
430 2.*(rxi(1,0)*rxi(2,0)+rxi(1,1)*rxi(2,1)+rxi(1,2)*rxi(2,2))*ust(
m)\
434 ! set default values
for no 2nd
order artificial diffusion:
445 defineArtificialDiffusionCoefficients(2,
dir,C,)
447 if( computeMatrix.eq.1 )then
449 t2=kThermal*(rxi(
dir,0)**2+rxi(
dir,1)**2)*drvsqi(
dir)
451 bm(
i1,
i2,
i3)= dtScale/dt(
i1,
i2,
i3) +2.*(t2+kThermal*(rxi(dirp1,0)**2+rxi(dirp1,1)**2)*drvsqi(dirp1) )+cdDiag
454 if( computeRHS.eq.1 )then
461 if( computeMatrix.eq.1 )then
466 if( computeRHS.eq.1 )then
479 defineArtificialDiffusionCoefficients(3,
dir,C,)
481 if( computeMatrix.eq.1 )then
482 t1=(uu(uc)*rxi(
dir,0)+uu(vc)*rxi(
dir,1)+uu(
wc)*rxi(
dir,2)-kThermal*(rxx3(
dir,0)+rxy3(
dir,1)+rxz3(
dir,2)))*drv2i(
dir)
483 t2=kThermal*(rxi(
dir,0)**2+rxi(
dir,1)**2+rxi(
dir,2)**2)*drvsqi(
dir)
486 +2.*(t2+kThermal*( (rxi(dirp1,0)**2+rxi(dirp1,1)**2+rxi(dirp1,2)**2)*drvsqi(dirp1)+\
487 (rxi(dirp2,0)**2+rxi(dirp2,1)**2+rxi(dirp2,2)**2)*drvsqi(dirp2) )) +cdDiag
490 if( computeRHS.eq.1 )then
497 if( computeMatrix.eq.1 )then
502 if( computeRHS.eq.1 )then
509 stop 222 ! unexpected value
for nd
517 c==================================================================================
518 c Residual Computation
for INS: incompressible Navier Stokes (including Boussinesq)
522 c====================================================================================
523 #beginMacro computeResidualINS(
GRIDTYPE)
525 ! write(*,*)
'new: computeResidualINS'
537 ! ************
INS 2
d rectangular case ********************
541 residual(
i1,
i2,
i3,uc)=
f(
i1,
i2,
i3,uc)-
u(
i1,
i2,
i3,uc)*
ux2(uc)-
u(
i1,
i2,
i3,vc)*
uy2(uc)-
ux2(
pc)+nu*lap2d2(uc)\
544 residual(
i1,
i2,
i3,vc)=
f(
i1,
i2,
i3,vc)-
u(
i1,
i2,
i3,uc)*
ux2(vc)-
u(
i1,
i2,
i3,vc)*
uy2(vc)-
uy2(
pc)+nu*lap2d2(vc)\
550 else if( use4thOrderAD.eq.1 )then
551 ! compute adc2,
adc4:
552 getDerivativesAndDissipation(2,2,
GRIDTYPE)
558 residual(
i1,
i2,
i3,
tc)=
f(
i1,
i2,
i3,
tc)-
u(
i1,
i2,
i3,uc)*
ux2(
tc)-
u(
i1,
i2,
i3,vc)*
uy2(
tc)+kThermal*lap2d2(
tc)
559 ! --- artificial dissipation
for T: do this
for now:
562 else if( use4thOrderAD.eq.1 )then
568 ! ************
INS 2
d curvilinear case ********************
570 residual(
i1,
i2,
i3,uc)=
f(
i1,
i2,
i3,uc)-
u(
i1,
i2,
i3,uc)*ux2c(uc)-
u(
i1,
i2,
i3,vc)*uy2c(uc)-ux2c(
pc)+nu*lap2d2c(uc)\
572 residual(
i1,
i2,
i3,vc)=
f(
i1,
i2,
i3,vc)-
u(
i1,
i2,
i3,uc)*ux2c(vc)-
u(
i1,
i2,
i3,vc)*uy2c(vc)-uy2c(
pc)+nu*lap2d2c(vc)\
578 else if( use4thOrderAD.eq.1 )then
579 ! compute adc2,
adc4:
580 getDerivativesAndDissipation(2,2,
GRIDTYPE)
586 residual(
i1,
i2,
i3,
tc)=
f(
i1,
i2,
i3,
tc)-
u(
i1,
i2,
i3,uc)*ux2c(
tc)-
u(
i1,
i2,
i3,vc)*uy2c(
tc)+kThermal*lap2d2c(
tc)
587 ! --- artificial dissipation
for T: do this
for now:
590 else if( use4thOrderAD.eq.1 )then
611 ! ************
INS 3
d rectangular case ********************
616 -
ux2(
pc)+nu*lap3d2(uc)\
621 -
uy2(
pc)+nu*lap3d2(vc)\
626 -uz2(
pc)+nu*lap3d2(
wc)\
632 else if( use4thOrderAD.eq.1 )then
633 ! compute adc2,
adc4:
634 getDerivativesAndDissipation(3,2,
GRIDTYPE)
646 ! --- artificial dissipation
for T: do this
for now:
649 else if( use4thOrderAD.eq.1 )then
655 ! ************
INS 3
d curvilinear case ********************
661 -ux3c(
pc)+nu*lap3d2c(uc)\
666 -uy3c(
pc)+nu*lap3d2c(vc)\
671 -uz3c(
pc)+nu*lap3d2c(
wc)\
677 else if( use4thOrderAD.eq.1 )then
678 ! compute adc2,
adc4:
679 getDerivativesAndDissipation(3,2,
GRIDTYPE)
689 +kThermal*lap3d2c(
tc)
690 ! --- artificial dissipation
for T: do this
for now:
693 else if( use4thOrderAD.eq.1 )then
705 stop 888 ! unexpected value
for nd