forked from ESCOMP/CAM
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restore pp_trop_mam_oslo from cam_cesm2_1_rel_05-Nor_v1.0.5
- Loading branch information
Steve Goldhaber
committed
Sep 1, 2023
1 parent
64f5990
commit a70cefd
Showing
18 changed files
with
1,369 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.