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

GitFlow: Merge develop into main for release #255

Merged
merged 6 commits into from
Sep 28, 2023
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
88 changes: 45 additions & 43 deletions DynCore_GridCompMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -7043,106 +7043,108 @@ subroutine ADD_INCS ( STATE,IMPORT,DT,IS_WEIGHTED,RC )
if (.not. ADIABATIC) then
_ASSERT(nwat >= 1, 'expecting water species (nwat) to match')
endif

select case(nwat)
case(1)
sphum = 1
liq_wat = -1
ice_wat = -1
rainwat = -1
snowwat = -1
graupel = -1
case(3)
sphum = 1
liq_wat = 2
ice_wat = 3
rainwat = -1
snowwat = -1
graupel = -1
case(6:7)
sphum = 1
liq_wat = 2
ice_wat = 3
rainwat = 4
snowwat = 5
graupel = 6
end select

if (nwat >= 1) then
ALLOCATE( Q(is:ie,js:je,1:km,nwat) )
ALLOCATE( CVM(is:ie,js:je,1:km) )
Q(:,:,:,:) = 0.0
call PULL_Q ( STATE, IMPORT, qqq, NXQ, InFieldName='Q', RC=rc )
if (DYN_COLDSTART .and. overwrite_Q .and. (.not. ADIABATIC)) then
! USE Q computed by FV3
call getQ(Q(:,:,:,1), 'Q')
call getQ(Q(:,:,:,sphum), 'Q')
overwrite_Q=.false.
call WRITE_PARALLEL("Using QV from FV3 Initial Conditions")
fac = 1.0
call prt_maxmin('AI Q', Q(:,:,:,1), is, ie, js, je, 0, km, fac)
call prt_maxmin('AI Q', Q(:,:,:,sphum), is, ie, js, je, 0, km, fac)
if ( (qqq%is_r4) .and. (associated(qqq%content_r4)) ) then
if (size(Q(:,:,:,1))==size(qqq%content_r4)) qqq%content_r4 = Q(:,:,:,1)
if (size(Q(:,:,:,sphum))==size(qqq%content_r4)) qqq%content_r4 = Q(:,:,:,sphum)
elseif (associated(qqq%content)) then
if (size(Q(:,:,:,1))==size(qqq%content)) qqq%content = Q(:,:,:,1)
if (size(Q(:,:,:,sphum))==size(qqq%content)) qqq%content = Q(:,:,:,sphum)
endif
else
! Grab QV from imports
if ( (qqq%is_r4) .and. (associated(qqq%content_r4)) ) then
if (size(Q(:,:,:,1))==size(qqq%content_r4)) Q(:,:,:,1) = qqq%content_r4
if (size(Q(:,:,:,sphum))==size(qqq%content_r4)) Q(:,:,:,sphum) = qqq%content_r4
elseif (associated(qqq%content)) then
if (size(Q(:,:,:,1))==size(qqq%content)) Q(:,:,:,1) = qqq%content
if (size(Q(:,:,:,sphum))==size(qqq%content)) Q(:,:,:,sphum) = qqq%content
endif
endif
endif
if (nwat >= 3) then
! Grab QLIQ from imports
call PULL_Q ( STATE, IMPORT, qqq, NXQ, InFieldName='QLLS', RC=rc )
if ( (qqq%is_r4) .and. (associated(qqq%content_r4)) ) then
if (size(Q(:,:,:,2))==size(qqq%content_r4)) Q(:,:,:,2) = Q(:,:,:,2) + qqq%content_r4
if (size(Q(:,:,:,liq_wat))==size(qqq%content_r4)) Q(:,:,:,liq_wat) = Q(:,:,:,liq_wat) + qqq%content_r4
elseif (associated(qqq%content)) then
if (size(Q(:,:,:,2))==size(qqq%content)) Q(:,:,:,2) = Q(:,:,:,2) + qqq%content
if (size(Q(:,:,:,liq_wat))==size(qqq%content)) Q(:,:,:,liq_wat) = Q(:,:,:,liq_wat) + qqq%content
endif
call PULL_Q ( STATE, IMPORT, qqq, NXQ, InFieldName='QLCN', RC=rc )
if ( (qqq%is_r4) .and. (associated(qqq%content_r4)) ) then
if (size(Q(:,:,:,2))==size(qqq%content_r4)) Q(:,:,:,2) = Q(:,:,:,2) + qqq%content_r4
if (size(Q(:,:,:,liq_wat))==size(qqq%content_r4)) Q(:,:,:,liq_wat) = Q(:,:,:,liq_wat) + qqq%content_r4
elseif (associated(qqq%content)) then
if (size(Q(:,:,:,2))==size(qqq%content)) Q(:,:,:,2) = Q(:,:,:,2) + qqq%content
if (size(Q(:,:,:,liq_wat))==size(qqq%content)) Q(:,:,:,liq_wat) = Q(:,:,:,liq_wat) + qqq%content
endif
! Grab QICE from imports
call PULL_Q ( STATE, IMPORT, qqq, NXQ, InFieldName='QILS', RC=rc )
if ( (qqq%is_r4) .and. (associated(qqq%content_r4)) ) then
if (size(Q(:,:,:,3))==size(qqq%content_r4)) Q(:,:,:,3) = Q(:,:,:,3) + qqq%content_r4
if (size(Q(:,:,:,ice_wat))==size(qqq%content_r4)) Q(:,:,:,ice_wat) = Q(:,:,:,ice_wat) + qqq%content_r4
elseif (associated(qqq%content)) then
if (size(Q(:,:,:,3))==size(qqq%content)) Q(:,:,:,3) = Q(:,:,:,3) + qqq%content
if (size(Q(:,:,:,ice_wat))==size(qqq%content)) Q(:,:,:,ice_wat) = Q(:,:,:,ice_wat) + qqq%content
endif
call PULL_Q ( STATE, IMPORT, qqq, NXQ, InFieldName='QICN', RC=rc )
if ( (qqq%is_r4) .and. (associated(qqq%content_r4)) ) then
if (size(Q(:,:,:,3))==size(qqq%content_r4)) Q(:,:,:,3) = Q(:,:,:,3) + qqq%content_r4
if (size(Q(:,:,:,ice_wat))==size(qqq%content_r4)) Q(:,:,:,ice_wat) = Q(:,:,:,ice_wat) + qqq%content_r4
elseif (associated(qqq%content)) then
if (size(Q(:,:,:,3))==size(qqq%content)) Q(:,:,:,3) = Q(:,:,:,3) + qqq%content
if (size(Q(:,:,:,ice_wat))==size(qqq%content)) Q(:,:,:,ice_wat) = Q(:,:,:,ice_wat) + qqq%content
endif
endif
if (nwat >= 6) then
! Grab RAIN from imports
call PULL_Q ( STATE, IMPORT, qqq, NXQ, InFieldName='QRAIN', RC=rc )
if ( (qqq%is_r4) .and. (associated(qqq%content_r4)) ) then
if (size(Q(:,:,:,4))==size(qqq%content_r4)) Q(:,:,:,4) = qqq%content_r4
if (size(Q(:,:,:,rainwat))==size(qqq%content_r4)) Q(:,:,:,rainwat) = qqq%content_r4
elseif (associated(qqq%content)) then
if (size(Q(:,:,:,4))==size(qqq%content)) Q(:,:,:,4) = qqq%content
if (size(Q(:,:,:,rainwat))==size(qqq%content)) Q(:,:,:,rainwat) = qqq%content
endif
! Grab SNOW from imports
call PULL_Q ( STATE, IMPORT, qqq, NXQ, InFieldName='QSNOW', RC=rc )
if ( (qqq%is_r4) .and. (associated(qqq%content_r4)) ) then
if (size(Q(:,:,:,5))==size(qqq%content_r4)) Q(:,:,:,5) = qqq%content_r4
if (size(Q(:,:,:,snowwat))==size(qqq%content_r4)) Q(:,:,:,snowwat) = qqq%content_r4
elseif (associated(qqq%content)) then
if (size(Q(:,:,:,5))==size(qqq%content)) Q(:,:,:,5) = qqq%content
if (size(Q(:,:,:,snowwat))==size(qqq%content)) Q(:,:,:,snowwat) = qqq%content
endif
! Grab GRAUPEL from imports
call PULL_Q ( STATE, IMPORT, qqq, NXQ, InFieldName='QGRAUPEL', RC=rc )
if ( (qqq%is_r4) .and. (associated(qqq%content_r4)) ) then
if (size(Q(:,:,:,6))==size(qqq%content_r4)) Q(:,:,:,6) = qqq%content_r4
if (size(Q(:,:,:,graupel))==size(qqq%content_r4)) Q(:,:,:,graupel) = qqq%content_r4
elseif (associated(qqq%content)) then
if (size(Q(:,:,:,6))==size(qqq%content)) Q(:,:,:,6) = qqq%content
if (size(Q(:,:,:,graupel))==size(qqq%content)) Q(:,:,:,graupel) = qqq%content
endif
endif
select case(nwat)
case(1)
sphum = 1
liq_wat = -1
ice_wat = -1
rainwat = -1
snowwat = -1
graupel = -1
case(3)
sphum = 1
liq_wat = 2
ice_wat = 3
rainwat = -1
snowwat = -1
graupel = -1
case(6:7)
sphum = 1
liq_wat = 2
ice_wat = 3
rainwat = 4
snowwat = 5
graupel = 6
end select

if ( (.not. ADIABATIC) .and. (DO_ADD_INCS) ) then

Expand Down
42 changes: 24 additions & 18 deletions FV_StateMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ subroutine FV_Setup(GC,LAYOUT_FILE, RC)
! when reading the tracer bundle in fv_first_run
FV_Atm(1)%flagstruct%nwat = 0
! Trigger to enable autoconversion/cloud processes on the fv_mapz step
FV_Atm(1)%flagstruct%do_sat_adj = .false. ! only valid when nwat >= 6
FV_Atm(1)%flagstruct%do_sat_adj = .false.
! Veritical resolution dependencies
FV_Atm(1)%flagstruct%external_eta = .true.
if (FV_Atm(1)%flagstruct%npz >= 70) then
Expand Down Expand Up @@ -544,6 +544,9 @@ subroutine FV_Setup(GC,LAYOUT_FILE, RC)
! Rayleigh & Divergence Damping
if (index(FV3_CONFIG,"HWT") > 0) then
FV_Atm(1)%flagstruct%fv_sg_adj = min(3600.0,DT*4.0)
if (FV_Atm(1)%flagstruct%npz >= 71) then
FV_Atm(1)%flagstruct%n_zfilter = 37 ! ~100mb
endif
if (FV_Atm(1)%flagstruct%npz >= 90) then
FV_Atm(1)%flagstruct%n_zfilter = 46 ! ~100mb
endif
Expand All @@ -553,11 +556,15 @@ subroutine FV_Setup(GC,LAYOUT_FILE, RC)
if (FV_Atm(1)%flagstruct%npz >= 180) then
FV_Atm(1)%flagstruct%n_zfilter = 92 ! ~100mb
endif
FV_Atm(1)%flagstruct%do_sat_adj = .true. ! only valid when nwat >= 6
FV_Atm(1)%flagstruct%do_sat_adj = .false. ! only valid when nwat >= 6
FV_Atm(1)%flagstruct%dz_min = 6.0
FV_Atm(1)%flagstruct%RF_fast = .true.
FV_Atm(1)%flagstruct%tau = 2.0
FV_Atm(1)%flagstruct%rf_cutoff = 10.e2
if (FV_Atm(1)%flagstruct%npz == 72) then
FV_Atm(1)%flagstruct%tau = 0.0
else
FV_Atm(1)%flagstruct%tau = 2.0
endif
FV_Atm(1)%flagstruct%rf_cutoff = 0.35e2
! 6th order default damping options
FV_Atm(1)%flagstruct%nord = 3
FV_Atm(1)%flagstruct%dddmp = 0.1
Expand Down Expand Up @@ -653,7 +660,7 @@ subroutine FV_Setup(GC,LAYOUT_FILE, RC)
FV_Atm(1)%flagstruct%d_con = 0.
else
! Non-Monotonic advection
if (FV_Atm(1)%flagstruct%stretch_fac > 1.0) then
if (index(FV3_CONFIG,"HWT") > 0) then
FV_Atm(1)%flagstruct%hord_mt = 6
FV_Atm(1)%flagstruct%hord_vt = 6
FV_Atm(1)%flagstruct%hord_tm = 6
Expand Down Expand Up @@ -730,7 +737,9 @@ subroutine FV_Setup(GC,LAYOUT_FILE, RC)
endif

!! Setup GFDL microphysics module
call gfdl_cloud_microphys_init()
if (FV_Atm(1)%flagstruct%do_sat_adj) then
call gfdl_cloud_microphys_init()
endif

_ASSERT(DT > 0.0, 'DT must be greater than zero')

Expand Down Expand Up @@ -1326,9 +1335,6 @@ subroutine FV_Run (STATE, EXPORT, CLOCK, GC, RC)
endif
if (nwat_tracers >= 10) FV_Atm(1)%flagstruct%nwat = 6 ! Tell FV3 about QV, QLIQ, QICE, QRAIN, QSNOW, QGRAUPEL plus QCLD
endif
!if (FV_Atm(1)%flagstruct%do_sat_adj) then
! _ASSERT(FV_Atm(1)%flagstruct%nwat >= 6, 'when using fv saturation adjustment NWAT must >= 6')
!endif
STATE%VARS%nwat = FV_Atm(1)%flagstruct%nwat
endif
#ifdef VERIFY_GRID
Expand Down Expand Up @@ -1485,7 +1491,7 @@ subroutine FV_Run (STATE, EXPORT, CLOCK, GC, RC)
endif
endif
if (qlcnf /= -1) then ! QLCN
if (fv_first_run) call WRITE_PARALLEL( trim(STATE%VARS%TRACER(n)%TNAME) )
if (fv_first_run) call WRITE_PARALLEL( trim('QLCNF') )
QLCN_FILLED = .TRUE.
nn = nn+1
if (state%vars%tracer(n)%is_r4) then
Expand Down Expand Up @@ -1538,7 +1544,7 @@ subroutine FV_Run (STATE, EXPORT, CLOCK, GC, RC)
endif
endif
if (qicnf /= -1) then ! QICN
if (fv_first_run) call WRITE_PARALLEL( trim(STATE%VARS%TRACER(n)%TNAME) )
if (fv_first_run) call WRITE_PARALLEL( trim('QICNF') )
QICN_FILLED = .TRUE.
nn = nn+1
if (state%vars%tracer(n)%is_r4) then
Expand Down Expand Up @@ -1622,7 +1628,7 @@ subroutine FV_Run (STATE, EXPORT, CLOCK, GC, RC)
endif
endif
if (clcnf /= -1) then ! CLCN
if (fv_first_run) call WRITE_PARALLEL( trim(STATE%VARS%TRACER(n)%TNAME) )
if (fv_first_run) call WRITE_PARALLEL( trim('CLCNF') )
CLCN_FILLED = .TRUE.
nn = nn+1
if (state%vars%tracer(n)%is_r4) then
Expand Down Expand Up @@ -1733,7 +1739,7 @@ subroutine FV_Run (STATE, EXPORT, CLOCK, GC, RC)
select case (FV_Atm(1)%flagstruct%nwat)
case (0)
do n=1,STATE%GRID%NQ
if (fv_first_run) call WRITE_PARALLEL( trim(STATE%VARS%TRACER(n)%TNAME) )
if (fv_first_run) call WRITE_PARALLEL( trim('--'//STATE%VARS%TRACER(n)%TNAME) )
nn = nn+1
if (state%vars%tracer(n)%is_r4) then
FV_Atm(1)%q(isc:iec,jsc:jec,1:npz,nn) = state%vars%tracer(n)%content_r4(:,:,:)
Expand All @@ -1748,7 +1754,7 @@ subroutine FV_Run (STATE, EXPORT, CLOCK, GC, RC)
(TRIM(state%vars%tracer(n)%tname) /= 'QLLS' ) .and. &
(TRIM(state%vars%tracer(n)%tname) /= 'QICN' ) .and. &
(TRIM(state%vars%tracer(n)%tname) /= 'QILS' ) ) then
if (fv_first_run) call WRITE_PARALLEL( trim(STATE%VARS%TRACER(n)%TNAME) )
if (fv_first_run) call WRITE_PARALLEL( trim('--'//STATE%VARS%TRACER(n)%TNAME) )
nn=nn+1
if (state%vars%tracer(n)%is_r4) then
FV_Atm(1)%q(isc:iec,jsc:jec,1:npz,nn) = state%vars%tracer(n)%content_r4(:,:,:)
Expand All @@ -1764,7 +1770,7 @@ subroutine FV_Run (STATE, EXPORT, CLOCK, GC, RC)
(TRIM(state%vars%tracer(n)%tname) /= 'QLLS' ) .and. &
(TRIM(state%vars%tracer(n)%tname) /= 'QICN' ) .and. &
(TRIM(state%vars%tracer(n)%tname) /= 'QILS' ) ) then
if (fv_first_run) call WRITE_PARALLEL( trim(STATE%VARS%TRACER(n)%TNAME) )
if (fv_first_run) call WRITE_PARALLEL( trim('--'//STATE%VARS%TRACER(n)%TNAME) )
nn=nn+1
if (state%vars%tracer(n)%is_r4) then
FV_Atm(1)%q(isc:iec,jsc:jec,1:npz,nn) = state%vars%tracer(n)%content_r4(:,:,:)
Expand All @@ -1785,7 +1791,7 @@ subroutine FV_Run (STATE, EXPORT, CLOCK, GC, RC)
(TRIM(state%vars%tracer(n)%tname) /= 'QRAIN' ) .and. &
(TRIM(state%vars%tracer(n)%tname) /= 'QSNOW' ) .and. &
(TRIM(state%vars%tracer(n)%tname) /= 'QGRAUPEL') ) then
if (fv_first_run) call WRITE_PARALLEL( trim(STATE%VARS%TRACER(n)%TNAME) )
if (fv_first_run) call WRITE_PARALLEL( trim('--'//STATE%VARS%TRACER(n)%TNAME) )
nn=nn+1
if (state%vars%tracer(n)%is_r4) then
FV_Atm(1)%q(isc:iec,jsc:jec,1:npz,nn) = state%vars%tracer(n)%content_r4(:,:,:)
Expand Down Expand Up @@ -2593,7 +2599,7 @@ subroutine State_To_FV ( STATE )

if ( FV_Atm(1)%flagstruct%range_warn ) then
call range_check('T_S2F', FV_Atm(1)%pt, isc, iec, jsc, jec, ng, km, FV_Atm(1)%gridstruct%agrid, &
130., 335., bad_range=bad_range_T)
100., 335., bad_range=bad_range_T)
endif

!------------
Expand Down Expand Up @@ -2660,7 +2666,7 @@ subroutine FV_To_State ( STATE )
!-----------------------------------
!if ( FV_Atm(1)%flagstruct%range_warn ) then
! call range_check('T_F2S', FV_Atm(1)%pt, isc, iec, jsc, jec, ng, km, FV_Atm(1)%gridstruct%agrid, &
! 130., 335., bad_range)
! 100., 335., bad_range)
!endif
STATE%VARS%PT = FV_Atm(1)%pt(isc:iec,jsc:jec,:)

Expand Down
Loading