Skip to content

Commit

Permalink
Restore pp_trop_mam_oslo from cam_cesm2_1_rel_05-Nor_v1.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve Goldhaber committed Sep 1, 2023
1 parent 64f5990 commit a70cefd
Show file tree
Hide file tree
Showing 18 changed files with 1,369 additions and 4 deletions.
11 changes: 11 additions & 0 deletions src/chemistry/pp_trop_mam_oslo/chem_mech.doc
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@


|--------------------------------------------------------------------------------------------------|
| |
| |
| This is a mam-oslo simulation with : |
| (1) comments to add |
| (2) comments to add |
| |
| |
|--------------------------------------------------------------------------------------------------|


Solution species
( 1) SO2
( 2) H2SO4
Expand Down
10 changes: 6 additions & 4 deletions src/chemistry/pp_trop_mam_oslo/chem_mech.in
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
BEGSIM
SPECIES

Solution
SO2, H2SO4
DMS -> CH3SCH3, H2O2
SO4_NA->H2SO4, SO4_A1->H2SO4, SO4_A2->NH4HSO4
SO4_AC->H2SO4, SO4_PR->H2SO4, BC_N->C
BC_AX->C, BC_NI->C, BC_A->C, BC_AI->C
BC_AX->C, BC_NI->C, BC_A->C, BC_AI->C
BC_AC->C, OM_NI->C, OM_AI->C, OM_AC->C
DST_A2->AlSiO5, DST_A3->AlSiO5
SS_A1->NaCl, SS_A2->NaCl, SS_A3->NaCl
* Approximate soa species with those of monoterpene oxidation products
* based on Paasonen et al. (2010); Taipale et al. (2008).
* based on Paasonen et al. (2010); Taipale et al. (2008).
SOA_NA->C10H16O2, SOA_A1->C10H16O2
SOA_LV ->C10H16O2, SOA_SV->C10H16O2
monoterp -> C10H16, isoprene -> C5H8
Expand All @@ -35,7 +36,7 @@
DMS, SO2, H2O2
SO4_NA, SO4_A1, SO4_A2
SO4_AC, SO4_PR, BC_N
BC_AX, BC_NI, BC_A, BC_AI
BC_AX, BC_NI, BC_A, BC_AI
BC_AC, OM_NI, OM_AI, OM_AC
DST_A2, DST_A3
SS_A1, SS_A2, SS_A3 , H2SO4
Expand All @@ -60,7 +61,7 @@
* Then account for 0.25 which is 0.25 MSA molec per DMS molec (the other 0.75 goes to SO2)
* Then 0.2 assumed yield for SOA_LV and 0.8 assumed yield for SOA_SV gives the coefficients below
* reaction rate from Chin et al 1996, JGR, vol 101, no D13
*
*
[usr_DMS_OH] DMS + OH -> .75 * SO2 + .5 * HO2 + 0.029*SOA_LV + 0.114*SOA_SV
*
*cka: added organic vapor oxidation with constants from IUPAC below
Expand Down Expand Up @@ -105,3 +106,4 @@
End Version Options

END SIMULATION PARAMETERS
ENDSIM
50 changes: 50 additions & 0 deletions src/chemistry/pp_trop_mam_oslo/chem_mods.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
module chem_mods
!--------------------------------------------------------------
! ... Basic chemistry parameters and arrays
!--------------------------------------------------------------
use shr_kind_mod, only : r8 => shr_kind_r8
implicit none
save
integer, parameter :: phtcnt = 1, & ! number of photolysis reactions
rxntot = 13, & ! number of total reactions
gascnt = 12, & ! number of gas phase reactions
nabscol = 2, & ! number of absorbing column densities
gas_pcnst = 30, & ! number of "gas phase" species
nfs = 7, & ! number of "fixed" species
relcnt = 0, & ! number of relationship species
grpcnt = 0, & ! number of group members
nzcnt = 38, & ! number of non-zero matrix entries
extcnt = 7, & ! number of species with external forcing
clscnt1 = 0, & ! number of species in explicit class
clscnt2 = 0, & ! number of species in hov class
clscnt3 = 0, & ! number of species in ebi class
clscnt4 = 30, & ! number of species in implicit class
clscnt5 = 0, & ! number of species in rodas class
indexm = 1, & ! index of total atm density in invariant array
indexh2o = 0, & ! index of water vapor density
clsze = 1, & ! loop length for implicit chemistry
rxt_tag_cnt = 3, &
enthalpy_cnt = 0, &
nslvd = 0
integer :: clscnt(5) = 0
integer :: cls_rxt_cnt(4,5) = 0
integer :: clsmap(gas_pcnst,5) = 0
integer :: permute(gas_pcnst,5) = 0
integer :: diag_map(clscnt4) = 0
real(r8) :: adv_mass(gas_pcnst) = 0._r8
real(r8) :: crb_mass(gas_pcnst) = 0._r8
real(r8) :: fix_mass(max(1,nfs))
real(r8), allocatable :: cph_enthalpy(:)
integer, allocatable :: cph_rid(:)
integer, allocatable :: num_rnts(:)
integer, allocatable :: rxt_tag_map(:)
real(r8), allocatable :: pht_alias_mult(:,:)
character(len=32), allocatable :: rxt_tag_lst(:)
character(len=16), allocatable :: pht_alias_lst(:,:)
character(len=16) :: inv_lst(max(1,nfs))
character(len=16) :: extfrc_lst(max(1,extcnt))
logical :: frc_from_dataset(max(1,extcnt))
logical :: is_vector
logical :: is_scalar
character(len=16) :: slvd_lst(max(1,nslvd))
end module chem_mods
16 changes: 16 additions & 0 deletions src/chemistry/pp_trop_mam_oslo/m_rxt_id.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module m_rxt_id
implicit none
integer, parameter :: rid_jh2o2 = 1
integer, parameter :: rid_usr_HO2_HO2 = 2
integer, parameter :: rid_usr_DMS_OH = 7
integer, parameter :: rid_r0003 = 3
integer, parameter :: rid_r0004 = 4
integer, parameter :: rid_r0005 = 5
integer, parameter :: rid_r0006 = 6
integer, parameter :: rid_r0008 = 8
integer, parameter :: rid_r0009 = 9
integer, parameter :: rid_r0010 = 10
integer, parameter :: rid_r0011 = 11
integer, parameter :: rid_r0012 = 12
integer, parameter :: rid_r0013 = 13
end module m_rxt_id
33 changes: 33 additions & 0 deletions src/chemistry/pp_trop_mam_oslo/m_spc_id.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
module m_spc_id
implicit none
integer, parameter :: id_SO2 = 1
integer, parameter :: id_H2SO4 = 2
integer, parameter :: id_DMS = 3
integer, parameter :: id_H2O2 = 4
integer, parameter :: id_SO4_NA = 5
integer, parameter :: id_SO4_A1 = 6
integer, parameter :: id_SO4_A2 = 7
integer, parameter :: id_SO4_AC = 8
integer, parameter :: id_SO4_PR = 9
integer, parameter :: id_BC_N = 10
integer, parameter :: id_BC_AX = 11
integer, parameter :: id_BC_NI = 12
integer, parameter :: id_BC_A = 13
integer, parameter :: id_BC_AI = 14
integer, parameter :: id_BC_AC = 15
integer, parameter :: id_OM_NI = 16
integer, parameter :: id_OM_AI = 17
integer, parameter :: id_OM_AC = 18
integer, parameter :: id_DST_A2 = 19
integer, parameter :: id_DST_A3 = 20
integer, parameter :: id_SS_A1 = 21
integer, parameter :: id_SS_A2 = 22
integer, parameter :: id_SS_A3 = 23
integer, parameter :: id_SOA_NA = 24
integer, parameter :: id_SOA_A1 = 25
integer, parameter :: id_SOA_LV = 26
integer, parameter :: id_SOA_SV = 27
integer, parameter :: id_monoterp = 28
integer, parameter :: id_isoprene = 29
integer, parameter :: id_H2O = 30
end module m_spc_id
34 changes: 34 additions & 0 deletions src/chemistry/pp_trop_mam_oslo/mo_adjrxt.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
module mo_adjrxt
private
public :: adjrxt
contains
subroutine adjrxt( rate, inv, m, ncol, nlev )
use shr_kind_mod, only : r8 => shr_kind_r8
use chem_mods, only : nfs, rxntot
implicit none
!--------------------------------------------------------------------
! ... dummy arguments
!--------------------------------------------------------------------
integer, intent(in) :: ncol, nlev
real(r8), intent(in) :: inv(ncol,nlev,nfs)
real(r8), intent(in) :: m(ncol,nlev)
real(r8), intent(inout) :: rate(ncol,nlev,rxntot)
!--------------------------------------------------------------------
! ... local variables
!--------------------------------------------------------------------
real(r8) :: im(ncol,nlev)
im(:,:) = 1._r8 / m(:,:)
rate(:,:, 3) = rate(:,:, 3) * inv(:,:, 5)
rate(:,:, 4) = rate(:,:, 4) * inv(:,:, 5)
rate(:,:, 5) = rate(:,:, 5) * inv(:,:, 6)
rate(:,:, 7) = rate(:,:, 7) * inv(:,:, 5)
rate(:,:, 8) = rate(:,:, 8) * inv(:,:, 4)
rate(:,:, 9) = rate(:,:, 9) * inv(:,:, 5)
rate(:,:, 10) = rate(:,:, 10) * inv(:,:, 6)
rate(:,:, 11) = rate(:,:, 11) * inv(:,:, 4)
rate(:,:, 12) = rate(:,:, 12) * inv(:,:, 5)
rate(:,:, 13) = rate(:,:, 13) * inv(:,:, 6)
rate(:,:, 2) = rate(:,:, 2) * inv(:,:, 7) * inv(:,:, 7) * im(:,:)
rate(:,:, 6) = rate(:,:, 6) * inv(:,:, 5) * inv(:,:, 1)
end subroutine adjrxt
end module mo_adjrxt
79 changes: 79 additions & 0 deletions src/chemistry/pp_trop_mam_oslo/mo_exp_sol.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
module mo_exp_sol
private
public :: exp_sol
public :: exp_sol_inti
contains
subroutine exp_sol_inti
use mo_tracname, only : solsym
use chem_mods, only : clscnt1, clsmap
use ppgrid, only : pver
use cam_history, only : addfld
implicit none
integer :: i,j
do i = 1,clscnt1
j = clsmap(i,1)
call addfld( trim(solsym(j))//'_CHMP', (/ 'lev' /), 'I', '/cm3/s', 'chemical production rate' )
call addfld( trim(solsym(j))//'_CHML', (/ 'lev' /), 'I', '/cm3/s', 'chemical loss rate' )
enddo
end subroutine exp_sol_inti
subroutine exp_sol( base_sol, reaction_rates, het_rates, extfrc, delt, xhnm, ncol, lchnk, ltrop )
!-----------------------------------------------------------------------
! ... Exp_sol advances the volumetric mixing ratio
! forward one time step via the fully explicit
! Euler scheme
!-----------------------------------------------------------------------
use chem_mods, only : clscnt1, extcnt, gas_pcnst, clsmap, rxntot
use ppgrid, only : pcols, pver
use mo_prod_loss, only : exp_prod_loss
use mo_indprd, only : indprd
use shr_kind_mod, only : r8 => shr_kind_r8
use cam_history, only : outfld
use mo_tracname, only : solsym
implicit none
!-----------------------------------------------------------------------
! ... Dummy arguments
!-----------------------------------------------------------------------
integer, intent(in) :: ncol ! columns in chunck
integer, intent(in) :: lchnk ! chunk id
real(r8), intent(in) :: delt ! time step (s)
real(r8), intent(in) :: het_rates(ncol,pver,max(1,gas_pcnst)) ! het rates (1/cm^3/s)
real(r8), intent(in) :: reaction_rates(ncol,pver,rxntot) ! rxt rates (1/cm^3/s)
real(r8), intent(in) :: extfrc(ncol,pver,extcnt) ! "external insitu forcing" (1/cm^3/s)
real(r8), intent(in) :: xhnm(ncol,pver)
integer, intent(in) :: ltrop(pcols) ! chemistry troposphere boundary (index)
real(r8), intent(inout) :: base_sol(ncol,pver,gas_pcnst) ! working mixing ratios (vmr)
!-----------------------------------------------------------------------
! ... Local variables
!-----------------------------------------------------------------------
integer :: i, k, l, m
real(r8), dimension(ncol,pver,clscnt1) :: &
prod, &
loss, &
ind_prd
real(r8), dimension(ncol,pver) :: wrk
!-----------------------------------------------------------------------
! ... Put "independent" production in the forcing
!-----------------------------------------------------------------------
call indprd( 1, ind_prd, clscnt1, base_sol, extfrc, &
reaction_rates, ncol )
!-----------------------------------------------------------------------
! ... Form F(y)
!-----------------------------------------------------------------------
call exp_prod_loss( prod, loss, base_sol, reaction_rates, het_rates )
!-----------------------------------------------------------------------
! ... Solve for the mixing ratio at t(n+1)
!-----------------------------------------------------------------------
do m = 1,clscnt1
l = clsmap(m,1)
do i = 1,ncol
do k = ltrop(i)+1,pver
base_sol(i,k,l) = base_sol(i,k,l) + delt * (prod(i,k,m) + ind_prd(i,k,m) - loss(i,k,m))
end do
end do
wrk(:,:) = (prod(:,:,m) + ind_prd(:,:,m))*xhnm
call outfld( trim(solsym(l))//'_CHMP', wrk(:,:), ncol, lchnk )
wrk(:,:) = (loss(:,:,m))*xhnm
call outfld( trim(solsym(l))//'_CHML', wrk(:,:), ncol, lchnk )
end do
end subroutine exp_sol
end module mo_exp_sol
Loading

0 comments on commit a70cefd

Please sign in to comment.