Skip to content

Commit

Permalink
Update GEOS-Chem from 14.3.1 to 14.4 and build successfully
Browse files Browse the repository at this point in the history
NOTE: this commit is not yet demonstrated to run. Updates include:
- Update .gitmodules with temporary branches for needed submodule updates
- Code updates in geoschem/chemistry.F90 for the version change
- Add HETP submodule for aerosol thermodynamics in GEOS-Chem
- bld/configure updates to build HETP if using GEOS-Chem
- Add Cloud-J as a submodule
- Update commit hashes for HEMCO_CESM and GEOS-Chem submodules

Signed-off-by: Lizzie Lundgren <[email protected]>
  • Loading branch information
lizziel committed Jun 25, 2024
1 parent dc9c1b9 commit 15af803
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 32 deletions.
18 changes: 16 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,27 @@
path = src/chemistry/geoschem/geoschem_src
url = https://github.com/geoschem/geos-chem.git
fxrequired = AlwaysRequired
fxtag = 14.1.2
fxbranch = geoschem_14.4_in_cesm
fxDONOTUSEurl = https://github.com/geoschem/geos-chem.git

[submodule "cloud_j"]
path = src/chemistry/cloud_j
url = https://github.com/geoschem/cloud-j.git
fxrequired = AlwaysRequired
fxbranch = feature/set_levels_with_cloud_from_parent_model
fxDONOTUSEurl = https://github.com/geoschem/cloud-j.git

[submodule "hetp"]
path = src/chemistry/hetp
url = https://github.com/geoschem/heterogeneous-vectorized-or-parallel.git
fxrequired = AlwaysRequired
fxtag = geoschem_hetp_1.0
fxDONOTUSEurl = https://github.com/geoschem/heterogeneous-vectorized-or-parallel.git

[submodule "hemco"]
path = src/hemco
url = https://github.com/ESCOMP/HEMCO_CESM.git
fxtag = hemco-cesm1_2_1_hemco3_6_3_cesm_rme
fxbranch = dev/hemco-cesm1_4_0_hemco3_9_0
fxrequired = AlwaysRequired
fxDONOTUSEurl = https://github.com/ESCOMP/HEMCO_CESM.git

Expand Down
5 changes: 5 additions & 0 deletions bld/configure
Original file line number Diff line number Diff line change
Expand Up @@ -2195,6 +2195,11 @@ sub write_filepath
print $fh "$camsrcdir/src/chemistry/cloud_j/src/Core\n";
}

# HETP for aerosol thermodynamics in GEOS-Chem chemistry
if ($chem_pkg =~ 'geoschem') {
print $fh "$camsrcdir/src/chemistry/hetp/src/Core\n";
}

# GEOS-Chem must be prior to Mozart
if ($chem_pkg =~ 'geoschem') {
print $fh "$chem_src_dir/geoschem_src/GeosCore\n";
Expand Down
1 change: 1 addition & 0 deletions src/chemistry/cloud_j
Submodule cloud_j added at 4bad0b
58 changes: 30 additions & 28 deletions src/chemistry/geoschem/chemistry.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,7 @@ subroutine chem_init(phys_state, pbuf2d)
use GC_Grid_Mod, only : SetGridFromCtrEdges
use Input_Mod, only : Read_Input_File, Validate_Directories
use Input_Opt_Mod, only : Set_Input_Opt
use isorropiaII_Mod, only : Init_IsorropiaII
use Aerosol_Thermodynamics_Mod, only : Init_ATE
use Linear_Chem_Mod, only : Init_Linear_Chem
use Linoz_Mod, only : Linoz_Read
use Photolysis_Mod, only : Init_Photolysis
Expand Down Expand Up @@ -1451,7 +1451,9 @@ subroutine chem_init(phys_state, pbuf2d)
ENDIF

! Start with v/v dry (CAM standard)
State_Chm(I)%Spc_Units = MOLES_SPECIES_PER_MOLES_DRY_AIR
DO N = 1, State_Chm(I)%nSpecies
State_Chm(I)%Species(N)%Units = MOLES_SPECIES_PER_MOLES_DRY_AIR
ENDDO

ENDDO
Input_Opt%amIRoot = MasterProc
Expand Down Expand Up @@ -1665,7 +1667,7 @@ subroutine chem_init(phys_state, pbuf2d)
ENDIF

IF ( Input_Opt%LSSalt ) THEN
CALL INIT_ISORROPIAII( State_Grid = maxGrid )
CALL INIT_ATE( State_Grid = maxGrid )
ENDIF

! Get some indices
Expand Down Expand Up @@ -2043,7 +2045,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o )
TYPE(Species), POINTER :: SpcInfo
TYPE(SfcMrObj), POINTER :: iSfcMrObj

INTEGER :: OrigUnit
INTEGER :: previous_units

REAL(r8) :: SlsData(PCOLS, PVER, nSls)

Expand Down Expand Up @@ -2153,9 +2155,9 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o )

! 2. Copy tracers into State_Chm
! Data was received in kg/kg dry
State_Chm(LCHNK)%Spc_Units = KG_SPECIES_PER_KG_DRY_AIR
! Initialize ALL State_Chm species data to zero, not just tracers
! Initialize ALL State_Chm species data to zero, not just tracer
DO N = 1, State_Chm(LCHNK)%nSpecies
State_Chm(LCHNK)%Species(N)%Units = KG_SPECIES_PER_KG_DRY_AIR
State_Chm(LCHNK)%Species(N)%Conc = 0.0e+0_fp
ENDDO

Expand Down Expand Up @@ -2745,7 +2747,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o )
ENDIF
ENDDO

! Field : FRCLND, FRLAND, FROCEAN, FRSEAICE, FRLAKE, FRLANDIC
! Field : FRCLND, FRLAND, FROCEAN, FRSEAICE, FRLAKE, FRLANDICE
! Description: Olson land fraction
! Fraction of land
! Fraction of ocean
Expand All @@ -2761,8 +2763,8 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o )
State_Met(LCHNK)%FROCEAN (1,:nY) = cam_in%ocnFrac(:nY) + cam_in%iceFrac(:nY)
State_Met(LCHNK)%FRSEAICE (1,:nY) = cam_in%iceFrac(:nY)
State_Met(LCHNK)%FRLAKE (1,:nY) = 0.0e+0_fp
State_Met(LCHNK)%FRLANDIC (1,:nY) = 0.0e+0_fp
State_Met(LCHNK)%FRSNO (1,:nY) = 0.0e+0_fp
State_Met(LCHNK)%FRLANDICE (1,:nY) = 0.0e+0_fp
State_Met(LCHNK)%FRSNOW (1,:nY) = 0.0e+0_fp

! Field : GWETROOT, GWETTOP
! Description: Root and top soil moisture
Expand Down Expand Up @@ -3269,11 +3271,11 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o )
! isIce, which are based on albedo. Rather, we use CLM landFranc, ocnFrac
! and iceFrac. We also compute isSnow
DO J = 1, nY
iMaxLoc = MAXLOC( (/ State_Met(LCHNK)%FRLAND(1,J) + &
State_Met(LCHNK)%FRLANDIC(1,J) + &
State_Met(LCHNK)%FRLAKE(1,J), &
State_Met(LCHNK)%FRSEAICE(1,J), &
State_Met(LCHNK)%FROCEAN(1,J) - &
iMaxLoc = MAXLOC( (/ State_Met(LCHNK)%FRLAND(1,J) + &
State_Met(LCHNK)%FRLANDICE(1,J) + &
State_Met(LCHNK)%FRLAKE(1,J), &
State_Met(LCHNK)%FRSEAICE(1,J), &
State_Met(LCHNK)%FROCEAN(1,J) - &
State_Met(LCHNK)%FRSEAICE(1,J) /) )
IF ( iMaxLoc(1) == 3 ) iMaxLoc(1) = 0
! reset ocean to 0
Expand Down Expand Up @@ -3739,13 +3741,13 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o )
call t_startf('GEOSChem_Emissions')

! Use units of kg/m2 as State_Chm%Species to add emissions fluxes
CALL Convert_Spc_Units( Input_Opt = Input_Opt, &
State_Chm = State_Chm(LCHNK), &
State_Grid = State_Grid(LCHNK), &
State_Met = State_Met(LCHNK), &
OutUnit = KG_SPECIES_PER_M2, &
OrigUnit = OrigUnit, &
RC = RC )
CALL Convert_Spc_Units( Input_Opt = Input_Opt, &
State_Chm = State_Chm(LCHNK), &
State_Grid = State_Grid(LCHNK), &
State_Met = State_Met(LCHNK), &
new_units = KG_SPECIES_PER_M2, &
previous_units = previous_units, &
RC = RC )


IF ( RC /= GC_SUCCESS ) THEN
Expand Down Expand Up @@ -3773,7 +3775,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o )
State_Chm = State_Chm(LCHNK), &
State_Grid = State_Grid(LCHNK), &
State_Met = State_Met(LCHNK), &
OutUnit = OrigUnit, &
new_units = previous_units, &
RC = RC )

! Convert State_Chm%Species back to original units
Expand Down Expand Up @@ -3885,9 +3887,9 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o )
State_Chm(LCHNK)%Species(iCO2)%Conc(1,:nY,:nZ) = State_Chm(LCHNK)%Species(iCO2)%Conc(1,:nY,:nZ) &
+ MMR_Beg(:nY,:nZ,iCO2)

! Make sure State_Chm(LCHNK) is back in kg/kg dry!
IF ( State_Chm(LCHNK)%Spc_Units /= KG_SPECIES_PER_KG_DRY_AIR ) THEN
Write(iulog,*) 'Current unit = ', TRIM(UNIT_STR(State_Chm(LCHNK)%Spc_Units))
! Make sure State_Chm(LCHNK) is back in kg/kg dry! Just check first species.
IF ( State_Chm(LCHNK)%Species(1)%Units /= KG_SPECIES_PER_KG_DRY_AIR ) THEN
Write(iulog,*) 'Current unit = ', TRIM(UNIT_STR(State_Chm(LCHNK)%Species(1)%Units))
Write(iulog,*) 'Expected unit = ', TRIM(UNIT_STR(KG_SPECIES_PER_KG_DRY_AIR))
CALL ENDRUN('Incorrect unit in GEOS-Chem State_Chm%Species')
ENDIF
Expand Down Expand Up @@ -4256,9 +4258,9 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o )
adv_mass(N) / MWDry
ENDDO

! Make sure State_Chm(LCHNK) is back in kg/kg dry!
IF ( State_Chm(LCHNK)%Spc_Units /= KG_SPECIES_PER_KG_DRY_AIR ) THEN
Write(iulog,*) 'Current unit = ', TRIM(UNIT_STR(State_Chm(LCHNK)%Spc_Units))
! Make sure State_Chm(LCHNK) is back in kg/kg dry! Only check first species.
IF ( State_Chm(LCHNK)%Species(1)%Units /= KG_SPECIES_PER_KG_DRY_AIR ) THEN
Write(iulog,*) 'Current unit = ', TRIM(UNIT_STR(State_Chm(LCHNK)%Species(1)%Units))
Write(iulog,*) 'Expected unit = ', TRIM(UNIT_STR(KG_SPECIES_PER_KG_DRY_AIR))
CALL ENDRUN('Incorrect unit in GEOS-Chem State_Chm%Species')
ENDIF
Expand Down
2 changes: 1 addition & 1 deletion src/chemistry/geoschem/geoschem_src
Submodule geoschem_src updated 391 files
1 change: 1 addition & 0 deletions src/chemistry/hetp
Submodule hetp added at 2a99b2
2 changes: 1 addition & 1 deletion src/hemco
Submodule hemco updated 4 files
+12 −1 CHANGELOG.md
+10 −0 Externals_HCO.cfg
+1 −1 HEMCO
+41 −16 hemco_interface.F90

0 comments on commit 15af803

Please sign in to comment.