From de0f056bb841cecb79317cd4f2fe5b51667704d3 Mon Sep 17 00:00:00 2001 From: Mike Manyin Date: Mon, 5 Dec 2022 10:30:03 -0500 Subject: [PATCH] TR now imports stOX_loss only under certain conditions --- CHANGELOG.md | 2 ++ TR_GridComp/TR_GridComp---stOX.rc | 4 +-- TR_GridComp/TR_GridCompMod.F90 | 46 ++++++++++++++++++++++++------- 3 files changed, 40 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64ce093b..8275d7ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Modified TR to only import stOX_loss if loss_species == OX; without this, a GMI _ASSERT may exit the program needlessly. + ## [1.10.4] - 2022-11-08 ### Added ### Removed diff --git a/TR_GridComp/TR_GridComp---stOX.rc b/TR_GridComp/TR_GridComp---stOX.rc index 9b580742..e65971dc 100644 --- a/TR_GridComp/TR_GridComp---stOX.rc +++ b/TR_GridComp/TR_GridComp---stOX.rc @@ -1,5 +1,5 @@ # -# Tracer with O3 values in stratosphere, and O3 loss applied in the troposphere +# Tracer with OX values in stratosphere, and OX loss applied in the troposphere # # SHOULD THE TRACER SOURCE BE ADDED FIRST, OR THE SINK APPLIED FIRST @@ -26,7 +26,7 @@ # --------------------------- # snk_mode: none snk_mode: chemical_loss - loss_species: O3 + loss_species: OX # SINK - Horizontal coverage: all | lat_zone | latlon_box # --------------------------- diff --git a/TR_GridComp/TR_GridCompMod.F90 b/TR_GridComp/TR_GridCompMod.F90 index 06776fa7..d42488b0 100644 --- a/TR_GridComp/TR_GridCompMod.F90 +++ b/TR_GridComp/TR_GridCompMod.F90 @@ -354,12 +354,14 @@ SUBROUTINE SetServices ( GC, RC ) character(len=ESMF_MAXSTR) :: rcfilen character(len=ESMF_MAXSTR) :: src_mode character(len=ESMF_MAXSTR) :: snk_mode + character(len=ESMF_MAXSTR) :: loss_species character(len=ESMF_MAXSTR) :: regions_ExtData_entry character(len=ESMF_MAXSTR) :: friend_list logical :: dry_dep logical :: wet_removal logical :: gocart_conv logical :: lai_needed + logical :: stOX_loss_needed character(len=ESMF_MAXSTR), allocatable :: str_array(:) ! to hold unique ExtData entries integer :: s_count ! number of entries in str_array @@ -832,14 +834,17 @@ SUBROUTINE SetServices ( GC, RC ) RESTART = MAPL_RestartSkip, & __RC__ ) - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'stOX_loss', & - LONG_NAME = 'loss to apply to strat OX tracer', & - UNITS = 'mole m-3 s-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RESTART = MAPL_RestartSkip, & - __RC__ ) +! Only do this conditionally, because GMI needs to run all the QQJ & QQK +! in order to provide it: +! +! call MAPL_AddImportSpec(GC, & +! SHORT_NAME = 'stOX_loss', & +! LONG_NAME = 'loss to apply to strat OX tracer', & +! UNITS = 'mole m-3 s-1', & +! DIMS = MAPL_DimsHorzVert, & +! VLOCATION = MAPL_VLocationCenter, & +! RESTART = MAPL_RestartSkip, & +! __RC__ ) call MAPL_AddImportSpec(GC, & SHORT_NAME = 'DD_OX', & @@ -868,6 +873,7 @@ SUBROUTINE SetServices ( GC, RC ) !! Add EXPORT (WR,WRvsum) specs for tracers subject to Wet Removal !! lai_needed = .FALSE. + stOX_loss_needed = .FALSE. allocate ( str_array( r%nq ), __STAT__ ) s_count = 0 @@ -1029,6 +1035,13 @@ SUBROUTINE SetServices ( GC, RC ) ! END IF + IF ( TRIM(snk_mode) == "chemical_loss" ) THEN + call ESMF_ConfigGetAttribute ( myState%CF, label='loss_species:', value=loss_species, default='NO_SPECIES', __RC__ ) + IF( TRIM(loss_species) == "OX") THEN + stOX_loss_needed = .TRUE. + END IF + END IF + call ESMF_ConfigGetAttribute ( myState%CF, label='GOCART_convection:', value=gocart_conv, default=.FALSE., __RC__ ) !MEM @@ -1082,6 +1095,19 @@ SUBROUTINE SetServices ( GC, RC ) END IF +! Only import if it's going to be used (expensive!): + IF ( stOX_loss_needed ) THEN + + call MAPL_AddImportSpec(GC, & + SHORT_NAME = 'stOX_loss', & + LONG_NAME = 'loss to apply to strat OX tracer', & + UNITS = 'mole m-3 s-1', & + DIMS = MAPL_DimsHorzVert, & + VLOCATION = MAPL_VLocationCenter, & + RESTART = MAPL_RestartSkip, & + __RC__ ) + END IF + ! Import the Region Masks DO n = 1, s_count @@ -2769,7 +2795,7 @@ SUBROUTINE TR_init_tracer_spec_ ( tname, tunits, kit, CF, spec, impChem, expChem call ESMF_ConfigGetAttribute ( CF, label='loss_species:', value=spec%loss_species, __RC__ ) - IF( TRIM(spec%loss_species) == "O3") THEN + IF( TRIM(spec%loss_species) == "OX") THEN ! OK ELSE IF(MAPL_AM_I_ROOT()) PRINT *,myname,": Invalid loss_species specified for TRACER snk." @@ -4174,7 +4200,7 @@ SUBROUTINE TR_run_tracer_ ( pet, kit, spec_array, spec, qa, grid_esmf, impChem, !CL CALL MAPL_GetPointer( expChem, cl_export_3d, 'CL_'//TRIM(spec%name), __RC__ ) - IF ( TRIM(spec%loss_species) == 'O3' ) THEN + IF ( TRIM(spec%loss_species) == 'OX' ) THEN ! Use volume mixing ratio data_double = DBLE(DATA3d)