Skip to content
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
4 changes: 2 additions & 2 deletions driver/fvGFS/atmosphere.F90
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ subroutine atmosphere_init (Time_init, Time, Time_step, Grid_box, area)
use ccpp_static_api, only: ccpp_physics_init
use CCPP_data, only: ccpp_suite, &
cdata => cdata_tile, &
CCPP_interstitial
GFDL_interstitial
#ifdef OPENMP
use omp_lib
#endif
Expand Down Expand Up @@ -512,7 +512,7 @@ subroutine atmosphere_init (Time_init, Time, Time_step, Grid_box, area)
#endif
! Create interstitial data type for fast physics; for multi-gases physics,
! pass q(:,:,:,1:num_gas) as qvi, otherwise pass q(:,:,:,1:1) as 4D array
call CCPP_interstitial%create(Atm(mygrid)%bd%is, Atm(mygrid)%bd%ie, Atm(mygrid)%bd%isd, Atm(mygrid)%bd%ied, &
call GFDL_interstitial%create(Atm(mygrid)%bd%is, Atm(mygrid)%bd%ie, Atm(mygrid)%bd%isd, Atm(mygrid)%bd%ied, &
Atm(mygrid)%bd%js, Atm(mygrid)%bd%je, Atm(mygrid)%bd%jsd, Atm(mygrid)%bd%jed, &
Atm(mygrid)%npz, Atm(mygrid)%ng, &
dt_atmos, p_split, Atm(mygrid)%flagstruct%k_split, &
Expand Down
16 changes: 8 additions & 8 deletions model/fv_dynamics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ subroutine fv_dynamics(npx, npy, npz, nq_tot, ng, bdt, consv_te, fill,
ccpp_physics_timestep_finalize
use CCPP_data, only: ccpp_suite
use CCPP_data, only: cdata => cdata_tile
use CCPP_data, only: CCPP_interstitial
use CCPP_data, only: GFDL_interstitial

use molecular_diffusion_mod, only: md_time, md_wait_sec, md_tadj_layers, &
thermosphere_adjustment
Expand Down Expand Up @@ -299,11 +299,11 @@ subroutine fv_dynamics(npx, npy, npz, nq_tot, ng, bdt, consv_te, fill,
real :: time_total
integer :: seconds, days

ccpp_associate: associate( cappa => CCPP_interstitial%cappa, &
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this syntax here. What is going on?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This association was done so that we didn't have to change the entire code and replace cappa with CCPP_interstitial%cappa everywhere. This was especially important when IPD and CCPP coexisted in the UFS, as we had to switch between the two builds.

Previously, in the IPD, and still the case in the dev/gfdl branch (I think), cappa is a local (module) variable in fv_dynamics.F90. In the CCPP implementation, it is part of the DDT currently called CCPP_interstitial. When CCPP was implemented first as a dynamic build option, this was the only way to pass cappa to the saturation adjustment in CCPP. Later, the dynamic build was phased out. It would be possible to rearrange things a bit, although I don't think we can use cappa as a local variable in fv_dynamics.F90 as it is for the dev/gfdl branch. It could be a module variable in separate Fortran module.

@bensor and I talked a while ago about a possible refactoring of the physics implementations with the goal to have a generic interface to call physics in the FV3 dycore, and then the two backends GFDL physics and CCPP physics. Unfortunately, we haven't made any progress on that. But this would be a good opportunity to revisit the CCPP implementation.

dp1 => CCPP_interstitial%te0, &
dtdt_m => CCPP_interstitial%dtdt, &
last_step => CCPP_interstitial%last_step, &
te_2d => CCPP_interstitial%te0_2d )
ccpp_associate: associate( cappa => GFDL_interstitial%cappa, &
dp1 => GFDL_interstitial%te0, &
dtdt_m => GFDL_interstitial%dtdt, &
last_step => GFDL_interstitial%last_step, &
te_2d => GFDL_interstitial%te0_2d )

is = bd%is
ie = bd%ie
Expand All @@ -329,9 +329,9 @@ subroutine fv_dynamics(npx, npy, npz, nq_tot, ng, bdt, consv_te, fill,
call ccpp_physics_timestep_init(cdata, suite_name=trim(ccpp_suite), group_name="fast_physics", ierr=ierr)
! Reset all interstitial variables for CCPP version
! of fast physics, and manually set runtime parameters
call CCPP_interstitial%reset()
call GFDL_interstitial%reset()
if (flagstruct%do_sat_adj) then
CCPP_interstitial%out_dt = (idiag%id_mdt > 0)
GFDL_interstitial%out_dt = (idiag%id_mdt > 0)
end if

#ifdef MULTI_GASES
Expand Down
12 changes: 6 additions & 6 deletions model/fv_mapz.F90
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ module fv_mapz_mod
! </tr>
! <tr>
! <td>CCPP_data</td>
! <td>ccpp_suite, cdata_tile, CCPP_interstitial</td>
! <td>ccpp_suite, cdata_tile, GFDL_interstitial</td>
! </tr>
! <tr>
! <td>fv_timing_mod</td>
Expand Down Expand Up @@ -99,7 +99,7 @@ module fv_mapz_mod
use ccpp_static_api, only: ccpp_physics_run
use CCPP_data, only: ccpp_suite
use CCPP_data, only: cdata => cdata_tile
use CCPP_data, only: CCPP_interstitial
use CCPP_data, only: GFDL_interstitial
#ifdef MULTI_GASES
use multi_gases_mod, only: virq, virqd, vicpqd, vicvqd, num_gas
#endif
Expand Down Expand Up @@ -229,8 +229,8 @@ subroutine Lagrangian_to_Eulerian(last_step, consv, ps, pe, delp, pkz, pk, &
integer:: nt, liq_wat, ice_wat, rainwat, snowwat, cld_amt, graupel, hailwat, ccn_cm3, iq, n, kmp, kp, k_next
integer :: ierr

ccpp_associate: associate( fast_mp_consv => CCPP_interstitial%fast_mp_consv, &
kmp => CCPP_interstitial%kmp )
ccpp_associate: associate( fast_mp_consv => GFDL_interstitial%fast_mp_consv, &
kmp => GFDL_interstitial%kmp )

k1k = rdgas/cv_air ! akap / (1.-akap) = rg/Cv=0.4
rg = rdgas
Expand Down Expand Up @@ -673,7 +673,7 @@ subroutine Lagrangian_to_Eulerian(last_step, consv, ps, pe, delp, pkz, pk, &
!$OMP ng,gridstruct,E_Flux,pdt,dtmp,reproduce_sum,q, &
!$OMP mdt,cld_amt,cappa,dtdt,out_dt,rrg,akap,do_sat_adj, &
!$OMP kord_tm,pe4, npx,npy,ccn_cm3,u_dt,v_dt, c2l_ord,bd,dp0,ps, &
!$OMP cdata,CCPP_interstitial) &
!$OMP cdata,GFDL_interstitial) &
!$OMP shared(ccpp_suite) &
#ifdef MULTI_GASES
!$OMP shared(num_gas) &
Expand All @@ -688,7 +688,7 @@ subroutine Lagrangian_to_Eulerian(last_step, consv, ps, pe, delp, pkz, pk, &
!$OMP ng,gridstruct,E_Flux,pdt,dtmp,reproduce_sum,q, &
!$OMP mdt,cld_amt,cappa,dtdt,out_dt,rrg,akap,do_sat_adj, &
!$OMP fast_mp_consv,kord_tm, pe4,npx,npy, ccn_cm3, &
!$OMP u_dt,v_dt,c2l_ord,bd,dp0,ps,cdata,CCPP_interstitial) &
!$OMP u_dt,v_dt,c2l_ord,bd,dp0,ps,cdata,GFDL_interstitial) &
!$OMP shared(ccpp_suite) &
#ifdef MULTI_GASES
!$OMP shared(num_gas) &
Expand Down