Skip to content

Commit

Permalink
Merge pull request #207 from GEOS-ESM/feature/sdrabenh/r21c_G2G
Browse files Browse the repository at this point in the history
Pull in changes from feature/sdrabenh/r21c_G2G
  • Loading branch information
mathomp4 authored Apr 19, 2023
2 parents d9d4036 + c2d0516 commit 13b9282
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 25 deletions.
8 changes: 6 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
version: 2.1

# Anchor to prevent forgetting to update a version
baselibs_version: &baselibs_version v7.5.0
# Anchors to prevent forgetting to update a version
baselibs_version: &baselibs_version v7.7.0
bcs_version: &bcs_version v10.25.0


orbs:
ci: geos-esm/circleci-tools@1
Expand All @@ -19,6 +21,7 @@ workflows:
baselibs_version: *baselibs_version
repo: GEOSgcm
checkout_fixture: true
fixture_branch: release/v10
mepodevelop: true
persist_workspace: true # Needs to be true to run fv3/gcm experiment, costs extra
- ci/run_fv3:
Expand All @@ -43,6 +46,7 @@ workflows:
baselibs_version: *baselibs_version
repo: GEOSfvdycore
checkout_fixture: true
fixture_branch: release/v1
mepodevelop: false
persist_workspace: true # Needs to be true to run fv3/gcm experiment, costs extra
- ci/run_fv3:
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/enforce-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Enforce PR Labels

on:
pull_request:
types: [opened, labeled, unlabeled, edited, synchronize]

jobs:
require-label:
runs-on: ubuntu-latest
steps:
- uses: mheap/github-action-required-labels@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
mode: minimum
count: 1
labels: "0 diff,0 diff trivial,Non 0-diff,0 diff structural,0-diff trivial,Not 0-diff,0-diff,automatic,0-diff uncoupled"
add_comment: true
blocking-label:
runs-on: ubuntu-latest
steps:
- uses: mheap/github-action-required-labels@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
mode: exactly
count: 0
labels: "Contingent - DNA,Needs Lead Approval,Contingent -- Do Not Approve"
add_comment: true
96 changes: 73 additions & 23 deletions DynCore_GridCompMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,24 @@ Subroutine SetServices ( gc, rc )
VLOCATION = MAPL_VLocationCenter, RC=STATUS )
VERIFY_(STATUS)

call MAPL_AddExportSpec ( gc, &
SHORT_NAME = 'DUDTPHY', &
LONG_NAME = 'tendency_of_eastward_wind_due_to_physics', &
UNITS = 'm/s/s', &
DIMS = MAPL_DimsHorzVert, &
FIELD_TYPE = MAPL_VectorField, &
VLOCATION = MAPL_VLocationCenter, RC=STATUS )
VERIFY_(STATUS)

call MAPL_AddExportSpec ( gc, &
SHORT_NAME = 'DVDTPHY', &
LONG_NAME = 'tendency_of_northward_wind_due_to_physics', &
UNITS = 'm/s/s', &
DIMS = MAPL_DimsHorzVert, &
FIELD_TYPE = MAPL_VectorField, &
VLOCATION = MAPL_VLocationCenter, RC=STATUS )
VERIFY_(STATUS)

call MAPL_AddExportSpec ( gc, &
SHORT_NAME = 'DUDTANA', &
LONG_NAME = 'tendency_of_eastward_wind_due_to_analysis', &
Expand Down Expand Up @@ -2810,8 +2828,6 @@ subroutine Run(gc, import, export, clock, rc)
real(r8), allocatable :: trsum1(:) ! Global Sum of Tracers before Add_Incs
real(r8), allocatable :: trsum2(:) ! Global Sum of Tracers after Add_Incs

real(kind=4), pointer :: dudtana(:,:,:)
real(kind=4), pointer :: dvdtana(:,:,:)
real(kind=4), pointer :: dtdtana(:,:,:)
real(kind=4), pointer :: ddpdtana(:,:,:)
real(kind=4), pointer :: qctmp (:,:,:)
Expand Down Expand Up @@ -3504,15 +3520,11 @@ subroutine Run(gc, import, export, clock, rc)

! DUDTANA
! -------
call MAPL_GetPointer ( export, dudtana, 'DUDTANA', rc=status )
VERIFY_(STATUS)
if( associated(dudtana) ) dudtana = ua
! Note: Calculation of DUDTANA moved to ADD_INCS to account for AtoD & DtoA transformations

! DVDTANA
! -------
call MAPL_GetPointer ( export, dvdtana, 'DVDTANA', rc=status )
VERIFY_(STATUS)
if( associated(dvdtana) ) dvdtana = va
! Note: Calculation of DVDTANA moved to ADD_INCS to account for AtoD & DtoA transformations

! DTDTANA
! -------
Expand Down Expand Up @@ -3635,7 +3647,7 @@ subroutine Run(gc, import, export, clock, rc)
! -----------------------
delpold = delp ! Old Pressure Thickness

call ADD_INCS ( STATE,IMPORT,DT,IS_WEIGHTED=IS_WEIGHTED )
call ADD_INCS ( STATE,IMPORT,EXPORT,DT,'ANA ADD_INCS',IS_WEIGHTED=IS_WEIGHTED )

if (DYN_DEBUG) call DEBUG_FV_STATE('ANA ADD_INCS',STATE)

Expand Down Expand Up @@ -3799,21 +3811,11 @@ subroutine Run(gc, import, export, clock, rc)

! DUDTANA
! -------
call MAPL_GetPointer ( export, dudtana, 'DUDTANA', rc=status )
VERIFY_(STATUS)
if( associated(dudtana) ) then
dummy = ua
dudtana = (dummy-dudtana)/dt
endif
! Note: Calculation of DUDTANA moved to ADD_INCS to account for AtoD & DtoA transformations

! DVDTANA
! -------
call MAPL_GetPointer ( export, dvdtana, 'DVDTANA', rc=status )
VERIFY_(STATUS)
if( associated(dvdtana) ) then
dummy = va
dvdtana = (dummy-dvdtana)/dt
endif
! Note: Calculation of DVDTANA moved to ADD_INCS to account for AtoD & DtoA transformations

! DTDTANA
! -------
Expand Down Expand Up @@ -6279,7 +6281,7 @@ subroutine RunAddIncs(gc, import, export, clock, rc)

! Add Diabatic Forcing to State Variables
! ---------------------------------------
call ADD_INCS ( STATE,IMPORT,DT )
call ADD_INCS ( STATE,IMPORT,EXPORT,DT,'PHYSICS ADD_INCS' )

if (DYN_DEBUG) call DEBUG_FV_STATE('PHYSICS ADD_INCS',STATE)

Expand Down Expand Up @@ -6751,7 +6753,7 @@ subroutine RunAddIncs(gc, import, export, clock, rc)
end subroutine RunAddIncs

!-----------------------------------------------------------------------
subroutine ADD_INCS ( STATE,IMPORT,DT,IS_WEIGHTED,RC )
subroutine ADD_INCS ( STATE,IMPORT,EXPORT,DT,STRING,IS_WEIGHTED,RC )

use fms_mod, only: set_domain, nullify_domain
use fv_diagnostics_mod, only: prt_maxmin
Expand All @@ -6762,7 +6764,9 @@ subroutine ADD_INCS ( STATE,IMPORT,DT,IS_WEIGHTED,RC )

type(DynState), pointer :: STATE
type(ESMF_State), intent(INOUT) :: IMPORT
type(ESMF_State), intent(INOUT) :: EXPORT
real(FVPRC), intent(IN ) :: DT
character(len=*), intent(IN ) :: STRING
integer, optional, intent(OUT ) :: RC
logical, optional, intent(IN ) :: is_weighted

Expand All @@ -6781,6 +6785,7 @@ subroutine ADD_INCS ( STATE,IMPORT,DT,IS_WEIGHTED,RC )
real(r4), allocatable :: fvQOLD(:,:,:), QTEND(:,:,:)
real(r8), allocatable :: DPNEW(:,:,:),DPOLD(:,:,:)

real(REAL8), allocatable :: ua(:,:,:), va(:,:,:)
real(REAL8), allocatable :: tend_ua(:,:,:), tend_va(:,:,:)
real(REAL8), allocatable :: tend_un(:,:,:), tend_vn(:,:,:)

Expand Down Expand Up @@ -6957,6 +6962,8 @@ subroutine ADD_INCS ( STATE,IMPORT,DT,IS_WEIGHTED,RC )
! **** while IMPORT Tendencies are on the A-Grid ****
! **********************************************************************

ALLOCATE( ua(is:ie ,js:je ,km) )
ALLOCATE( va(is:ie ,js:je ,km) )
ALLOCATE( tend_ua(is:ie ,js:je ,km) )
ALLOCATE( tend_va(is:ie ,js:je ,km) )
ALLOCATE( tend_un(is:ie ,js:je+1,km) )
Expand All @@ -6981,12 +6988,55 @@ subroutine ADD_INCS ( STATE,IMPORT,DT,IS_WEIGHTED,RC )
! Put the wind tendencies on the Native Dynamics grid
! ---------------------------------------------------
call Agrid_To_Native( tend_ua, tend_va, tend_un, tend_vn )
call getAgridWinds( STATE%VARS%U, STATE%VARS%V, ua, va, rotate=.true.)

if( trim(STRING) == 'ANA ADD_INCS' ) then
call ESMFL_StateGetPointerToData ( EXPORT,TEND,'DUDTANA',RC=STATUS )
VERIFY_(STATUS)
if( associated(TEND) ) tend = ua(is:ie,js:je,1:km)
call ESMFL_StateGetPointerToData ( EXPORT,TEND,'DVDTANA',RC=STATUS )
VERIFY_(STATUS)
if( associated(TEND) ) tend = va(is:ie,js:je,1:km)
endif

if( trim(STRING) == 'PHYSICS ADD_INCS' ) then
call ESMFL_StateGetPointerToData ( EXPORT,TEND,'DUDTPHY',RC=STATUS )
VERIFY_(STATUS)
if( associated(TEND) ) tend = ua(is:ie,js:je,1:km)
call ESMFL_StateGetPointerToData ( EXPORT,TEND,'DVDTPHY',RC=STATUS )
VERIFY_(STATUS)
if( associated(TEND) ) tend = va(is:ie,js:je,1:km)
endif

! Add the wind tendencies to the control variables
! ------------------------------------------------
STATE%VARS%U = STATE%VARS%U + DT*TEND_UN(is:ie,js:je,1:km)
STATE%VARS%V = STATE%VARS%V + DT*TEND_VN(is:ie,js:je,1:km)

! Put the wind tendencies back on A-Grid (for consistency with wind output)
! -------------------------------------------------------------------------
call getAgridWinds( STATE%VARS%U, STATE%VARS%V, ua, va, rotate=.true.)

if( trim(STRING) == 'ANA ADD_INCS' ) then
call ESMFL_StateGetPointerToData ( EXPORT,TEND,'DUDTANA',RC=STATUS )
VERIFY_(STATUS)
if( associated(TEND) ) tend = ( ua(is:ie,js:je,1:km)-tend )/DT
call ESMFL_StateGetPointerToData ( EXPORT,TEND,'DVDTANA',RC=STATUS )
VERIFY_(STATUS)
if( associated(TEND) ) tend = ( va(is:ie,js:je,1:km)-tend )/DT
endif

if( trim(STRING) == 'PHYSICS ADD_INCS' ) then
call ESMFL_StateGetPointerToData ( EXPORT,TEND,'DUDTPHY',RC=STATUS )
VERIFY_(STATUS)
if( associated(TEND) ) tend = ( ua(is:ie,js:je,1:km)-tend )/DT
call ESMFL_StateGetPointerToData ( EXPORT,TEND,'DVDTPHY',RC=STATUS )
VERIFY_(STATUS)
if( associated(TEND) ) tend = ( va(is:ie,js:je,1:km)-tend )/DT
endif

DEALLOCATE( ua )
DEALLOCATE( va )
DEALLOCATE( tend_ua )
DEALLOCATE( tend_va )
DEALLOCATE( tend_un )
Expand Down

0 comments on commit 13b9282

Please sign in to comment.