Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cam6_3_147: GEOS-Chem chemistry and four new compsets that use it #484

Merged
merged 194 commits into from
Feb 2, 2024
Merged
Changes from 1 commit
Commits
Show all changes
194 commits
Select commit Hold shift + click to select a range
1189062
Feat: Changes to include GEOS-Chem as a chemistry option for CESM
fritzt Nov 6, 2019
a5bf274
Squashed of 50+ commits from Thibaud Fritz
fritzt May 14, 2020
94b7423
Squashed 5 commits from Haipeng Lin
jimmielin May 16, 2020
b25ec88
Squashed 2 commits from Thibaud Fritz
fritzt May 19, 2020
63df680
Squashed 4 commits from Lizzie Lundgren
lizziel Jul 21, 2020
9a9ead5
Squashed 60+ commits from Thibaud Fritz
fritzt Jul 31, 2020
6c3299f
Feat: Write ZPJ values for RXN_NO2, RXN_O3_1/2a into HCO_IN_JNO2, HCO…
jimmielin Feb 24, 2021
edf9056
Squashed 4 commits from Thibaud Fritz
fritzt Feb 24, 2021
7afe235
Feat: Now retrieve fields from HEMCO using 2-D pbuf fields
jimmielin Mar 1, 2021
de05dff
Squashed 10 commits from Thibaud Fritz
fritzt Mar 2, 2021
2343800
Feat: Retrieve ParaNOx deposition fluxes from HEMCO
jimmielin Mar 24, 2021
b1d572e
Squashed 18 commits from Thibaud Fritz
fritzt Mar 24, 2021
d8f3709
Fix: correct improper merge conflict handling introduced during rebase
lizziel Dec 7, 2021
1db7a5b
Merge branch 'cam_development' into CESM-GC+cam_development
lizziel Dec 9, 2021
62bb87d
Feat: Return in sox_cldaero_mod if running with GEOS-Chem
fritzt Dec 9, 2021
515ad9a
Fix: correct wrong indexes introduced by manual revert; rm GC wetscav
lizziel Dec 13, 2021
1b1aaea
Merge branch 'cam_development' into CESM-GC_rebased_on_cam6_0_034
lizziel Dec 15, 2021
d86976c
Merge branch 'cam_development' into CESM-GC_rebased_on_cam6_0_034
lizziel Jan 7, 2022
490e50b
Merge branch 'cam_development' into CESM-GC_rebased_on_cam6_0_034
lizziel Jan 25, 2022
71fb83a
Enable compilation in CESM 2.3 for non-GEOS-Chem case
lizziel Feb 7, 2022
9f80b02
Build fixes for CESM-GC within CESM: non-GEOS-Chem cases
lizziel Feb 10, 2022
60e537a
Update GEOS-Chem interface code for compatibility with CESM 2.3
lizziel Feb 16, 2022
a6c7cc6
Fix bug in J-value diagnostic names for O3O1D
lizziel Mar 4, 2022
035f27c
Remove remaining references to compset FSPCAMM_GC
lizziel Mar 7, 2022
a002aff
GEOS-Chem driver routine updates for compatibility with GEOS-Chem 13.3.4
lizziel Mar 11, 2022
6fd9744
Modifications for new GEOS-Chem species (HMS) in version 13.3
lizziel Mar 31, 2022
596c261
Use ESCOMP/HEMCO_CESM rather than H. Lin's fork
lizziel Mar 31, 2022
425bb49
Change GEOS-Chem branch name to diverge from version used in CESM-GC 2.1
lizziel Mar 31, 2022
eb70ed3
Set default namelist values for cam_physics_mesh in geos-chem use cases
lizziel Mar 31, 2022
1778e5d
Bug fix: increase module parameter gas_pcnst by 1 to include HMS
lizziel Apr 27, 2022
0a782b9
Modifications to turn off dry deposition and dependencies on CLM for …
lizziel Jun 24, 2022
97f4a30
Kludge to get by missing Henry's Law coeffs for certain species
lizziel Jun 24, 2022
e9b8b27
Configure compsets that use GEOS-Chem to also use HEMCO
lizziel Jun 24, 2022
ae59e64
Added high-level log prints
lizziel Jun 29, 2022
aae00e7
Use same RUN_STARTDATE for compset FCHIST_GC as used in FCHIST
lizziel Jun 30, 2022
e27c049
Revert hist_geoschem.xml to original; will adjust in user_nl_cam
lizziel Jun 30, 2022
87e3511
Remove compset that uses geoschem_mam3
lizziel Jun 30, 2022
19832a9
No diff updates to GEOS-Chem use cases to document diffs with non-GC
lizziel Jul 14, 2022
e6dd893
Clean up GEOS-Chem compset namelists
lizziel Jul 19, 2022
849edd7
Move GEOS-Chem deposition lists to common file with namelist defaults
lizziel Jul 21, 2022
45d4efe
Merge branch 'cam_development' into CESM-GC_rebased_on_cam6_0_034
lizziel Jul 25, 2022
d7e810f
Merge remote-tracking branch 'fvitt/dep_data_file' into temp_fvitt_pr…
lizziel Jul 27, 2022
9ab1b89
Updates to Neu wet dep in GEOS-Chem for Henry's Law coeffs from netcdf
lizziel Aug 4, 2022
4fa1cf4
Update Neu wet dep debug prints in GEOS-Chem
lizziel Aug 4, 2022
9fed226
Preliminary updates for GEOS-Chem 14.0
lizziel Aug 4, 2022
e8c43b2
Add debug print option within GEOS-Chem chemistry.F90
lizziel Aug 4, 2022
44c48db
Fixes for using GEOS-Chem 14.0
lizziel Aug 9, 2022
5c153c1
Updates to get gas-phase dry deposition when using GEOS-Chem to run
lizziel Aug 11, 2022
e565c30
Change geoschem .exclude file to use relative paths to files
lizziel Sep 13, 2022
03f75fd
Clean up new debug print code in physpkg.F90
lizziel Sep 13, 2022
e8b0747
Expand error prints in constituents module for clarify
lizziel Sep 13, 2022
a11b7e8
Remove online land type option when using GEOS-Chem and use Olson/XLAI
lizziel Sep 13, 2022
3a27896
Update GEOS-Chem chemistry log messages for clarity
lizziel Sep 16, 2022
d9d9f67
Remove unused code from GEOS-Chem chemistry.F90 file
lizziel Sep 16, 2022
5ddd22e
Externals update to use latest GEOS-Chem, HEMCO_CESM, and HEMCO
lizziel Sep 21, 2022
fd67bd8
Temporarily put wetdep and drydep lists in namelist file per GEOS-Che…
lizziel Sep 21, 2022
bfd2a09
Add deposition coefficient data file to GEOS-Chem use case files
lizziel Sep 21, 2022
5da5680
Minor edit to Neu wet deposition debug code when using GEOS-Chem
lizziel Sep 21, 2022
33de60e
Add non-advected GEOS-Chem species OH and HO2 to solsym for diagnostics
lizziel Sep 23, 2022
06985e5
Change default FCSD_GC year from 2005 to 2015
lizziel Sep 23, 2022
822cd06
Fix parameters incremented for non-advected species added to solysm
lizziel Sep 27, 2022
8056597
Change Default FCHIST_GC run startdate year from 2010 t0 2015
lizziel Sep 27, 2022
a89b9cb
Add friction velocity as a nuopc import in CAM
lizziel Sep 29, 2022
c8dd834
Add hemco_grid_xdim, hemco_grid_ydim namelist variables to configure …
jimmielin Oct 31, 2022
a9b8c51
Update HEMCO tag to hemco-cesm1_0_hemco3_5_0
jimmielin Oct 31, 2022
aefa2ef
Experimental first version of New History Diagnostics
jimmielin Oct 31, 2022
5cac78c
Disable legacy Jval_ approach; new history diags with debug (wip)
jimmielin Nov 1, 2022
3f0e725
Fix diagnostic chunk bug; now functional
jimmielin Nov 1, 2022
23a2ca7
Update HEMCO external to 3.5.1
jimmielin Nov 3, 2022
73b1cc2
Add FCnudged_GC component set based on FCnudged.
jimmielin Nov 3, 2022
edc6ebc
Merge pull request #9 from jimmielin/CESM-GC_rebased_on_cam6_0_034
lizziel Nov 3, 2022
babae9f
Add hist_geoschem_nudged.xml configuration for FCnudged_GC
jimmielin Nov 3, 2022
f19429e
Remove config_compsets.xml change that does not belong to this branch…
jimmielin Nov 3, 2022
dca0f5e
Expand CAM history field name maximum to 32 chars
jimmielin Nov 3, 2022
c74560a
Fix bug that was forcing HEMCO_Config.rc as hemco_config_file
jimmielin Nov 3, 2022
ea168b0
Fix typo in HEMCO-CESM tag
lizziel Nov 3, 2022
0af7d66
Remove debugging routines
jimmielin Nov 4, 2022
ecc9be2
Merge pull request #12 from jimmielin/hplin/fix-bld-namelist
lizziel Nov 9, 2022
17b6180
Fix HEMCO namelist bugs
lizziel Nov 9, 2022
13607ad
Upgrade GEOS-Chem to version 14.0.1
lizziel Nov 9, 2022
dc68379
Fix MEGAN emissions in CESM-GC - active_fall_flxvoc is a logical and …
jimmielin Nov 14, 2022
717e0fb
Merge pull request #13 from jimmielin/CESM-GC_rebased_on_cam6_0_034
lizziel Nov 14, 2022
224faaf
Add comments on xml source
jimmielin Nov 14, 2022
ad9f8d5
Merge pull request #10 from jimmielin/hplin/add_FCnudged_GC
lizziel Nov 15, 2022
07d197c
Update comments; remove more debug routines
jimmielin Nov 16, 2022
a0742f4
Remove array temporary allocations; now use one outTmp_3D and outTmp_…
jimmielin Nov 17, 2022
cbe679e
Remove unnecessary legacy code in cesmgc_diag_mod.F90
jimmielin Nov 17, 2022
0c6204e
Update comments; remove extraneous GC_FAILURE call to address review …
jimmielin Nov 17, 2022
6553464
Merge pull request #11 from CESM-GC/hplin/new_history_diags
lizziel Nov 17, 2022
74bb99d
Merge branch 'cam_development' into CESM-GC_rebased_on_cam6_0_034
lizziel Nov 17, 2022
76bd32a
Change CMEPS and coupler remotes from fvitt to ESCOMP github
lizziel Dec 15, 2022
2001197
Merge branch 'cam_development' into CESM-GC_rebased_on_cam6_0_034
lizziel Dec 15, 2022
a20ed2d
Reduce GEOS-Chem dir mozart files; build mozart and pp_none if geos-chem
lizziel Dec 21, 2022
9c5f0b4
Removed unused file geoschem/getLandTypes.F90
lizziel Jan 4, 2023
0458ae6
Modify mozart module mo_neu_wetdep for use when GEOS-Chem chemistry e…
lizziel Jan 4, 2023
c7d196c
Use mozart chem_prod_loss_diags.F90 rather than copy if GEOS-Chem ena…
lizziel Jan 4, 2023
ae549e2
Modifications to use Mozart short_lived_species module in GEOS-Chem
lizziel Jan 9, 2023
08ea9a3
Add missing GEOS-Chem diagnostics subroutine calls; cleanup other files
lizziel Jan 10, 2023
36afa14
Merge branch 'cam_development' into CESM-GC_rebased_on_cam6_0_034
lizziel Jan 11, 2023
f60ef7a
Update GEOS-Chem compset diagnostics list; fix build-namelist permiss…
lizziel Jan 11, 2023
f9de916
Update cam_physics_mesh defaults for HEMCO
lizziel Jan 12, 2023
0d98d57
Draft commit to support HEMCO_CESM v1.1.0.
jimmielin Jan 20, 2023
60861dc
Tag to upstream HEMCO-CESM 1.1.0 and HEMCO 3.6.0
jimmielin Feb 9, 2023
99e30ec
Fix automatic array indexing
jimmielin Feb 13, 2023
fb7acec
Updates H2SO4 production rate passed to MAM4 sulfate nucleation
jimmielin Mar 2, 2023
c5f6792
Use online CLM albedo for CESM-GC simulations instead of offline albe…
jimmielin Mar 2, 2023
5a79789
Merge pull request #17 from jimmielin/hplin/use_online_clm_albd
lizziel Mar 2, 2023
3bdbfd0
Merge pull request #16 from jimmielin/hplin/update_h2so4_prdr
lizziel Mar 2, 2023
f501dfb
Set rxt_tag_cnt to 0 in GEOS-Chem as feature is unused
jimmielin Mar 2, 2023
9126efb
Update cesmgc_diag_mod for moved ucx_mod module variables
jimmielin Mar 2, 2023
37b34b1
Remove LWI; remove cleanup_ucx
jimmielin Mar 2, 2023
0fadb7b
Update to upstream HEMCO-CESM 1.1.1 and HEMCO 3.6.2
jimmielin Mar 2, 2023
9af0d17
Also run Init_UCX per State_Chm, not just once
jimmielin Mar 3, 2023
a6a71d6
Add comments on aerosol mapping code
jimmielin Mar 3, 2023
50a0a11
Merge pull request #18 from jimmielin/hplin/change_rxntag
lizziel Mar 6, 2023
ec8b7b7
Merge pull request #14 from jimmielin/hplin/update_extlst_3d_emis
lizziel Mar 6, 2023
c1447e9
Merge pull request #19 from jimmielin/hplin/fix_cesmgc_diag_ucx
lizziel Mar 6, 2023
5afb293
Change GEOS-Chem version tag to 14.1.1
lizziel Mar 6, 2023
1cb1223
Change names of GEOS-Chem diagnostic and emissions modules and subrou…
lizziel Mar 6, 2023
99a6698
Move short-lived reference MMR array from chem_mods to short-lived mo…
lizziel Mar 6, 2023
b5c73f4
Merge remote-tracking branch 'origin/cam_development' into CESM-GC_re…
lizziel Mar 7, 2023
a924520
Delete unused GEOS-Chem build code
lizziel Mar 7, 2023
6688703
Assorted minor code cleanup; add preliminary GEOS-Chem tests
lizziel Mar 7, 2023
1dc7019
Now emit surface emissions consistently as a 3-D flux term.
jimmielin Mar 8, 2023
b245303
Merge pull request #21 from jimmielin/hplin/update_srf_emis
lizziel Mar 15, 2023
1a3fbcf
Fix SOA mapping indices
jimmielin Mar 17, 2023
e07c7d6
Fix TSKIN field to correct value
jimmielin Mar 20, 2023
bda2db3
Update upstream HEMCO-CESM 1.1.3
jimmielin Mar 20, 2023
935edbb
Fix other indices in the reverse direction.
jimmielin Mar 30, 2023
ab58d4e
Merge pull request #22 from jimmielin/hplin/fix_soa_map
lizziel Apr 12, 2023
217721d
Merge pull request #23 from jimmielin/hplin/fix_tskin
lizziel Apr 12, 2023
794d1ba
Fix dry and wet deposition for GEOS-Chem non-gas species.
jimmielin Apr 18, 2023
d77da0b
Merge pull request #24 from jimmielin/hplin/fix_aer_deposition
lizziel Apr 18, 2023
a16a4ff
Fix GEOS-Chem tests by replacing StrSplit in chem_readnl
lizziel Apr 18, 2023
9ed40a2
Merge remote-tracking branch 'upstream/cam_development' into CESM-GC_…
lizziel May 18, 2023
acfe426
Update lightning emissions code in GEOS-Chem interface for compatibility
lizziel May 18, 2023
006d314
Merge pull request #25 from CESM-GC/ewl/update_lightning_emissions_fo…
lizziel May 23, 2023
efc1efd
Merge branch 'cam_development' into CESM-GC_rebased_on_cam6_0_034
lizziel Jul 21, 2023
f71850c
Post-merge update to add pbuf argument to GEOS-Chem chem_emissions
lizziel Jul 28, 2023
5eb55a1
Updates to use HEMCO for GEOS-Chem compset
lizziel Jul 28, 2023
4563541
Minor cleanup changes
lizziel Jul 28, 2023
38d51b7
Remove HEMCO from src/control/cam_comp.F90
lizziel Aug 29, 2023
8796376
Fix how HEMCO is specified in GEOS-Chem compset configuration
lizziel Aug 29, 2023
750cf52
Use HEMCO config files in Buildconf/camconf when running with GEOS-Chem
lizziel Aug 29, 2023
a105233
Merge remote-tracking branch 'upstream/cam_development' into CESM-GC_…
lizziel Sep 1, 2023
dae6502
Remove unused code in configure and build-namelist
lizziel Sep 6, 2023
e1a6fd2
Use shr_kind_cl in GEOS-Chem character declarations; remove SPMD cpp …
lizziel Sep 6, 2023
8b3dff5
Always use ONLY keyword in USE statements
lizziel Sep 6, 2023
ac9e547
rename optional arg compare_uppercase; use spmd_utils and mpi_bcast
lizziel Sep 7, 2023
9418375
Change modal aerosol species name retrieval method
lizziel Sep 8, 2023
d37e70a
Unused code deletion and update setting short-lived species fieldnames
lizziel Sep 29, 2023
d43c4e8
Add script to copy GEOS-Chem config files during case setup
lizziel Oct 2, 2023
675afd0
Update deposition input file path used for GEOS-Chem
lizziel Oct 5, 2023
4e552bb
Copy GEOS-Chem configuration files from caseroot to run directory
lizziel Oct 5, 2023
99361e1
Updates to copy GEOS-Chem files to case and then run directory
lizziel Oct 13, 2023
6898cf7
Merge branch 'cam_development' into CESM-GC_rebased_on_cam6_0_034
lizziel Oct 13, 2023
2731270
Change cam case_setup script from bash to python
lizziel Oct 13, 2023
c44c904
Fix typo in error message
lizziel Oct 13, 2023
ba31348
Change GEOS-Chem acronym in compset long name from GC to GEOSCHEM
lizziel Oct 13, 2023
da76f71
Change GEOS-Chem namelist and its parameter to use geoschem not gc
lizziel Oct 16, 2023
7f1d099
Updates for paper, SE grid compatibility, bug fixes
jimmielin Oct 17, 2023
a66be15
Slight formatting updates to GEOS-Chem run log output
jimmielin Oct 19, 2023
972c057
Update GEOS-Chem external tag to 14.1.2
jimmielin Oct 20, 2023
95bc735
Remove unnecessary comment about NTHRDS
lizziel Oct 20, 2023
cf0e7b6
Update Externals_CAM.cfg to use hash as 14.1.2 matches branch as well
jimmielin Oct 30, 2023
95cd2a5
Revert "Update Externals_CAM.cfg to use hash as 14.1.2 matches branch…
jimmielin Oct 30, 2023
1b5c281
Suggested changes to cam.case_setup.py
Oct 2, 2023
0d4bf3f
Fix bug and change error messages in cam.case_setup.py
lizziel Oct 31, 2023
6f86e11
Merge pull request #27 from jimmielin/hplin/updates_cgc_part1r
lizziel Nov 2, 2023
84e830d
Remove the FCSD_GC compset
lizziel Nov 3, 2023
15bbeef
Remove NTHRDS overrides for GEOS-Chem
lizziel Nov 3, 2023
392e9e3
Remove redundant includes of src/hemco in .gitignore
lizziel Nov 8, 2023
12d89ea
Exit with warning in build-namelist if hemco_config_file or hemco_dia…
jimmielin Nov 15, 2023
5c048af
Fix typo; indent with spaces
jimmielin Nov 15, 2023
fecbd92
Merge pull request #30 from jimmielin/hplin/nl_catch_hemco_error
lizziel Nov 16, 2023
cc85a5b
Split master deposition lists into two: mozart and geoschem
lizziel Nov 16, 2023
dcc7e20
Revert dep_data_file input_pathname to "abs"; use new file for geoschem
lizziel Nov 16, 2023
e06ddff
Merge remote-tracking branch 'origin/cam_development' into CESM-GC_re…
lizziel Dec 21, 2023
4441ce0
Merge branch 'cam_development' into CESM-GC_rebased_on_cam6_0_034
lizziel Jan 18, 2024
3558a95
Update bld/configure
lizziel Jan 18, 2024
14b6813
Clean up GEOS-Chem code in configure based on suggestions from Brian …
lizziel Jan 18, 2024
6319c77
Remove unnecessary changes made for GEOS-Chem; minor bug fix for GNU
lizziel Jan 23, 2024
3301267
Revert setting GEOS-Chem $chem_cppdefs to earlier in configure
lizziel Jan 30, 2024
9a4144a
Remove project paths to GEOS-Chem inputs; now stored in inputdata
lizziel Jan 30, 2024
c18380c
Updated GEOs-Chem tests from cheyenne to derecho
lizziel Jan 30, 2024
5d05e8c
Add categories prealpha and aux_cam to all GEOS-Chem compset tests
lizziel Jan 30, 2024
5fa370c
Delete redundant setting of deposition lists in namelists
lizziel Jan 31, 2024
28412bf
Reduce GEOS-Chem tests to one aux_cam and one prealpha across two com…
lizziel Jan 31, 2024
e9773d8
Merge remote-tracking branch 'upstream/cam_development' into CESM-GC_…
lizziel Jan 31, 2024
40371e4
Change FCnudged_GC derecho test to not use zonal mean nudging
lizziel Jan 31, 2024
ffec5d1
skip over geoschem in r8 kind checker
fvitt Feb 1, 2024
a5e78df
Update Changelog
lizziel Feb 1, 2024
4442c2a
include commit and time limit to goes-chem tests
fvitt Feb 1, 2024
86720cc
update ChangLog
fvitt Feb 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
GEOS-Chem driver routine updates for compatibility with GEOS-Chem 13.3.4
lizziel committed Apr 1, 2022
commit a002aff2955bfd55f7bad9e5dcd2ddcbc87b0f3d
138 changes: 51 additions & 87 deletions src/chemistry/geoschem/chemistry.F90
Original file line number Diff line number Diff line change
@@ -212,7 +212,6 @@ subroutine chem_register
use State_Chm_Mod, only : Init_State_Chm, Cleanup_State_Chm
use State_Chm_Mod, only : Ind_
use Input_Opt_Mod, only : Set_Input_Opt, Cleanup_Input_Opt
use CMN_SIZE_Mod, only : Init_CMN_SIZE

use mo_sim_dat, only : set_sim_dat
use mo_chem_utls, only : get_spc_ndx
@@ -291,7 +290,6 @@ subroutine chem_register
! Options needed by Init_State_Chm
IO%ITS_A_FULLCHEM_SIM = .True.
IO%LLinoz = .True.
IO%LUCX = .True.
IO%LPRT = .False.
IO%N_Advect = nTracers
DO I = 1, nTracers
@@ -326,9 +324,6 @@ subroutine chem_register
CALL Error_Stop( ErrMsg, ThisLoc )
ENDIF

CALL Init_CMN_SIZE( Input_Opt = IO, &
RC = RC )

IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error encountered within call to "Init_CMN_SIZE"!'
CALL Error_Stop( ErrMsg, ThisLoc )
@@ -1002,7 +997,7 @@ subroutine chem_init(phys_state, pbuf2d)
use Pressure_Mod, only : Accept_External_ApBp
use Chemistry_Mod, only : Init_Chemistry
use Ucx_Mod, only : Init_Ucx
use Strat_chem_Mod, only : Init_Strat_Chem
use Linear_Chem_Mod, only : Init_Linear_Chem
use isorropiaII_Mod, only : Init_IsorropiaII
use Input_Mod, only : Read_Input_File
use Input_Mod, only : Validate_Directories
@@ -1207,11 +1202,7 @@ subroutine chem_init(phys_state, pbuf2d)
! Define more variables for maxGrid
maxGrid%MaxTropLev = nTrop
maxGrid%MaxStratLev = nStrat
IF ( Input_Opt%LUCX ) THEN
maxGrid%MaxChemLev = maxGrid%MaxStratLev
ELSE
maxGrid%MaxChemLev = maxGrid%MaxTropLev
ENDIF
maxGrid%MaxChemLev = maxGrid%MaxStratLev

DO I = BEGCHUNK, ENDCHUNK

@@ -1244,11 +1235,7 @@ subroutine chem_init(phys_state, pbuf2d)
State_Grid(I)%MaxStratLev = nStrat

! Set maximum number of levels in the chemistry grid
IF ( Input_Opt%LUCX ) THEN
State_Grid(I)%MaxChemLev = State_Grid(I)%MaxStratLev
ELSE
State_Grid(I)%MaxChemLev = State_Grid(I)%MaxTropLev
ENDIF
State_Grid(I)%MaxChemLev = State_Grid(I)%MaxStratLev

ENDDO

@@ -1617,23 +1604,22 @@ subroutine chem_init(phys_state, pbuf2d)
ENDIF
ENDIF

IF ( Input_Opt%LChem .AND. &
Input_Opt%LUCX ) THEN
IF ( Input_Opt%LChem ) THEN
CALL Init_UCX( Input_Opt = Input_Opt, &
State_Chm = State_Chm(BEGCHUNK), &
State_Diag = State_Diag(BEGCHUNK), &
State_Grid = maxGrid )
ENDIF

IF ( Input_Opt%LSCHEM ) THEN
CALL Init_Strat_Chem( Input_Opt = Input_Opt, &
State_Chm = State_Chm(BEGCHUNK), &
State_Met = State_Met(BEGCHUNK), &
State_Grid = maxGrid, &
RC = RC )
IF ( Input_Opt%Linear_Chem ) THEN
CALL Init_Linear_Chem( Input_Opt = Input_Opt, &
State_Chm = State_Chm(BEGCHUNK), &
State_Met = State_Met(BEGCHUNK), &
State_Grid = maxGrid, &
RC = RC )

IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error encountered in "Init_Strat_Chem"!'
ErrMsg = 'Error encountered in "Init_Linear_Chem"!'
CALL Error_Stop( ErrMsg, ThisLoc )
ENDIF
ENDIF
@@ -1877,13 +1863,13 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o )
use PBL_Mix_Mod, only : Compute_PBL_Height
use UCX_Mod, only : Set_H2O_Trac
use CMN_FJX_MOD, only : ZPJ
use FAST_JX_MOD, only : RXN_NO2, RXN_O3_1, RXN_O3_2a
use FAST_JX_MOD, only : RXN_NO2, RXN_O3_1
use State_Diag_Mod, only : get_TagInfo
use Unitconv_Mod, only : Convert_Spc_Units
use State_Chm_Mod, only : Ind_

use Strat_Chem_Mod, only : Strat_TrID_GC, GC_Bry_TrID, NSCHEM
use Strat_Chem_Mod, only : BrPtrDay, BrPtrNight, PLVEC, STRAT_OH
use Linear_Chem_Mod, only : TrID_GC, GC_Bry_TrID, NSCHEM
use Linear_Chem_Mod, only : BrPtrDay, BrPtrNight, PLVEC, GMI_OH

use CESMGC_Emissions_Mod,only : CESMGC_Emissions_Calc
use CESMGC_Diag_Mod, only : CESMGC_Diag_Calc
@@ -3178,15 +3164,14 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o )
ENDIF

! SDE 05/28/13: Set H2O to State_Chm tracer if relevant and,
! if LUCX=T and LSETH2O=F and LACTIVEH2O=T, update specific humidity
! if LSETH2O=F and LACTIVEH2O=T, update specific humidity
! in the stratosphere
!
! NOTE: Specific humidity may change in SET_H2O_TRAC and
! therefore this routine may call AIRQNT again to update
! air quantities and tracer concentrations (ewl, 10/28/15)
IF ( Input_Opt%Its_A_Fullchem_Sim .and. iH2O > 0 ) THEN
CALL Set_H2O_Trac( SETSTRAT = ( ( .not. Input_Opt%LUCX ) &
.or. Input_Opt%LSETH2O ), &
CALL Set_H2O_Trac( SETSTRAT = Input_Opt%LSETH2O, &
Input_Opt = Input_Opt, &
State_Chm = State_Chm(LCHNK), &
State_Grid = State_Grid(LCHNK), &
@@ -3263,7 +3248,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o )
! Dimensions : nX, nY
State_Met(LCHNK)%TO3 (1,:nY) = O3col(:nY)

IF ( Input_Opt%LSCHEM .AND. &
IF ( Input_Opt%Linear_Chem .AND. &
State_Grid(LCHNK)%MaxChemLev /= State_Grid(LCHNK)%nZ ) THEN
IF ( iStep == 1 ) THEN
ALLOCATE( BrPtrDay ( 6 ), STAT=IERR )
@@ -3320,7 +3305,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o )
DO N = 1,NSCHEM

! Get GEOS-Chem species index
M = Strat_TrID_GC(N)
M = TrID_GC(N)

! Skip if species is not defined
IF ( M <= 0 ) CYCLE
@@ -3333,11 +3318,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o )
! ---------------------------------------------------------------

! Production rates [v/v/s]
IF ( Input_Opt%LUCX ) THEN
FieldName = 'GMI_PROD_'//TRIM(SpcName)
ELSE
FieldName = 'UCX_PROD_'//TRIM(SpcName)
ENDIF
FieldName = 'GMI_PROD_'//TRIM(SpcName)

ALLOCATE( PLVEC(N)%PROD(1,PCOLS,nZ), STAT=IERR )
IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating PLVEC%PROD')
@@ -3369,11 +3350,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o )
ENDIF

! Loss frequency [s-1]
IF ( Input_Opt%LUCX ) THEN
FieldName = 'GMI_LOSS_'//TRIM(SpcName)
ELSE
FieldName = 'UCX_LOSS_'//TRIM(SpcName)
ENDIF
FieldName = 'GMI_LOSS_'//TRIM(SpcName)

! Get pointer from HEMCO
tmpIdx = pbuf_get_index(FieldName, RC)
@@ -3401,19 +3378,19 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o )

ENDDO !N

! Get pointer to STRAT_OH
! Get pointer to GMI_OH

ALLOCATE( STRAT_OH(1,PCOLS,nZ), STAT=IERR )
IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating STRAT_OH')
ALLOCATE( GMI_OH(1,PCOLS,nZ), STAT=IERR )
IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating GMI_OH')

tmpIdx = pbuf_get_index(FieldName, RC)
IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN
IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FieldName)
STRAT_OH(1,:nY,nZ:1:-1) = 0.0e+0_f4
GMI_OH(1,:nY,nZ:1:-1) = 0.0e+0_f4
ELSE
pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK)
CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_ik)
STRAT_OH(1,:nY,nZ:1:-1) = REAL(pbuf_ik(:nY,:nZ), f4)
GMI_OH(1,:nY,nZ:1:-1) = REAL(pbuf_ik(:nY,:nZ), f4)
pbuf_chnk => NULL()
pbuf_ik => NULL()
ENDIF
@@ -3749,7 +3726,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o )
ENDIF

IF ( Input_Opt%Its_A_Fullchem_Sim .and. iH2O > 0 ) THEN
CALL Set_H2O_Trac( SETSTRAT = (.not. Input_Opt%LUCX), &
CALL Set_H2O_Trac( SETSTRAT = .False. , &
Input_Opt = Input_Opt, &
State_Chm = State_Chm(LCHNK), &
State_Grid = State_Grid(LCHNK), &
@@ -3853,13 +3830,8 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o )
pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK)
CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_i)

IF ( Input_Opt%LUCX ) THEN
! RXN_O3_1: O3 + hv --> O2 + O
pbuf_i(:nY) = ZPJ(1,RXN_O3_1,1,:nY)
ELSE
! RXN_O3_2a: O3 + hv --> 2OH
pbuf_i(:nY) = ZPJ(1,RXN_O3_2a,1,:nY)
ENDIF
! RXN_O3_1: O3 + hv --> O2 + O
pbuf_i(:nY) = ZPJ(1,RXN_O3_1,1,:nY)
pbuf_chnk => NULL()
pbuf_i => NULL()
ENDIF
@@ -4259,31 +4231,29 @@ end subroutine chem_init_cnst

subroutine chem_final

use Input_Opt_Mod, only : Cleanup_Input_Opt
use State_Chm_Mod, only : Cleanup_State_Chm
use State_Diag_Mod, only : Cleanup_State_Diag
use State_Grid_Mod, only : Cleanup_State_Grid
use State_Met_Mod, only : Cleanup_State_Met
use Error_Mod, only : Cleanup_Error

use FlexChem_Mod, only : Cleanup_FlexChem
use UCX_Mod, only : Cleanup_UCX
use Drydep_Mod, only : Cleanup_Drydep
use Carbon_Mod, only : Cleanup_Carbon
use Dust_Mod, only : Cleanup_Dust
use Seasalt_Mod, only : Cleanup_Seasalt
use Aerosol_Mod, only : Cleanup_Aerosol
use Sulfate_Mod, only : Cleanup_Sulfate
use Pressure_Mod, only : Cleanup_Pressure
use Strat_Chem_Mod, only : Cleanup_Strat_Chem

use CMN_Size_Mod, only : Cleanup_CMN_Size
use CMN_FJX_Mod, only : Cleanup_CMN_FJX
use Input_Opt_Mod, only : Cleanup_Input_Opt
use State_Chm_Mod, only : Cleanup_State_Chm
use State_Diag_Mod, only : Cleanup_State_Diag
use State_Grid_Mod, only : Cleanup_State_Grid
use State_Met_Mod, only : Cleanup_State_Met
use Error_Mod, only : Cleanup_Error
use Fullchem_Mod, only : Cleanup_FullChem
use UCX_Mod, only : Cleanup_UCX
use Drydep_Mod, only : Cleanup_Drydep
use Carbon_Mod, only : Cleanup_Carbon
use Dust_Mod, only : Cleanup_Dust
use Seasalt_Mod, only : Cleanup_Seasalt
use Aerosol_Mod, only : Cleanup_Aerosol
use Sulfate_Mod, only : Cleanup_Sulfate
use Pressure_Mod, only : Cleanup_Pressure
use Linear_Chem_Mod, only : Cleanup_Linear_Chem

use CMN_FJX_Mod, only : Cleanup_CMN_FJX

#ifdef BPCH_DIAG
use CMN_O3_Mod, only : Cleanup_CMN_O3
use CMN_O3_Mod, only : Cleanup_CMN_O3
! Special: cleans up after NDXX_Setup
use Diag_Mod, only : Cleanup_Diag
use Diag_Mod, only : Cleanup_Diag
#endif

use CESMGC_Emissions_Mod, only: CESMGC_Emissions_Final
@@ -4298,25 +4268,19 @@ subroutine chem_final
CALL Cleanup_Carbon
CALL Cleanup_Drydep
CALL Cleanup_Dust
CALL Cleanup_FlexChem( RC )
CALL Cleanup_FullChem( RC )
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error encountered in "Cleanup_FlexChem"!'
ErrMsg = 'Error encountered in "Cleanup_FullChem"!'
CALL Error_Stop( ErrMsg, ThisLoc )
ENDIF

CALL Cleanup_Pressure
CALL Cleanup_Seasalt
CALL Cleanup_Sulfate
CALL Cleanup_Strat_Chem
CALL Cleanup_Linear_Chem

CALL CESMGC_Emissions_Final

CALL Cleanup_CMN_SIZE( RC )
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error encountered in "Cleanup_CMN_SIZE"!'
CALL Error_Stop( ErrMsg, ThisLoc )
ENDIF

CALL Cleanup_CMN_FJX( RC )
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error encountered in "Cleanup_CMN_FJX"!'