Skip to content

Commit

Permalink
Remove IPD steps 3 and 5 (cleanup preprocessor directives) (#50)
Browse files Browse the repository at this point in the history
* Add calls to ccpp_physics_timestep_init and ccpp_physics_timestep_finalize to model/fv_dynamics.F90
* Clean up CCPP preprocessor directives in dycore
* Replace IPD DDTs with GFS DDTs
* Introduce logic to switch between using GFS data types and IPD data types
* Cosmetic changes in driver/fvGFS/atmosphere.F90
  • Loading branch information
climbfuji committed Jan 14, 2021
1 parent 34a6fdf commit 00397ef
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 1,499 deletions.
1 change: 0 additions & 1 deletion docs/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ INPUT = ./documentation.dox \
../model/boundary.F90 \
../model/dyn_core.F90 \
../model/fv_arrays.F90 \
../model/fv_cmp.F90 \
../model/fv_control.F90 \
../model/fv_dynamics.F90 \
../model/fv_fill.F90 \
Expand Down
31 changes: 11 additions & 20 deletions driver/fvGFS/atmosphere.F90
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,11 @@ module atmosphere_mod
use tracer_manager_mod, only: get_tracer_index, get_number_tracers, &
NO_TRACER, get_tracer_names
use DYCORE_typedefs, only: DYCORE_data_type
#ifdef GFS_TYPES
use GFS_typedefs, only: IPD_data_type => GFS_data_type, kind_phys
#else
use IPD_typedefs, only: IPD_data_type, kind_phys => IPD_kind_phys
#endif
use fv_iau_mod, only: IAU_external_data_type

!-----------------
Expand Down Expand Up @@ -243,10 +247,7 @@ module atmosphere_mod
logical :: cold_start = .false. ! used in initial condition

integer, dimension(:), allocatable :: id_tracerdt_dyn
integer :: sphum, liq_wat, rainwat, ice_wat, snowwat, graupel ! condensate species tracer indices
#ifdef CCPP
integer :: cld_amt
#endif
integer :: sphum, liq_wat, rainwat, ice_wat, snowwat, graupel, cld_amt ! condensate species tracer indices

integer :: mygrid = 1
integer :: p_split = 1
Expand All @@ -271,15 +272,15 @@ module atmosphere_mod
!! including the grid structures, memory, initial state (self-initialization or restart),
!! and diagnostics.
subroutine atmosphere_init (Time_init, Time, Time_step, Grid_box, area)
#ifdef CCPP

use ccpp_static_api, only: ccpp_physics_init
use CCPP_data, only: ccpp_suite, &
cdata => cdata_tile, &
CCPP_interstitial
#ifdef OPENMP
use omp_lib
#endif
#endif

type (time_type), intent(in) :: Time_init, Time, Time_step
type(grid_box_type), intent(inout) :: Grid_box
real(kind=kind_phys), pointer, dimension(:,:), intent(inout) :: area
Expand All @@ -289,11 +290,7 @@ subroutine atmosphere_init (Time_init, Time, Time_step, Grid_box, area)
logical :: do_atmos_nudge
character(len=32) :: tracer_name, tracer_units
real :: ps1, ps2
#ifdef CCPP
integer :: nthreads
integer :: ierr
#endif

integer :: nthreads, ierr
integer :: nlunit = 9999
character (len = 64) :: fn_nml = 'input.nml'

Expand Down Expand Up @@ -354,9 +351,7 @@ subroutine atmosphere_init (Time_init, Time, Time_step, Grid_box, area)
rainwat = get_tracer_index (MODEL_ATMOS, 'rainwat' )
snowwat = get_tracer_index (MODEL_ATMOS, 'snowwat' )
graupel = get_tracer_index (MODEL_ATMOS, 'graupel' )
#ifdef CCPP
cld_amt = get_tracer_index (MODEL_ATMOS, 'cld_amt')
#endif

if (max(sphum,liq_wat,ice_wat,rainwat,snowwat,graupel) > Atm(mygrid)%flagstruct%nwat) then
call mpp_error (FATAL,' atmosphere_init: condensate species are not first in the list of &
Expand Down Expand Up @@ -425,7 +420,6 @@ subroutine atmosphere_init (Time_init, Time, Time_step, Grid_box, area)

call timing_off('ATMOS_INIT')

#ifdef CCPP
! Do CCPP fast physics initialization before call to adiabatic_init (since this calls fv_dynamics)

! For fast physics running over the entire domain, block
Expand Down Expand Up @@ -474,7 +468,6 @@ subroutine atmosphere_init (Time_init, Time, Time_step, Grid_box, area)
call mpp_error (FATAL, cdata%errmsg)
end if
end if
#endif

! --- initiate the start for a restarted regional forecast
if ( Atm(mygrid)%gridstruct%regional .and. Atm(mygrid)%flagstruct%warm_start ) then
Expand Down Expand Up @@ -693,17 +686,16 @@ end subroutine atmosphere_dynamics
!>@brief The subroutine 'atmosphere_end' is an API for the termination of the
!! FV3 dynamical core responsible for writing out a restart and final diagnostic state.
subroutine atmosphere_end (Time, Grid_box, restart_endfcst)
#ifdef CCPP

use ccpp_static_api, only: ccpp_physics_finalize
use CCPP_data, only: ccpp_suite
use CCPP_data, only: cdata => cdata_tile
#endif

type (time_type), intent(in) :: Time
type(grid_box_type), intent(inout) :: Grid_box
logical, intent(in) :: restart_endfcst

#ifdef CCPP
integer :: ierr

if (Atm(mygrid)%flagstruct%do_sat_adj) then
! Finalize fast physics
call ccpp_physics_finalize(cdata, suite_name=trim(ccpp_suite), group_name="fast_physics", ierr=ierr)
Expand All @@ -712,7 +704,6 @@ subroutine atmosphere_end (Time, Grid_box, restart_endfcst)
call mpp_error (FATAL, cdata%errmsg)
end if
end if
#endif

! initialize domains for writing global physics data
call set_domain ( Atm(mygrid)%domain )
Expand Down
7 changes: 0 additions & 7 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ else
$(info )
endif

ifneq (,$(findstring CCPP,$(CPPDEFS)))
FAST_PHYSICS_SRCS_F90 =
else
FAST_PHYSICS_SRCS_F90 = ./model/fv_cmp.F90
endif

LIBRARY = libfv3core.a

FFLAGS += -I$(FMS_DIR) -I../gfsphysics -I../ipd -I../io -I.
Expand All @@ -37,7 +31,6 @@ SRCS_F90 = \
./model/boundary.F90 \
./model/dyn_core.F90 \
./model/fv_arrays.F90 \
$(FAST_PHYSICS_SRCS_F90) \
./model/fv_control.F90 \
./model/fv_dynamics.F90 \
./model/fv_fill.F90 \
Expand Down
Loading

0 comments on commit 00397ef

Please sign in to comment.