LCOV - code coverage report
Current view: top level - physics/carma/models/trop_strat_soa1 - carma_model_flags_mod.F90 (source / functions) Hit Total Coverage
Test: coverage.info Lines: 23 24 95.8 %
Date: 2025-03-14 01:33:33 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 a specific CARMA model's behavior.
       3             : !!
       4             : !! By default the specific CARMA model does not have any unique namelist values. If
       5             : !! a CARMA model wishes to have its own namelist, then this file needs to be copied
       6             : !! from physics/cam to physics/model/<model_name> and the code needed to read in the
       7             : !! namelist values added there. This file will take the place of the one in
       8             : !! physics/cam.
       9             : !!
      10             : !! It needs to be in its own file to resolve some circular dependencies.
      11             : !!
      12             : !! @author  Chuck Bardeen
      13             : !! @version Mar-2011
      14             : module carma_model_flags_mod
      15             : 
      16             :   use shr_kind_mod,   only: r8 => shr_kind_r8
      17             :   use spmd_utils,     only: masterproc
      18             : 
      19             :   ! Flags for integration with CAM Microphysics
      20             :   public carma_model_readnl                   ! read the carma model namelist
      21             : 
      22             : 
      23             :   ! Namelist flags
      24             :   !
      25             :   ! Create a public definition of any new namelist variables that you wish to have,
      26             :   ! and default them to an inital value.
      27             : 
      28             :   ! name of the dust erosion factor file
      29             :   logical, public, protected :: carma_do_WeibullK   = .false.  ! if .true. then use calculated Weibull K, [Monahan, 2006]
      30             :   character(len=32), public, protected  :: carma_seasalt_emis  = 'Gong'   ! the source function scheme, either "Gong", "Martensson",
      31             :                                                                           ! "Clarke",  "Caffrey", "CMS", "CONST", or "NONE"
      32             :   character(len=32), public, protected  :: carma_BCOCemissions = 'Yu2015'
      33             :   character(len=32), public, protected  :: carma_SO4elevemis   = 'NONE'
      34             :   character(len=256), public, protected :: carma_soilerosion_file  = 'NONE'
      35             :   character(len=256), public, protected :: BC_GAINS_filename   = 'NONE'
      36             :   character(len=256), public, protected :: OC_GAINS_filename   = 'NONE'
      37             :   character(len=256), public, protected :: BC_ship_filename    = 'NONE'
      38             :   character(len=256), public, protected :: OC_ship_filename    = 'NONE'
      39             :   character(len=256), public, protected :: BC_GFEDv3_filename  = 'NONE'
      40             :   character(len=256), public, protected :: OC_GFEDv3_filename  = 'NONE'
      41             :   real(r8), public, protected :: carma_dustemisfactor = 0.5e-9_r8
      42             : 
      43             : contains
      44             : 
      45             : 
      46             :   !! Read the CARMA model runtime options from the namelist
      47             :   !!
      48             :   !! @author  Chuck Bardeen
      49             :   !! @version Mar-2011
      50        1536 :   subroutine carma_model_readnl(nlfile)
      51             : 
      52             :     ! Read carma namelist group.
      53             : 
      54             :     use cam_abortutils,  only: endrun
      55             :     use namelist_utils,  only: find_group_name
      56             :     use units,           only: getunit, freeunit
      57             :     use mpishorthand
      58             : 
      59             :     ! args
      60             : 
      61             :     character(len=*), intent(in) :: nlfile  ! filepath for file containing namelist input
      62             : 
      63             :     ! local vars
      64             : 
      65             :     integer :: unitn, ierr
      66             : 
      67             :     ! read namelist for CARMA
      68             :     namelist /carma_model_nl/ &
      69             :       carma_do_WeibullK, &
      70             :       carma_seasalt_emis, &
      71             :       carma_BCOCemissions, &
      72             :       carma_SO4elevemis, &
      73             :       carma_soilerosion_file, &
      74             :       BC_GAINS_filename, &
      75             :       OC_GAINS_filename, &
      76             :       BC_ship_filename, &
      77             :       OC_ship_filename, &
      78             :       BC_GFEDv3_filename, &
      79             :       OC_GFEDv3_filename, &
      80             :       carma_dustemisfactor
      81             : 
      82        1536 :     if (masterproc) then
      83           2 :        unitn = getunit()
      84           2 :        open( unitn, file=trim(nlfile), status='old' )
      85           2 :        call find_group_name(unitn, 'carma_model_nl', status=ierr)
      86           2 :        if (ierr == 0) then
      87           2 :           read(unitn, carma_model_nl, iostat=ierr)
      88           2 :           if (ierr /= 0) then
      89           0 :              call endrun('carma_model_readnl: ERROR reading namelist')
      90             :           end if
      91             :        end if
      92           2 :        close(unitn)
      93           2 :        call freeunit(unitn)
      94             :     end if
      95             : 
      96             : #ifdef SPMD
      97        1536 :     call mpibcast(carma_soilerosion_file,      len(carma_soilerosion_file),       mpichar, 0, mpicom)
      98        1536 :     call mpibcast(carma_do_WeibullK,   1,                       mpilog,  0, mpicom)
      99        1536 :     call mpibcast(carma_seasalt_emis, len(carma_seasalt_emis), mpichar, 0, mpicom)
     100        1536 :     call mpibcast(carma_BCOCemissions,len(carma_BCOCemissions), mpichar, 0, mpicom)
     101        1536 :     call mpibcast(carma_SO4elevemis,  len(carma_SO4elevemis), mpichar, 0, mpicom)
     102        1536 :     call mpibcast(BC_GAINS_filename,  len(BC_GAINS_filename), mpichar, 0, mpicom)
     103        1536 :     call mpibcast(OC_GAINS_filename,  len(OC_GAINS_filename), mpichar, 0, mpicom)
     104        1536 :     call mpibcast(BC_ship_filename,   len(BC_ship_filename), mpichar, 0, mpicom)
     105        1536 :     call mpibcast(OC_ship_filename,   len(OC_ship_filename), mpichar, 0, mpicom)
     106        1536 :     call mpibcast(BC_GFEDv3_filename, len(BC_GFEDv3_filename), mpichar, 0, mpicom)
     107        1536 :     call mpibcast(OC_GFEDv3_filename, len(OC_GFEDv3_filename), mpichar, 0, mpicom)
     108        1536 :     call mpibcast(carma_dustemisfactor,1,                      mpir8, 0,mpicom)
     109             : #endif
     110             : 
     111        1536 :   end subroutine carma_model_readnl
     112             : 
     113             : end module carma_model_flags_mod

Generated by: LCOV version 1.14