gas_eos_mod.F90       coverage:  0.00 %func     0.00 %block


     1) module Gas_EOS_module
     2)   use PFLOTRAN_Constants_module
     3) 
     4)   implicit none
     5) 
     6) #include "petsc/finclude/petscsys.h"
     7) 
     8)   public
     9)  
    10) contains
    11) 
    12) ! ************************************************************************** !
    13) 
    14) subroutine ideal_gaseos_noderiv(p,tc,d,h,u)
    15)     
    16)   PetscReal,intent(in) :: p  ! [Pa]
    17)   PetscReal,intent(in) :: tc ! [C]
    18)   PetscReal, intent(out) :: d ! [kmol/m^3]
    19)   PetscReal, intent(out) :: h ! [J/kmol]
    20)   PetscReal, intent(out) :: u ! [J/kmol]
    21)    
    22)   PetscReal, parameter :: Rg=8.31415 
    23)   ! Cpg units: J/mol-K
    24)   PetscReal, parameter :: Cv_air = 20.85 ! head capacity wiki
    25)   PetscReal  tk
    26)     
    27)   tk = tc + 273.15
    28)   d = p / tk / Rg * 1.d-3 ! mol/m^3 -> kmol/m^3
    29)   h = Cv_air * tk * 1.d3  ! J/mol -> J/kmol
    30)   u = (Cv_air - Rg) * tk * 1.d3 ! J/mol -> J/kmol
    31)    
    32) end subroutine ideal_gaseos_noderiv
    33) 
    34) ! ************************************************************************** !
    35) 
    36) subroutine ideal_gaseos(p,tc,d,d_p,d_t,h,h_p,h_t,u,u_p,u_t)
    37)     
    38)   PetscReal,intent(in) :: p  ! [Pa]
    39)   PetscReal,intent(in) :: tc ! [C]
    40)   PetscReal, intent(out) :: d ! [kmol/m^3]
    41)   PetscReal, intent(out) :: h ! [J/kmol]
    42)   PetscReal, intent(out) :: u ! [J/kmol]
    43)   PetscReal, intent(out) :: d_p,d_t,h_p,h_t,u_p,u_t
    44) 
    45)   PetscReal, parameter :: Rg=8.31415 
    46)   ! Cpg units: J/mol-K
    47)   PetscReal, parameter :: Cv_air = 20.85 ! head capacity wiki
    48)   PetscReal  tk
    49) 
    50)   tk = tc + 273.15
    51)   d = p / tk / Rg * 1.d-3 ! mol/m^3 -> kmol/m^3
    52)   h = Cv_air * tk * 1.d3  ! J/mol -> J/kmol
    53)   u = (Cv_air - Rg) * tk * 1.d3 ! J/mol -> J/kmol
    54) 
    55)   d_p =  d / p
    56)   d_t = -d / tk
    57)   h_p = 0.d0
    58)   h_t = Cv_air * 1.d3
    59)   u_p = 0.d0
    60)   u_t = (Cv_air - Rg) * 1.d3
    61) 
    62) end subroutine ideal_gaseos
    63) 
    64) ! ************************************************************************** !
    65) 
    66) subroutine visgas_noderiv(t,p_air,p_gas,d_air,visg)
    67)   ! 
    68)   ! REFERENCES
    69)   ! THIS ROUTINE IS LARGELY ADAPTED FROM THE TOUGH CODE.
    70)   ! this routine computes the viscosity of vapor-air mixtures.
    71)   ! it uses a modified version of a formulation based on kinetic
    72)   ! gas theory, as given by j.o. hirschfelder, c.f. curtiss, and
    73)   ! r.b. bird, molecular theory of gases and liquids, john wiley
    74)   ! & sons, 1954, pp. 528-530.
    75)   ! the modification made to the hirschfelder et al. expressions is
    76)   ! that for vapor viscosity accurate (empirical) values are used,
    77)   ! rather than the first order expression of kinetic theory.
    78)   ! the formulation matches experimental data on viscosities of
    79)   ! vapor-air mixtures in the temperature range from 100 to 150
    80)   ! deg. c, for all compositions, to better than 4%.
    81)   ! 
    82)   PetscReal, intent(in) :: t     ! [C]
    83)   PetscReal, intent(in) :: p_air ! [Pa]
    84)   PetscReal, intent(in) :: p_gas ! [Pa]
    85)   PetscReal, intent(in) :: d_air ! [kmol/m^3]
    86)   PetscReal, intent(out) :: visg ! [Pa-s]
    87) 
    88)   PetscReal ::  fair,fwat,cair,cwat
    89) 
    90)       data  fair,   fwat,    cair,  cwat &
    91)            /97.d0, 363.d0, 3.617d0, 2.655d0/
    92)  
    93)       PetscReal fmix,cmix,d,xga,xg1,tk,trd1,trd3,ome1,ome3,ard,fmw3,vis1, &
    94)              v1,vs,vis2,vis3,z1,g,h,e,z2,z3
    95) 
    96) 
    97) !c======================================================================
    98) 
    99)       fmix = sqrt (fair*fwat)
   100)       cmix = (cair+cwat)*0.5d0
   101) 
   102) !      do k = 1,nb
   103)  !       if (iphas(k).eq.2 .or. iphas(k).eq.0) then
   104) 
   105)           d   = d_air *FMWAIR       
   106)           xga = p_air / p_gas ! for debug, set x constant
   107)           xg1 = 1.D0 - xga
   108)           tk  = t +273.15d0
   109) 
   110)           trd1 = tk/fair
   111)           trd3 = tk/fmix
   112)           ome1 = (1.188d0-0.051d0*trd1)/trd1
   113)           ome3 = (1.480d0-0.412d0*log(trd3))/trd3
   114)           ard  = 1.095d0/trd3
   115)           fmw3 = 2.d0*FMWAIR*FMWH2O/(FMWAIR+FMWH2O)
   116)           vis1 = 266.93d-7*sqrt(FMWAIR*trd1*fair)/(cair*cair*ome1*trd1)
   117)  
   118)           v1 = .407d0*t +80.4d0
   119)           if (t .le.350.d0) then
   120)             vs = 1.d-7*(v1-d*(1858.d0-5.9d0*t )*1.d-3)
   121)           else
   122) !             if (t .gt.350.d0) 
   123) !cpcl .      vs = 1.d-7*(v1 + 0.353d0*d + 676.5d-6*d**2 + 102.1d-9*d**3)
   124)            vs = 1.d-7*(v1 + (0.353d0 + (676.5d-6 + 102.1d-9*d)*d)*d)
   125)           endif
   126) 
   127)           vis2 = 10.d0*vs
   128)           vis3 = 266.93d-7*sqrt(fmw3*trd3*fmix)/(cmix*cmix*ome3*trd3)
   129)           z1   = xga*xga/vis1+2.d0*xg1*xga/vis3+xg1*xg1/vis2
   130)           g    = xga*xga*FMWAIR/FMWH2O
   131)           h    = xg1*xg1*FMWH2O/FMWAIR
   132)           e    = (2.d0*xga*xg1*FMWAIR*FMWH2O/fmw3**2)*vis3/(vis1*vis2)
   133)           z2   = 0.6d0*ard*(g/vis1+e+h/vis2)
   134)           z3   = 0.6d0*ard*(g+e*(vis1+vis2)-2.d0*xga*xg1+h)
   135)           visg  = (1.d0+z3)/(z1+z2)*.1d0
   136)            
   137) end subroutine visgas_noderiv
   138) 
   139) ! ************************************************************************** !
   140) 
   141) subroutine Henry_air_noderiv(p,tc,ps,Henry)
   142) ! Calculate Henry Coefficient for N2
   143) ! t in K
   144) ! Henry have the same unit as p and ps, then make it dimensionless by
   145) ! devide it with p
   146) 
   147)     implicit none
   148)     PetscReal,intent(in) ::  p,tc,ps
   149)     PetscReal,intent(out) ::  Henry
   150) 
   151)     PetscReal  Tr,tao,tmp,t
   152)     PetscReal, parameter :: a=-9.67578, b=4.72162, c=11.70585
   153)     PetscReal, parameter :: Tcl=647.096 ! H2O critical temp(K) from IAPWS(1995b)
   154) 
   155)     t=tc+273.15D0
   156)     Tr=t/Tcl
   157)     tao=1.D0-Tr
   158)     tmp= a/Tr + B * tao**0.355/Tr + c * (Tr**(-0.41)) * exp(tao)
   159)     Henry=exp(tmp)*ps
   160) 
   161)    return 
   162) end subroutine Henry_air_noderiv
   163) 
   164) ! ************************************************************************** !
   165) 
   166) subroutine Henry_air(p,tc,ps,ps_p,ps_t,Henry,Henry_p,Henry_t)
   167)    implicit none
   168)     PetscReal,intent(in) ::  p,tc,ps,ps_p,ps_t
   169)     PetscReal,intent(out) ::  Henry,Henry_p,Henry_t
   170) ! note t/K, p/Pa, Henry/Pa 
   171) 
   172)     PetscReal  Tr,tao,tmp,t
   173)     PetscReal, parameter :: a=-9.67578, b=4.72162, c=11.70585
   174)     PetscReal, parameter :: Tcl=647.096 ! H2O critical temp from IAPWS(1995b)
   175) 
   176)     t=tc+273.15D0
   177)     Tr=t/Tcl
   178)     tao=1.D0-Tr
   179)     tmp= a/Tr + b * tao**0.355/Tr + c * (Tr**(-0.41)) * exp(tao)
   180)     Henry=exp(tmp)*ps
   181) 
   182)     tmp =((-a/Tr+b*(-0.355*tao**(-0.645)-tao**0.355/Tr))/Tr - &
   183)          c*exp(tao)*(tao**(-.41))*(0.41/Tr-1.))/Tcl
   184)     Henry_t=Henry*(tmp +ps_t/ps)
   185)     Henry_p=ps_p*Henry/ps
   186) 
   187)   
   188)    return 
   189) end subroutine Henry_air
   190) 
   191) end module Gas_EOS_module

generated by
Intel(R) C++/Fortran Compiler code-coverage tool
Web-Page Owner: Nobody