LCOV - code coverage report
Current view: top level - physics/carma/cam - carma_getH2O.F90 (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 13 0.0 %
Date: 2025-03-14 01:33:33 Functions: 0 1 0.0 %

          Line data    Source code
       1             :   ! Read the average water vapor profile from the initial condition file.
       2             :   !
       3             :   ! NOTE: This needs to be in its own file to avoid circular references.
       4           0 :   subroutine carma_getH2O(h2o)
       5             :     use shr_kind_mod,   only: r8 => shr_kind_r8
       6             :     use cam_initfiles,  only: initial_file_get_id
       7             :     use pio,            only: file_desc_t
       8             :     use cam_pio_utils,  only: cam_pio_get_var
       9             :     use pmgrid,         only: plat, plev, plevp, plon
      10             :     use ppgrid,         only: pcols, pver, pverp
      11             :     use cam_abortutils, only: endrun
      12             : 
      13             :     real(r8), intent(out)   :: h2o(pver)      ! midpoint h2o mmr (kg/kg)
      14             : 
      15             :     integer                    :: iz           ! vertical index
      16             :     type(file_desc_t), pointer :: ncid_ini
      17             :     logical                    :: found
      18           0 :     real(r8), pointer          :: init_h2o(:,:,:)
      19             : 
      20             :     ! For an initial run, if the file is missing, then create one using the
      21             :     ! average concentration from the initial condition file.
      22           0 :     ncid_ini  => initial_file_get_id()
      23           0 :     nullify(init_h2o)
      24             : 
      25           0 :     allocate(init_h2o(plon,pver,plat))
      26           0 :     call cam_pio_get_var('Q', ncid_ini, init_h2o, found=found)
      27             :             
      28           0 :     if (.not. found) then
      29           0 :       call endrun('carma_init::cam_pio_get_var failed to find field Q.')
      30             :     end if
      31             : 
      32             :     ! Just do a simple average. Could get gw and do a weighted average.
      33           0 :     do iz = 1, pver
      34           0 :       h2o(iz) = sum(init_h2o(:, iz, :)) / plat / plon
      35             :     end do
      36             : 
      37           0 :     deallocate(init_h2o)
      38             :     
      39           0 :     return
      40           0 :   end

Generated by: LCOV version 1.14