LCOV - code coverage report
Current view: top level - physics/carma/base - supersat.F90 (source / functions) Hit Total Coverage
Test: coverage.info Lines: 9 22 40.9 %
Date: 2025-03-14 01:33:33 Functions: 1 2 50.0 %

          Line data    Source code
       1             : ! Include shortname defintions, so that the F77 code does not have to be modified to
       2             : ! reference the CARMA structure.
       3             : #include "carma_globaer.h"
       4             : 
       5             : !!  This routine evaluates supersaturations <supsatl> and <supsati> for all gases.
       6             : !!
       7             : !! @author Andy Ackerman, Chuck Bardeen
       8             : !! @version Dec-1995, Aug-2010
       9  5829642552 : subroutine supersat(carma, cstate, iz, igas, rc)
      10             : 
      11             :   ! types
      12             :   use carma_precision_mod
      13             :   use carma_enums_mod
      14             :   use carma_constants_mod
      15             :   use carma_types_mod
      16             :   use carmastate_mod
      17             :   use carma_mod
      18             : 
      19             :   implicit none
      20             : 
      21             :   type(carma_type), intent(in)         :: carma   !! the carma object
      22             :   type(carmastate_type), intent(inout) :: cstate  !! the carma state object
      23             :   integer, intent(in)                  :: iz      !! z index
      24             :   integer, intent(in)                  :: igas    !! gas index
      25             :   integer, intent(inout)               :: rc      !! return code, negative indicates failure
      26             : 
      27             :   ! Local declarations
      28             :   real(kind=f)  :: rvap
      29             :   real(kind=f)  :: gc_cgs
      30             :   real(kind=f)  :: alpha
      31             : 
      32             :   ! Calculate vapor pressures.
      33  5829642552 :   call vaporp(carma, cstate, iz, igas, rc)
      34             : 
      35             :   ! Define gas constant for this gas
      36  5829642552 :   rvap = RGAS / gwtmol(igas)
      37             : 
      38  5829642552 :   gc_cgs = gc(iz,igas) / zmet(iz)
      39             : 
      40  5829642552 :   supsatl(iz,igas) = (gc_cgs * rvap * t(iz) - pvapl(iz,igas)) / pvapl(iz,igas)
      41  5829642552 :   supsati(iz,igas) = (gc_cgs * rvap * t(iz) - pvapi(iz,igas)) / pvapi(iz,igas)
      42             : 
      43             :   ! For subgrid scale clouds, the supersaturation needs to be increased be scaled
      44             :   ! based upon cloud fraction. This approach is similar to Wilson and Ballard (1999),
      45             :   ! except that only the water vapor (no liquid water) is used to determine the available
      46             :   ! water.
      47             :   !
      48             :   ! NOTE: This assumes that the cloud is an ice cloud.
      49  5829642552 :   if (do_incloud) then
      50           0 :     alpha = rhcrit(iz) * (1._f - cldfrc(iz)) + cldfrc(iz)
      51             : 
      52           0 :     supsatl(iz,igas) = (gc_cgs * rvap * t(iz) - alpha * pvapl(iz,igas)) / pvapl(iz,igas)
      53           0 :     supsati(iz,igas) = (gc_cgs * rvap * t(iz) - alpha * pvapi(iz,igas)) / pvapi(iz,igas)
      54             : 
      55             :     ! Limit supersaturation to liquid saturation.
      56           0 :     supsatl(iz,igas) = min(supsatl(iz,igas), 0._f)
      57           0 :     supsati(iz,igas) = min(supsati(iz,igas), (pvapl(iz,igas) - alpha * pvapi(iz,igas)) / pvapi(iz,igas))
      58             :   end if
      59             : 
      60  5829642552 :   return
      61  5829642552 : end
      62             : 
      63             : 
      64             : !! This routine evaluates supersaturations <supsatl> and <supsati> for all gases, but
      65             : !! thus version of the routine does not scale the supersaturation based on the cloud
      66             : !! fraction. It also assumes that vaporp has already been called.
      67             : !!
      68             : !! @author Andy Ackerman, Chuck Bardeen
      69             : !! @version Dec-1995, Aug-2010
      70           0 : subroutine supersat_nocldf(carma, cstate, iz, igas, ssi, ssl, rc)
      71             : 
      72             :   ! types
      73             :   use carma_precision_mod
      74             :   use carma_enums_mod
      75             :   use carma_constants_mod
      76             :   use carma_types_mod
      77             :   use carmastate_mod
      78             :   use carma_mod
      79             : 
      80             :   implicit none
      81             : 
      82             :   type(carma_type), intent(in)         :: carma   !! the carma object
      83             :   type(carmastate_type), intent(inout) :: cstate  !! the carma state object
      84             :   integer, intent(in)                  :: iz      !! z index
      85             :   integer, intent(in)                  :: igas    !! gas index
      86             :   real(kind=f), intent(out)            :: ssl
      87             :   real(kind=f), intent(out)            :: ssi
      88             :   integer, intent(inout)               :: rc      !! return code, negative indicates failure
      89             : 
      90             :   ! Local declarations
      91             :   real(kind=f)  :: rvap
      92             :   real(kind=f)  :: gc_cgs
      93             :   real(kind=f)  :: alpha
      94             : 
      95             :   ! Calculate vapor pressures.
      96           0 :   call vaporp(carma, cstate, iz, igas, rc)
      97             : 
      98             :   ! Define gas constant for this gas
      99           0 :   rvap = RGAS / gwtmol(igas)
     100             : 
     101           0 :   gc_cgs = gc(iz,igas) / zmet(iz)
     102             : 
     103           0 :   ssl = (gc_cgs * rvap * t(iz) - pvapl(iz,igas)) / pvapl(iz,igas)
     104           0 :   ssi = (gc_cgs * rvap * t(iz) - pvapi(iz,igas)) / pvapi(iz,igas)
     105             : 
     106           0 :   return
     107           0 : end

Generated by: LCOV version 1.14