LCOV - code coverage report
Current view: | top level - physics/cam7 - stochastic_tau_cam.F90 (source / functions) |  |  | Hit | Total | Coverage
Test: | coverage.info |  | Lines: | 0 | 53 | 0.0 %
Date: | 2024-12-17 22:39:59 |  | Functions: | 0 | 2 | 0.0 %

              Line data    Source code
           1             : module stochastic_tau_cam
           2             : ! From Morrison (Lebo, originally TAU bin code)
           3             : ! Gettelman and Chen 2018
           4             : !the subroutines take in air density, air temperature, and the bin mass boundaries, and
           5             : !output the mass and number mixing ratio tendencies in each bin directly.
           6             : !this is then wrapped for CAM.
           7             :
           8             : use shr_kind_mod,      only: cl=>shr_kind_cl
           9             : use cam_history,       only: addfld
          10             : use cam_logfile,       only: iulog
          11             :
          12             : implicit none
          13             : private
          14             : save
          15             :
          16             : ! Subroutines
          17             : public :: stochastic_tau_init_cam, stochastic_tau_readnl
          18             :
          19             : !Module variables
          20             :
          21             : integer, parameter, public  :: ncd = 35
          22             : character(len=cl) :: pumas_stochastic_tau_kernel_filename ! Full filepath/filename for tau kernel file
          23             :
          24             : !===============================================================================
          25             : contains
          26             : !===============================================================================
          27           0 : subroutine stochastic_tau_readnl(nlfile)
          28             :
          29             :   use namelist_utils,  only: find_group_name
          30             :   use units,           only: getunit, freeunit
          31             :   use spmd_utils,      only: mpicom, mstrid=>masterprocid, mpi_character, masterproc
          32             :   use cam_abortutils,  only: endrun
          33             :   use string_utils,    only: int2str
          34             :
          35             :   character(len=*), intent(in) :: nlfile  ! filepath for file containing namelist input
          36             :
          37             :   integer :: unitn, ierr
          38             :   character(len=*), parameter :: sub = 'stochastic_tau_readnl'
          39             :
          40             :   namelist /pumas_stochastic_tau_nl/ pumas_stochastic_tau_kernel_filename
          41             :
          42           0 :   if (masterproc) then
          43           0 :      unitn = getunit()
          44           0 :      open( unitn, file=trim(nlfile), status='old' )
          45           0 :      call find_group_name(unitn, 'pumas_stochastic_tau_nl', status=ierr)
          46           0 :      if (ierr == 0) then
          47           0 :         read(unitn, pumas_stochastic_tau_nl, iostat=ierr)
          48           0 :         if (ierr /= 0) then
          49           0 :            call endrun(sub // ':: ERROR reading namelist, iostat = ' // int2str(ierr))
          50             :         end if
          51             :      end if
          52           0 :      close(unitn)
          53           0 :      call freeunit(unitn)
          54             :   end if
          55             :
          56             :   ! Broadcast namelist variables
          57           0 :   call mpi_bcast(pumas_stochastic_tau_kernel_filename, cl, mpi_character, mstrid, mpicom, ierr)
          58           0 :   if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: pumas_stochastic_tau_kernel_filename")
          59             :
          60           0 :   write(iulog,*) 'PUMAS stochastic_tau_readnl, pumas_stochastic_tau_kernel_filename=',pumas_stochastic_tau_kernel_filename
          61             :
          62           0 : end subroutine stochastic_tau_readnl
          63             :
          64           0 : subroutine stochastic_tau_init_cam
          65             :
          66             :     use cam_history_support, only:          add_hist_coord
          67             :     use pumas_stochastic_collect_tau, only: pumas_stochastic_kernel_init
          68             :
          69             :
          70           0 :     call pumas_stochastic_kernel_init(pumas_stochastic_tau_kernel_filename)
          71             :
          72           0 :     call add_hist_coord('bins_ncd', ncd, 'bins for TAU microphysics')
          73             :
          74             :     !Note: lev needs to be trop_cld_lev for proc_rates....
          75           0 :     call addfld('amk_c',(/'trop_cld_lev','bins_ncd    '/),'A','kg','cloud liquid mass from bins')
          76           0 :     call addfld('ank_c',(/'trop_cld_lev','bins_ncd    '/),'A','1/kg','cloud liquid number concentration from bins')
          77           0 :     call addfld('amk_r',(/'trop_cld_lev','bins_ncd    '/),'A','kg','rain mass from bins')
          78           0 :     call addfld('ank_r',(/'trop_cld_lev','bins_ncd    '/),'A','1/kg','rain number concentration from bins')
          79           0 :     call addfld('amk',(/'trop_cld_lev','bins_ncd    '/),'A','kg','all liquid mass from bins')
          80           0 :     call addfld('ank',(/'trop_cld_lev','bins_ncd    '/),'A','1/kg','all liquid number concentration from bins')
          81           0 :     call addfld('amk_out',(/'trop_cld_lev','bins_ncd    '/),'A','kg','all liquid mass from bins')
          82           0 :     call addfld('ank_out',(/'trop_cld_lev','bins_ncd    '/),'A','1/kg','all liquid number concentration from bins')
          83             :
          84           0 :     call addfld('scale_nc',(/'trop_cld_lev'/),'A','1','scaling factor for nc')
          85           0 :     call addfld('scale_nr',(/'trop_cld_lev'/),'A','1','scaling factor for nr')
          86           0 :     call addfld('scale_qc',(/'trop_cld_lev'/),'A','1','scaling factor for qc')
          87           0 :     call addfld('scale_qr',(/'trop_cld_lev'/),'A','1','scaling factor for qr')
          88             :
          89           0 :     call addfld('QC_TAU_in',(/'trop_cld_lev'/),'A','kg/kg','qc in TAU')
          90           0 :     call addfld('NC_TAU_in',(/'trop_cld_lev'/),'A','1/kg','nc in TAU')
          91           0 :     call addfld('QR_TAU_in',(/'trop_cld_lev'/),'A','kg/kg','qr in TAU')
          92           0 :     call addfld('NR_TAU_in',(/'trop_cld_lev'/),'A','1/kg','nr in TAU')
          93           0 :     call addfld('QC_TAU_out',(/'trop_cld_lev'/),'A','kg/kg','qc out TAU')
          94           0 :     call addfld('NC_TAU_out',(/'trop_cld_lev'/),'A','1/kg','nc out TAU')
          95           0 :     call addfld('QR_TAU_out',(/'trop_cld_lev'/),'A','kg/kg','qr out TAU')
          96           0 :     call addfld('NR_TAU_out',(/'trop_cld_lev'/),'A','1/kg','nr out TAU')
          97             :
          98           0 :     call addfld('qctend_TAU',(/'trop_cld_lev'/),'A','kg/kg/s','qc tendency due to TAU bin code')
          99           0 :     call addfld('nctend_TAU',(/'trop_cld_lev'/),'A','1/kg/s','nc tendency due to TAU bin code')
         100           0 :     call addfld('qrtend_TAU',(/'trop_cld_lev'/),'A','kg/kg/s','qr tendency due to TAU bin code')
         101           0 :     call addfld('nrtend_TAU',(/'trop_cld_lev'/),'A','1/kg/s','nr tendency due to TAU bin code')
         102           0 :     call addfld('qctend_TAU_diag',(/'trop_cld_lev'/),'A','kg/kg/s','qc tendency due to TAU bin code')
         103           0 :     call addfld('nctend_TAU_diag',(/'trop_cld_lev'/),'A','1/kg/s','nc tendency due to TAU bin code')
         104           0 :     call addfld('qrtend_TAU_diag',(/'trop_cld_lev'/),'A','kg/kg/s','qr tendency due to TAU bin code')
         105           0 :     call addfld('nrtend_TAU_diag',(/'trop_cld_lev'/),'A','1/kg/s','nr tendency due to TAU bin code')
         106             :
         107           0 :     call addfld('gmnnn_lmnnn_TAU',(/'trop_cld_lev'/),'A','1','sum of mass gain and loss from bin code')
         108           0 :     call addfld('ML_fixer',(/'trop_cld_lev'/),'A','1','frequency that ML fixer is activated')
         109           0 :     call addfld('qc_fixer',(/'trop_cld_lev'/),'A','kg/kg','delta qc due to ML fixer')
         110           0 :     call addfld('nc_fixer',(/'trop_cld_lev'/),'A','kg/kg','delta nc due to ML fixer')
         111           0 :     call addfld('qr_fixer',(/'trop_cld_lev'/),'A','kg/kg','delta qr due to ML fixer')
         112           0 :     call addfld('nr_fixer',(/'trop_cld_lev'/),'A','kg/kg','delta nr due to ML fixer')
         113             :
         114           0 : end subroutine stochastic_tau_init_cam
         115             : end module stochastic_tau_cam
         116             :
         117             :

Generated by: LCOV version 1.14