LCOV - code coverage report
Current view: | top level - physics/cam - carma_model_flags_mod.F90 (source / functions) |  |  | Hit | Total | Coverage
Test: | coverage.info |  | Lines: | 2 | 2 | 100.0 %
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 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             :   logical, public                :: carma_flag        = .false.   ! If .true. then turn on CARMA microphysics in CAM
          28             :   real(r8), public               :: carma_vf_const    = 0.0_r8    ! If specified and non-zero, constant fall velocity for all particles [cm/s]
          29             :   character(len=256), public     :: carma_reftfile    = 'carma_reft.nc'  ! path to the file containing the reference temperature profile
          30             :
          31             : contains
          32             :
          33             :
          34             :   !! Read the CARMA model runtime options from the namelist
          35             :   !!
          36             :   !! @author  Chuck Bardeen
          37             :   !! @version Mar-2011
          38        1536 :   subroutine carma_model_readnl(nlfile)
          39             :
          40             :     ! Read carma namelist group.
          41             :
          42             :     use cam_abortutils,  only: endrun
          43             :     use namelist_utils,  only: find_group_name
          44             :     use units,           only: getunit, freeunit
          45             :     use mpishorthand
          46             :
          47             :     ! args
          48             :
          49             :     character(len=*), intent(in) :: nlfile  ! filepath for file containing namelist input
          50             :
          51             :     ! local vars
          52             :
          53             :     integer :: unitn, ierr
          54             :
          55             :     ! read namelist for CARMA
          56             : !    namelist /carma_model_nl/ &
          57             : !      carma_flag, &
          58             : !      carma_maxretries, &
          59             : !      carma_conmax, &
          60             : !      carma_reftfile
          61             :
          62             : !    if (masterproc) then
          63             : !       unitn = getunit()
          64             : !       open( unitn, file=trim(nlfile), status='old' )
          65             : !       call find_group_name(unitn, 'carma_model_nl', status=ierr)
          66             : !       if (ierr == 0) then
          67             : !          read(unitn, carma_model_nl, iostat=ierr)
          68             : !          if (ierr /= 0) then
          69             : !             call endrun('carma_model_readnl: ERROR reading namelist')
          70             : !          end if
          71             : !       end if
          72             : !       close(unitn)
          73             : !       call freeunit(unitn)
          74             : !    end if
          75             :
          76             : #ifdef SPMD
          77             : !    call mpibcast (carma_flag,            1 ,mpilog, 0,mpicom)
          78             : !    call mpibcast (carma_maxretries,      1 ,mpiint, 0,mpicom)
          79             : !    call mpibcast (carma_conmax,          1 ,mpir8,  0,mpicom)
          80             : !    call mpibcast (carma_reftfile, len(carma_reftfile), mpichar, 0, mpicom)
          81             : #endif
          82             :
          83        1536 :   end subroutine carma_model_readnl
          84             :
          85             : end module carma_model_flags_mod

Generated by: LCOV version 1.14