LCOV - code coverage report
Current view: top level - chemistry/pp_trop_strat_noaero - mo_exp_sol.F90 (source / functions) Hit Total Coverage
Test: coverage.info Lines: 25 25 100.0 %
Date: 2025-03-14 01:30:37 Functions: 2 2 100.0 %

          Line data    Source code
       1             : module mo_exp_sol
       2             :   private
       3             :   public :: exp_sol
       4             :   public :: exp_sol_inti
       5             : contains
       6       74496 :   subroutine exp_sol_inti
       7             :     use mo_tracname, only : solsym
       8             :     use chem_mods, only : clscnt1, clsmap
       9             :     use cam_history, only : addfld
      10             :     implicit none
      11             :     integer :: i,j
      12       49152 :     do i = 1,clscnt1
      13       47616 :        j = clsmap(i,1)
      14       95232 :        call addfld( trim(solsym(j))//'_CHMP', (/ 'lev' /), 'I', '/cm3/s', 'chemical production rate' )
      15       96768 :        call addfld( trim(solsym(j))//'_CHML', (/ 'lev' /), 'I', '/cm3/s', 'chemical loss rate' )
      16             :     enddo
      17        1536 :   end subroutine exp_sol_inti
      18       72960 :   subroutine exp_sol( base_sol, reaction_rates, het_rates, extfrc, delt, xhnm, ncol, lchnk, ltrop )
      19             :     !-----------------------------------------------------------------------
      20             :     ! ... Exp_sol advances the volumetric mixing ratio
      21             :     ! forward one time step via the fully explicit
      22             :     ! Euler scheme
      23             :     !-----------------------------------------------------------------------
      24        1536 :     use chem_mods, only : clscnt1, extcnt, gas_pcnst, clsmap, rxntot
      25             :     use ppgrid, only : pcols, pver
      26             :     use mo_prod_loss, only : exp_prod_loss
      27             :     use mo_indprd, only : indprd
      28             :     use shr_kind_mod, only : r8 => shr_kind_r8
      29             :     use cam_history, only : outfld
      30             :     use mo_tracname, only : solsym
      31             :     implicit none
      32             :     !-----------------------------------------------------------------------
      33             :     ! ... Dummy arguments
      34             :     !-----------------------------------------------------------------------
      35             :     integer, intent(in) :: ncol ! columns in chunck
      36             :     integer, intent(in) :: lchnk ! chunk id
      37             :     real(r8), intent(in) :: delt ! time step (s)
      38             :     real(r8), intent(in) :: het_rates(ncol,pver,max(1,gas_pcnst)) ! het rates (1/cm^3/s)
      39             :     real(r8), intent(in) :: reaction_rates(ncol,pver,rxntot) ! rxt rates (1/cm^3/s)
      40             :     real(r8), intent(in) :: extfrc(ncol,pver,extcnt) ! "external insitu forcing" (1/cm^3/s)
      41             :     real(r8), intent(in) :: xhnm(ncol,pver)
      42             :     integer, intent(in) :: ltrop(pcols) ! chemistry troposphere boundary (index)
      43             :     real(r8), intent(inout) :: base_sol(ncol,pver,gas_pcnst) ! working mixing ratios (vmr)
      44             :     !-----------------------------------------------------------------------
      45             :     ! ... Local variables
      46             :     !-----------------------------------------------------------------------
      47             :     integer :: i, k, l, m
      48             :     integer :: chnkpnts
      49             :     real(r8), dimension(ncol,pver,max(1,clscnt1)) :: &
      50      145920 :          prod, &
      51      145920 :          loss
      52      145920 :     real(r8), dimension(ncol,pver,clscnt1) :: ind_prd
      53      145920 :     real(r8), dimension(ncol,pver) :: wrk
      54       72960 :     chnkpnts = ncol*pver
      55             :     !-----------------------------------------------------------------------
      56             :     ! ... Put "independent" production in the forcing
      57             :     !-----------------------------------------------------------------------
      58             :     call indprd( 1, ind_prd, clscnt1, base_sol, extfrc, &
      59       72960 :                  reaction_rates, chnkpnts )
      60             :     !-----------------------------------------------------------------------
      61             :     ! ... Form F(y)
      62             :     !-----------------------------------------------------------------------
      63             :     call exp_prod_loss( 1, chnkpnts, prod, loss, base_sol, reaction_rates, &
      64       72960 :                         het_rates, chnkpnts )
      65             :     !-----------------------------------------------------------------------
      66             :     ! ... Solve for the mixing ratio at t(n+1)
      67             :     !-----------------------------------------------------------------------
      68     2334720 :     do m = 1,clscnt1
      69     2261760 :        l = clsmap(m,1)
      70    34831104 :        do i = 1,ncol
      71  1077050112 :           do k = ltrop(i)+1,pver
      72  1074788352 :              base_sol(i,k,l) = base_sol(i,k,l) + delt * (prod(i,k,m) + ind_prd(i,k,m) - loss(i,k,m))
      73             :           end do
      74             :        end do
      75  1116857088 :        wrk(:,:) = (prod(:,:,m) + ind_prd(:,:,m))*xhnm
      76     2261760 :        call outfld( trim(solsym(l))//'_CHMP', wrk(:,:), ncol, lchnk )
      77  1116857088 :        wrk(:,:) = (loss(:,:,m))*xhnm
      78     2334720 :        call outfld( trim(solsym(l))//'_CHML', wrk(:,:), ncol, lchnk )
      79             :     end do
      80       72960 :   end subroutine exp_sol
      81             : end module mo_exp_sol

Generated by: LCOV version 1.14