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          ipcvis
integer          ipcvsl, 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 :: taup
double precision, dimension(:), pointer :: taufpt
double precision, dimension(:), pointer :: crom
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
      ipcvsl = 0
    endif
    
    
    
    
    
    diamp = 1.d-4
    cuning = 1.d0
    rhop = 1.d4
    
    
    
    endif
    
    
    if (diamp.le.1.d-6) then
      
        taup(iel) = cuning*diamp**2*rhop/(18.d0*propce(iel,ipcvis))
      enddo
    else
        taup(iel) = diamp**2*rhop/(18.d0*propce(iel,ipcvis))
      enddo
    endif
    
    
      
          taufpt(iel) = (3.d0/2.d0)*(
cmu/
sigmas(iscal))*xk/xeps
        enddo
      
        beta1  = 0.5d0+3.d0/(4.d0*
xkappa)
          xk = 0.5d0*( rtp(iel,
ir11)                    &
          taufpt(iel) = xk/xeps/beta1
        enddo
      
      else if (
iturb.eq.60) 
then 
          taufpt(iel) = (3.d0/2.d0)*(
cmu/
sigmas(iscal))*xk/xeps
        enddo
      endif
    endif
    
    
    
    if (ipcvsl.le.0) then
    endif
    
      xrtp = rtp(iel,ivart)
      rho = crom(iel)
      viscl = propce(iel, ipcvis)
      propce(iel,ipcvsl) = rho*
kboltz*xrtp*cuning/(3.d0*
pi*diamp*viscl)
    enddo
  endif 
enddo