LCOV - code coverage report
Current view: | top level - chemistry/mozart - gas_wetdep_opts.F90 (source / functions) |  |  | Hit | Total | Coverage
Test: | coverage.info |  | Lines: | 18 | 20 | 90.0 %
Date: | 2024-12-17 22:39:59 |  | Functions: | 1 | 1 | 100.0 %

              Line data    Source code
           1             : !-----------------------------------------------------------------------
           2             : ! Reads namelist options for gas-phase wet deposition
           3             : !
           4             : ! Created by Francis Vitt -- 22 Apr 2011
           5             : !-----------------------------------------------------------------------
           6             : module gas_wetdep_opts
           7             :
           8             :   use constituents,     only : pcnst
           9             :   use cam_logfile,      only : iulog
          10             :   use constituents,     only : pcnst
          11             :   use spmd_utils,       only : masterproc
          12             :   use cam_abortutils,   only : endrun
          13             :
          14             :   implicit none
          15             :
          16             :   character(len=16), protected :: gas_wetdep_list(pcnst) = ' '
          17             :   character(len=3), protected :: gas_wetdep_method = 'MOZ'
          18             :   integer,          protected :: gas_wetdep_cnt = 0
          19             :
          20             : contains
          21             :
          22             :   !-----------------------------------------------------------------------
          23             :   !-----------------------------------------------------------------------
          24             :
          25        1536 :   subroutine gas_wetdep_readnl(nlfile)
          26             :
          27             :     use cam_abortutils,  only: endrun
          28             :     use namelist_utils,  only: find_group_name
          29             :     use units,           only: getunit, freeunit
          30             : #ifdef SPMD
          31             :     use mpishorthand,    only: mpichar, mpicom
          32             : #endif
          33             :
          34             :     implicit none
          35             :
          36             :     character(len=*), intent(in) :: nlfile  ! filepath for file containing namelist input
          37             :
          38             :     integer :: unitn, i, ierr
          39             :
          40             :     namelist /wetdep_inparm/ gas_wetdep_list
          41             :     namelist /wetdep_inparm/ gas_wetdep_method
          42             :
          43        1536 :     if (masterproc) then
          44           2 :        unitn = getunit()
          45           2 :        open( unitn, file=trim(nlfile), status='old' )
          46           2 :        call find_group_name(unitn, 'wetdep_inparm', status=ierr)
          47           2 :        if (ierr == 0) then
          48           2 :           read(unitn, wetdep_inparm, iostat=ierr)
          49           2 :           if (ierr /= 0) then
          50           0 :              call endrun('mo_neu_wetdep->wetdep_readnl: ERROR reading wetdep_inparm namelist')
          51             :           end if
          52             :        end if
          53           2 :        close(unitn)
          54           2 :        call freeunit(unitn)
          55             :     end if
          56             :
          57             : #ifdef SPMD
          58        1536 :     call mpibcast (gas_wetdep_list, len(gas_wetdep_list(1))*pcnst, mpichar, 0, mpicom)
          59        1536 :     call mpibcast (gas_wetdep_method, len(gas_wetdep_method), mpichar, 0, mpicom)
          60             : #endif
          61             :
          62        1536 :     gas_wetdep_cnt = 0
          63       64512 :     do i = 1,pcnst
          64       64512 :        if ( len_trim(gas_wetdep_list(i)) > 0 ) then
          65        7680 :           gas_wetdep_cnt = gas_wetdep_cnt + 1
          66             :        endif
          67             :     enddo
          68             :
          69        1536 :     if (( gas_wetdep_cnt>0 ).and.( .not.(gas_wetdep_method=='MOZ' .or. gas_wetdep_method=='NEU' &
          70             :          .or. gas_wetdep_method=='OFF') )) then
          71           0 :        call endrun('gas_wetdep_readnl; gas_wetdep_method must be set to either MOZ or NEU')
          72             :     endif
          73             :
          74        1536 :   end subroutine gas_wetdep_readnl
          75             :
          76             : end module gas_wetdep_opts

Generated by: LCOV version 1.14