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

WORK IN PROGRESS: fv3atm changes for splitting physics group in SDF #276

Closed
Closed
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
6 changes: 4 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
branch = master
[submodule "ccpp/physics"]
path = ccpp/physics
url = https://github.com/NCAR/ccpp-physics
branch = master
#url = https://github.com/NCAR/ccpp-physics
#branch = master
url = https://github.com/climbfuji/ccpp-physics
branch = split_physics_group_20210409
47 changes: 28 additions & 19 deletions atmos_model.F90
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ module atmos_model_mod
use GFS_restart, only: GFS_restart_type, GFS_restart_populate
use GFS_diagnostics, only: GFS_externaldiag_type, &
GFS_externaldiag_populate
use CCPP_data, only: ccpp_suite, GFS_control, &
GFS_data, GFS_interstitial
use CCPP_data, only: ccpp_suite, GFS_control, GFS_data, &
GFS_suite_interstitial, GFS_interstitial
use GFS_init, only: GFS_initialize
use CCPP_driver, only: CCPP_step, non_uniform_blocks

Expand Down Expand Up @@ -255,7 +255,7 @@ subroutine update_atmos_radiation_physics (Atmos)
jdat(5), jdat(6), jdat(7))
GFS_control%jdat(:) = jdat(:)

!--- execute the IPD atmospheric setup step
!--- execute the atmospheric setup step
call mpp_clock_begin(setupClock)
call CCPP_step (step="timestep_init", nblks=Atm_block%nblks, ierr=ierr)
if (ierr/=0) call mpp_error(FATAL, 'Call to CCPP timestep_init step failed')
Expand All @@ -279,8 +279,8 @@ subroutine update_atmos_radiation_physics (Atmos)

endif

! Calculate total non-physics tendencies by substracting old IPD Stateout
! variables from new/updated IPD Statein variables (gives the tendencies
! Calculate total non-physics tendencies by substracting old GFS Stateout
! variables from new/updated GFS Statein variables (gives the tendencies
! due to anything else than physics)
if (GFS_control%ldiag3d) then
do nb = 1,Atm_block%nblks
Expand All @@ -305,7 +305,7 @@ subroutine update_atmos_radiation_physics (Atmos)

if (mpp_pe() == mpp_root_pe() .and. debug) write(6,*) "radiation driver"

!--- execute the IPD atmospheric radiation subcomponent (RRTM)
!--- execute the atmospheric radiation subcomponent (RRTM)

call mpp_clock_begin(radClock)
! Performance improvement. Only enter if it is time to call the radiation physics.
Expand All @@ -322,11 +322,19 @@ subroutine update_atmos_radiation_physics (Atmos)

if (mpp_pe() == mpp_root_pe() .and. debug) write(6,*) "physics driver"

!--- execute the IPD atmospheric physics step1 subcomponent (main physics driver)
!--- execute the atmospheric physics step1 subcomponent (main physics driver)

call mpp_clock_begin(physClock)
call CCPP_step (step="physics", nblks=Atm_block%nblks, ierr=ierr)
if (ierr/=0) call mpp_error(FATAL, 'Call to CCPP physics step failed')
if (trim(ccpp_suite)=='FV3_GFS_v16') then
call CCPP_step (step="surface_physics", nblks=Atm_block%nblks, ierr=ierr)
if (ierr/=0) call mpp_error(FATAL, 'Call to CCPP surface physics step failed')
if (mpp_pe() == mpp_root_pe() .and. debug) write(6,*) "time to do something facy between surface and atmosphere physics"
call CCPP_step (step="atmosphere_physics", nblks=Atm_block%nblks, ierr=ierr)
if (ierr/=0) call mpp_error(FATAL, 'Call to CCPP atmosphere physics step failed')
else
call CCPP_step (step="physics", nblks=Atm_block%nblks, ierr=ierr)
if (ierr/=0) call mpp_error(FATAL, 'Call to CCPP physics step failed')
end if
call mpp_clock_end(physClock)

if (chksum_debug) then
Expand All @@ -336,7 +344,7 @@ subroutine update_atmos_radiation_physics (Atmos)

if (mpp_pe() == mpp_root_pe() .and. debug) write(6,*) "stochastic physics driver"

!--- execute the IPD atmospheric physics step2 subcomponent (stochastic physics driver)
!--- execute the atmospheric physics step2 subcomponent (stochastic physics driver)

call mpp_clock_begin(physClock)
call CCPP_step (step="stochastics", nblks=Atm_block%nblks, ierr=ierr)
Expand All @@ -350,7 +358,7 @@ subroutine update_atmos_radiation_physics (Atmos)
call getiauforcing(GFS_control,IAU_data)
if (mpp_pe() == mpp_root_pe() .and. debug) write(6,*) "end of radiation and physics step"

!--- execute the IPD atmospheric timestep finalize step
!--- execute the atmospheric timestep finalize step
call mpp_clock_begin(setupClock)
call CCPP_step (step="timestep_finalize", nblks=Atm_block%nblks, ierr=ierr)
if (ierr/=0) call mpp_error(FATAL, 'Call to CCPP timestep_finalize step failed')
Expand Down Expand Up @@ -462,6 +470,7 @@ subroutine atmos_model_init (Atmos, Time_init, Time, Time_step)

allocate(DYCORE_Data(Atm_block%nblks))
allocate(GFS_data(Atm_block%nblks))
allocate(GFS_suite_interstitial(Atm_block%nblks))

#ifdef _OPENMP
nthrds = omp_get_max_threads()
Expand Down Expand Up @@ -501,7 +510,7 @@ subroutine atmos_model_init (Atmos, Time_init, Time, Time_step)
do i = 1, ntracers
call get_tracer_names(MODEL_ATMOS, i, tracer_names(i))
enddo
!--- setup IPD Init_parm
!--- setup Init_parm
Init_parm%me = mpp_pe()
Init_parm%master = mpp_root_pe()
Init_parm%tile_num = tile_num
Expand Down Expand Up @@ -543,9 +552,9 @@ subroutine atmos_model_init (Atmos, Time_init, Time, Time_step)
endif
#endif

call GFS_initialize (GFS_control, GFS_data%Statein, GFS_data%Stateout, GFS_data%Sfcprop, &
GFS_data%Coupling, GFS_data%Grid, GFS_data%Tbd, GFS_data%Cldprop, GFS_data%Radtend, &
GFS_data%Intdiag, GFS_interstitial, commglobal, mpp_npes(), Init_parm)
call GFS_initialize (GFS_Control, GFS_Data%Statein, GFS_Data%Stateout, GFS_Data%Sfcprop, GFS_Data%Coupling, &
GFS_Data%Grid, GFS_Data%Tbd, GFS_Data%Cldprop, GFS_Data%Radtend, GFS_Data%Intdiag, &
GFS_suite_Interstitial, GFS_Interstitial, commglobal, mpp_npes(), Init_parm)

!--- populate/associate the Diag container elements
call GFS_externaldiag_populate (GFS_Diag, GFS_Control, GFS_Data%Statein, GFS_Data%Stateout, &
Expand Down Expand Up @@ -668,7 +677,7 @@ subroutine atmos_model_init (Atmos, Time_init, Time, Time_step)

!if in coupled mode, set up coupled fields
if (GFS_control%cplflx .or. GFS_control%cplwav) then
if (mpp_pe() == mpp_root_pe()) print *,'COUPLING: IPD layer'
if (mpp_pe() == mpp_root_pe()) print *,'COUPLING: CCPP layer'
call setup_exportdata(ierr)
endif

Expand Down Expand Up @@ -887,7 +896,7 @@ subroutine atmos_model_end (Atmos)
call stochastic_physics_wrapper_end(GFS_control)

! Fast physics (from dynamics) are finalized in atmosphere_end above;
! standard/slow physics (from IPD) are finalized in CCPP_step 'finalize'.
! standard/slow physics (from CCPP) are finalized in CCPP_step 'finalize'.
! The CCPP framework for all cdata structures is finalized in CCPP_step 'finalize'.
call CCPP_step (step="finalize", nblks=Atm_block%nblks, ierr=ierr)
if (ierr/=0) call mpp_error(FATAL, 'Call to CCPP finalize step failed')
Expand Down Expand Up @@ -1613,10 +1622,10 @@ subroutine assign_importdata(rc)
if (GFS_data(nb)%Sfcprop%oceanfrac(ix) > zero .and. datar8(i,j) > zorlmin) then
tem = 100.0_GFS_kind_phys * min(0.1_GFS_kind_phys, datar8(i,j))
! GFS_data(nb)%Coupling%zorlwav_cpl(ix) = tem
GFS_data(nb)%Sfcprop%zorlo(ix) = tem
GFS_data(nb)%Sfcprop%zorlw(ix) = tem
GFS_data(nb)%Sfcprop%zorlwav(ix) = tem
else
GFS_data(nb)%Sfcprop%zorlw(ix) = -999.0_GFS_kind_phys
GFS_data(nb)%Sfcprop%zorlwav(ix) = -999.0_GFS_kind_phys

endif
enddo
Expand Down
25 changes: 13 additions & 12 deletions ccpp/config/ccpp_prebuild_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,19 @@
'CCPP_data' : '',
},
'GFS_typedefs' : {
'GFS_control_type' : 'GFS_Control',
'GFS_interstitial_type' : 'GFS_Interstitial(cdata%thrd_no)',
'GFS_data_type' : 'GFS_Data(cdata%blk_no)',
'GFS_diag_type' : 'GFS_Data(cdata%blk_no)%Intdiag',
'GFS_tbd_type' : 'GFS_Data(cdata%blk_no)%Tbd',
'GFS_sfcprop_type' : 'GFS_Data(cdata%blk_no)%Sfcprop',
'GFS_coupling_type' : 'GFS_Data(cdata%blk_no)%Coupling',
'GFS_statein_type' : 'GFS_Data(cdata%blk_no)%Statein',
'GFS_cldprop_type' : 'GFS_Data(cdata%blk_no)%Cldprop',
'GFS_radtend_type' : 'GFS_Data(cdata%blk_no)%Radtend',
'GFS_grid_type' : 'GFS_Data(cdata%blk_no)%Grid',
'GFS_stateout_type' : 'GFS_Data(cdata%blk_no)%Stateout',
'GFS_control_type' : 'GFS_Control',
'GFS_suite_interstitial_type' : 'GFS_Suite_Interstitial(cdata%blk_no)',
'GFS_interstitial_type' : 'GFS_Interstitial(cdata%thrd_no)',
'GFS_data_type' : 'GFS_Data(cdata%blk_no)',
'GFS_diag_type' : 'GFS_Data(cdata%blk_no)%Intdiag',
'GFS_tbd_type' : 'GFS_Data(cdata%blk_no)%Tbd',
'GFS_sfcprop_type' : 'GFS_Data(cdata%blk_no)%Sfcprop',
'GFS_coupling_type' : 'GFS_Data(cdata%blk_no)%Coupling',
'GFS_statein_type' : 'GFS_Data(cdata%blk_no)%Statein',
'GFS_cldprop_type' : 'GFS_Data(cdata%blk_no)%Cldprop',
'GFS_radtend_type' : 'GFS_Data(cdata%blk_no)%Radtend',
'GFS_grid_type' : 'GFS_Data(cdata%blk_no)%Grid',
'GFS_stateout_type' : 'GFS_Data(cdata%blk_no)%Stateout',
'GFS_typedefs' : '',
},
'mo_gas_concentrations' : {
Expand Down
13 changes: 8 additions & 5 deletions ccpp/data/CCPP_data.F90
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ module CCPP_data

use ccpp_types, only: ccpp_t
use CCPP_typedefs, only: CCPP_interstitial_type
use GFS_typedefs, only: GFS_control_type, &
GFS_data_type, &
use GFS_typedefs, only: GFS_control_type, &
GFS_data_type, &
GFS_suite_interstitial_type, &
GFS_interstitial_type

implicit none
Expand All @@ -21,15 +22,17 @@ module CCPP_data
CCPP_interstitial, &
GFS_control, &
GFS_data, &
GFS_suite_interstitial, &
GFS_interstitial

!-------------------------------------------------------!
! GFS data containers, GFS_Data has dimension nblocks !
! and GFS_Interstitial has dimension nthreads !
!-------------------------------------------------------!
type(GFS_control_type), save, target :: GFS_control
type(GFS_data_type), dimension(:), allocatable, save, target :: GFS_data
type(GFS_interstitial_type), dimension(:), allocatable, save, target :: GFS_interstitial
type(GFS_control_type), save, target :: GFS_control
type(GFS_data_type), dimension(:), allocatable, save, target :: GFS_data
type(GFS_suite_interstitial_type), dimension(:), allocatable, save, target :: GFS_suite_interstitial
type(GFS_interstitial_type), dimension(:), allocatable, save, target :: GFS_interstitial

!------------------------------------------------------!
! CCPP data containers for dynamics (fast physics) !
Expand Down
12 changes: 12 additions & 0 deletions ccpp/data/CCPP_data.meta
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
units = DDT
dimensions = ()
type = GFS_data_type
[GFS_Suite_Interstitial(ccpp_block_number)]
standard_name = GFS_suite_interstitial_type_instance
long_name = instance of derived type GFS_suite_interstitial_type
units = DDT
dimensions = ()
type = GFS_suite_interstitial_type
[GFS_Interstitial(ccpp_thread_number)]
standard_name = GFS_interstitial_type_instance
long_name = instance of derived type GFS_interstitial_type
Expand All @@ -42,6 +48,12 @@
units = DDT
dimensions = (ccpp_block_count)
type = GFS_data_type
[GFS_Suite_Interstitial]
standard_name = GFS_suite_interstitial_type_instance_all_blocks
long_name = instance of derived type GFS_suite_interstitial_type
units = DDT
dimensions = (ccpp_block_count)
type = GFS_suite_interstitial_type
[GFS_Interstitial]
standard_name = GFS_interstitial_type_instance_all_threads
long_name = instance of derived type GFS_interstitial_type
Expand Down
Loading