LCOV - code coverage report
Current view: top level - physics/cam - carma_flags_mod.F90 (source / functions) Hit Total Coverage
Test: coverage.info Lines: 49 52 94.2 %
Date: 2025-01-13 21:54:50 Functions: 1 1 100.0 %

          Line data    Source code
       1             : !! This module handles reading the namelist and provides access to some other flags
       2             : !! that control CARMA's behavior.
       3             : !!
       4             : !! It needs to be in its own file to resolve some circular dependencies.
       5             : !!
       6             : !! @author  Chuck Bardeen
       7             : !! @version Aug-2010
       8             : module carma_flags_mod
       9             : 
      10             :   use shr_kind_mod,   only: r8 => shr_kind_r8
      11             :   use spmd_utils,     only: masterproc
      12             : 
      13             :   ! Flags for integration with CAM Microphysics
      14             :   public carma_readnl                   ! read the carma namelist
      15             :   
      16             : 
      17             :   ! Namelist flags
      18             :   !
      19             :   ! NOTE: Setting the carma_flag to false prevents CARMA from doing any microphysics
      20             :   ! calculations, but it will still initialize itself. This allows the same build and
      21             :   ! namelist to be used, but the CARMA processing diabled. Use the configure option
      22             :   ! -carma none to totally disable CARMA and prevent even the register from happening.
      23             :   logical, public                :: carma_flag        = .false.   ! If .true. then turn on CARMA microphysics in CAM
      24             :   logical, public                :: carma_do_aerosol  = .true.    ! If .true. then CARMA is processed after surface coupling
      25             :   logical, public                :: carma_do_cldice   = .false.   ! If .true. then do cloud ice
      26             :   logical, public                :: carma_do_cldliq   = .false.   ! If .true. then do cloud liquid
      27             :   logical, public                :: carma_do_clearsky = .false.   ! If .true. then do clear sky particle calculations
      28             :   logical, public                :: carma_do_coag     = .false.   ! If .true. then do coagulation
      29             :   logical, public                :: carma_do_detrain  = .false.   ! If .true. then do detrain
      30             :   logical, public                :: carma_do_drydep   = .false.   ! If .true. then do dry deposition
      31             :   logical, public                :: carma_do_emission = .false.   ! If .true. then do emission
      32             :   logical, public                :: carma_do_fixedinit= .false.   ! If .true. then do fixed initialization to a reference state
      33             :   logical, public                :: carma_hetchem_feedback= .false.! If .true. then CARMA sulfate surface area density used in heterogeneous chemistry
      34             :   logical, public                :: carma_rad_feedback= .false.   ! If .true. then CARMA sulfate mass mixing ratio & effective radius used in radiation
      35             :   logical, public                :: carma_do_explised = .false.   ! If .true. then do sedimentation with substepping
      36             :   logical, public                :: carma_do_incloud  = .false.   ! If .true. then do incloud particle calculations
      37             :   logical, public                :: carma_do_grow     = .false.   ! If .true. then do growth
      38             :   logical, public                :: carma_do_optics   = .false.   ! If .true. then do optical properties file
      39             :   logical, public                :: carma_do_partialinit= .false. ! If .true. then do initialization of coagulation to a reference state (requires fixedinit)
      40             :   logical, public                :: carma_do_pheat    = .false.   ! If .true. then do particle heating
      41             :   logical, public                :: carma_do_pheatatm = .false.   ! If .true. then do particle heating of atmosphere
      42             :   logical, public                :: carma_do_substep  = .false.   ! If .true. then do substeping
      43             :   logical, public                :: carma_do_thermo   = .false.   ! If .true. then do solve thermodynamics equation
      44             :   logical, public                :: carma_do_wetdep   = .false.   ! If .true. then do wet deposition
      45             :   logical, public                :: carma_do_vdiff    = .false.   ! If .true. then do vertical brownian diffusion
      46             :   logical, public                :: carma_do_vtran    = .false.   ! If .true. then do vertical transport
      47             :   integer, public                :: carma_maxsubsteps = 1         ! Maximum number of time substeps allowed
      48             :   integer, public                :: carma_minsubsteps = 1         ! Minimum number of time substeps allowed
      49             :   integer, public                :: carma_maxretries  = 8         ! Maximum number of time substeps allowed
      50             :   real(r8), public               :: carma_conmax      = 0.1_r8    ! Minumum relative concentration to consider in substep
      51             :   real(r8), public               :: carma_dgc_threshold  = 0.0_r8 ! When non-zero, the largest percentage change in gas concentration allowed per substep.
      52             :   real(r8), public               :: carma_ds_threshold  = 0.0_r8  ! When non-zero, the largest percentage change in gas saturation allowed per substep.
      53             :   real(r8), public               :: carma_dt_threshold  = 0.0_r8  ! When non-zero, the largest change in temperature (K) allowed per substep.
      54             :   real(r8), public               :: carma_tstick      = 1.0_r8    ! Thermal accommodation coefficient
      55             :   real(r8), public               :: carma_gsticki     = 0.93_r8   ! Growth accommodation coefficient for ice
      56             :   real(r8), public               :: carma_gstickl     = 1.0_r8    ! Growth accommodation coefficient for liquid
      57             :   real(r8), public               :: carma_cstick      = 1.0_r8    ! Coagulation accommodation coefficient
      58             :   real(r8), public               :: carma_rhcrit      = 1.0_r8    ! Critical relative humidity for liquid clouds
      59             :   real(r8), public               :: carma_vf_const    = 0.0_r8    ! If specified and non-zero, constant fall velocity for all particles [cm/s]
      60             :   character(len=256), public     :: carma_reftfile    = 'carma_reft.nc'  ! path to the file containing the reference temperature profile
      61             :   character(len=32), public      :: carma_model       = "none"    ! String (no spaces) that identifies the model
      62             : 
      63             : contains
      64             : 
      65             : 
      66             :   !! Read the CARMA runtime options from the namelist
      67             :   !!
      68             :   !! @author  Chuck Bardeen
      69             :   !! @version Aug-2010
      70        1536 :   subroutine carma_readnl(nlfile)
      71             :   
      72             :     ! Read carma namelist group.
      73             :   
      74             :     use cam_abortutils,  only: endrun
      75             :     use namelist_utils,  only: find_group_name
      76             :     use units,           only: getunit, freeunit
      77             :     use mpishorthand
      78             :     use carma_model_flags_mod, only: carma_model_readnl
      79             :   
      80             :     ! args
      81             :   
      82             :     character(len=*), intent(in) :: nlfile  ! filepath for file containing namelist input
      83             :   
      84             :     ! local vars
      85             :   
      86             :     integer :: unitn, ierr
      87             :   
      88             :     ! read namelist for CARMA
      89             :     namelist /carma_nl/ &
      90             :       carma_flag, &
      91             :       carma_do_aerosol, &
      92             :       carma_do_cldliq, &
      93             :       carma_do_cldice, &
      94             :       carma_do_clearsky, &
      95             :       carma_do_coag, &
      96             :       carma_do_detrain, &
      97             :       carma_do_drydep, &
      98             :       carma_do_emission, &
      99             :       carma_do_fixedinit, &
     100             :       carma_hetchem_feedback, &
     101             :       carma_rad_feedback, &
     102             :       carma_do_explised, &
     103             :       carma_do_incloud, &
     104             :       carma_do_grow, &
     105             :       carma_do_optics, &
     106             :       carma_do_partialinit, &
     107             :       carma_do_pheat, &
     108             :       carma_do_pheatatm, &
     109             :       carma_do_substep, &
     110             :       carma_do_thermo, &
     111             :       carma_do_wetdep, &
     112             :       carma_do_vdiff, &
     113             :       carma_do_vtran, &
     114             :       carma_maxsubsteps, &
     115             :       carma_minsubsteps, &
     116             :       carma_maxretries, &
     117             :       carma_model, &
     118             :       carma_reftfile, &
     119             :       carma_conmax, &
     120             :       carma_dgc_threshold, &
     121             :       carma_ds_threshold, &
     122             :       carma_dt_threshold, &
     123             :       carma_tstick, &
     124             :       carma_gsticki, &
     125             :       carma_gstickl, &
     126             :       carma_cstick, &
     127             :       carma_rhcrit, &
     128             :       carma_vf_const
     129             :   
     130        1536 :     if (masterproc) then
     131           2 :        unitn = getunit()
     132           2 :        open( unitn, file=trim(nlfile), status='old' )
     133           2 :        call find_group_name(unitn, 'carma_nl', status=ierr)
     134           2 :        if (ierr == 0) then
     135           0 :           read(unitn, carma_nl, iostat=ierr)
     136           0 :           if (ierr /= 0) then
     137           0 :              call endrun('carma_readnl: ERROR reading namelist')
     138             :           end if
     139             :        end if
     140           2 :        close(unitn)
     141           2 :        call freeunit(unitn)
     142             :     end if
     143             :   
     144             : #ifdef SPMD
     145        1536 :     call mpibcast (carma_flag,            1 ,mpilog, 0,mpicom)
     146        1536 :     call mpibcast (carma_do_aerosol,      1 ,mpilog, 0,mpicom)
     147        1536 :     call mpibcast (carma_do_cldliq,       1 ,mpilog, 0,mpicom)
     148        1536 :     call mpibcast (carma_do_cldice,       1 ,mpilog, 0,mpicom)
     149        1536 :     call mpibcast (carma_do_clearsky,     1 ,mpilog, 0,mpicom)
     150        1536 :     call mpibcast (carma_do_coag,         1 ,mpilog, 0,mpicom)
     151        1536 :     call mpibcast (carma_do_detrain,      1 ,mpilog, 0,mpicom)
     152        1536 :     call mpibcast (carma_do_drydep,       1 ,mpilog, 0,mpicom)
     153        1536 :     call mpibcast (carma_do_emission,     1 ,mpilog, 0,mpicom)
     154        1536 :     call mpibcast (carma_do_fixedinit,    1 ,mpilog, 0,mpicom)
     155        1536 :     call mpibcast (carma_hetchem_feedback,1 ,mpilog, 0,mpicom)
     156        1536 :     call mpibcast (carma_rad_feedback,   1 ,mpilog, 0,mpicom)
     157        1536 :     call mpibcast (carma_do_explised,     1 ,mpilog, 0,mpicom)
     158        1536 :     call mpibcast (carma_do_incloud,      1 ,mpilog, 0,mpicom)
     159        1536 :     call mpibcast (carma_do_grow,         1 ,mpilog, 0,mpicom)
     160        1536 :     call mpibcast (carma_do_optics,       1 ,mpilog, 0,mpicom)
     161        1536 :     call mpibcast (carma_do_partialinit,  1 ,mpilog, 0,mpicom)
     162        1536 :     call mpibcast (carma_do_pheat,        1 ,mpilog, 0,mpicom)
     163        1536 :     call mpibcast (carma_do_pheatatm,     1 ,mpilog, 0,mpicom)
     164        1536 :     call mpibcast (carma_do_substep,      1 ,mpilog, 0,mpicom)
     165        1536 :     call mpibcast (carma_do_thermo,       1 ,mpilog, 0,mpicom)
     166        1536 :     call mpibcast (carma_do_wetdep,       1 ,mpilog, 0,mpicom)
     167        1536 :     call mpibcast (carma_do_vdiff,        1 ,mpilog, 0,mpicom)
     168        1536 :     call mpibcast (carma_do_vtran,        1 ,mpilog, 0,mpicom)
     169        1536 :     call mpibcast (carma_maxsubsteps,     1 ,mpiint, 0,mpicom)
     170        1536 :     call mpibcast (carma_minsubsteps,     1 ,mpiint, 0,mpicom)
     171        1536 :     call mpibcast (carma_maxretries,      1 ,mpiint, 0,mpicom)
     172        1536 :     call mpibcast (carma_conmax,          1 ,mpir8,  0,mpicom)
     173        1536 :     call mpibcast (carma_dgc_threshold,   1 ,mpir8,  0,mpicom)
     174        1536 :     call mpibcast (carma_ds_threshold,    1 ,mpir8,  0,mpicom)
     175        1536 :     call mpibcast (carma_dt_threshold,    1 ,mpir8,  0,mpicom)
     176        1536 :     call mpibcast (carma_tstick,          1 ,mpir8,  0,mpicom)
     177        1536 :     call mpibcast (carma_gsticki,         1 ,mpir8,  0,mpicom)
     178        1536 :     call mpibcast (carma_gstickl,         1 ,mpir8,  0,mpicom)
     179        1536 :     call mpibcast (carma_cstick,          1 ,mpir8,  0,mpicom)
     180        1536 :     call mpibcast (carma_rhcrit,          1 ,mpir8,  0,mpicom)
     181        1536 :     call mpibcast (carma_vf_const,        1 ,mpir8,  0,mpicom)
     182        1536 :     call mpibcast (carma_model, len(carma_model), mpichar, 0, mpicom)
     183        1536 :     call mpibcast (carma_reftfile, len(carma_reftfile), mpichar, 0, mpicom)
     184             : #endif
     185             : 
     186             :     ! Also cause the CARMA model flags to be read in.
     187        1536 :     call carma_model_readnl(nlfile)
     188             :   
     189        1536 :   end subroutine carma_readnl
     190             : 
     191             : end module carma_flags_mod

Generated by: LCOV version 1.14