LCOV - code coverage report
Current view: top level - physics/carma/base - setupgrow.F90 (source / functions) Hit Total Coverage
Test: coverage.info Lines: 17 23 73.9 %
Date: 2025-03-14 01:30:37 Functions: 1 1 100.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 defines time-independent parameters used to calculate
       6             : !! condensational growth/evaporation.
       7             : !!
       8             : !! The parameters defined for each gas are
       9             : !1>
      10             : !!   gwtmol:   molecular weight [g/mol]
      11             : !!   diffus:   diffusivity      [cm^2/s]
      12             : !!   rlhe  :   latent heat of evaporation [cm^2/s^2]
      13             : !!   rlhm  :   latent heat of melting [cm^2/s^2]
      14             : !!<
      15             : !! Time-independent parameters that depend on particle radius are
      16             : !! defined in setupgkern.f.
      17             : !!
      18             : !! This routine requires that vertical profiles of temperature <T>,
      19             : !! and pressure <p> are defined.
      20             : !!
      21             : !! @author Andy Ackerman
      22             : !! @version Dec-1995
      23     1050624 : subroutine setupgrow(carma, cstate, rc)
      24             : 
      25             :   ! types
      26             :   use carma_precision_mod
      27             :   use carma_enums_mod
      28             :   use carma_constants_mod
      29             :   use carma_types_mod
      30             :   use carmastate_mod
      31             :   use carma_mod
      32             : 
      33             :   implicit none
      34             : 
      35             :   type(carma_type), intent(in)         :: carma   !! the carma object
      36             :   type(carmastate_type), intent(inout) :: cstate  !! the carma state object
      37             :   integer, intent(inout)               :: rc       !! return code, negative indicates failure
      38             : 
      39             :   ! Local Variable
      40             :   integer                        :: ielem    !! element index
      41             :   integer                        :: k        !! z index
      42             :   integer                        :: i
      43             :   real(kind=f)                   :: rhoa_cgs, aden
      44             :   ! Define formats
      45             :   1 format(a,':  ',12i6)
      46             :   2 format(a,':  ',i6)
      47             :   3 format(/' id  gwtmol   gasname',(/,i3,3x,f5.1,3x,a))
      48             :   5 format(/,'Particle growth mapping arrays (setupgrow):')
      49             : 
      50             : 
      51             :   !-----Check that values are valid------------------------------------------
      52    12607488 :   do ielem = 1, NELEM
      53    12607488 :     if( igrowgas(ielem) .gt. NGAS )then
      54           0 :       if (do_print) write(LUNOPRT,*) 'setupgrow::ERROR - component of igrowgas > NGAS'
      55           0 :       rc = -1
      56           0 :       return
      57             :     endif
      58             :   enddo
      59             : 
      60             :   ! Define parameters with weak time-dependence to be used in
      61             :   ! growth equation.
      62    34670592 :   do k = 1, NZ
      63             : 
      64             :     ! Diffusivity of water vapor in air from Pruppacher & Klett (eq. 13-3);
      65             :     ! units are [cm^2/s].
      66    33619968 :     if (igash2o /= 0) then
      67    33619968 :       diffus(k, igash2o) = 0.211_f * (1.01325e+6_f / p(k)) * (t(k) / 273.15_f )**1.94_f
      68             : 
      69             :       ! Latent heat of evaporation for water; units are [cm^2/s^2]
      70    33619968 :       if (do_cnst_rlh) then
      71    33619968 :         rlhe(k, igash2o) = RLHE_CNST
      72             :       else
      73             :         ! from Stull
      74           0 :         rlhe(k, igash2o) = (2.5_f - .00239_f * (t(k) - 273.16_f)) * 1.e10_f
      75             :       end if
      76             : 
      77             :       ! Latent heat of ice melting; units are [cm^2/s^2]
      78    33619968 :       if (do_cnst_rlh) then
      79    33619968 :         rlhm(k, igash2o) = RLHM_CNST
      80             :       else
      81             : 
      82             :         ! from Pruppacher & Klett (eq. 4-85b)
      83             :         !
      84             :         ! NOTE: This expression yields negative values for rlmh at mesospheric
      85             :         ! temperatures.
      86           0 :         rlhm(k, igash2o) = (79.7_f + 0.485_f * (t(k) - 273.16_f) - 2.5e-3_f * &
      87           0 :           ((t(k) - 273.16_f)**2)) * 4.186e7_f
      88             :       end if
      89             :     end if
      90             : 
      91             :     ! Properties for H2SO4
      92    34670592 :     if (igash2so4 /= 0) then
      93             :       ! Diffusivity
      94    33619968 :       rhoa_cgs = rhoa(k) / zmet(k)
      95    33619968 :       aden     = rhoa_cgs * AVG / WTMOL_AIR
      96    33619968 :       diffus(k,igash2so4) = 1.76575e+17_f * sqrt(t(k)) / aden
      97             : 
      98             :       ! HACK: make H2SO4 latent heats same as water
      99    33619968 :       rlhe(k,igash2so4) = rlhe(k, igash2o)
     100    33619968 :       rlhm(k,igash2so4) = rlhe(k, igash2o)
     101             :     end if
     102             : 
     103             :   enddo
     104             : 
     105             : #ifdef CARMA_DEBUG
     106             :   ! Report some initialization values
     107             :   if (do_print_init) then
     108             :     write(LUNOPRT,5)
     109             :     write(LUNOPRT,2) 'NGAS    ',NGAS
     110             :     write(LUNOPRT,1) 'igrowgas',(igrowgas(i),i=1,NELEM)
     111             :     write(LUNOPRT,3) (i,gwtmol(i),gasname(i),i=1,NGAS)
     112             :   endif
     113             : #endif
     114             : 
     115             :   ! Return to caller with particle growth mapping arrays and time-dependent
     116             :   ! parameters initialized.
     117             :   return
     118     1050624 : end

Generated by: LCOV version 1.14