-
Notifications
You must be signed in to change notification settings - Fork 170
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
Extending Stratospheric Adjustment to GCClassic #2525
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -255,6 +255,7 @@ PROGRAM GEOS_Chem | |
#ifdef RRTMG | ||
! For stratospheric adjustment | ||
REAL(f8), ALLOCATABLE :: DT_3D(:,:,:) | ||
REAL(f8), ALLOCATABLE :: DT_3D_UPDATE(:,:,:) | ||
REAL(f8), ALLOCATABLE :: HR_3D(:,:,:) | ||
#endif | ||
|
||
|
@@ -1658,6 +1659,42 @@ PROGRAM GEOS_Chem | |
WRITE( 6, '(a)' ) REPEAT( '#', 79 ) | ||
ENDIF | ||
|
||
! Allocate temperature difference arrays (crb, 14/02/24) | ||
If ( Input_Opt%RRTMG_FDH ) THEN | ||
Allocate(DT_3D(State_Grid%NX,State_Grid%NY,State_Grid%NZ),Stat=RC) | ||
IF ( RC /= 0 ) Call Error_Stop( 'Error allocating DT_3D', ThisLoc ) | ||
|
||
! If using seasonally evolving FDH, need to grab the internal | ||
! state temperature adjustment array | ||
IF (Input_Opt%RRTMG_SEFDH) THEN | ||
! DT_3D will be updated by the first call to RRTMG; also need to | ||
! store the "current" value | ||
Allocate(DT_3D_UPDATE(State_Grid%NX,State_Grid%NY,State_Grid%NZ),Stat=RC) | ||
IF ( RC /= 0 ) Call Error_Stop( 'Error allocating DT_3D_UPDATE', ThisLoc ) | ||
! Store the adjustment as previously projected to this time point | ||
DT_3D(:,:,:) = State_Chm%TStrat_Adj(:,:,:) | ||
! This will just hold the end-of-step value | ||
DT_3D_UPDATE(:,:,:) = 0 | ||
ELSE | ||
DT_3D(:,:,:) = 0 | ||
END IF | ||
|
||
Allocate(HR_3D(State_Grid%NX,State_Grid%NY,State_Grid%NZ),Stat=RC) | ||
IF ( RC /= 0 ) Call Error_Stop( 'Error allocating HR_3D', ThisLoc ) | ||
HR_3D(:,:,:) = 0 | ||
|
||
! Read in dynamical heating rates if necessary | ||
IF (Input_Opt%Read_Dyn_Heating) THEN | ||
HR_3D(:,:,:) = State_Met%DynHeating(:,:,:) | ||
ENDIF | ||
ELSE | ||
! Safer | ||
Allocate(DT_3D(0,0,0),Stat=RC) | ||
IF ( RC /= 0 ) Call Error_Stop( 'Error allocating DT_3D', ThisLoc ) | ||
Allocate(HR_3D(0,0,0),Stat=RC) | ||
IF ( RC /= 0 ) Call Error_Stop( 'Error allocating HR_3D', ThisLoc ) | ||
ENDIF | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cbarker211 Could this be placed into a subroutine after the |
||
State_Chm%RRTMG_iSeed = State_Chm%RRTMG_iSeed + 15 | ||
|
||
!------------------------------------------------------------------ | ||
|
@@ -1676,9 +1713,10 @@ PROGRAM GEOS_Chem | |
! Calculation for each of the potential output types | ||
! See: wiki.geos-chem.org/Coupling_GEOS-Chem_with_RRTMG | ||
! | ||
! RRTMG outputs (scheduled in HISTORY.rc): | ||
! 0-BA 1=O3 2=ME 3=SU 4=NI 5=AM | ||
! 6=BC 7=OA 8=SS 9=DU 10=PM 11=ST | ||
! 0=BASE and then... | ||
! 1=O3 2=O3T 3=ME 4=H2O 5=CO2 6=CFC 7=N2O | ||
! 8=SU 9=NI 10=AM 11=BC 12=OA 13=SS 14=DU | ||
! 15=PM 16=ST | ||
! | ||
! State_Diag%RadOutInd(1) will ALWAYS correspond to BASE due | ||
! to how it is populated from HISTORY.rc diaglist_mod.F90. | ||
|
@@ -1695,13 +1733,9 @@ PROGRAM GEOS_Chem | |
! Generate mask for species in RT | ||
CALL Set_SpecMask( State_Diag%RadOutInd(N), State_Chm ) | ||
|
||
! Dummy values (FDH not available in GC-Classic) | ||
Allocate(DT_3D(0,0,0),Stat=RC) | ||
IF ( RC /= 0 ) Call Error_Stop( 'Error allocating DT_3D', ThisLoc ) | ||
Allocate(HR_3D(0,0,0),Stat=RC) | ||
IF ( RC /= 0 ) Call Error_Stop( 'Error allocating HR_3D', ThisLoc ) | ||
|
||
! Compute radiative transfer for the given output | ||
! If FDH is used, this step will be used to calculate DT and | ||
! fill out DT_3D. The same will be true for HR_3D | ||
CALL Do_RRTMG_Rad_Transfer( ThisDay = Day, & | ||
ThisMonth = Month, & | ||
iCld = State_Chm%RRTMG_iCld, & | ||
|
@@ -1727,8 +1761,10 @@ PROGRAM GEOS_Chem | |
|
||
! Calculate for rest of outputs, if any | ||
DO N = 2, State_Diag%nRadOut | ||
! This time around, DT_3D is read in but not overwritten | ||
WRITE( 6, 520 ) State_Diag%RadOutName(N), State_Diag%RadOutInd(N) | ||
CALL Set_SpecMask( State_Diag%RadOutInd(N), State_Chm ) | ||
! This call will NOT update DT_3D, so we can just reuse the array | ||
CALL Do_RRTMG_Rad_Transfer( ThisDay = Day, & | ||
ThisMonth = Month, & | ||
iCld = State_Chm%RRTMG_iCld, & | ||
|
@@ -1763,8 +1799,33 @@ PROGRAM GEOS_Chem | |
CALL Debug_Msg( '### MAIN: a DO_RRTMG_RAD_TRANSFER' ) | ||
ENDIF | ||
|
||
If (Allocated(DT_3D)) Deallocate(DT_3D) | ||
If (Allocated(HR_3D)) Deallocate(HR_3D) | ||
! Copy the adjustment back to DT_3D as calculated in the baseline calculation | ||
IF (Input_Opt%RRTMG_SEFDH) THEN | ||
DT_3D(:,:,:) = DT_3D_UPDATE(:,:,:) | ||
END IF | ||
|
||
! Store temperature change THEN heating rate from RRTMG in diagnostics (crb, 14/02/24) | ||
If (Input_Opt%RRTMG_FDH) Then | ||
IF (State_Diag%Archive_DynHeating) THEN | ||
State_Diag%DynHeating(:,:,:) = HR_3D(:,:,:) | ||
ENDIF | ||
! NB: DT_3D is the temperature adjustment either after equilibration (pure FDH) | ||
! or at the start of the NEXT radiation time step (SEFDH) | ||
IF (State_Diag%Archive_DTRad ) THEN | ||
State_Diag%DTRad(:,:,:) = DT_3D(:,:,:) | ||
ENDIF | ||
IF (Input_Opt%RRTMG_SEFDH) THEN | ||
State_Chm%TStrat_Adj(:,:,:) = DT_3D(:,:,:) | ||
END IF | ||
ENDIF | ||
|
||
RC = 0 | ||
IF (Allocated(DT_3D)) Deallocate(DT_3D, STAT=RC) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be more efficient to allocate all necessary arrays once in initialization and then to deallocate them at finalaization rather than on every timestep. |
||
IF ( RC /= 0 ) Call Error_Stop( 'Error deallocating DT_3D', ThisLoc ) | ||
IF (Allocated(HR_3D)) Deallocate(HR_3D, STAT=RC) | ||
IF ( RC /= 0 ) Call Error_Stop( 'Error deallocating HR_3D', ThisLoc ) | ||
IF (Allocated(DT_3D_UPDATE)) Deallocate(DT_3D_UPDATE, STAT=RC) | ||
IF ( RC /= 0 ) Call Error_Stop( 'Error deallocating DT_3D_UPDATE', ThisLoc ) | ||
|
||
IF ( Input_Opt%useTimers ) THEN | ||
CALL Timer_End( "RRTMG", RC ) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cbarker211 can we remove these commented-out lines if they aren't needed?