Skip to content

Commit

Permalink
Merge pull request #435 from GEOS-ESM/develop
Browse files Browse the repository at this point in the history
Sync develop into main
  • Loading branch information
mathomp4 authored May 25, 2021
2 parents f69b26e + 92cb4c7 commit b770948
Show file tree
Hide file tree
Showing 18 changed files with 153 additions and 95 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/@GEOSchem_GridComp
/GEOSchem_GridComp
/GEOSchem_GridComp@
2 changes: 2 additions & 0 deletions GEOSagcm_GridComp/GEOSphysics_GridComp/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/@GEOSchem_GridComp
/GEOSchem_GridComp
/GEOSchem_GridComp@
128 changes: 84 additions & 44 deletions GEOSagcm_GridComp/GEOSphysics_GridComp/GEOS_PhysicsGridComp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -811,57 +811,73 @@ subroutine SetServices ( GC, RC )
VERIFY_(STATUS)

call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'TUNPERT', &
SHORT_NAME = 'DTDTUNPERT', &
LONG_NAME = 'unperturbed_air_temperature_tendency', &
UNITS = 'K s-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
RC=STATUS )
VERIFY_(STATUS)
call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'UUNPERT', &
SHORT_NAME = 'DUDTUNPERT', &
LONG_NAME = 'unperturtbed_tendency_of_eastward_wind', &
UNITS = 'm s-2', &
UNITS = 'm s-2 s-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
RC=STATUS )
VERIFY_(STATUS)
call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'VUNPERT', &
LONG_NAME = 'unperturtbed_tendency_of_northward_wind', &
UNITS = 'm s-2', &
SHORT_NAME = 'DVDTUNPERT', &
LONG_NAME = 'unperturtbed_tendency_of_northward_wind', &
UNITS = 'm s-2 s-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
RC=STATUS )
VERIFY_(STATUS)
call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'QVUNPERT', &
LONG_NAME = 'unperturbed_water_vapor', &
UNITS = 'kg kg-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
RC=STATUS )
VERIFY_(STATUS)
call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'QUNPERT', &
SHORT_NAME = 'DQVDTUNPERT', &
LONG_NAME = 'unperturbed_tendency_of_water_vapor', &
UNITS = 'n/a', &
UNITS = 'kg kg-1 s-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
RC=STATUS )
VERIFY_(STATUS)
call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'QPERT', &
SHORT_NAME = 'QVPERT', &
LONG_NAME = 'stochastically_pert_water_vapor', &
UNITS = 'kg kg-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
RC=STATUS )
VERIFY_(STATUS)
call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'DQVDTPERT', &
LONG_NAME = 'stochastically_pert_tendency_of_water_vapor', &
UNITS = 'kg m-2 s-1', &
UNITS = 'kg kg-1 s-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
RC=STATUS )
VERIFY_(STATUS)
call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'DUDTSTOCH', &
LONG_NAME = 'eastward_wind_tendency_due_to_stochastic_physics', &
UNITS = 'm s-2', &
UNITS = 'm s-2 s-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
RC=STATUS )
VERIFY_(STATUS)
call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'DVDTSTOCH', &
LONG_NAME = 'northward_wind_tendency_due_to_stochastic_physics', &
UNITS = 'm s-2', &
UNITS = 'm s-2 s-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
RC=STATUS )
Expand All @@ -875,9 +891,9 @@ subroutine SetServices ( GC, RC )
RC=STATUS )
VERIFY_(STATUS)
call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'DQDTSTOCH', &
SHORT_NAME = 'DQVDTSTOCH', &
LONG_NAME = 'water_vapor_tendency_due_to_stochastic_physics', &
UNITS = 'kg m-2 s-1', &
UNITS = 'kg kg-1 s-1', &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, &
RC=STATUS )
Expand Down Expand Up @@ -2001,9 +2017,10 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC )
real, pointer, dimension(:,:,:) :: RNDPERT,RNDPTR
real, pointer, dimension(:,:,:) :: SKEBU_WT,SKEBV_WT
real, pointer, dimension(:,:,:) :: SKEBU,SKEBV
real, pointer, dimension(:,:,:) :: DUDTSTOCH, DVDTSTOCH, DTDTSTOCH, DQDTSTOCH
real, pointer, dimension(:,:,:) :: QPERT
real, pointer, dimension(:,:,:) :: TUNPERT, UUNPERT, VUNPERT, QUNPERT
real, pointer, dimension(:,:,:) :: DUDTSTOCH, DVDTSTOCH, DTDTSTOCH, DQVDTSTOCH
real, pointer, dimension(:,:,:) :: DQVDTPERT
real, pointer, dimension(:,:,:) :: QVPERT, QVUNPERT
real, pointer, dimension(:,:,:) :: DTDTUNPERT, DUDTUNPERT, DVDTUNPERT, DQVDTUNPERT
real, pointer, dimension(:,:,:) :: TIR, TIM, TIMFRIC, TIT, TIF
real, pointer, dimension(:,:,:) :: UIM, VIM, WIM, THIM
real, pointer, dimension(:,:,:) :: UIT, VIT, SIT
Expand Down Expand Up @@ -2364,23 +2381,27 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC )
if (DO_SPPT) then
call MAPL_GetPointer (EXPORT, RNDPTR, 'RNDPTR', RC=STATUS)
VERIFY_(STATUS)
call MAPL_GetPointer (EXPORT, TUNPERT, 'TUNPERT', RC=STATUS)
call MAPL_GetPointer (EXPORT, DTDTUNPERT, 'DTDTUNPERT', RC=STATUS)
VERIFY_(STATUS)
call MAPL_GetPointer (EXPORT, DUDTUNPERT, 'DUDTUNPERT', RC=STATUS)
VERIFY_(STATUS)
call MAPL_GetPointer (EXPORT, UUNPERT, 'UUNPERT', RC=STATUS)
call MAPL_GetPointer (EXPORT, DVDTUNPERT, 'DVDTUNPERT', RC=STATUS)
VERIFY_(STATUS)
call MAPL_GetPointer (EXPORT, VUNPERT, 'VUNPERT', RC=STATUS)
call MAPL_GetPointer (EXPORT, DQVDTUNPERT, 'DQVDTUNPERT', RC=STATUS)
VERIFY_(STATUS)
call MAPL_GetPointer (EXPORT, QUNPERT, 'QUNPERT', RC=STATUS)
call MAPL_GetPointer (EXPORT, DQVDTPERT, 'DQVDTPERT', RC=STATUS)
VERIFY_(STATUS)
call MAPL_GetPointer (EXPORT, QPERT, 'QPERT', RC=STATUS)
call MAPL_GetPointer (EXPORT, QVUNPERT, 'QVUNPERT', RC=STATUS)
VERIFY_(STATUS)
call MAPL_GetPointer (EXPORT, QVPERT, 'QVPERT', RC=STATUS)
VERIFY_(STATUS)
call MAPL_GetPointer (EXPORT, DUDTSTOCH, 'DUDTSTOCH', RC=STATUS)
VERIFY_(STATUS)
call MAPL_GetPointer (EXPORT, DVDTSTOCH, 'DVDTSTOCH', RC=STATUS)
VERIFY_(STATUS)
call MAPL_GetPointer (EXPORT, DTDTSTOCH, 'DTDTSTOCH', RC=STATUS)
VERIFY_(STATUS)
call MAPL_GetPointer (EXPORT, DQDTSTOCH, 'DQDTSTOCH', RC=STATUS)
call MAPL_GetPointer (EXPORT, DQVDTSTOCH, 'DQVDTSTOCH', RC=STATUS)
VERIFY_(STATUS)
endif
if (DO_SKEB) then
Expand Down Expand Up @@ -2706,23 +2727,25 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC )
IF( DO_SPPT ) THEN
allocate(TMP(IM,JM,LM),stat=STATUS)
VERIFY_(STATUS)
if( associated(UUNPERT) ) UUNPERT = DUDT
if( associated(VUNPERT) ) VUNPERT = DVDT
TMP = 0.
DO L=1,LM
TMP(:,:,L) = DUDT(:,:,L)*RNDPERT(:,:,L)
DUDT(:,:,L) = DUDT(:,:,L) + TMP(:,:,L)
ENDDO
if( associated(DUDTSTOCH) ) DUDTSTOCH = TMP
TMP = 0.
DO L=1,LM
TMP(:,:,L) = DVDT(:,:,L)*RNDPERT(:,:,L)
DVDT(:,:,L) = DVDT(:,:,L) + TMP(:,:,L)
ENDDO
if( associated(DVDTSTOCH) ) DVDTSTOCH = TMP
if( associated(DUDT) .and. associated(DVDT) ) then
if( associated(DUDTUNPERT) ) DUDTUNPERT = DUDT
if( associated(DVDTUNPERT) ) DVDTUNPERT = DVDT
TMP = 0.
DO L=1,LM
TMP(:,:,L) = DUDT(:,:,L)*RNDPERT(:,:,L)
DUDT(:,:,L) = DUDT(:,:,L) + TMP(:,:,L)
ENDDO
if( associated(DUDTSTOCH) ) DUDTSTOCH = TMP
TMP = 0.
DO L=1,LM
TMP(:,:,L) = DVDT(:,:,L)*RNDPERT(:,:,L)
DVDT(:,:,L) = DVDT(:,:,L) + TMP(:,:,L)
ENDDO
if( associated(DVDTSTOCH) ) DVDTSTOCH = TMP
endif
ENDIF

IF ( DO_SKEB ) THEN
IF ( DO_SKEB .and. associated(DUDT) .and. associated(DVDT) ) THEN
DO L=1,LM
DUDT(:,:,L)= DUDT(:,:,L) + SKEBU(:,:,L)
DVDT(:,:,L)= DVDT(:,:,L) + SKEBV(:,:,L)
Expand Down Expand Up @@ -2751,6 +2774,13 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC )
allocate(TOT(IM,JM,LM),stat=STATUS)
VERIFY_(STATUS)

if ( .not.associated(TIR) .or. .not.associated(STN) .or. &
.not.associated(TTN) .or. .not.associated(FRI) .or. &
.not.associated(TIG) .or. .not.associated(TICU) ) then
status=99
if( MAPL_am_I_root() ) print*, "GEOS_PhysicsGridComp: missing T-tend pointer, aborting ..."
VERIFY_(STATUS)
endif
TOT = TIR & ! Mass-Weighted Temperature Tendency due to Radiation
+ STN & ! Mass-Weighted Temperature Tendency due to Turbulent Mixing
+ TTN & ! Mass-Weighted Temperature Tendency due to Moist Processes
Expand All @@ -2761,7 +2791,7 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC )
IF(DO_SPPT) THEN
allocate(TFORQS(IM,JM,LM))
TFORQS = T + DT*TOT*DPI
if( associated(TUNPERT) ) TUNPERT = TOT
if( associated(DTDTUNPERT) ) DTDTUNPERT = TOT
DO L=1,LM
TMP(:,:,L) = (TOT(:,:,L) - TIG(:,:,L) ) *RNDPERT(:,:,L) ! Remove contribution from GWD before rndpert
TOT(:,:,L) = TOT(:,:,L) + TMP(:,:,L)
Expand Down Expand Up @@ -2816,7 +2846,7 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC )

if(associated(DTDTTOT)) DTDTTOT = TOT * DPI
if (DO_SPPT) then
if(associated(TUNPERT)) TUNPERT = TUNPERT * DPI
if(associated(DTDTUNPERT)) DTDTUNPERT = DTDTUNPERT * DPI
end if
deallocate(TOT)
end if
Expand Down Expand Up @@ -2961,6 +2991,12 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC )
! -------------
IF(DO_SPPT) THEN

if ( .not.associated(DQVDTMST) .or. .not.associated(DQVDTTRB) .or. .not.associated(DQVDTCHM) ) then
status=99
if( MAPL_am_I_root() ) print*, "GEOS_PhysicsGridComp: missing Q-tend pointer, aborting ..."
VERIFY_(STATUS)
endif

! Create Proxy for Updated Pressure due to Moist Physics
!-------------------------------------------------------
allocate( dp_mst(IM,JM, LM),STAT=STATUS ) ; VERIFY_(STATUS)
Expand All @@ -2986,10 +3022,13 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC )

! Compute Stochastic Perturbation
! -------------------------------
if( associated(QUNPERT) ) QUNPERT = QV
if( associated(DQDTSTOCH) ) DQDTSTOCH = QV
if( associated(QVUNPERT) ) QVUNPERT = QV
if( associated(DQVDTPERT) ) DQVDTPERT = QV
if( associated(DQVDTSTOCH) ) DQVDTSTOCH = QV
if( associated(DQVDTUNPERT) ) DQVDTUNPERT = DQVDTMST + DQVDTTRB + DQVDTCHM
DO L=1,LM
TMP(:,:,L) = (DQVDTMST(:,:,L)+DQVDTTRB(:,:,L))*RNDPERT(:,:,L)
if( associated(DQVDTSTOCH) ) DQVDTSTOCH(:,:,L) = TMP(:,:,L)
TMP(:,:,L) = QV(:,:,L) + max(DT*TMP(:,:,L),-QV(:,:,L))
ENDDO
allocate(qs(IM,JM))
Expand All @@ -3001,7 +3040,7 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC )
QV(:,:,L) = TMP(:,:,L)
endwhere
ENDDO
if( associated(QPERT) ) QPERT = QV
! if( associated(DQVDTSTOCH) ) DQVDTSTOCH = (QV - DQVDTSTOCH)/DT

! Create Water Mass after Stochastic Perturbation
! -----------------------------------------------
Expand Down Expand Up @@ -3088,7 +3127,8 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC )
endif
enddo

if( associated(DQDTSTOCH) ) DQDTSTOCH = ( QV - DQDTSTOCH )/DT
if( associated(QVPERT) ) QVPERT = QV
if( associated(DQVDTPERT) ) DQVDTPERT = (QV-DQVDTPERT)/DT

deallocate( dp_mst )
deallocate( ple_mst )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13637,7 +13637,7 @@ SUBROUTINE Get_hemcoFlashrate ( STATE, IMPORT, IM, JM, LM, T, PLE, ZLE, CNV_MFC,
REAL, DIMENSION(IM,JM,LM), INTENT(IN) :: T
REAL, DIMENSION(IM,JM,0:LM), INTENT(IN) :: PLE
REAL, DIMENSION(IM,JM,0:LM), INTENT(IN) :: ZLE
REAL, DIMENSION(IM,JM,LM), INTENT(IN) :: CNV_MFC
REAL, DIMENSION(IM,JM,0:LM), INTENT(IN) :: CNV_MFC
REAL, DIMENSION(IM,JM), INTENT(IN) :: AREA
REAL, DIMENSION(IM,JM), INTENT(IN) :: TS
REAL, DIMENSION(:,:), POINTER :: LFR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,12 @@ subroutine SetServices ( GC, RC )
call ESMF_ConfigLoadFile(SCF,SURFRC,rc=status) ; VERIFY_(STATUS)

call MAPL_GetResource (MAPL, DO_OBIO, label="USE_OCEANOBIOGEOCHEM:",DEFAULT=0, RC=STATUS); VERIFY_(STATUS)
call ESMF_ConfigGetAttribute (SCF, label='ATM_CO2:', value=ATM_CO2, DEFAULT=0, __RC__ )
call MAPL_GetResource (SCF, ATM_CO2, label='ATM_CO2:', DEFAULT=2, __RC__ )

call ESMF_ConfigGetAttribute (SCF, label='N_CONST_LAND4SNWALB:', value=catchswim, DEFAULT=0, __RC__ )
call ESMF_ConfigGetAttribute (SCF, label='N_CONST_LANDICE4SNWALB:', value=landicegoswim, DEFAULT=0, __RC__ )
call ESMF_ConfigGetAttribute (SCF, label='LAND_PARAMS:', value=LAND_PARAMS, DEFAULT="Icarus", __RC__ )
call ESMF_ConfigGetAttribute (SCF, label='CHOOSEMOSFC:', value=CHOOSEMOSFC, DEFAULT=1, __RC__ )
call MAPL_GetResource (SCF, catchswim, label='N_CONST_LAND4SNWALB:', DEFAULT=0, __RC__ )
call MAPL_GetResource (SCF, landicegoswim, label='N_CONST_LANDICE4SNWALB:', DEFAULT=0, __RC__ )
call MAPL_GetResource (SCF, LAND_PARAMS, label='LAND_PARAMS:', DEFAULT="NRv7.2", __RC__ )
call MAPL_GetResource (SCF, CHOOSEMOSFC, label='CHOOSEMOSFC:', DEFAULT=1, __RC__ )
call ESMF_ConfigDestroy (SCF, __RC__)

if ( (catchswim/=0) .or. (landicegoswim/=0) .or. (DO_OBIO/=0)) then
Expand Down Expand Up @@ -8504,7 +8504,7 @@ subroutine DOTYPE(type,RC)
VERIFY_(STATUS)
call MAPL_GetPointer(GEX(type), dum, 'ISTSFC', ALLOC=associated(ISTSFCTILE ), notFoundOK=.true., RC=STATUS)
VERIFY_(STATUS)
call MAPL_GetPointer(GEX(type), dum, 'SSKINW2',ALLOC=associated(SSKINWTILE ), notFoundOK=.true., RC=STATUS)
call MAPL_GetPointer(GEX(type), dum, 'SSKINW', ALLOC=associated(SSKINWTILE ), notFoundOK=.true., RC=STATUS)
VERIFY_(STATUS)
call MAPL_GetPointer(GEX(type), dum, 'MELTT', ALLOC=associated(MELTTTILE ), notFoundOK=.true., RC=STATUS)
VERIFY_(STATUS)
Expand Down Expand Up @@ -9235,7 +9235,7 @@ subroutine DOTYPE(type,RC)
VERIFY_(STATUS)
end if
if(associated(SSKINWTILE)) then
call FILLOUT_TILE(GEX(type), 'SSKINW2',SSKINWTILE, XFORM, RC=STATUS)
call FILLOUT_TILE(GEX(type), 'SSKINW',SSKINWTILE, XFORM, RC=STATUS)
VERIFY_(STATUS)
end if
if(associated(MELTTTILE)) then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ subroutine SetServices ( GC, RC )
call MAPL_GetResource (MAPL, SURFRC, label = 'SURFRC:', default = 'GEOS_SurfaceGridComp.rc', RC=STATUS) ; VERIFY_(STATUS)
SCF = ESMF_ConfigCreate(rc=status) ; VERIFY_(STATUS)
call ESMF_ConfigLoadFile (SCF,SURFRC,rc=status) ; VERIFY_(STATUS)
call ESMF_ConfigGetAttribute (SCF, label='CHOOSEMOSFC:', value=mystate%CHOOSEMOSFC, DEFAULT=1, __RC__ )
call MAPL_GetResource (SCF, mystate%CHOOSEMOSFC, label='CHOOSEMOSFC:', DEFAULT=1, __RC__ )
call ESMF_ConfigDestroy (SCF, __RC__)
wrap%ptr => mystate
call ESMF_UserCompSetInternalState(gc, 'lake_private', wrap,status)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ subroutine SetServices ( GC, RC )
call MAPL_GetResource (MAPL, SURFRC, label = 'SURFRC:', default = 'GEOS_SurfaceGridComp.rc', RC=STATUS) ; VERIFY_(STATUS)
SCF = ESMF_ConfigCreate(rc=status) ; VERIFY_(STATUS)
call ESMF_ConfigLoadFile(SCF,SURFRC,rc=status) ; VERIFY_(STATUS)
call ESMF_ConfigGetAttribute (SCF, label='RUN_ROUTE:' , value=RUN_ROUTE , DEFAULT=0, __RC__ )
call ESMF_ConfigGetAttribute (SCF, label='N_CONST_LAND4SNWALB:' , value=DO_GOSWIM , DEFAULT=0, __RC__ )
call MAPL_GetResource (SCF, RUN_ROUTE, label='RUN_ROUTE:', DEFAULT=0, __RC__ )
call MAPL_GetResource (SCF, DO_GOSWIM, label='N_CONST_LAND4SNWALB:', DEFAULT=0, __RC__ )
call ESMF_ConfigDestroy (SCF, __RC__)

SELECT CASE (LSM_CHOICE)
Expand Down
Loading

0 comments on commit b770948

Please sign in to comment.