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

Some fixes required to compile adjoint geos chem #2578

Merged
merged 6 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Fixed bug in `download_data.py` which caused script to fail if log filename contained uppercase characters.
- Fixed the satellite diagnostics counters from being inadvertently being reset
- Fixed segmentation fault in qfyaml when running with certain compilers without debug flags on
- Fixed errors in adjoint-only code preventing successful adjoint build

### Removed
- Removed duplicate `WD_RetFactor` tag for HgClHO2 in `species_database.yml`
Expand Down
10 changes: 9 additions & 1 deletion GeosCore/diagnostics_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ SUBROUTINE Set_SpcAdj_Diagnostic( Input_Opt, State_Chm, State_Diag, &
USE State_Diag_Mod, ONLY : DgnState
USE State_Grid_Mod, ONLY : GrdState
USE UnitConv_Mod, ONLY : Check_Units, KG_SPECIES_PER_KG_DRY_AIR
USE TIME_MOD, ONLY : GET_LOCALTIME
!
! !INPUT PARAMETERS:
!
Expand Down Expand Up @@ -465,7 +466,7 @@ SUBROUTINE Set_SpcAdj_Diagnostic( Input_Opt, State_Chm, State_Diag, &
!
! Scalars
LOGICAL :: Found
INTEGER :: N, S
INTEGER :: N, S, I
REAL(fp) :: LT, GOOD

! Strings
Expand All @@ -474,6 +475,12 @@ SUBROUTINE Set_SpcAdj_Diagnostic( Input_Opt, State_Chm, State_Diag, &
! Objects
TYPE(DgnMap), POINTER :: mapData


! Arrays
REAL(fp) :: TmpSpcArr(State_Grid%NX,State_Grid%NY, &
State_Grid%NZ,State_Chm%nSpecies)


!====================================================================
! Set_SpcAdj_Diagnostic begins here!
!====================================================================
Expand Down Expand Up @@ -546,6 +553,7 @@ SUBROUTINE Set_SpcAdj_Diagnostic( Input_Opt, State_Chm, State_Diag, &
!$OMP PRIVATE( N, S )
DO S = 1, mapData%nSlots
N = mapData%slot2id(S)
! TmpSpcArr is not defined
State_Diag%SatDiagnConc(I,:,:,S) = TmpSpcArr(I,:,:,N) * GOOD
ENDDO
!$OMP END PARALLEL DO
Expand Down
2 changes: 1 addition & 1 deletion GeosUtil/unitconv_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2081,7 +2081,7 @@ SUBROUTINE ConvertSpc_MND_to_Kg( State_Chm, State_Grid, State_Met, &
#ifdef ADJOINT
IF ( isAdjoint ) THEN
State_Chm%SpeciesAdj(:,:,:,N) = &
State_Chm%SpeciesAdj(:,:,:,N) const * State_Met%AIRVOL
State_Chm%SpeciesAdj(:,:,:,N) * const * State_Met%AIRVOL
ENDIF
#endif

Expand Down
7 changes: 4 additions & 3 deletions Interfaces/GCHP/Chem_GridCompMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1263,9 +1263,10 @@ SUBROUTINE Initialize_( GC, Import, Export, Clock, RC )
! Initialize MAPL Generic
CALL MAPL_GenericInitialize( GC, Import, Export, Clock, __RC__ )

#ifdef ADJOINT
CALL MAPL_GenericStateClockAdd( GC, name='--AdjointCheckpoint', __RC__ )
#endif
! AdjointChekpoint is not defined
!#ifdef ADJOINT
! CALL MAPL_GenericStateClockAdd( GC, name='--AdjointCheckpoint', __RC__ )
!#endif

! Get Internal state.
CALL MAPL_Get ( STATE, INTERNAL_ESMF_STATE=INTSTATE, __RC__ )
Expand Down
2 changes: 1 addition & 1 deletion Interfaces/GCHP/gchp_chunk_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,7 @@ SUBROUTINE GCHP_Chunk_Run( GC, &
State_Chm%Species(NFD)%Conc = State_Chm%Species(NFD)%Conc(:,:,:) * 1.1d0
ELSEIF (Input_Opt%FD_STEP .eq. 2) THEN
WRITE(*, *) ' Perturbing -0.1'
State_Chm%Species(NFD)%Conc = State_Shm%Species(NFD)%Conc(:,:,:) * 0.9d0
State_Chm%Species(NFD)%Conc = State_Chm%Species(NFD)%Conc(:,:,:) * 0.9d0
ELSE
WRITE(*, *) ' FD_STEP = ', Input_Opt%FD_STEP, ' NOT SUPPORTED!'
ENDIF
Expand Down