Line data Source code
1 : module mo_exp_sol
2 : private
3 : public :: exp_sol
4 : public :: exp_sol_inti
5 : contains
6 22656 : 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 : do i = 1,clscnt1
13 : j = clsmap(i,1)
14 : call addfld( trim(solsym(j))//'_CHMP', (/ 'lev' /), 'I', '/cm3/s', 'chemical production rate' )
15 : call addfld( trim(solsym(j))//'_CHML', (/ 'lev' /), 'I', '/cm3/s', 'chemical loss rate' )
16 : enddo
17 768 : end subroutine exp_sol_inti
18 21888 : 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 768 : 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 43776 : prod, &
51 43776 : loss
52 43776 : real(r8), dimension(ncol,pver,clscnt1) :: ind_prd
53 21888 : real(r8), dimension(ncol,pver) :: wrk
54 21888 : chnkpnts = ncol*pver
55 : !-----------------------------------------------------------------------
56 : ! ... Put "independent" production in the forcing
57 : !-----------------------------------------------------------------------
58 : call indprd( 1, ind_prd, clscnt1, base_sol, extfrc, &
59 21888 : reaction_rates, chnkpnts )
60 : !-----------------------------------------------------------------------
61 : ! ... Form F(y)
62 : !-----------------------------------------------------------------------
63 : call exp_prod_loss( 1, chnkpnts, prod, loss, base_sol, reaction_rates, &
64 21888 : het_rates, chnkpnts )
65 : !-----------------------------------------------------------------------
66 : ! ... Solve for the mixing ratio at t(n+1)
67 : !-----------------------------------------------------------------------
68 : do m = 1,clscnt1
69 : l = clsmap(m,1)
70 : do i = 1,ncol
71 : do k = ltrop(i)+1,pver
72 : 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 : wrk(:,:) = (prod(:,:,m) + ind_prd(:,:,m))*xhnm
76 : call outfld( trim(solsym(l))//'_CHMP', wrk(:,:), ncol, lchnk )
77 : wrk(:,:) = (loss(:,:,m))*xhnm
78 : call outfld( trim(solsym(l))//'_CHML', wrk(:,:), ncol, lchnk )
79 : end do
80 21888 : end subroutine exp_sol
81 : end module mo_exp_sol
|