Introduction
This page provides an example of code blocks that may be used to perform a calculation with drift scalars for coal combustion.
Physical properties
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, ipccp
integer ipcvsl, ivar
integer f_id
integer iclapc, idecal
integer ll
integer ipcte1, icla, iromf
integer iscdri, keydri, iflid, nfld, keyccl
double precision xrtp
double precision aa1, bb1, cc1, dd1
double precision aa2, bb2, cc2, dd2
double precision aa3, bb3, cc3, dd3
double precision aa4, bb4, cc4, dd4
double precision aa5, bb5, cc5, dd5
double precision aa6, bb6, cc6, dd6
double precision aa7, bb7, cc7, dd7
double precision visco_o2, visco_co, visco_h2, visco_n2
double precision visco_so2, visco_nh3, visco_co2
double precision g
character*80 fname
double precision, allocatable, dimension(:) :: x1, visco
double precision, dimension(:), pointer :: taup
double precision, dimension(:), pointer :: taupg
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
Here is the corresponding code:
g = sqrt(
gx**2 +
gy**2 +
gz**2)
do icla = 1, nclacp
enddo
enddo
endif
aa1 = 4.0495d-6
bb1 = 6.22d-8
cc1 = -2.3032d-11
dd1 = 4.4077d-15
aa2 = 9.9987d-6
bb2 = 5.1578d-8
cc2 = -1.8383d-11
dd2 = 3.33307d-15
aa3 = 2.894d-6
bb3 = 2.22508d-8
cc3 = -8.041d-12
dd3 = 1.4619d-15
aa4 = 4.3093d-6
bb4 = 5.0516d-8
cc4 = -1.7869d-11
dd4 = 3.2136d-15
aa5 = -1.9889d-6
bb5 = 5.365d-8
cc5 = -1.4286d-11
dd5 = 2.1639d-15
aa6 = -1.293d-6
bb6 = 4.1194d-8
cc6 = -1.772d-11
dd6 = 1.8699d-15
aa7 = 4.4822d-7
bb7 = 5.4327d-8
cc7 = -1.7581d-11
dd7 = 2.9979d-15
xrtp = propce(iel,ipcte1)
visco_o2 = aa1 + xrtp*bb1 + cc1*xrtp**2 + dd1*xrtp**3
visco_co = aa2 + xrtp*bb2 + cc2*xrtp**2 + dd2*xrtp**3
visco_h2 = aa3 + xrtp*bb3 + cc3*xrtp**2 + dd3*xrtp**3
visco_n2 = aa4 + xrtp*bb4 + cc4*xrtp**2 + dd4*xrtp**3
visco_so2 = aa5 + xrtp*bb5 + cc5*xrtp**2 + dd5*xrtp**3
visco_nh3 = aa6 + xrtp*bb6 + cc6*xrtp**2 + dd6*xrtp**3
visco_co2 = aa7 + xrtp*bb7 + cc7*xrtp**2 + dd7*xrtp**3
visco(iel) = ( propce(iel,
ipproc(
iym1(8))) * visco_o2 &
enddo
endif
x1(iel) = 1.d0
do icla = 1, nclacp
x1(iel) = x1(iel) - propce(iel,
ipproc(
ix2(icla)))
enddo
enddo
do iflid = 0, nfld-1
taupg(iel) = 0.d0
enddo
endif
enddo
do iflid = 0, nfld-1
taup(iel) = x1(iel) * propce(iel,
ipproc(
irom2(icla))) &
/ (18.d0*visco(iel))
enddo
taupg(iel) = taupg(iel) &
- ( taup(iel) * propce(iel,
ipproc(
ix2(icla))) )
enddo
endif
enddo