LCOV - code coverage report
Current view: top level - physics/cam - pkg_cld_sediment.F90 (source / functions) Hit Total Coverage
Test: coverage.info Lines: 13 14 92.9 %
Date: 2025-04-28 18:57:11 Functions: 1 1 100.0 %

          Line data    Source code
       1             : ! CAM interface for CCPPized cloud_particle_sedimentation
       2             : module pkg_cld_sediment
       3             : 
       4             :   use shr_kind_mod, only: r8 => shr_kind_r8
       5             : 
       6             :   implicit none
       7             :   private
       8             :   save
       9             : 
      10             :   public :: cld_sediment_readnl
      11             : 
      12             :   ! namelist variables
      13             :   real(r8) :: cldsed_ice_stokes_fac = huge(1._r8)   ! factor applied to the ice fall velocity computed from
      14             :   ! stokes terminal velocity
      15             : 
      16             : !===============================================================================
      17             : contains
      18             : !===============================================================================
      19             : 
      20        1024 :   subroutine cld_sediment_readnl(nlfile)
      21             : 
      22             :     use namelist_utils, only: find_group_name
      23             :     use units, only: getunit, freeunit
      24             :     use mpishorthand
      25             :     use cam_abortutils, only: endrun
      26             :     use cam_logfile,  only: iulog
      27             :     use spmd_utils, only: masterproc
      28             :     use physconst, only: gravit, rhoh2o
      29             : 
      30             :     use cloud_particle_sedimentation, only: cloud_particle_sedimentation_init
      31             : 
      32             :     character(len=*), intent(in) :: nlfile  ! filepath for file containing namelist input
      33             : 
      34             :     ! Local variables
      35             :     integer :: unitn, ierr
      36             :     character(len=*), parameter :: subname = 'cld_sediment_readnl'
      37             :     character(len=512) :: errmsg
      38             :     integer            :: errflg
      39             : 
      40             :     namelist /cldsed_nl/ cldsed_ice_stokes_fac
      41             :     !-----------------------------------------------------------------------------
      42             : 
      43        1026 :     if (masterproc) then
      44           2 :       unitn = getunit()
      45           2 :       open (unitn, file=trim(nlfile), status='old')
      46           2 :       call find_group_name(unitn, 'cldsed_nl', status=ierr)
      47           2 :       if (ierr == 0) then
      48           2 :         read (unitn, cldsed_nl, iostat=ierr)
      49           2 :         if (ierr /= 0) then
      50           0 :           call endrun(subname//':: ERROR reading namelist')
      51             :         end if
      52             :       end if
      53           2 :       close (unitn)
      54           2 :       call freeunit(unitn)
      55             : 
      56             :     end if
      57             : 
      58             : #ifdef SPMD
      59             :     ! Broadcast namelist variables
      60        1024 :     call mpibcast(cldsed_ice_stokes_fac, 1, mpir8, 0, mpicom)
      61             : #endif
      62             : 
      63             :     ! Call CCPP-ized subroutine initialization
      64             :     call cloud_particle_sedimentation_init(&
      65             :       amIRoot = masterproc, iulog = iulog, &
      66             :       cldsed_ice_stokes_fac_in = cldsed_ice_stokes_fac, &
      67             :       rhoh2o = rhoh2o, gravit = gravit, &
      68        1024 :       errmsg = errmsg, errflg = errflg)
      69             : 
      70        1024 :   end subroutine cld_sediment_readnl
      71             : end module pkg_cld_sediment

Generated by: LCOV version 1.14