Skip to content

Commit

Permalink
Fix build errors in GEOS code due to changes in recent GEOS-Chem version
Browse files Browse the repository at this point in the history
Signed-off-by: Lizzie Lundgren <elundgren@seas.harvard.edu>
  • Loading branch information
lizziel committed Dec 5, 2024
1 parent 4bcc43e commit 2c2c0dc
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 19 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Fixed segmentation fault in qfyaml when running with certain compilers without debug flags on
- Fixed errors in adjoint-only code preventing successful adjoint build
- Fixed zero convective precipitation and high cloud base in runs using GEOS-FP (>=01Jun2020) or GEOS-IT
- Updated GEOS-only code for compatibility with GEOS-Chem 14.5

### Removed
- Removed duplicate `WD_RetFactor` tag for HgClHO2 in `species_database.yml`
Expand Down
5 changes: 3 additions & 2 deletions Interfaces/GEOS/Includes_After_Run.H
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
!BOC

!=========================================================================
! Pass advected tracers from GEOS-Chem tracers array to internal state
! Pass tracers from GEOS-Chem tracers array to internal state
!=========================================================================
DO I = 1, SIZE(Int2Spc,1)
IF ( Int2Spc(I)%ID <= 0 ) CYCLE
Expand All @@ -54,8 +54,9 @@
ENDIF
! testing only
!if(MAPL_am_I_Root()) write(*,*) 'Copied to internal: ',I,Int2Spc(I)%ID,trim(Int2Spc(I)%Name),MINVAL(State_Chm%Species(Int2Spc(I)%ID)%Conc(:,:,LM:1:-1)),MAXVAL(State_Chm%Species(Int2Spc(I)%ID)%Conc(:,:,LM:1:-1)),SUM(State_Chm%Species(Int2Spc(I)%ID)%Conc(:,:,LM:1:-1))/IM/JM/LM
State_Chm%Species(I)%Units = KG_SPECIES_PER_KG_TOTAL_AIR
ENDDO
State_Chm%Spc_Units = KG_SPECIES_PER_KG_TOTAL_AIR


!=========================================================================
! Various other archived variables needed in internal state.
Expand Down
4 changes: 2 additions & 2 deletions Interfaces/GEOS/Includes_Before_Run.H
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@
ENDDO

!=========================================================================
! Pass advected tracers from internal state to GEOS-Chem tracers array
! Pass all tracers from internal state to GEOS-Chem tracers array
! Species in internal state are in kg/kg total. GEOS-Chem will convert
! them to kg/kg dry internally.
!=========================================================================
Expand All @@ -246,8 +246,8 @@
State_Chm%Species(Int2Spc(I)%ID)%Conc(:,:,LM:1:-1) = Int2Spc(I)%Internal(:,:,:)
ENDIF
!IF ( MAPL_am_I_Root() ) WRITE(*,*) 'Copying from internal: ',I,Int2Spc(I)%ID,MINVAL(Int2Spc(I)%Internal(:,:,:)),MAXVAL(Int2Spc(I)%Internal(:,:,:)),SUM(Int2Spc(I)%Internal(:,:,:))/IM/JM/LM
State_Chm%Species(I)%Units = KG_SPECIES_PER_KG_TOTAL_AIR
ENDDO
State_Chm%Spc_Units = KG_SPECIES_PER_KG_TOTAL_AIR

!=========================================================================
! Various other archived variables needed in internal state. Eventually,
Expand Down
18 changes: 9 additions & 9 deletions Interfaces/GEOS/geos_CarbonInterface.F90
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ SUBROUTINE GEOS_CarbonRunPhoto( Input_Opt, State_Chm, State_Met, &
CHARACTER(LEN=*), PARAMETER :: myname = 'GEOS_CarbonRunPhoto'
CHARACTER(LEN=*), PARAMETER :: Iam = myname

INTEGER :: origUnit
INTEGER :: previous_units
REAL, ALLOCATABLE :: aj(:)
INTEGER :: I, J, L, LM, STATUS
INTEGER :: indCO, indCO2, indO3
Expand All @@ -641,13 +641,13 @@ SUBROUTINE GEOS_CarbonRunPhoto( Input_Opt, State_Chm, State_Met, &

! Convert to molec/cm3 units are molec/cm3
CALL Convert_Spc_Units( &
Input_Opt = Input_Opt, &
State_Chm = State_Chm, &
State_Grid = State_Grid, &
State_Met = State_Met, &
outUnit = MOLECULES_SPECIES_PER_CM3, &
origUnit = origUnit, &
RC = RC )
Input_Opt = Input_Opt, &
State_Chm = State_Chm, &
State_Grid = State_Grid, &
State_Met = State_Met, &
new_units = MOLECULES_SPECIES_PER_CM3, &
previous_units = previous_units, &
RC = RC )
ASSERT_(RC==GC_SUCCESS)

! Chemistry time step in secods
Expand Down Expand Up @@ -725,7 +725,7 @@ SUBROUTINE GEOS_CarbonRunPhoto( Input_Opt, State_Chm, State_Met, &
State_Chm = State_Chm, &
State_Grid = State_Grid, &
State_Met = State_Met, &
outUnit = origUnit, &
new_units = previous_units, &
RC = RC )
ASSERT_( RC == GC_SUCCESS )

Expand Down
14 changes: 8 additions & 6 deletions Interfaces/GEOS/geos_interface.F90
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ SUBROUTINE GEOS_RATSandOxDiags( GC, Internal, Export, Input_Opt, State_Met, &
REAL, POINTER :: PTR_O1D(:,:,:) => NULL()
REAL, ALLOCATABLE :: OXLOCAL(:,:,:)
LOGICAL :: NeedO3
INTEGER :: OrigUnit
INTEGER :: previous_units

__Iam__('GEOS_RATSandOxDiags')

Expand All @@ -336,7 +336,8 @@ SUBROUTINE GEOS_RATSandOxDiags( GC, Internal, Export, Input_Opt, State_Met, &
! Make sure that species are in kg/kg total. This should be the case already,
! but better be safe!
CALL Convert_Spc_Units ( Input_Opt, State_Chm, State_Grid, State_Met, &
outUnit=KG_SPECIES_PER_KG_TOTAL_AIR, OrigUnit=OrigUnit, RC=RC )
new_units=KG_SPECIES_PER_KG_TOTAL_AIR, &
previous_units=previous_units, RC=RC )

!=======================================================================
! Fill RATS export states if GC is the RATS provider
Expand Down Expand Up @@ -437,7 +438,7 @@ SUBROUTINE GEOS_RATSandOxDiags( GC, Internal, Export, Input_Opt, State_Met, &

! Convert back to original unit
CALL Convert_Spc_Units ( Input_Opt, State_Chm, State_Grid, State_Met, &
OutUnit=OrigUnit, RC=RC )
new_units=previous_units, RC=RC )

! All done
RETURN_(ESMF_SUCCESS)
Expand Down Expand Up @@ -489,7 +490,7 @@ SUBROUTINE GEOS_SetH2O( GC, Input_Opt, State_Met, &
! LOCAL VARIABLES:
!
INTEGER :: IndH2O, LM
INTEGER :: OrigUnit
INTEGER :: previous_units

__Iam__('GEOS_SetH2O')

Expand All @@ -499,7 +500,8 @@ SUBROUTINE GEOS_SetH2O( GC, Input_Opt, State_Met, &
! Make sure that species are in kg/kg total. This should be the case already,
! but better be safe!
CALL Convert_Spc_Units ( Input_Opt, State_Chm, State_Grid, State_Met, &
outUnit=KG_SPECIES_PER_KG_TOTAL_AIR, OrigUnit=OrigUnit, RC=RC )
new_units=KG_SPECIES_PER_KG_TOTAL_AIR, &
previous_units=previous_units, RC=RC )

! Sync Q and H2O concentration array. Q is in kg/kg total, so is H2O.
LM = State_Grid%NZ
Expand All @@ -514,7 +516,7 @@ SUBROUTINE GEOS_SetH2O( GC, Input_Opt, State_Met, &

! Convert back to original unit
CALL Convert_Spc_Units ( Input_Opt, State_Chm, State_Grid, State_Met, &
outUnit=OrigUnit, RC=RC )
new_units=previous_units, RC=RC )
ENDIF

! All done
Expand Down

0 comments on commit 2c2c0dc

Please sign in to comment.