Introduction
This page provides an example of code blocks that may be used to perform a calculation with drift scalars.
Physical properties
Energy balance
Local variables to be added
The following local variables need to be defined for the examples in this section:
integer ivart, iel, ifac
integer iscal, iflid, iscdri
integer f_id, keydri, nfld, keysca
double precision rho, viscl
double precision diamp, rhop, cuning
double precision xrtp, xk, xeps, beta1
character*80 fname
double precision, dimension(:), pointer :: cpro_taup
double precision, dimension(:), pointer :: cpro_taufpt
double precision, dimension(:), pointer :: cpro_rom
double precision, dimension(:), pointer :: cvar_k, cvar_ep, cvar_omg
double precision, dimension(:), pointer :: cvar_r11, cvar_r22, cvar_r33
double precision, dimension(:), pointer :: cpro_viscl, cpro_vscal
double precision, dimension(:), pointer :: cvar_scalt
Initialization and finalization
The following initialization block needs to be added for the following examples:
In theory Fortran 95 deallocates locally-allocated arrays automatically, but deallocating arrays in a symmetric manner to their allocation is good practice, and it avoids using a different logic for C and Fortran.
Body
This example set the scalar laminar diffusivity (for Brownian motion) to take thermophoresis into account.
Here is the corresponding code:
do iflid = 0, nfld-1
else
endif
else
cpro_vscal => null()
endif
diamp = 1.d-4
cuning = 1.d0
rhop = 1.d4
endif
if (diamp.le.1.d-6) then
cpro_taup(iel) = cuning*diamp**2*rhop/(18.d0*cpro_viscl(iel))
enddo
else
cpro_taup(iel) = diamp**2*rhop/(18.d0*cpro_viscl(iel))
enddo
endif
xk = cvar_k(iel)
xeps = cvar_ep(iel)
cpro_taufpt(iel) = (3.d0/2.d0)*(
cmu/
sigmas(iscal))*xk/xeps
enddo
beta1 = 0.5d0+3.d0/(4.d0*
xkappa)
xk = 0.5d0*( cvar_r11(iel) &
+cvar_r22(iel) &
+cvar_r33(iel) )
xeps = cvar_ep(iel)
cpro_taufpt(iel) = xk/xeps/beta1
enddo
else if (
iturb.eq.60)
then
xk = cvar_k(iel)
xeps =
cmu*xk*cvar_omg(iel)
cpro_taufpt(iel) = (3.d0/2.d0)*(
cmu/
sigmas(iscal))*xk/xeps
enddo
endif
endif
endif
xrtp = cvar_scalt(iel)
rho = cpro_rom(iel)
viscl = cpro_viscl(iel)
cpro_vscal(iel) = rho*
kboltz*xrtp*cuning/(3.d0*
pi*diamp*viscl)
enddo
endif
enddo