diff --git a/CCPP_layer/CCPP_driver.F90 b/CCPP_layer/CCPP_driver.F90 new file mode 100644 index 000000000..449aaf03c --- /dev/null +++ b/CCPP_layer/CCPP_driver.F90 @@ -0,0 +1,310 @@ +module CCPP_driver + +#ifdef STATIC +! For static builds, the ccpp_physics_{init,run,finalize} calls +! are not pointing to code in the CCPP framework, but to auto-generated +! ccpp_suite_cap and ccpp_group_*_cap modules behind a ccpp_static_api + use ccpp_api, only: ccpp_t, & + ccpp_init, & + ccpp_finalize, & + ccpp_initialized + use ccpp_static_api, only: ccpp_physics_init, & + ccpp_physics_run, & + ccpp_physics_finalize +#else + use ccpp_api, only: ccpp_t, & + ccpp_init, & + ccpp_finalize, & + ccpp_physics_init, & + ccpp_physics_run, & + ccpp_physics_finalize, & + ccpp_field_add, & + ccpp_initialized, & + ccpp_error +#endif + + use CCPP_data, only: cdata_tile, & + cdata_domain, & + cdata_block, & + ccpp_suite, & + GFS_control + +#ifndef STATIC +! Begin include auto-generated list of modules for ccpp +#include "ccpp_modules_slow_physics.inc" +! End include auto-generated list of modules for ccpp + use iso_c_binding, only: c_loc +#endif + + implicit none + +!--------------------------------------------------------! +! Pointer to CCPP containers defined in CCPP_data ! +!--------------------------------------------------------! + type(ccpp_t), pointer :: cdata => null() + +!--------------------------------------------------------! +! Flag for non-uniform block sizes (last block smaller) ! +! and number of OpenMP threads (with special thread ! +! number nthrdsX in case of non-uniform block sizes) ! +!--------------------------------------------------------! + logical :: non_uniform_blocks + integer :: nthrds, nthrdsX + +!---------------- +! Public Entities +!---------------- +! functions + public CCPP_step +! module variables + public non_uniform_blocks + + CONTAINS +!******************************************************************************************* + +!------------------------------- +! CCPP step +!------------------------------- + subroutine CCPP_step (step, nblks, ierr) + +#ifdef OPENMP + use omp_lib +#endif + + implicit none + + character(len=*), intent(in) :: step + integer, target, intent(in) :: nblks + integer, intent(out) :: ierr + ! Local variables + integer :: nb, nt, ntX + integer :: ierr2 + + ierr = 0 + + if (trim(step)=="init") then + + ! Get and set number of OpenMP threads (module + ! variable) that are available to run physics +#ifdef OPENMP + nthrds = omp_get_max_threads() +#else + nthrds = 1 +#endif + + ! For non-uniform blocksizes, we use index nthrds+1 + ! for the interstitial data type with different length + if (non_uniform_blocks) then + nthrdsX = nthrds+1 + else + nthrdsX = nthrds + end if + + !--- Initialize CCPP framework, if cdata_tile for fast physics + ! is already initialized, use its suite to avoid reading the + ! SDF multiple times. Initialize cdata for the entire domain: + if (ccpp_initialized(cdata_tile)) then + call ccpp_init(trim(ccpp_suite), cdata_domain, ierr=ierr, cdata_target=cdata_tile) + else + call ccpp_init(trim(ccpp_suite), cdata_domain, ierr=ierr) + end if + if (ierr/=0) then + write(0,*) 'An error occurred in ccpp_init' + return + end if + + ! For physics running over the entire domain, block and thread + ! number are not used; set to safe values + cdata_domain%blk_no = 1 + cdata_domain%thrd_no = 1 + +#ifndef STATIC + ! Associate cdata with the global/domain cdata structure; + ! this is needed because ccpp_fields.inc uses 'cdata' in + ! its ccpp_field_add statements. + associate_domain: associate (cdata => cdata_domain) +! Begin include auto-generated list of calls to ccpp_field_add +#include "ccpp_fields_slow_physics.inc" +! End include auto-generated list of calls to ccpp_field_add + end associate associate_domain +#endif + + ! Allocate cdata structures for blocks and threads + allocate(cdata_block(1:nblks,1:nthrdsX)) + + ! Loop over all blocks and threads + do nt=1,nthrdsX + do nb=1,nblks + !--- Initialize CCPP framework for blocks/threads, use suite from scalar cdata + ! to avoid reading the SDF multiple times. If cdata_tile is initialized, use + ! this version (since cdata_domain is just a copy), otherwise use cdata_domain + if (ccpp_initialized(cdata_tile)) then + call ccpp_init(trim(ccpp_suite), cdata_block(nb,nt), ierr=ierr, cdata_target=cdata_tile) + else + call ccpp_init(trim(ccpp_suite), cdata_block(nb,nt), ierr=ierr, cdata_target=cdata_domain) + end if + if (ierr/=0) then + write(0,'(2(a,i4))') "An error occurred in ccpp_init for block ", nb, " and thread ", nt + return + end if + + ! Assign the correct block and thread numbers + cdata_block(nb,nt)%blk_no = nb + cdata_block(nb,nt)%thrd_no = nt + +#ifndef STATIC + ! Associate cdata with the cdata structure for this block + ! and thread; this is needed because ccpp_fields.inc uses + ! 'cdata' in its ccpp_field_add statements. + associate_block: associate (cdata => cdata_block(nb,nt)) +! Begin include auto-generated list of calls to ccpp_field_add +#include "ccpp_fields_slow_physics.inc" +! End include auto-generated list of calls to ccpp_field_add + end associate associate_block +#endif + + end do + end do + + else if (trim(step)=="physics_init") then + + ! Since the physics init steps are independent of the blocking structure, + ! we can use cdata_domain here. Since we don't use threading on the outside, + ! we can allow threading inside the time_vary routines. + GFS_control%nthreads = nthrds + +#ifdef STATIC + call ccpp_physics_init(cdata_domain, suite_name=trim(ccpp_suite), ierr=ierr) +#else + call ccpp_physics_init(cdata_domain, ierr=ierr) +#endif + if (ierr/=0) then + write(0,'(a)') "An error occurred in ccpp_physics_init" + write(0,'(a)') trim(cdata_domain%errmsg) + return + end if + + else if (trim(step)=="time_vary") then + + ! Since the time_vary steps only use data structures for all blocks (except the + ! CCPP-internal variables ccpp_error_flag and ccpp_error_message, which are defined + ! for all cdata structures independently), we can use cdata_domain here. + ! Since we don't use threading on the outside, we can allow threading + ! inside the time_vary routines. + GFS_control%nthreads = nthrds + +#ifdef STATIC + call ccpp_physics_run(cdata_domain, suite_name=trim(ccpp_suite), group_name="time_vary", ierr=ierr) +#else + call ccpp_physics_run(cdata_domain, group_name="time_vary", ierr=ierr) +#endif + if (ierr/=0) then + write(0,'(a)') "An error occurred in ccpp_physics_run for group time_vary" + write(0,'(a)') trim(cdata_domain%errmsg) + return + end if + + ! Radiation and stochastic physics + else if (trim(step)=="radiation" .or. trim(step)=="physics" .or. trim(step)=="stochastics") then + + ! Set number of threads available to physics schemes to one, + ! because threads are used on the outside for blocking + GFS_control%nthreads = 1 + +!$OMP parallel num_threads (nthrds) & +!$OMP default (shared) & +!$OMP private (nb,nt,ntX,ierr2) & +!$OMP reduction (+:ierr) +#ifdef OPENMP + nt = omp_get_thread_num()+1 +#else + nt = 1 +#endif +!$OMP do schedule (dynamic,1) + do nb = 1,nblks + ! For non-uniform blocks, the last block has a different (shorter) + ! length than the other blocks; use special CCPP_Interstitial(nthrdsX) + if (non_uniform_blocks .and. nb==nblks) then + ntX = nthrdsX + else + ntX = nt + end if + !--- Call CCPP radiation/physics/stochastics group +#ifdef STATIC + call ccpp_physics_run(cdata_block(nb,ntX), suite_name=trim(ccpp_suite), group_name=trim(step), ierr=ierr2) +#else + call ccpp_physics_run(cdata_block(nb,ntX), group_name=trim(step), ierr=ierr2) +#endif + if (ierr2/=0) then + write(0,'(2a,3(a,i4),a)') "An error occurred in ccpp_physics_run for group ", trim(step), & + ", block ", nb, " and thread ", nt, " (ntX=", ntX, ")" + write(0,'(a)') trim(cdata_block(nb,nt)%errmsg) + ierr = ierr + ierr2 + end if + end do +!$OMP end do + +!$OMP end parallel + if (ierr/=0) return + + ! Finalize + else if (trim(step)=="finalize") then + + ! Loop over blocks, don't use threading on the outside but allowing threading + ! inside the finalization, similar to what is done for the initialization + GFS_control%nthreads = nthrds + + ! Fast physics are finalized in atmosphere_end, loop over + ! all blocks and threads to finalize all other physics + do nt=1,nthrdsX + do nb=1,nblks + !--- Finalize CCPP physics +#ifdef STATIC + call ccpp_physics_finalize(cdata_block(nb,nt), suite_name=trim(ccpp_suite), ierr=ierr) +#else + call ccpp_physics_finalize(cdata_block(nb,nt), ierr=ierr) +#endif + if (ierr/=0) then + write(0,'(a,i4,a,i4)') "An error occurred in ccpp_physics_finalize for block ", nb, " and thread ", nt + write(0,'(a)') trim(cdata_block(nb,nt)%errmsg) + return + end if + !--- Finalize CCPP framework for blocks/threads + call ccpp_finalize(cdata_block(nb,nt), ierr=ierr) + if (ierr/=0) then + write(0,'(a,i4,a,i4)') "An error occurred in ccpp_finalize for block ", nb, " and thread ", nt + return + end if + end do + end do + + ! Deallocate cdata structure for blocks and threads + deallocate(cdata_block) + + !--- Finalize CCPP framework for domain + call ccpp_finalize(cdata_domain, ierr=ierr) + if (ierr/=0) then + write(0,'(a)') "An error occurred in ccpp_finalize" + return + end if + + !--- Finalize CCPP framework for fast physics last (all other frameworks point to cdata_tile's suite) + if (ccpp_initialized(cdata_tile)) then + call ccpp_finalize(cdata_tile, ierr) + if (ierr/=0) then + write(0,'(a)') "An error occurred in ccpp_finalize" + return + end if + end if + + else + + write(0,'(2a)') 'Error, undefined CCPP step ', trim(step) + ierr = 1 + return + + end if + + end subroutine CCPP_step + +end module CCPP_driver diff --git a/CCPP_layer/makefile b/CCPP_layer/makefile new file mode 100644 index 000000000..d84e4e01c --- /dev/null +++ b/CCPP_layer/makefile @@ -0,0 +1,73 @@ +SHELL = /bin/sh + +inside_nems := $(wildcard ../../../conf/configure.nems) +ifneq ($(strip $(inside_nems)),) + include ../../../conf/configure.nems +else + exist_configure_fv3 := $(wildcard ../conf/configure.fv3) + ifneq ($(strip $(exist_configure_fv3)),) + include ../conf/configure.fv3 + else + $(error "../conf/configure.fv3 file is missing. Run ./configure") + endif + $(info ) + $(info Build CCPP layer ...) + $(info ) +endif + +CCPP_DRIVER = CCPP_driver.F90 + +LIBRARY = libccppdriver.a + +# Needed for ccpp_data.mod, fv_arrays_mod.mod, ... +FFLAGS += -I$(FMS_DIR) -I../gfsphysics -I../atmos_cubed_sphere + +#CPPDEFS += -DNEW_TAUCTMAX -DSMALL_PE -DNEMS_GSM -DINTERNAL_FILE_NML + +# Set flags for 32-bit dynamics build +ifeq ($(DYN32),Y) +CPPDEFS += -DOVERLOAD_R4 +endif + +SRCS_F90 = \ + CCPP_driver.F90 + +SRCS_c = + +DEPEND_FILES = $(SRCS_f) $(SRCS_f90) $(SRCS_F) $(SRCS_F90) + +OBJS_f = $(SRCS_f:.f=.o) +OBJS_f90 = $(SRCS_f90:.f90=.o) +OBJS_F = $(SRCS_F:.F=.o) +OBJS_F90 = $(SRCS_F90:.F90=.o) +OBJS_c = $(SRCS_c:.c=.o) + +OBJS = $(OBJS_f) $(OBJS_f90) $(OBJS_F) $(OBJS_F90) $(OBJS_c) + +all default: depend $(LIBRARY) + +$(LIBRARY): $(OBJS) + $(AR) $(ARFLAGS) $@ $? + +# Do preprocessing of the CCPP driver in two steps to be +# able to look at the actual .f90 file that gets compiled +./CCPP_driver.o: ./CCPP_driver.F90 + $(CPP) $(CPPDEFS) $(CPPFLAGS) $< > $*.tmp.f90 + $(FC) $(FFLAGS) $(OTHER_FFLAGS) -c $*.tmp.f90 -o $@ + +.PHONY: clean +clean: + @echo "Cleaning CCPP_layer ... " + @echo + $(RM) -f $(LIBRARY) *__genmod.f90 *.tmp.f90 *.o */*.o *.mod *.i90 *.lst *.i depend + +MKDEPENDS = ../mkDepends.pl +include ../conf/make.rules + +include ./depend + +# do not include 'depend' file if the target contains string 'clean' +ifneq (clean,$(findstring clean,$(MAKECMDGOALS))) + -include depend +endif + diff --git a/atmos_cubed_sphere/driver/fvGFS/atmosphere.F90 b/atmos_cubed_sphere/driver/fvGFS/atmosphere.F90 index 26da3028b..48b8d1d54 100644 --- a/atmos_cubed_sphere/driver/fvGFS/atmosphere.F90 +++ b/atmos_cubed_sphere/driver/fvGFS/atmosphere.F90 @@ -188,7 +188,7 @@ module atmosphere_mod use fv_update_phys_mod, only: fv_update_phys use fv_nwp_nudge_mod, only: fv_nwp_nudge_init, fv_nwp_nudge_end, do_adiabatic_init #ifdef MULTI_GASES -use multi_gases_mod, only: virq, virq_max, num_gas +use multi_gases_mod, only: virq, virq_max, num_gas, ri, cpi #endif use fv_regional_mod, only: start_regional_restart, read_new_bc_data, & a_step, p_step, current_time_in_seconds @@ -241,6 +241,9 @@ module atmosphere_mod 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 :: mytile = 1 integer :: p_split = 1 @@ -265,6 +268,32 @@ 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 +#ifdef STATIC +! For static builds, the ccpp_physics_{init,run,finalize} calls +! are not pointing to code in the CCPP framework, but to auto-generated +! ccpp_suite_cap and ccpp_group_*_cap modules behind a ccpp_static_api + use ccpp_api, only: ccpp_init + use ccpp_static_api, only: ccpp_physics_init +#else + use iso_c_binding, only: c_loc + use ccpp_api, only: ccpp_init, & + ccpp_physics_init, & + ccpp_field_add, & + ccpp_error +#endif + use CCPP_data, only: ccpp_suite, & + cdata => cdata_tile, & + CCPP_interstitial +#ifdef OPENMP + use omp_lib +#endif +#ifndef STATIC +! Begin include auto-generated list of modules for ccpp +#include "ccpp_modules_fast_physics.inc" +! End include auto-generated list of modules for ccpp +#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 @@ -274,6 +303,10 @@ 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 current_time_in_seconds = time_type_to_real( Time - Time_init ) if (mpp_pe() == 0) write(*,"('atmosphere_init: current_time_seconds = ',f9.1)")current_time_in_seconds @@ -335,6 +368,9 @@ 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(mytile)%flagstruct%nwat) then call mpp_error (FATAL,' atmosphere_init: condensate species are not first in the list of & @@ -403,6 +439,72 @@ 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) + + ! Initialize the cdata structure + call ccpp_init(trim(ccpp_suite), cdata, ierr) + if (ierr/=0) then + cdata%errmsg = ' atmosphere_dynamics: error in ccpp_init: ' // trim(cdata%errmsg) + call mpp_error (FATAL, cdata%errmsg) + end if + + ! For fast physics running over the entire domain, block and thread + ! number are not used; set to safe values + cdata%blk_no = 1 + cdata%thrd_no = 1 + + ! Create shared data type for fast and slow physics, one for each thread +#ifdef OPENMP + nthreads = omp_get_max_threads() +#else + nthreads = 1 +#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(mytile)%bd%is, Atm(mytile)%bd%ie, Atm(mytile)%bd%isd, Atm(mytile)%bd%ied, & + Atm(mytile)%bd%js, Atm(mytile)%bd%je, Atm(mytile)%bd%jsd, Atm(mytile)%bd%jed, & + Atm(mytile)%npz, Atm(mytile)%ng, & + dt_atmos, p_split, Atm(mytile)%flagstruct%k_split, & + zvir, Atm(mytile)%flagstruct%p_ref, Atm(mytile)%ak, Atm(mytile)%bk, & + cld_amt>0, kappa, Atm(mytile)%flagstruct%hydrostatic, & + Atm(mytile)%flagstruct%do_sat_adj, & + Atm(mytile)%delp, Atm(mytile)%delz, Atm(mytile)%gridstruct%area_64, & + Atm(mytile)%peln, Atm(mytile)%phis, Atm(mytile)%pkz, Atm(mytile)%pt, & +#ifdef MULTI_GASES + Atm(mytile)%q(:,:,:,1:max(1,num_gas)), & +#else + Atm(mytile)%q(:,:,:,1:1), & +#endif + Atm(mytile)%q(:,:,:,sphum), Atm(mytile)%q(:,:,:,liq_wat), & + Atm(mytile)%q(:,:,:,ice_wat), Atm(mytile)%q(:,:,:,rainwat), & + Atm(mytile)%q(:,:,:,snowwat), Atm(mytile)%q(:,:,:,graupel), & + Atm(mytile)%q(:,:,:,cld_amt), Atm(mytile)%q_con, nthreads, & + Atm(mytile)%flagstruct%nwat, & +#ifdef MULTI_GASES + ngas=num_gas, rilist=ri, cpilist=cpi, & +#endif + mpirank=mpp_pe(), mpiroot=mpp_root_pe()) + +#ifndef STATIC +! Populate cdata structure with fields required to run fast physics (auto-generated). +#include "ccpp_fields_fast_physics.inc" +#endif + + if (Atm(mytile)%flagstruct%do_sat_adj) then + ! Initialize fast physics +#ifdef STATIC + call ccpp_physics_init(cdata, suite_name=trim(ccpp_suite), group_name="fast_physics", ierr=ierr) +#else + call ccpp_physics_init(cdata, group_name="fast_physics", ierr=ierr) +#endif + if (ierr/=0) then + cdata%errmsg = ' atmosphere_dynamics: error in ccpp_physics_init for group fast_physics: ' // trim(cdata%errmsg) + call mpp_error (FATAL, cdata%errmsg) + end if + end if +#endif + ! --- initiate the start for a restarted regional forecast if ( Atm(mytile)%gridstruct%regional .and. Atm(mytile)%flagstruct%warm_start ) then @@ -611,9 +713,38 @@ 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) +#ifdef CCPP +#ifdef STATIC +! For static builds, the ccpp_physics_{init,run,finalize} calls +! are not pointing to code in the CCPP framework, but to auto-generated +! ccpp_suite_cap and ccpp_group_*_cap modules behind a ccpp_static_api + use ccpp_static_api, only: ccpp_physics_finalize + use CCPP_data, only: ccpp_suite +#else + use ccpp_api, only: ccpp_physics_finalize +#endif + use CCPP_data, only: cdata => cdata_tile +#endif type (time_type), intent(in) :: Time type(grid_box_type), intent(inout) :: Grid_box +#ifdef CCPP + integer :: ierr + + if (Atm(mytile)%flagstruct%do_sat_adj) then + ! Finalize fast physics +#ifdef STATIC + call ccpp_physics_finalize(cdata, suite_name=trim(ccpp_suite), group_name="fast_physics", ierr=ierr) +#else + call ccpp_physics_finalize(cdata, group_name="fast_physics", ierr=ierr) +#endif + if (ierr/=0) then + cdata%errmsg = ' atmosphere_dynamics: error in ccpp_physics_finalize for group fast_physics: ' // trim(cdata%errmsg) + call mpp_error (FATAL, cdata%errmsg) + end if + end if +#endif + call nullify_domain ( ) if (first_diag) then call timing_on('FV_DIAG') @@ -957,7 +1088,7 @@ subroutine atmosphere_diss_est (npass) Atm(mytile)%domain, npx, npy, npz, 3, Atm(mytile)%bd) enddo ! provide back sqrt of dissipation estimate - Atm(mytile)%diss_est=sqrt(Atm(mytile)%diss_est) + Atm(mytile)%diss_est=sqrt(abs(Atm(mytile)%diss_est)) end subroutine atmosphere_diss_est @@ -1250,7 +1381,7 @@ subroutine get_stock_pe(index, value) end subroutine get_stock_pe -!>@brief The subroutine 'atmospehre_state_update' is an API to apply tendencies +!>@brief The subroutine 'atmosphere_state_update' is an API to apply tendencies !! and compute a consistent prognostic state. subroutine atmosphere_state_update (Time, IPD_Data, IAU_Data, Atm_block, flip_vc) type(time_type), intent(in) :: Time @@ -1475,7 +1606,7 @@ end subroutine atmosphere_state_update !! to pre-condition a solution via backward-forward steps with capability for various !! nudgings. subroutine adiabatic_init(zvir,nudge_dz,time) - type(time_type),intent(in) :: Time + type(time_type),intent(in) :: time real, allocatable, dimension(:,:,:):: u0, v0, t0, dz0, dp0 real, intent(in) :: zvir logical, intent(inout):: nudge_dz diff --git a/atmos_cubed_sphere/driver/fvGFS/fv_nggps_diag.F90 b/atmos_cubed_sphere/driver/fvGFS/fv_nggps_diag.F90 index 96ef9111c..f8c8f94b9 100644 --- a/atmos_cubed_sphere/driver/fvGFS/fv_nggps_diag.F90 +++ b/atmos_cubed_sphere/driver/fvGFS/fv_nggps_diag.F90 @@ -748,7 +748,7 @@ subroutine fv_nggps_tavg(Atm, Time_step_atmos,avg_max_length,zvir) .and. id_uhmax25 > 0 .and. id_uhmin25 > 0 .and. id_maxvort01 > 0 & .and. id_maxvorthy1 > 0 .and. id_maxvort02 > 0) then allocate ( vort(isco:ieco,jsco:jeco,npzo) ) - if(first_call == .true.) then + if (first_call) then call get_time (Time_step_atmos, seconds, days) first_time=seconds first_call=.false. diff --git a/atmos_cubed_sphere/makefile b/atmos_cubed_sphere/makefile index de18b2abb..7b029e0ee 100644 --- a/atmos_cubed_sphere/makefile +++ b/atmos_cubed_sphere/makefile @@ -15,6 +15,12 @@ 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../namphysics @@ -31,7 +37,7 @@ SRCS_F90 = \ ./model/boundary.F90 \ ./model/dyn_core.F90 \ ./model/fv_arrays.F90 \ - ./model/fv_cmp.F90 \ + $(FAST_PHYSICS_SRCS_F90) \ ./model/fv_control.F90 \ ./model/fv_dynamics.F90 \ ./model/fv_fill.F90 \ @@ -90,6 +96,7 @@ $(LIBRARY): $(OBJS) ./model/nh_utils.o : ./model/nh_utils.F90 $(FC) $(CPPDEFS) $(FPPFLAGS) $(FFLAGS) $(OTHER_FFLAGS) $(FAST) -c $< -o $@ +# For PROD/TRANSITION, this is overwritten below ./model/fv_mapz.o : ./model/fv_mapz.F90 $(FC) $(CPPDEFS) $(FPPFLAGS) $(FFLAGS) $(OTHER_FFLAGS) $(FAST) -c $< -o $@ @@ -100,6 +107,20 @@ $(LIBRARY): $(OBJS) ./driver/fvGFS/atmosphere.o : ./driver/fvGFS/atmosphere.F90 $(FC) $(CPPDEFS) $(FPPFLAGS) $(FFLAGS) $(OTHER_FFLAGS) $(ESMF_INC) -c $< -o $@ +# For CCPP acceptance: reduce optimization for certain files to +# obtain bit-for-bit identical results in PROD mode on Theia/Intel 15 +ifneq (,$(findstring TRANSITION,$(CPPDEFS))) +FFLAGS_LOPT=$(subst CORE-AVX2,CORE-AVX-I,\ + $(subst no-prec-div,prec-div,\ + $(subst no-prec-sqrt,prec-sqrt,$(FFLAGS)))) +./model/dyn_core.o : ./model/dyn_core.F90 + $(FC) $(CPPDEFS) $(FPPFLAGS) $(FFLAGS_LOPT) $(OTHER_FFLAGS) -c $< -o $@ +./model/fv_mapz.o : ./model/fv_mapz.F90 + $(FC) $(CPPDEFS) $(FPPFLAGS) $(FFLAGS_LOPT) $(OTHER_FFLAGS) $(FAST) -c $< -o $@ +./model/fv_cmp.o : ./model/fv_cmp.F90 + $(FC) $(CPPDEFS) $(FPPFLAGS) $(FFLAGS_LOPT) $(OTHER_FFLAGS) -c $< -o $@ +endif # (,$(findstring TRANSITION,$(CPPDEFS))) + .PHONY: clean clean: @echo "Cleaning fv3core ... " diff --git a/atmos_cubed_sphere/model/fv_control.F90 b/atmos_cubed_sphere/model/fv_control.F90 index e2228bcf2..e87b01963 100644 --- a/atmos_cubed_sphere/model/fv_control.F90 +++ b/atmos_cubed_sphere/model/fv_control.F90 @@ -154,7 +154,9 @@ module fv_control_mod #ifdef MULTI_GASES use constants_mod, only: rvgas, cp_air - use multi_gases_mod, only: multi_gases_init + use multi_gases_mod, only: multi_gases_init, & + rilist => ri, & + cpilist => cpi #endif implicit none @@ -672,7 +674,6 @@ subroutine run_setup(Atm, dt_atmos, grids_on_this_pe, p_split) namelist /test_case_nml/test_case, bubble_do, alpha, nsolitons, soliton_Umax, soliton_size #ifdef MULTI_GASES namelist /multi_gases_nml/ rilist,cpilist - real, allocatable :: rilist(:), cpilist(:) #endif @@ -756,8 +757,6 @@ subroutine run_setup(Atm, dt_atmos, grids_on_this_pe, p_split) if( is_master() ) print *,' enter multi_gases: ncnst = ',ncnst allocate (rilist(0:ncnst)) allocate (cpilist(0:ncnst)) - allocate (rilist(0:ncnst)) - allocate (cpilist(0:ncnst)) rilist = 0.0 cpilist = 0.0 rilist(0) = rdgas @@ -779,7 +778,7 @@ subroutine run_setup(Atm, dt_atmos, grids_on_this_pe, p_split) write(unit, nml=test_case_nml) #ifdef MULTI_GASES write(unit, nml=multi_gases_nml) - call multi_gases_init(ncnst,nwat,rilist,cpilist) + call multi_gases_init(ncnst,nwat) #endif if (len_trim(grid_file) /= 0) Atm(n)%flagstruct%grid_file = grid_file diff --git a/atmos_cubed_sphere/model/fv_dynamics.F90 b/atmos_cubed_sphere/model/fv_dynamics.F90 index 27ee0e722..42aa487d6 100644 --- a/atmos_cubed_sphere/model/fv_dynamics.F90 +++ b/atmos_cubed_sphere/model/fv_dynamics.F90 @@ -179,6 +179,11 @@ subroutine fv_dynamics(npx, npy, npz, nq_tot, ng, bdt, consv_te, fill, gridstruct, flagstruct, neststruct, idiag, bd, & parent_grid, domain, diss_est, time_total) +#ifdef CCPP + use mpp_mod, only: FATAL, mpp_error + use CCPP_data, only: CCPP_interstitial +#endif + real, intent(IN) :: bdt !< Large time-step real, intent(IN) :: consv_te real, intent(IN) :: kappa, cp_air @@ -250,13 +255,17 @@ subroutine fv_dynamics(npx, npy, npz, nq_tot, ng, bdt, consv_te, fill, ! Local Arrays real :: ws(bd%is:bd%ie,bd%js:bd%je) +#ifndef CCPP real :: te_2d(bd%is:bd%ie,bd%js:bd%je) +#endif real :: teq(bd%is:bd%ie,bd%js:bd%je) real :: ps2(bd%isd:bd%ied,bd%jsd:bd%jed) real :: m_fac(bd%is:bd%ie,bd%js:bd%je) real :: pfull(npz) real, dimension(bd%is:bd%ie):: cvm +#ifndef CCPP real, allocatable :: dp1(:,:,:), dtdt_m(:,:,:), cappa(:,:,:) +#endif #ifdef MULTI_GASES real, allocatable :: kapad(:,:,:) #endif @@ -267,12 +276,27 @@ subroutine fv_dynamics(npx, npy, npz, nq_tot, ng, bdt, consv_te, fill, integer :: sphum, liq_wat = -999, ice_wat = -999 ! GFDL physics integer :: rainwat = -999, snowwat = -999, graupel = -999, cld_amt = -999 integer :: theta_d = -999 +#ifdef CCPP + logical used, do_omega +#else logical used, last_step, do_omega +#endif integer, parameter :: max_packs=12 type(group_halo_update_type), save :: i_pack(max_packs) integer :: is, ie, js, je integer :: isd, ied, jsd, jed real :: dt2 +#ifdef CCPP + integer :: ierr +#endif + +#ifdef CCPP + ccpp_associate: associate( cappa => CCPP_interstitial%cappa, & + dp1 => CCPP_interstitial%te0, & + dtdt_m => CCPP_interstitial%dtdt, & + last_step => CCPP_interstitial%last_step, & + te_2d => CCPP_interstitial%te0_2d ) +#endif is = bd%is ie = bd%ie @@ -292,11 +316,21 @@ subroutine fv_dynamics(npx, npy, npz, nq_tot, ng, bdt, consv_te, fill, nwat = flagstruct%nwat nq = nq_tot - flagstruct%dnats rdg = -rdgas * agrav + +#ifdef CCPP + + ! Reset all interstitial variables for CCPP version + ! of fast physics, and manually set runtime parameters + call CCPP_interstitial%reset() + if (flagstruct%do_sat_adj) then + CCPP_interstitial%out_dt = (idiag%id_mdt > 0) + end if + +#else + te_2d = 0. + allocate ( dp1(isd:ied, jsd:jed, 1:npz) ) -#ifdef MULTI_GASES - allocate ( kapad(isd:ied, jsd:jed, npz) ) - call init_ijk_mem(isd,ied, jsd,jed, npz, kapad, kappa) -#endif + call init_ijk_mem(isd,ied, jsd,jed, npz, dp1, 0.) #ifdef MOIST_CAPPA allocate ( cappa(isd:ied,jsd:jed,npz) ) @@ -305,6 +339,13 @@ subroutine fv_dynamics(npx, npy, npz, nq_tot, ng, bdt, consv_te, fill, allocate ( cappa(isd:isd,jsd:jsd,1) ) cappa = 0. #endif +#endif + +#ifdef MULTI_GASES + allocate ( kapad(isd:ied, jsd:jed, npz) ) + call init_ijk_mem(isd,ied, jsd,jed, npz, kapad, kappa) +#endif + !We call this BEFORE converting pt to virtual potential temperature, !since we interpolate on (regular) temperature rather than theta. if (gridstruct%nested .or. ANY(neststruct%child_grids)) then @@ -395,7 +436,11 @@ subroutine fv_dynamics(npx, npy, npz, nq_tot, ng, bdt, consv_te, fill, enddo if ( hydrostatic ) then +#if defined(CCPP) && defined(__GFORTRAN__) +!$OMP parallel do default(none) shared(is,ie,js,je,isd,ied,jsd,jed,npz,zvir,nwat,q,q_con,sphum,liq_wat, & +#else !$OMP parallel do default(none) shared(is,ie,js,je,isd,ied,jsd,jed,npz,dp1,zvir,nwat,q,q_con,sphum,liq_wat, & +#endif !$OMP rainwat,ice_wat,snowwat,graupel) private(cvm,i,j,k) do k=1,npz do j=js,je @@ -407,12 +452,20 @@ subroutine fv_dynamics(npx, npy, npz, nq_tot, ng, bdt, consv_te, fill, enddo enddo else +#if defined(CCPP) && defined(__GFORTRAN__) +!$OMP parallel do default(none) shared(is,ie,js,je,isd,ied,jsd,jed,npz,zvir,q,q_con,sphum,liq_wat, & +#else !$OMP parallel do default(none) shared(is,ie,js,je,isd,ied,jsd,jed,npz,dp1,zvir,q,q_con,sphum,liq_wat, & +#endif !$OMP rainwat,ice_wat,snowwat,graupel,pkz,flagstruct, & #ifdef MULTI_GASES !$OMP kapad, & #endif +#if defined(CCPP) && defined(__GFORTRAN__) +!$OMP kappa,rdg,delp,pt,delz,nwat) & +#else !$OMP cappa,kappa,rdg,delp,pt,delz,nwat) & +#endif !$OMP private(cvm,i,j,k) do k=1,npz if ( flagstruct%moist_phys ) then @@ -537,8 +590,11 @@ subroutine fv_dynamics(npx, npy, npz, nq_tot, ng, bdt, consv_te, fill, pt_initialized = .true. endif else -!$OMP parallel do default(none) shared(is,ie,js,je,npz,pt, dp1,pkz,q_con) - +#if defined(CCPP) && defined(__GFORTRAN__) +!$OMP parallel do default(none) shared(is,ie,js,je,npz,pt,pkz,q_con) +#else +!$OMP parallel do default(none) shared(is,ie,js,je,npz,pt,dp1,pkz,q_con) +#endif do k=1,npz do j=js,je do i=is,ie @@ -562,6 +618,7 @@ subroutine fv_dynamics(npx, npy, npz, nq_tot, ng, bdt, consv_te, fill, last_step = .false. mdt = bdt / real(k_split) +#ifndef CCPP if ( idiag%id_mdt > 0 .and. (.not. do_adiabatic_init) ) then allocate ( dtdt_m(is:ie,js:je,npz) ) !$OMP parallel do default(none) shared(is,ie,js,je,npz,dtdt_m) @@ -573,6 +630,7 @@ subroutine fv_dynamics(npx, npy, npz, nq_tot, ng, bdt, consv_te, fill, enddo enddo endif +#endif call timing_on('FV_DYN_LOOP') do n_map=1, k_split ! first level of time-split @@ -593,7 +651,11 @@ subroutine fv_dynamics(npx, npy, npz, nq_tot, ng, bdt, consv_te, fill, call start_group_halo_update(i_pack(8), u, v, domain, gridtype=DGRID_NE) #endif call timing_off('COMM_TOTAL') +#if defined(CCPP) && defined(__GFORTRAN__) +!$OMP parallel do default(none) shared(isd,ied,jsd,jed,npz,delp) +#else !$OMP parallel do default(none) shared(isd,ied,jsd,jed,npz,dp1,delp) +#endif do k=1,npz do j=jsd,jed do i=isd,ied @@ -756,7 +818,11 @@ subroutine fv_dynamics(npx, npy, npz, nq_tot, ng, bdt, consv_te, fill, call timing_off('FV_DYN_LOOP') if ( idiag%id_mdt > 0 .and. (.not.do_adiabatic_init) ) then ! Output temperature tendency due to inline moist physics: +#if defined(CCPP) && defined(__GFORTRAN__) +!$OMP parallel do default(none) shared(is,ie,js,je,npz,bdt) +#else !$OMP parallel do default(none) shared(is,ie,js,je,npz,dtdt_m,bdt) +#endif do k=1,npz do j=js,je do i=is,ie @@ -766,7 +832,9 @@ subroutine fv_dynamics(npx, npy, npz, nq_tot, ng, bdt, consv_te, fill, enddo ! call prt_mxm('Fast DTDT (deg/Day)', dtdt_m, is, ie, js, je, 0, npz, 1., gridstruct%area_64, domain) used = send_data(idiag%id_mdt, dtdt_m, fv_time) +#ifndef CCPP deallocate ( dtdt_m ) +#endif endif if( nwat == 6 ) then @@ -848,7 +916,11 @@ subroutine fv_dynamics(npx, npy, npz, nq_tot, ng, bdt, consv_te, fill, endif if( (flagstruct%consv_am.or.idiag%id_amdt>0) .and. (.not.do_adiabatic_init) ) then -!$OMP parallel do default(none) shared(is,ie,js,je,te_2d,teq,dt2,ps2,ps,idiag) +#if defined(CCPP) && defined(__GFORTRAN__) +!$OMP parallel do default(none) shared(is,ie,js,je,teq,dt2,ps2,ps,idiag) +#else +!$OMP parallel do default(none) shared(is,ie,js,je,te_2d,teq,dt2,ps2,ps,idiag) +#endif do j=js,je do i=is,ie ! Note: the mountain torque computation contains also numerical error @@ -895,8 +967,10 @@ subroutine fv_dynamics(npx, npy, npz, nq_tot, ng, bdt, consv_te, fill, #ifdef MULTI_GASES deallocate(kapad) #endif +#ifndef CCPP deallocate(dp1) deallocate(cappa) +#endif if ( flagstruct%fv_debug ) then call prt_mxm('UA', ua, is, ie, js, je, ng, npz, 1., gridstruct%area_64, domain) @@ -917,6 +991,10 @@ subroutine fv_dynamics(npx, npy, npz, nq_tot, ng, bdt, consv_te, fill, -50., 100., bad_range) endif +#ifdef CCPP + end associate ccpp_associate +#endif + end subroutine fv_dynamics #ifdef USE_RF_FAST diff --git a/atmos_cubed_sphere/model/fv_mapz.F90 b/atmos_cubed_sphere/model/fv_mapz.F90 index 762135fb4..222aac9c5 100644 --- a/atmos_cubed_sphere/model/fv_mapz.F90 +++ b/atmos_cubed_sphere/model/fv_mapz.F90 @@ -92,14 +92,24 @@ module fv_mapz_mod use fv_arrays_mod, only: fv_grid_type use fv_timing_mod, only: timing_on, timing_off use fv_mp_mod, only: is_master +#ifndef CCPP use fv_cmp_mod, only: qs_init, fv_sat_adj +#else +#ifdef STATIC +! For static builds, the ccpp_physics_{init,run,finalize} calls +! are not pointing to code in the CCPP framework, but to auto-generated +! ccpp_suite_cap and ccpp_group_*_cap modules behind a ccpp_static_api + use ccpp_api, only: ccpp_initialized + use ccpp_static_api, only: ccpp_physics_run + use CCPP_data, only: ccpp_suite +#else + use ccpp_api, only: ccpp_initialized, ccpp_physics_run +#endif + use CCPP_data, only: cdata => cdata_tile, CCPP_interstitial +#endif #ifdef MULTI_GASES use multi_gases_mod, only: virq, virqd, vicpqd, vicvqd, num_gas #endif -#ifdef CCPP - use ccpp_api, only: ccpp_initialized, ccpp_physics_run - use IPD_CCPP_driver, only: ccpp_cdata => cdata -#endif implicit none real, parameter:: consv_min= 0.001 !< below which no correction applies @@ -191,6 +201,10 @@ subroutine Lagrangian_to_Eulerian(last_step, consv, ps, pe, delp, pkz, pk, & real, intent(inout):: dtdt(is:ie,js:je,km) real, intent(out):: pkz(is:ie,js:je,km) !< layer-mean pk for converting t to pt real, intent(out):: te(isd:ied,jsd:jed,km) +#if !defined(CCPP) && defined(TRANSITION) + ! For bit-for-bit reproducibility + real, volatile:: volatile_var +#endif ! !DESCRIPTION: ! @@ -198,17 +212,31 @@ subroutine Lagrangian_to_Eulerian(last_step, consv, ps, pe, delp, pkz, pk, & ! SJL 03.11.04: Initial version for partial remapping ! !----------------------------------------------------------------------- +#ifdef CCPP + real, dimension(is:ie,js:je):: te_2d, zsum0, zsum1 +#else real, dimension(is:ie,js:je):: te_2d, zsum0, zsum1, dpln +#endif real, dimension(is:ie,km) :: q2, dp2 real, dimension(is:ie,km+1):: pe1, pe2, pk1, pk2, pn2, phis real, dimension(is:ie+1,km+1):: pe0, pe3 real, dimension(is:ie):: gz, cvm, qv real rcp, rg, rrg, bkh, dtmp, k1k +#ifndef CCPP logical:: fast_mp_consv +#endif integer:: i,j,k + integer:: kdelz +#ifdef CCPP + integer:: nt, liq_wat, ice_wat, rainwat, snowwat, cld_amt, graupel, iq, n, kp, k_next + integer :: ierr +#else integer:: nt, liq_wat, ice_wat, rainwat, snowwat, cld_amt, graupel, iq, n, kmp, kp, k_next +#endif + #ifdef CCPP - integer :: ccpp_ierr + ccpp_associate: associate( fast_mp_consv => CCPP_interstitial%fast_mp_consv, & + kmp => CCPP_interstitial%kmp ) #endif k1k = rdgas/cv_air ! akap / (1.-akap) = rg/Cv=0.4 @@ -225,11 +253,13 @@ subroutine Lagrangian_to_Eulerian(last_step, consv, ps, pe, delp, pkz, pk, & if ( do_sat_adj ) then fast_mp_consv = (.not.do_adiabatic_init) .and. consv>consv_min +#ifndef CCPP do k=1,km kmp = k if ( pfull(k) > 10.E2 ) exit enddo call qs_init(kmp) +#endif endif !$OMP parallel do default(none) shared(is,ie,js,je,km,pe,ptop,kord_tm,hydrostatic, & @@ -592,25 +622,55 @@ subroutine Lagrangian_to_Eulerian(last_step, consv, ps, pe, delp, pkz, pk, & 1000 continue +#if defined(CCPP) && defined(__GFORTRAN__) +!$OMP parallel default(none) shared(is,ie,js,je,km,ptop,u,v,pe,ua,isd,ied,jsd,jed,kord_mt, & +!$OMP te_2d,te,delp,hydrostatic,hs,rg,pt,peln, adiabatic, & +!$OMP cp,delz,nwat,rainwat,liq_wat,ice_wat,snowwat, & +!$OMP graupel,q_con,r_vir,sphum,w,pk,pkz,last_step,consv, & +!$OMP do_adiabatic_init,zsum1,zsum0,te0_2d,domain, & +!$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,cdata,CCPP_interstitial) & +#ifdef STATIC +!$OMP shared(ccpp_suite) & +#endif +#ifdef MULTI_GASES +!$OMP shared(num_gas) & +#endif +!$OMP private(pe0,pe1,pe2,pe3,qv,cvm,gz,phis,kdelz,ierr) +#elif defined(CCPP) !$OMP parallel default(none) shared(is,ie,js,je,km,kmp,ptop,u,v,pe,ua,isd,ied,jsd,jed,kord_mt, & -!$OMP te_2d,te,delp,hydrostatic,hs,rg,pt,peln, adiabatic, & -!$OMP cp,delz,nwat,rainwat,liq_wat,ice_wat,snowwat, & -!$OMP graupel,q_con,r_vir,sphum,w,pk,pkz,last_step,consv, & -!$OMP do_adiabatic_init,zsum1,zsum0,te0_2d,domain, & -!$OMP ng,gridstruct,E_Flux,pdt,dtmp,reproduce_sum,q, & -!$OMP mdt,cld_amt,cappa,dtdt,out_dt,rrg,akap,do_sat_adj, & -#ifdef CCPP -!$OMP ccpp_cdata, & +!$OMP te_2d,te,delp,hydrostatic,hs,rg,pt,peln, adiabatic, & +!$OMP cp,delz,nwat,rainwat,liq_wat,ice_wat,snowwat, & +!$OMP graupel,q_con,r_vir,sphum,w,pk,pkz,last_step,consv, & +!$OMP do_adiabatic_init,zsum1,zsum0,te0_2d,domain, & +!$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,cdata, CCPP_interstitial) & +#ifdef STATIC +!$OMP shared(ccpp_suite) & #endif #ifdef MULTI_GASES -!$OMP num_gas, & +!$OMP shared(num_gas) & #endif -!$OMP fast_mp_consv,kord_tm) & -!$OMP private(pe0,pe1,pe2,pe3,qv,cvm,gz,phis, & -#ifdef CCPP -!$OMP ccpp_ierr, & +!$OMP private(pe0,pe1,pe2,pe3,qv,cvm,gz,phis,kdelz,ierr) +#else +!$OMP parallel default(none) shared(is,ie,js,je,km,kmp,ptop,u,v,pe,ua,isd,ied,jsd,jed,kord_mt, & +!$OMP te_2d,te,delp,hydrostatic,hs,rg,pt,peln, adiabatic, & +!$OMP cp,delz,nwat,rainwat,liq_wat,ice_wat,snowwat, & +!$OMP graupel,q_con,r_vir,sphum,w,pk,pkz,last_step,consv, & +!$OMP do_adiabatic_init,zsum1,zsum0,te0_2d,domain, & +!$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) & +#ifdef TRANSITION +!$OMP private(volatile_var) & +#endif +#ifdef MULTI_GASES +!$OMP shared(num_gas) & +#endif +!$OMP private(pe0,pe1,pe2,pe3,qv,cvm,gz,phis,kdelz,dpln) #endif -!$OMP dpln) !$OMP do do k=2,km @@ -753,16 +813,19 @@ subroutine Lagrangian_to_Eulerian(last_step, consv, ps, pe, delp, pkz, pk, & ! Note: pt at this stage is T_v ! if ( (.not.do_adiabatic_init) .and. do_sat_adj ) then if ( do_sat_adj ) then + call timing_on('sat_adj2') #ifdef CCPP - if (ccpp_initialized(ccpp_cdata)) then - call ccpp_physics_run(ccpp_cdata, group_name='fast_physics', ierr=ccpp_ierr) - if (ccpp_ierr/=0) call mpp_error(FATAL, "Call to IPD-CCPP step 'fast_physics' failed") + if (ccpp_initialized(cdata)) then +#ifdef STATIC + call ccpp_physics_run(cdata, suite_name=trim(ccpp_suite), group_name='fast_physics', ierr=ierr) +#else + call ccpp_physics_run(cdata, group_name='fast_physics', ierr=ierr) +#endif + if (ierr/=0) call mpp_error(FATAL, "Call to ccpp_physics_run for group 'fast_physics' failed") else - call mpp_error (NOTE, 'fv_mapz::skip ccpp fast physics because cdata not initialized') + call mpp_error (FATAL, 'Lagrangian_to_Eulerian: can not call CCPP fast physics because cdata not initialized') endif -#endif - - call timing_on('sat_adj2') +#else !$OMP do do k=kmp,km do j=js,je @@ -770,7 +833,11 @@ subroutine Lagrangian_to_Eulerian(last_step, consv, ps, pe, delp, pkz, pk, & dpln(i,j) = peln(i,k+1,j) - peln(i,k,j) enddo enddo - + if (hydrostatic) then + kdelz = 1 + else + kdelz = k + end if call fv_sat_adj(abs(mdt), r_vir, is, ie, js, je, ng, hydrostatic, fast_mp_consv, & te(isd,jsd,k), & #ifdef MULTI_GASES @@ -779,7 +846,7 @@ subroutine Lagrangian_to_Eulerian(last_step, consv, ps, pe, delp, pkz, pk, & q(isd,jsd,k,sphum), q(isd,jsd,k,liq_wat), & q(isd,jsd,k,ice_wat), q(isd,jsd,k,rainwat), & q(isd,jsd,k,snowwat), q(isd,jsd,k,graupel), & - hs ,dpln, delz(isd:,jsd:,k), pt(isd,jsd,k), delp(isd,jsd,k), q_con(isd:,jsd:,k), & + hs ,dpln, delz(isd:,jsd:,kdelz), pt(isd,jsd,k), delp(isd,jsd,k), q_con(isd:,jsd:,k), & cappa(isd:,jsd:,k), gridstruct%area_64, dtdt(is,js,k), out_dt, last_step, cld_amt>0, q(isd,jsd,k,cld_amt)) @@ -787,13 +854,28 @@ subroutine Lagrangian_to_Eulerian(last_step, consv, ps, pe, delp, pkz, pk, & do j=js,je do i=is,ie #ifdef MOIST_CAPPA +#ifdef TRANSITION + volatile_var = log(rrg*delp(i,j,k)/delz(i,j,k)*pt(i,j,k)) + pkz(i,j,k) = exp(cappa(i,j,k)*volatile_var) +#else pkz(i,j,k) = exp(cappa(i,j,k)*log(rrg*delp(i,j,k)/delz(i,j,k)*pt(i,j,k))) +#endif +#else +#ifdef TRANSITION +#ifdef MULTI_GASES + volatile_var = log(rrg*delp(i,j,k)/delz(i,j,k)*pt(i,j,k)) + pkz(i,j,k) = exp(akap*(virqd(q(i,j,k,1:num_gas))/vicpqd(q(i,j,k,1:num_gas))*volatile_var) +#else + volatile_var = log(rrg*delp(i,j,k)/delz(i,j,k)*pt(i,j,k)) + pkz(i,j,k) = exp(akap*volatile_var) +#endif #else #ifdef MULTI_GASES pkz(i,j,k) = exp(akap*(virqd(q(i,j,k,1:num_gas))/vicpqd(q(i,j,k,1:num_gas))*log(rrg*delp(i,j,k)/delz(i,j,k)*pt(i,j,k))) #else pkz(i,j,k) = exp(akap*log(rrg*delp(i,j,k)/delz(i,j,k)*pt(i,j,k))) #endif +#endif #endif enddo enddo @@ -811,6 +893,7 @@ subroutine Lagrangian_to_Eulerian(last_step, consv, ps, pe, delp, pkz, pk, & enddo enddo endif +#endif call timing_off('sat_adj2') endif ! do_sat_adj @@ -879,6 +962,10 @@ subroutine Lagrangian_to_Eulerian(last_step, consv, ps, pe, delp, pkz, pk, & endif !$OMP end parallel +#ifdef CCPP + end associate ccpp_associate +#endif + end subroutine Lagrangian_to_Eulerian diff --git a/atmos_cubed_sphere/model/fv_regional_bc.F90 b/atmos_cubed_sphere/model/fv_regional_bc.F90 index 74d8ceb1f..1bfdf158b 100644 --- a/atmos_cubed_sphere/model/fv_regional_bc.F90 +++ b/atmos_cubed_sphere/model/fv_regional_bc.F90 @@ -106,7 +106,7 @@ module fv_regional_mod real :: current_time_in_seconds integer,save :: ncid,next_time_to_read_bcs,npz,ntracers - integer,save :: liq_water_index,o3mr_index,sphum_index !<-- Locations of tracer vbls in the tracers array + integer,save :: liq_water_index,sphum_index !<-- Locations of tracer vbls in the tracers array integer,save :: bc_hour, ntimesteps_per_bc_update real(kind=R_GRID),dimension(:,:,:),allocatable :: agrid_reg & !<-- Lon/lat of cell centers @@ -304,9 +304,8 @@ subroutine setup_regional_BC(Atm & ! call compute_regional_bc_indices(Atm%regional_bc_bounds) ! - liq_water_index=get_tracer_index(MODEL_ATMOS, 'liq_wat') - o3mr_index =get_tracer_index(MODEL_ATMOS, 'o3mr') - sphum_index =get_tracer_index(MODEL_ATMOS, 'sphum') + liq_water_index = get_tracer_index(MODEL_ATMOS, 'liq_wat') + sphum_index = get_tracer_index(MODEL_ATMOS, 'sphum') ! !----------------------------------------------------------------------- !*** Allocate the objects that will hold the boundary variables @@ -1382,6 +1381,7 @@ subroutine regional_bc_data(Atm,bc_hour & ! character(len=60) :: var_name_root integer :: nside,nt,index + logical :: required ! logical :: call_remap ! @@ -1562,19 +1562,25 @@ subroutine regional_bc_data(Atm,bc_hour & !----------------------------------------------------------------------- !*** Read the tracers specified in the field_table. If they are not !*** in the input data then print a warning and set them to 0 in the -!*** boundary. The tracers that are not advected are not in the -!*** input and BC files. +!*** boundary. Some tracers are mandatory to have, because they are +!*** used later for calculating virtual potential temperature etc. !----------------------------------------------------------------------- ! do nt = 1, ntracers call get_tracer_names(MODEL_ATMOS, nt, var_name_root) index= get_tracer_index(MODEL_ATMOS,trim(var_name_root)) + if (index==liq_water_index .or. index==sphum_index) then + required = .true. + else + required = .false. + endif call read_regional_bc_file(is_input,ie_input,js_input,je_input & ,nlev & ,ntracers & ,var_name_root & ,array_4d=tracers_input & - ,tlev=index ) + ,tlev=index & + ,required=required ) enddo ! !----------------------------------------------------------------------- @@ -2306,7 +2312,8 @@ subroutine read_regional_bc_file(is_input,ie_input & ,var_name_root & ,array_3d & ,array_4d & - ,tlev ) + ,tlev & + ,required ) !----------------------------------------------------------------------- !*** Read the boundary data from the external file generated by !*** chgres. @@ -2328,7 +2335,8 @@ subroutine read_regional_bc_file(is_input,ie_input & ! integer,intent(in),optional :: tlev !<-- Position of current tracer among all of them ! - character(len= 60),intent(in) :: var_name_root !<-- Root of variable name in the boundary file + character(len=*),intent(in) :: var_name_root !<-- Root of variable name in the boundary file + logical,intent(in),optional :: required ! !------------ !*** Output @@ -2356,12 +2364,23 @@ subroutine read_regional_bc_file(is_input,ie_input & character(len=80) :: var_name !<-- Variable name in the boundary NetCDF file ! logical :: call_get_var + logical :: required_local ! !----------------------------------------------------------------------- !*********************************************************************** !----------------------------------------------------------------------- ! !----------------------------------------------------------------------- +!*** Process optional argument required, default value is .true. +!----------------------------------------------------------------------- +! + if(present(required)) then + required_local=required + else + required_local=.true. + endif +! +!----------------------------------------------------------------------- !*** Loop through the four sides of the domain. !----------------------------------------------------------------------- ! @@ -2521,6 +2540,9 @@ subroutine read_regional_bc_file(is_input,ie_input & if(call_get_var)then if (present(array_4d)) then !<-- 4-D variable status=nf90_inq_varid(ncid,trim(var_name),var_id) + if (required_local) then + call check(status) + endif if (status /= nf90_noerr) then if (east_bc) write(0,*)' WARNING: Tracer ',trim(var_name),' not in input file' array_4d(:,:,:,tlev)=0. !<-- Tracer not in input so set to zero in boundary. diff --git a/atmos_cubed_sphere/model/fv_sg.F90 b/atmos_cubed_sphere/model/fv_sg.F90 index e10ab950a..594e54873 100644 --- a/atmos_cubed_sphere/model/fv_sg.F90 +++ b/atmos_cubed_sphere/model/fv_sg.F90 @@ -59,7 +59,9 @@ module fv_sg_mod use constants_mod, only: rdgas, rvgas, cp_air, cp_vapor, hlv, hlf, kappa, grav use tracer_manager_mod, only: get_tracer_index use field_manager_mod, only: MODEL_ATMOS +#ifndef GFS_PHYS use gfdl_cloud_microphys_mod, only: wqs1, wqs2, wqsat2_moist +#endif use fv_mp_mod, only: mp_reduce_min, is_master #ifdef MULTI_GASES use multi_gases_mod, only: virq, virqd, virq_qpz, vicpqd_qpz, vicvqd_qpz, vicpqd, vicvqd, num_gas diff --git a/atmos_cubed_sphere/model/multi_gases.F90 b/atmos_cubed_sphere/model/multi_gases.F90 index 4c6c9e155..71d02bbef 100644 --- a/atmos_cubed_sphere/model/multi_gases.F90 +++ b/atmos_cubed_sphere/model/multi_gases.F90 @@ -45,6 +45,8 @@ module multi_gases_mod integer ind_gas integer num_wat integer sphum, sphump1 + real, allocatable :: ri(:) + real, allocatable :: cpi(:) real, allocatable :: vir(:) real, allocatable :: vicp(:) real, allocatable :: vicv(:) @@ -64,7 +66,7 @@ module multi_gases_mod CONTAINS ! -------------------------------------------------------- - subroutine multi_gases_init(ngas, nwat, ri, cpi ) + subroutine multi_gases_init(ngas, nwat) !-------------------------------------------- ! !OUTPUT PARAMETERS ! Ouput: vir(i): ri/rdgas - r0/rdgas @@ -76,8 +78,6 @@ subroutine multi_gases_init(ngas, nwat, ri, cpi ) ! vicv(0): cv0/cv_air !-------------------------------------------- integer, intent(in):: ngas, nwat - real, intent(in):: ri(0:ngas) - real, intent(in):: cpi(0:ngas) ! Local: integer n real cvi(0:ngas) diff --git a/atmos_cubed_sphere/tools/external_ic.F90 b/atmos_cubed_sphere/tools/external_ic.F90 index 79ce83b2e..66157aa5e 100644 --- a/atmos_cubed_sphere/tools/external_ic.F90 +++ b/atmos_cubed_sphere/tools/external_ic.F90 @@ -222,6 +222,9 @@ subroutine get_external_ic( Atm, fv_domain, cold_start ) integer :: is, ie, js, je integer :: isd, ied, jsd, jed integer :: sphum, liq_wat, ice_wat, rainwat, snowwat, graupel +#ifdef CCPP + integer :: liq_aero, ice_aero +#endif #ifdef MULTI_GASES integer :: spfo, spfo2, spfo3 #else @@ -320,6 +323,11 @@ subroutine get_external_ic( Atm, fv_domain, cold_start ) #else o3mr = get_tracer_index(MODEL_ATMOS, 'o3mr') #endif +#ifdef CCPP + liq_aero = get_tracer_index(MODEL_ATMOS, 'liq_aero') + ice_aero = get_tracer_index(MODEL_ATMOS, 'ice_aero') +#endif + if ( liq_wat > 0 ) & call prt_maxmin('liq_wat', Atm(1)%q(:,:,:,liq_wat), is, ie, js, je, ng, Atm(1)%npz, 1.) if ( ice_wat > 0 ) & @@ -340,6 +348,12 @@ subroutine get_external_ic( Atm, fv_domain, cold_start ) #else if ( o3mr > 0 ) & call prt_maxmin('O3MR', Atm(1)%q(:,:,:,o3mr), is, ie, js, je, ng, Atm(1)%npz, 1.) +#endif +#ifdef CCPP + if ( liq_aero > 0) & + call prt_maxmin('liq_aero',Atm(1)%q(:,:,:,liq_aero),is, ie, js, je, ng, Atm(1)%npz, 1.) + if ( ice_aero > 0) & + call prt_maxmin('ice_aero',Atm(1)%q(:,:,:,ice_aero),is, ie, js, je, ng, Atm(1)%npz, 1.) #endif endif @@ -476,6 +490,7 @@ subroutine get_nggps_ic (Atm, fv_domain) character(len=64) :: fn_gfs_ics = 'gfs_data.nc' character(len=64) :: fn_sfc_ics = 'sfc_data.nc' character(len=64) :: fn_oro_ics = 'oro_data.nc' + ! DH* character(len=64) :: fn_aero_ics = 'aero_data.nc' *DH logical :: remap logical :: filtered_terrain = .true. logical :: gfs_dwinds = .true. @@ -788,6 +803,7 @@ subroutine get_nggps_ic (Atm, fv_domain) ! prognostic tracers do nt = 1, ntracers call get_tracer_names(MODEL_ATMOS, nt, tracer_name) + ! DH* if aerosols are in separate file, need to test for indices liq_aero and ice_aero and change fn_gfs_ics to fn_aero_ics *DH id_res = register_restart_field (GFS_restart, fn_gfs_ics, trim(tracer_name), q(:,:,:,nt), & mandatory=.false.,domain=Atm(n)%domain) enddo @@ -2612,7 +2628,7 @@ subroutine remap_scalar_nggps(Atm, km, npz, ncnst, ak0, bk0, psc, t_in, qa, omga real(kind=R_GRID):: pst !!! High-precision integer i,j,k,l,m, k2,iq - integer sphum, liq_wat, ice_wat, rainwat, snowwat, graupel, cld_amt + integer sphum, liq_wat, ice_wat, rainwat, snowwat, graupel, cld_amt, liq_aero, ice_aero #ifdef MULTI_GASES integer spfo, spfo2, spfo3 #else @@ -2625,34 +2641,38 @@ subroutine remap_scalar_nggps(Atm, km, npz, ncnst, ak0, bk0, psc, t_in, qa, omga js = Atm%bd%js je = Atm%bd%je - sphum = get_tracer_index(MODEL_ATMOS, 'sphum') - liq_wat = get_tracer_index(MODEL_ATMOS, 'liq_wat') - ice_wat = get_tracer_index(MODEL_ATMOS, 'ice_wat') - rainwat = get_tracer_index(MODEL_ATMOS, 'rainwat') - snowwat = get_tracer_index(MODEL_ATMOS, 'snowwat') - graupel = get_tracer_index(MODEL_ATMOS, 'graupel') - cld_amt = get_tracer_index(MODEL_ATMOS, 'cld_amt') + sphum = get_tracer_index(MODEL_ATMOS, 'sphum') + liq_wat = get_tracer_index(MODEL_ATMOS, 'liq_wat') + ice_wat = get_tracer_index(MODEL_ATMOS, 'ice_wat') + rainwat = get_tracer_index(MODEL_ATMOS, 'rainwat') + snowwat = get_tracer_index(MODEL_ATMOS, 'snowwat') + graupel = get_tracer_index(MODEL_ATMOS, 'graupel') + cld_amt = get_tracer_index(MODEL_ATMOS, 'cld_amt') #ifdef MULTI_GASES - spfo = get_tracer_index(MODEL_ATMOS, 'spfo') - spfo2 = get_tracer_index(MODEL_ATMOS, 'spfo2') - spfo3 = get_tracer_index(MODEL_ATMOS, 'spfo3') + spfo = get_tracer_index(MODEL_ATMOS, 'spfo') + spfo2 = get_tracer_index(MODEL_ATMOS, 'spfo2') + spfo3 = get_tracer_index(MODEL_ATMOS, 'spfo3') #else - o3mr = get_tracer_index(MODEL_ATMOS, 'o3mr') + o3mr = get_tracer_index(MODEL_ATMOS, 'o3mr') #endif + liq_aero = get_tracer_index(MODEL_ATMOS, 'liq_aero') + ice_aero = get_tracer_index(MODEL_ATMOS, 'ice_aero') k2 = max(10, km/2) if (mpp_pe()==1) then - print *, 'sphum = ', sphum - print *, 'clwmr = ', liq_wat + print *, 'sphum = ', sphum + print *, 'clwmr = ', liq_wat #ifdef MULTI_GASES - print *, 'spfo3 = ', spfo3 - print *, ' spfo = ', spfo - print *, 'spfo2 = ', spfo2 + print *, 'spfo3 = ', spfo3 + print *, ' spfo = ', spfo + print *, 'spfo2 = ', spfo2 #else - print *, ' o3mr = ', o3mr + print *, ' o3mr = ', o3mr #endif - print *, 'ncnst = ', ncnst + print *, 'liq_aero = ', liq_aero + print *, 'ice_aero = ', ice_aero + print *, 'ncnst = ', ncnst endif if ( sphum/=1 ) then @@ -2664,7 +2684,7 @@ subroutine remap_scalar_nggps(Atm, km, npz, ncnst, ak0, bk0, psc, t_in, qa, omga #endif !$OMP parallel do default(none) & -!$OMP shared(sphum,liq_wat,rainwat,ice_wat,snowwat,graupel,source, & +!$OMP shared(sphum,liq_wat,rainwat,ice_wat,snowwat,graupel,liq_aero,ice_aero,source, & !$OMP cld_amt,ncnst,npz,is,ie,js,je,km,k2,ak0,bk0,psc,t_in,zh,omga,qa,Atm,z500) & !$OMP private(l,m,pst,pn,gz,pe0,pn0,pe1,pn1,dp2,qp,qn1,gz_fv) do 5000 j=js,je diff --git a/atmos_cubed_sphere/tools/fv_diagnostics.F90 b/atmos_cubed_sphere/tools/fv_diagnostics.F90 index 3ac1f8e59..33de06a75 100644 --- a/atmos_cubed_sphere/tools/fv_diagnostics.F90 +++ b/atmos_cubed_sphere/tools/fv_diagnostics.F90 @@ -142,7 +142,9 @@ module fv_diagnostics_mod use sat_vapor_pres_mod, only: compute_qs, lookup_es use fv_arrays_mod, only: max_step +#ifndef GFS_PHYS use gfdl_cloud_microphys_mod, only: wqs1, qsmith_init +#endif #ifdef MULTI_GASES use multi_gases_mod, only: virq, virqd, vicpqd, vicvqd, num_gas #endif @@ -3115,7 +3117,7 @@ subroutine get_height_field(is, ie, js, je, ng, km, hydrostatic, delz, wz, pt, q logical, intent(in):: hydrostatic real, intent(out):: wz(is:ie,js:je,km+1) ! - integer i,j,k,n + integer i,j,k real gg gg = rdgas * ginv @@ -4885,7 +4887,7 @@ subroutine dbzcalc(q, pt, delp, peln, delz, & real(kind=R_GRID):: factorb_s, factorb_g real(kind=R_GRID):: temp_c, pres, sonv, gonv, ronv, z_e - integer :: i,j,k, n + integer :: i,j,k integer :: is, ie, js, je is = bd%is diff --git a/atmos_cubed_sphere/tools/fv_mp_mod.F90 b/atmos_cubed_sphere/tools/fv_mp_mod.F90 index 0e27d6e8e..cd29b5f39 100644 --- a/atmos_cubed_sphere/tools/fv_mp_mod.F90 +++ b/atmos_cubed_sphere/tools/fv_mp_mod.F90 @@ -136,6 +136,9 @@ module fv_mp_mod integer :: isd, ied, jsd, jed integer :: isc, iec, jsc, jec +#ifdef CCPP + public commglobal +#endif public mp_start, mp_assign_gid, mp_barrier, mp_stop!, npes public domain_decomp, mp_bcst, mp_reduce_max, mp_reduce_sum, mp_gather public mp_reduce_min diff --git a/atmos_model.F90 b/atmos_model.F90 index 75e7d90f7..de5635b8a 100644 --- a/atmos_model.F90 +++ b/atmos_model.F90 @@ -81,20 +81,28 @@ module atmos_model_mod use atmosphere_mod, only: Atm, mytile use block_control_mod, only: block_control_type, define_blocks_packed use DYCORE_typedefs, only: DYCORE_data_type, DYCORE_diag_type +#ifdef CCPP +use IPD_typedefs, only: IPD_init_type, IPD_diag_type, & + IPD_restart_type, IPD_kind_phys, & + IPD_func0d_proc, IPD_func1d_proc +#else use IPD_typedefs, only: IPD_init_type, IPD_control_type, & IPD_data_type, IPD_diag_type, & IPD_restart_type, IPD_kind_phys, & -#ifdef CCPP - IPD_func0d_proc, IPD_func1d_proc,& - IPD_fastphys_type -#else IPD_func0d_proc, IPD_func1d_proc #endif -use IPD_driver, only: IPD_initialize, IPD_initialize_rst, IPD_step + #ifdef CCPP -use IPD_CCPP_driver, only: IPD_CCPP_step -#endif +use CCPP_data, only: ccpp_suite, & + IPD_control => GFS_control, & + IPD_data => GFS_data, & + IPD_interstitial => GFS_interstitial +use IPD_driver, only: IPD_initialize, IPD_initialize_rst +use CCPP_driver, only: CCPP_step, non_uniform_blocks +#else +use IPD_driver, only: IPD_initialize, IPD_initialize_rst, IPD_step use physics_abstraction_layer, only: time_vary_step, radiation_step1, physics_step1, physics_step2 +#endif use FV3GFS_io_mod, only: FV3GFS_restart_read, FV3GFS_restart_write, & FV3GFS_IPD_checksum, & FV3GFS_diag_register, FV3GFS_diag_output, & @@ -157,10 +165,8 @@ module atmos_model_mod integer, parameter :: maxhr = 4096 real, dimension(maxhr) :: fdiag = 0. real :: fhmax=384.0, fhmaxhf=120.0, fhout=3.0, fhouthf=1.0,avg_max_length=3600. -namelist /atmos_model_nml/ blocksize, chksum_debug, dycore_only, debug, sync, fdiag, fhmax, fhmaxhf, fhout, fhouthf, avg_max_length #ifdef CCPP -character(len=256) :: ccpp_suite='undefined.xml' -namelist /atmos_model_nml/ blocksize, chksum_debug, dycore_only, debug, sync, fdiag, fhmax, fhmaxhf, fhout, fhouthf, ccpp_suite +namelist /atmos_model_nml/ blocksize, chksum_debug, dycore_only, debug, sync, fdiag, fhmax, fhmaxhf, fhout, fhouthf, ccpp_suite, avg_max_length #else namelist /atmos_model_nml/ blocksize, chksum_debug, dycore_only, debug, sync, fdiag, fhmax, fhmaxhf, fhout, fhouthf, avg_max_length #endif @@ -177,12 +183,15 @@ module atmos_model_mod !---------------- ! IPD containers !---------------- +#ifndef CCPP type(IPD_control_type) :: IPD_Control type(IPD_data_type), allocatable :: IPD_Data(:) ! number of blocks type(IPD_diag_type), target :: IPD_Diag(DIAG_SIZE) type(IPD_restart_type) :: IPD_Restart -#ifdef CCPP -type(IPD_fastphys_type) :: IPD_Fastphys +#else +! IPD_Control and IPD_Data are coming from CCPP_data +type(IPD_diag_type), target :: IPD_Diag(DIAG_SIZE) +type(IPD_restart_type) :: IPD_Restart #endif !-------------- @@ -237,6 +246,9 @@ subroutine update_atmos_radiation_physics (Atmos) integer :: nb, jdat(8), rc procedure(IPD_func0d_proc), pointer :: Func0d => NULL() procedure(IPD_func1d_proc), pointer :: Func1d => NULL() +#ifdef CCPP + integer :: ierr +#endif if (mpp_pe() == mpp_root_pe() .and. debug) write(6,*) "statein driver" !--- get atmospheric state from the dynamic core call set_atmosphere_pelist() @@ -264,8 +276,13 @@ subroutine update_atmos_radiation_physics (Atmos) !--- execute the IPD atmospheric setup step call mpp_clock_begin(setupClock) +#ifdef CCPP + call CCPP_step (step="time_vary", nblks=Atm_block%nblks, ierr=ierr) + if (ierr/=0) call mpp_error(FATAL, 'Call to CCPP time_vary step failed') +#else Func1d => time_vary_step call IPD_step (IPD_Control, IPD_Data(:), IPD_Diag, IPD_Restart, IPD_func1d=Func1d) +#endif !--- if coupled, assign coupled fields if( IPD_Control%cplflx .or. IPD_Control%cplwav ) then ! print *,'in atmos_model,nblks=',Atm_block%nblks @@ -283,6 +300,13 @@ subroutine update_atmos_radiation_physics (Atmos) !--- execute the IPD atmospheric radiation subcomponent (RRTM) call mpp_clock_begin(radClock) +#ifdef CCPP + ! Performance improvement. Only enter if it is time to call the radiation physics. + if (IPD_Control%lsswr .or. IPD_Control%lslwr) then + call CCPP_step (step="radiation", nblks=Atm_block%nblks, ierr=ierr) + if (ierr/=0) call mpp_error(FATAL, 'Call to CCPP radiation step failed') + endif +#else Func0d => radiation_step1 !$OMP parallel do default (none) & !$OMP schedule (dynamic,1), & @@ -291,6 +315,7 @@ subroutine update_atmos_radiation_physics (Atmos) do nb = 1,Atm_block%nblks call IPD_step (IPD_Control, IPD_Data(nb:nb), IPD_Diag, IPD_Restart, IPD_func0d=Func0d) enddo +#endif call mpp_clock_end(radClock) if (chksum_debug) then @@ -303,6 +328,10 @@ subroutine update_atmos_radiation_physics (Atmos) !--- execute the IPD atmospheric physics step1 subcomponent (main physics driver) call mpp_clock_begin(physClock) +#ifdef CCPP + call CCPP_step (step="physics", nblks=Atm_block%nblks, ierr=ierr) + if (ierr/=0) call mpp_error(FATAL, 'Call to CCPP physics step failed') +#else Func0d => physics_step1 !$OMP parallel do default (none) & !$OMP schedule (dynamic,1), & @@ -311,6 +340,7 @@ subroutine update_atmos_radiation_physics (Atmos) do nb = 1,Atm_block%nblks call IPD_step (IPD_Control, IPD_Data(nb:nb), IPD_Diag, IPD_Restart, IPD_func0d=Func0d) enddo +#endif call mpp_clock_end(physClock) if (chksum_debug) then @@ -323,6 +353,10 @@ subroutine update_atmos_radiation_physics (Atmos) !--- execute the IPD atmospheric physics step2 subcomponent (stochastic physics driver) call mpp_clock_begin(physClock) +#ifdef CCPP + call CCPP_step (step="stochastics", nblks=Atm_block%nblks, ierr=ierr) + if (ierr/=0) call mpp_error(FATAL, 'Call to CCPP stochastics step failed') +#else Func0d => physics_step2 !$OMP parallel do default (none) & !$OMP schedule (dynamic,1), & @@ -331,6 +365,7 @@ subroutine update_atmos_radiation_physics (Atmos) do nb = 1,Atm_block%nblks call IPD_step (IPD_Control, IPD_Data(nb:nb), IPD_Diag, IPD_Restart, IPD_func0d=Func0d) enddo +#endif call mpp_clock_end(physClock) if (chksum_debug) then @@ -341,6 +376,10 @@ subroutine update_atmos_radiation_physics (Atmos) if (mpp_pe() == mpp_root_pe() .and. debug) write(6,*) "end of radiation and physics step" endif +#ifdef CCPP + ! Update flag for first time step of time integration + IPD_Control%first_time_step = .false. +#endif !----------------------------------------------------------------------- end subroutine update_atmos_radiation_physics ! @@ -355,6 +394,14 @@ end subroutine update_atmos_radiation_physics subroutine atmos_model_init (Atmos, Time_init, Time, Time_step) +#ifdef CCPP +#ifdef OPENMP + use omp_lib +#endif + use fv_mp_mod, only: commglobal + use mpp_mod, only: mpp_npes +#endif + type (atmos_data_type), intent(inout) :: Atmos type (time_type), intent(in) :: Time_init, Time, Time_step !--- local variables --- @@ -376,6 +423,10 @@ subroutine atmos_model_init (Atmos, Time_init, Time, Time_step) integer :: bdat(8), cdat(8) integer :: ntracers, maxhf, maxh character(len=32), allocatable, target :: tracer_names(:) +#ifdef CCPP + integer :: nthrds +#endif + !----------------------------------------------------------------------- !---- set the atmospheric model time ------ @@ -391,9 +442,11 @@ subroutine atmos_model_init (Atmos, Time_init, Time, Time_step) !----------------------------------------------------------------------- ! initialize atmospheric model ----- +#ifndef CCPP !---------- initialize atmospheric dynamics ------- call atmosphere_init (Atmos%Time_init, Atmos%Time, Atmos%Time_step,& Atmos%grid, Atmos%area) +#endif IF ( file_exist('input.nml')) THEN #ifdef INTERNAL_FILE_NML @@ -410,6 +463,13 @@ subroutine atmos_model_init (Atmos, Time_init, Time, Time_step) #endif endif +#ifdef CCPP +!---------- initialize atmospheric dynamics after reading the namelist ------- +!---------- (need name of CCPP suite definition file from input.nml) --------- + call atmosphere_init (Atmos%Time_init, Atmos%Time, Atmos%Time_step,& + Atmos%grid, Atmos%area) +#endif + !----------------------------------------------------------------------- call atmosphere_resolution (nlon, nlat, global=.false.) call atmosphere_resolution (mlon, mlat, global=.true.) @@ -433,6 +493,34 @@ subroutine atmos_model_init (Atmos, Time_init, Time, Time_step) allocate(DYCORE_Data(Atm_block%nblks)) allocate(IPD_Data(Atm_block%nblks)) +#ifdef CCPP +#ifdef OPENMP + nthrds = omp_get_max_threads() +#else + nthrds = 1 +#endif + + ! This logic deals with non-uniform block sizes for CCPP. + ! When non-uniform block sizes are used, it is required + ! that only the last block has a different (smaller) + ! size than all other blocks. This is the standard in + ! FV3. If this is the case, set non_uniform_blocks (a + ! variable imported from CCPP_driver) to .true. and + ! allocate nthreads+1 elements of the interstitial array. + ! The extra element will be used by the thread that + ! runs over the last, smaller block. + if (minval(Atm_block%blksz)==maxval(Atm_block%blksz)) then + non_uniform_blocks = .false. + allocate(IPD_Interstitial(nthrds)) + else if (all(minloc(Atm_block%blksz)==(/size(Atm_block%blksz)/))) then + non_uniform_blocks = .true. + allocate(IPD_Interstitial(nthrds+1)) + else + call mpp_error(FATAL, 'For non-uniform blocksizes, only the last element ' // & + 'in Atm_block%blksz can be different from the others') + end if + +#endif !--- update IPD_Control%jdat(8) bdat(:) = 0 @@ -472,6 +560,10 @@ subroutine atmos_model_init (Atmos, Time_init, Time, Time_step) Init_parm%xlat => Atmos%lat Init_parm%area => Atmos%area Init_parm%tracer_names => tracer_names +#ifdef CCPP + Init_parm%restart = Atm(mytile)%flagstruct%warm_start + Init_parm%hydrostatic = Atm(mytile)%flagstruct%hydrostatic +#endif #ifdef INTERNAL_FILE_NML Init_parm%input_nml_file => input_nml_file @@ -486,14 +578,23 @@ subroutine atmos_model_init (Atmos, Time_init, Time, Time_step) #endif #ifdef CCPP -! DH* for testing of CCPP integration - ! Fast physics runs over all blocks, initialize here to avoid changing all the interfaces down to GFS_driver - call IPD_Fastphys%create() - call IPD_CCPP_step (step="init", IPD_Control=IPD_Control, IPD_Fastphys=IPD_Fastphys, ccpp_suite=trim(ccpp_suite), ierr=ierr) - if (ierr/=0) call mpp_error(FATAL, 'Call to IPD-CCPP init step failed') + call IPD_initialize (IPD_Control, IPD_Data, IPD_Diag, IPD_Restart, & + IPD_Interstitial, commglobal, mpp_npes(), Init_parm) +#else + call IPD_initialize (IPD_Control, IPD_Data, IPD_Diag, IPD_Restart, Init_parm) +#endif + +#ifdef CCPP + ! Initialize the CCPP framework + call CCPP_step (step="init", nblks=Atm_block%nblks, ierr=ierr) + if (ierr/=0) call mpp_error(FATAL, 'Call to CCPP init step failed') + ! Doing the init here requires logic in thompson aerosol init if no aerosol + ! profiles are specified and internal profiles are calculated, because these + ! require temperature/geopotential etc which are not yet set. Sim. for RUC LSM. + call CCPP_step (step="physics_init", nblks=Atm_block%nblks, ierr=ierr) + if (ierr/=0) call mpp_error(FATAL, 'Call to CCPP physics_init step failed') #endif - call IPD_initialize (IPD_Control, IPD_Data, IPD_Diag, IPD_Restart, Init_parm) Atmos%Diag => IPD_Diag Atm(mytile)%flagstruct%do_skeb = IPD_Control%do_skeb @@ -516,7 +617,11 @@ subroutine atmos_model_init (Atmos, Time_init, Time, Time_step) call atmosphere_nggps_diag (Time, init=.true.) call FV3GFS_diag_register (IPD_Diag, Time, Atm_block, IPD_Control, Atmos%lon, Atmos%lat, Atmos%axes) call IPD_initialize_rst (IPD_Control, IPD_Data, IPD_Diag, IPD_Restart, Init_parm) +#ifdef CCPP + call FV3GFS_restart_read (IPD_Data, IPD_Restart, Atm_block, IPD_Control, Atmos%domain, Atm(mytile)%flagstruct%warm_start) +#else call FV3GFS_restart_read (IPD_Data, IPD_Restart, Atm_block, IPD_Control, Atmos%domain) +#endif !--- set the initial diagnostic timestamp diag_time = Time @@ -569,6 +674,10 @@ subroutine atmos_model_init (Atmos, Time_init, Time, Time_step) fv3Clock = mpp_clock_id( 'FV3 Dycore ', flags=clock_flag_default, grain=CLOCK_COMPONENT ) endif +#ifdef CCPP + ! Set flag for first time step of time integration + IPD_Control%first_time_step = .true. +#endif !----------------------------------------------------------------------- end subroutine atmos_model_init ! @@ -766,8 +875,11 @@ subroutine atmos_model_end (Atmos) IPD_Control, Atmos%domain) #ifdef CCPP - call IPD_CCPP_step (step="finalize", ierr=ierr) - if (ierr/=0) call mpp_error(FATAL, 'Call to IPD-CCPP finalize step failed') +! Fast physics (from dynamics) are finalized in atmosphere_end above; +! standard/slow physics (from IPD) 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') #endif end subroutine atmos_model_end diff --git a/gfsphysics/CCPP_layer/CCPP_data.F90 b/gfsphysics/CCPP_layer/CCPP_data.F90 new file mode 100644 index 000000000..89fbd7b76 --- /dev/null +++ b/gfsphysics/CCPP_layer/CCPP_data.F90 @@ -0,0 +1,79 @@ +module CCPP_data + +#if 0 +!! \section arg_table_CCPP_data Argument Table +!! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional | +!! |---------------------------------|----------------------------------------------------------|---------------------------------------------------------|---------|------|------------------------|-----------|--------|----------| +!! | cdata | ccpp_t_instance | instance of derived data type ccpp_t | DDT | 0 | ccpp_t | | none | F | +!! | CCPP_interstitial | CCPP_interstitial_type_instance | instance of derived type CCPP_interstitial_type | DDT | 0 | CCPP_interstitial_type | | none | F | +!! | GFS_Control | GFS_control_type_instance | instance of derived type GFS_control_type | DDT | 0 | GFS_control_type | | none | F | +!! | GFS_Data(cdata%blk_no) | GFS_data_type_instance | instance of derived type GFS_data_type | DDT | 0 | GFS_data_type | | none | F | +!! | GFS_Data(cdata%blk_no)%Cldprop | GFS_cldprop_type_instance | instance of derived type GFS_cldprop_type | DDT | 0 | GFS_cldprop_type | | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling | GFS_coupling_type_instance | instance of derived type GFS_coupling_type | DDT | 0 | GFS_coupling_type | | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag | GFS_diag_type_instance | instance of derived type GFS_diag_type | DDT | 0 | GFS_diag_type | | none | F | +!! | GFS_Data(cdata%blk_no)%Grid | GFS_grid_type_instance | instance of derived type GFS_grid_type | DDT | 0 | GFS_grid_type | | none | F | +!! | GFS_Data(cdata%blk_no)%Radtend | GFS_radtend_type_instance | instance of derived type GFS_radtend_type | DDT | 0 | GFS_radtend_type | | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop | GFS_sfcprop_type_instance | instance of derived type GFS_sfcprop_type | DDT | 0 | GFS_sfcprop_type | | none | F | +!! | GFS_Data(cdata%blk_no)%Statein | GFS_statein_type_instance | instance of derived type GFS_statein_type | DDT | 0 | GFS_statein_type | | none | F | +!! | GFS_Data(cdata%blk_no)%Stateout | GFS_stateout_type_instance | instance of derived type GFS_stateout_type | DDT | 0 | GFS_stateout_type | | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd | GFS_tbd_type_instance | instance of derived type GFS_tbd_type | DDT | 0 | GFS_tbd_type | | none | F | +!! | GFS_Interstitial(cdata%thrd_no) | GFS_interstitial_type_instance | instance of derived type GFS_interstitial_type | DDT | 0 | GFS_interstitial_type | | none | F | +!! | GFS_Data(:) | GFS_data_type_instance_all_blocks | instance of derived type GFS_data_type | DDT | 1 | GFS_data_type | | none | F | +!! | GFS_Data(:)%Statein | GFS_statein_type_instance_all_blocks | instance of derived type GFS_statein_type | DDT | 1 | GFS_statein_type | | none | F | +!! | GFS_Data(:)%Grid | GFS_grid_type_instance_all_blocks | instance of derived type GFS_grid_type | DDT | 1 | GFS_grid_type | | none | F | +!! | GFS_Data(:)%Tbd | GFS_tbd_type_instance_all_blocks | instance of derived type GFS_tbd_type | DDT | 1 | GFS_tbd_type | | none | F | +!! | GFS_Data(:)%Sfcprop | GFS_sfcprop_type_instance_all_blocks | instance of derived type GFS_sfcprop_type | DDT | 1 | GFS_sfcprop_type | | none | F | +!! | GFS_Data(:)%Cldprop | GFS_cldprop_type_instance_all_blocks | instance of derived type GFS_cldprop_type | DDT | 1 | GFS_cldprop_type | | none | F | +!! | GFS_Data(:)%Coupling | GFS_coupling_type_instance_all_blocks | instance of derived type GFS_coupling_type | DDT | 1 | GFS_coupling_type | | none | F | +!! | GFS_Data(:)%Intdiag | GFS_diag_type_instance_all_blocks | instance of derived type GFS_diag_type | DDT | 1 | GFS_diag_type | | none | F | +!! | GFS_Interstitial(:) | GFS_interstitial_type_instance_all_threads | instance of derived type GFS_interstitial_type | DDT | 1 | GFS_interstitial_type | | none | F | +!! +#endif + + use ccpp_types, only: ccpp_t + use CCPP_typedefs, only: CCPP_interstitial_type + use GFS_typedefs, only: GFS_control_type, & + GFS_data_type, & + GFS_interstitial_type + + implicit none + + private + + public cdata_tile, & + cdata_domain, & + cdata_block, & + ccpp_suite, & + CCPP_interstitial, & + GFS_control, & + GFS_data, & + 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 + + !------------------------------------------------------! + ! CCPP data containers for dynamics (fast physics) ! + !------------------------------------------------------! + type(CCPP_interstitial_type), save, target :: CCPP_interstitial + + !------------------------------------------------------! + ! CCPP containers for the six tiles used in dynamics, ! + ! for the entire domain and for the individual blocks ! + ! with dimensions nblocks and nthreads ! + !------------------------------------------------------! + type(ccpp_t), save, target :: cdata_tile + type(ccpp_t), save, target :: cdata_domain + type(ccpp_t), dimension(:,:), allocatable, save, target :: cdata_block + + !------------------------------------------------------! + ! CCPP suite name ! + !------------------------------------------------------! + character(len=256) :: ccpp_suite='undefined' + +end module CCPP_data diff --git a/gfsphysics/CCPP_layer/CCPP_typedefs.F90 b/gfsphysics/CCPP_layer/CCPP_typedefs.F90 new file mode 100644 index 000000000..952ef5efe --- /dev/null +++ b/gfsphysics/CCPP_layer/CCPP_typedefs.F90 @@ -0,0 +1,404 @@ +module CCPP_typedefs + +#if 0 +!> \section arg_table_CCPP_typedefs Argument Table +!! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional | +!! |---------------------------------|-------------------------------------------|---------------------------------------------------|---------------|------|------------------------|-----------|--------|----------| +!! | CCPP_interstitial_type | CCPP_interstitial_type | definition of type CCPP_interstitial_type | DDT | 0 | CCPP_interstitial_type | | none | F | +!! +#endif + + use machine, only: kind_grid, kind_dyn + + implicit none + + private + + public CCPP_interstitial_type + +#if 0 +!! \section arg_table_CCPP_interstitial_type Argument Table +!! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional | +!! |---------------------------------------------------|---------------------------------------------------------------|---------------------------------------------------------------------------------------|------------|------|-----------|-----------|--------|----------| +!! | CCPP_interstitial%akap | kappa_dry_for_fast_physics | modified kappa for fast physics | none | 0 | real | kind_dyn | none | F | +!! | CCPP_interstitial%bdt | | large time step for dynamics | s | 0 | real | kind_dyn | none | F | +!! | CCPP_interstitial%cappa | cappa_moist_gas_constant_at_Lagrangian_surface | cappa(i,j,k) = rdgas / ( rdgas + cvm(i)/(1.+r_vir*q(i,j,k,sphum)) ) | none | 3 | real | kind_dyn | none | F | +!! | CCPP_interstitial%dtdt | tendency_of_air_temperature_at_Lagrangian_surface | air temperature tendency due to fast physics at Lagrangian surface | K s-1 | 3 | real | kind_dyn | none | F | +!! | CCPP_interstitial%do_qa | flag_for_inline_cloud_fraction_calculation | flag for the inline cloud fraction calculation | flag | 0 | logical | | none | F | +!! | CCPP_interstitial%fast_mp_consv | flag_for_fast_microphysics_energy_conservation | flag for fast microphysics energy conservation | flag | 0 | logical | | none | F | +!! | CCPP_interstitial%kmp | top_layer_index_for_fast_physics | top_layer_inder_for_gfdl_mp | index | 0 | integer | | none | F | +!! | CCPP_interstitial%last_step | flag_for_the_last_step_of_k_split_remapping | flag for the last step of k-split remapping | flag | 0 | logical | | none | F | +!! | CCPP_interstitial%mdt | time_step_for_remapping_for_fast_physics | remapping time step | s | 0 | real | kind_dyn | none | F | +!! | CCPP_interstitial%npzdelz | vertical_dimension_for_thickness_at_Lagrangian_surface | vertical dimension for thickness at Lagrangian surface | count | 0 | integer | | none | F | +!! | CCPP_interstitial%out_dt | flag_for_tendency_of_air_temperature_at_Lagrangian_surface | flag for calculating tendency of air temperature due to fast physics | flag | 0 | logical | | none | F | +!! | CCPP_interstitial%te0_2d | atmosphere_energy_content_in_column | atmosphere total energy in columns | J m-2 | 2 | real | kind_dyn | none | F | +!! | CCPP_interstitial%te0 | atmosphere_energy_content_at_Lagrangian_surface | atmosphere total energy at Lagrangian surface | J m-2 | 3 | real | kind_dyn | none | F | +!! | CCPP_interstitial%zvir | ratio_of_vapor_to_dry_air_gas_constants_minus_one_default_kind| zvir=rv/rd-1.0 | none | 0 | real | kind_dyn | none | F | +!! | CCPP_interstitial%do_sat_adj | flag_for_saturation_adjustment_for_microphysics_in_dynamics | flag for saturation adjustment for microphysics in dynamics | none | 0 | logical | | none | F | +!! | CCPP_interstitial%is | starting_x_direction_index | starting X direction index | count | 0 | integer | | none | F | +!! | CCPP_interstitial%ie | ending_x_direction_index | ending X direction index | count | 0 | integer | | none | F | +!! | CCPP_interstitial%isd | starting_x_direction_index_domain | starting X direction index for domain | count | 0 | integer | | none | F | +!! | CCPP_interstitial%ied | ending_x_direction_index_domain | ending X direction index for domain | count | 0 | integer | | none | F | +!! | CCPP_interstitial%js | starting_y_direction_index | starting Y direction index | count | 0 | integer | | none | F | +!! | CCPP_interstitial%je | ending_y_direction_index | ending Y direction index | count | 0 | integer | | none | F | +!! | CCPP_interstitial%jsd | starting_y_direction_index_domain | starting X direction index for domain | count | 0 | integer | | none | F | +!! | CCPP_interstitial%jed | ending_y_direction_index_domain | ending X direction index for domain | count | 0 | integer | | none | F | +!! | CCPP_interstitial%delp | pressure_thickness_at_Lagrangian_surface | pressure thickness at Lagrangian surface | Pa | 3 | real | kind_dyn | none | F | +!! | CCPP_interstitial%delz | thickness_at_Lagrangian_surface | thickness at Lagrangian_surface | m | 3 | real | kind_dyn | none | F | +!! | CCPP_interstitial%area | cell_area_for_fast_physics | area of the grid cell for fast physics | m2 | 2 | real | kind_grid | none | F | +!! | CCPP_interstitial%ng | number_of_ghost_zones | number of ghost zones defined in fv_mp | count | 0 | integer | | none | F | +!! | CCPP_interstitial%npz | vertical_dimension_for_fast_physics | number of vertical levels for fast physics | count | 0 | integer | | none | F | +!! | CCPP_interstitial%peln | log_pressure_at_Lagrangian_surface | logarithm of pressure at Lagrangian surface | Pa | 3 | real | kind_dyn | none | F | +!! | CCPP_interstitial%phis | surface_geopotential_at_Lagrangian_surface | surface geopotential at Lagrangian surface | m2 s-2 | 2 | real | kind_dyn | none | F | +!! | CCPP_interstitial%pkz | finite-volume_mean_edge_pressure_raised_to_the_power_of_kappa | finite-volume mean edge pressure raised to the power of kappa | Pa**kappa | 3 | real | kind_dyn | none | F | +!! | CCPP_interstitial%pt | virtual_temperature_at_Lagrangian_surface | virtual temperature at Lagrangian surface | K | 3 | real | kind_dyn | none | F | +!! | CCPP_interstitial%qvi | gas_tracers_for_multi_gas_physics_at_Lagrangian_surface | gas tracers for multi gas physics at Lagrangian surface | kg kg-1 | 4 | real | kind_dyn | none | F | +!! | CCPP_interstitial%qv | water_vapor_specific_humidity_at_Lagrangian_surface | water vapor specific humidity updated by fast physics at Lagrangian surface | kg kg-1 | 3 | real | kind_dyn | none | F | +!! | CCPP_interstitial%ql | cloud_liquid_water_specific_humidity_at_Lagrangian_surface | cloud liquid water specific humidity updated by fast physics at Lagrangian surface | kg kg-1 | 3 | real | kind_dyn | none | F | +!! | CCPP_interstitial%qi | cloud_ice_specific_humidity_at_Lagrangian_surface | cloud ice specific humidity updated by fast physics at Lagrangian surface | kg kg-1 | 3 | real | kind_dyn | none | F | +!! | CCPP_interstitial%qr | cloud_rain_specific_humidity_at_Lagrangian_surface | cloud rain specific humidity updated by fast physics at Lagrangian surface | kg kg-1 | 3 | real | kind_dyn | none | F | +!! | CCPP_interstitial%qs | cloud_snow_specific_humidity_at_Lagrangian_surface | cloud snow specific humidity updated by fast physics at Lagrangian surface | kg kg-1 | 3 | real | kind_dyn | none | F | +!! | CCPP_interstitial%qg | cloud_graupel_specific_humidity_at_Lagrangian_surface | cloud graupel specific humidity updated by fast physics at Lagrangian surface | kg kg-1 | 3 | real | kind_dyn | none | F | +!! | CCPP_interstitial%qc | cloud_fraction_at_Lagrangian_surface | cloud fraction at Lagrangian surface | none | 3 | real | kind_dyn | none | F | +!! | CCPP_interstitial%q_con | cloud_condensed_water_specific_humidity_at_Lagrangian_surface | cloud condensed water specific humidity updated by fast physics at Lagrangian surface | kg kg-1 | 3 | real | kind_dyn | none | F | +!! | CCPP_interstitial%nthreads | omp_threads_for_fast_physics | number of OpenMP threads available for fast physics schemes | count | 0 | integer | | none | F | +!! | CCPP_interstitial%hydrostatic | flag_for_hydrostatic_solver_for_fast_physics | flag for use the hydrostatic or nonhydrostatic solver for fast physics schemes | flag | 0 | logical | | none | F | +!! | CCPP_interstitial%nwat | number_of_water_species | number of water species | count | 0 | integer | | none | F | +!! | CCPP_interstitial%ngas | number_of_gases_for_multi_gases_physics | number of gases for multi gases physics | count | 0 | integer | | none | F | +!! | CCPP_interstitial%rilist | gas_constants_for_multi_gases_physics | gas constants for multi gases physics | J kg-1 K-1 | 1 | real | kind_dyn | none | F | +!! | CCPP_interstitial%cpilist | specific_heat_capacities_for_multi_gases_physics | specific heat capacities for multi gases physics | J kg-1 K-1 | 1 | real | kind_dyn | none | F | +!! | CCPP_interstitial%mpirank | mpi_rank_for_fast_physics | current MPI-rank for fast physics schemes | index | 0 | integer | | none | F | +!! | CCPP_interstitial%mpiroot | mpi_root_for_fast_physics | master MPI-rank for fast physics schemes | index | 0 | integer | | none | F | +!! +#endif + type CCPP_interstitial_type + + real(kind_dyn) :: akap + real(kind_dyn) :: bdt + real(kind_dyn), pointer :: cappa(:,:,:) + logical :: do_qa + real(kind_dyn), pointer :: dtdt(:,:,:) + logical :: fast_mp_consv + integer :: kmp + logical :: last_step + real(kind_dyn) :: mdt + integer :: npzdelz + logical :: out_dt + real(kind_dyn), pointer :: pfull(:) + real(kind_dyn), pointer :: te0_2d(:,:) ! called te_2d in fv_dynamics, te0_2d in Lagrangian_to_Eulerian, te0_2d in fv_sat_adj + real(kind_dyn), pointer :: te0(:,:,:) ! called dp1 in fv_dynamics, te in Lagrangian_to_Eulerian, te0 in fv_sat_adj + real(kind_dyn) :: zvir + logical :: do_sat_adj + integer :: is + integer :: ie + integer :: isd + integer :: ied + integer :: js + integer :: je + integer :: jsd + integer :: jed + integer :: ng + integer :: npz + real(kind_dyn), pointer :: delp(:,:,:) + real(kind_dyn), pointer :: delz(:,:,:) + real(kind_grid), pointer :: area(:,:) + real(kind_dyn), pointer :: peln(:,:,:) + real(kind_dyn), pointer :: phis(:,:) + real(kind_dyn), pointer :: pkz(:,:,:) + real(kind_dyn), pointer :: pt(:,:,:) + real(kind_dyn), pointer :: qvi(:,:,:,:) + real(kind_dyn), pointer :: qv(:,:,:) + real(kind_dyn), pointer :: ql(:,:,:) + real(kind_dyn), pointer :: qi(:,:,:) + real(kind_dyn), pointer :: qr(:,:,:) + real(kind_dyn), pointer :: qs(:,:,:) + real(kind_dyn), pointer :: qg(:,:,:) + real(kind_dyn), pointer :: qc(:,:,:) + real(kind_dyn), pointer :: q_con(:,:,:) + integer :: nthreads + logical :: hydrostatic + integer :: nwat + integer :: ngas + real(kind_dyn), pointer :: rilist(:) + real(kind_dyn), pointer :: cpilist(:) + integer :: mpirank + integer :: mpiroot + + contains + + procedure :: create => interstitial_create !< allocate array data + procedure :: reset => interstitial_reset !< reset array data + procedure :: mprint => interstitial_print !< print array data + + end type CCPP_interstitial_type + +contains + +!----------------------------- +! CCPP_interstitial_type +!----------------------------- + subroutine interstitial_create (Interstitial, is, ie, isd, ied, js, je, jsd, jed, npz, ng, & + dt_atmos, p_split, k_split, zvir, p_ref, ak, bk, do_qa, & + kappa, hydrostatic, do_sat_adj, & + delp, delz, area, peln, phis, pkz, pt, & + qvi, qv, ql, qi, qr, qs, qg, qc, q_con, & + nthreads, nwat, ngas, rilist, cpilist, mpirank, mpiroot) + ! + implicit none + ! + class(CCPP_interstitial_type) :: Interstitial + integer, intent(in) :: is + integer, intent(in) :: ie + integer, intent(in) :: isd + integer, intent(in) :: ied + integer, intent(in) :: js + integer, intent(in) :: je + integer, intent(in) :: jsd + integer, intent(in) :: jed + integer, intent(in) :: npz + integer, intent(in) :: ng + real(kind_dyn), intent(in) :: dt_atmos + integer, intent(in) :: p_split + integer, intent(in) :: k_split + real(kind_dyn), intent(in) :: zvir + real(kind_dyn), intent(in) :: p_ref + real(kind_dyn), intent(in) :: ak(:) + real(kind_dyn), intent(in) :: bk(:) + logical, intent(in) :: do_qa + real(kind_dyn), intent(in) :: kappa + logical, intent(in) :: hydrostatic + logical, intent(in) :: do_sat_adj + real(kind_dyn), target, intent(in) :: delp(:,:,:) + real(kind_dyn), target, intent(in) :: delz(:,:,:) + real(kind_grid), target, intent(in) :: area(:,:) + real(kind_dyn), target, intent(in) :: peln(:,:,:) + real(kind_dyn), target, intent(in) :: phis(:,:) + real(kind_dyn), target, intent(in) :: pkz(:,:,:) + real(kind_dyn), target, intent(in) :: pt(:,:,:) + real(kind_dyn), target, intent(in) :: qvi(:,:,:,:) + real(kind_dyn), target, intent(in) :: qv(:,:,:) + real(kind_dyn), target, intent(in) :: ql(:,:,:) + real(kind_dyn), target, intent(in) :: qi(:,:,:) + real(kind_dyn), target, intent(in) :: qr(:,:,:) + real(kind_dyn), target, intent(in) :: qs(:,:,:) + real(kind_dyn), target, intent(in) :: qg(:,:,:) + real(kind_dyn), target, intent(in) :: qc(:,:,:) + real(kind_dyn), target, intent(in) :: q_con(:,:,:) + integer, intent(in) :: nthreads + ! For multi-gases physics + integer, intent(in) :: nwat + integer, intent(in), optional :: ngas + real(kind_dyn), intent(in), optional :: rilist(:) + real(kind_dyn), intent(in), optional :: cpilist(:) + integer, intent(in) :: mpirank + integer, intent(in) :: mpiroot + ! +#ifdef MOIST_CAPPA + allocate (Interstitial%cappa (isd:ied, jsd:jed, 1:npz) ) +#else + allocate (Interstitial%cappa (isd:isd, jsd:jsd, 1) ) +#endif + allocate (Interstitial%dtdt (is:ie, js:je, 1:npz) ) + allocate (Interstitial%pfull (1:npz) ) + allocate (Interstitial%te0_2d (is:ie, js:je) ) + allocate (Interstitial%te0 (isd:ied, jsd:jed, 1:npz) ) + ! + ! Initialize variables to default values +#ifdef SW_DYNAMICS + Interstitial%akap = 1. +#else + Interstitial%akap = kappa +#endif + Interstitial%bdt = dt_atmos/real(abs(p_split)) + Interstitial%do_qa = do_qa + Interstitial%mdt = Interstitial%bdt/real(k_split) + ! + ! Flag for hydrostatic/non-hydrostatic physics + Interstitial%hydrostatic = hydrostatic + if (hydrostatic) then + Interstitial%npzdelz = 1 + else + Interstitial%npzdelz = npz + end if + ! + Interstitial%zvir = zvir + ! + Interstitial%do_sat_adj = do_sat_adj + Interstitial%is = is + Interstitial%ie = ie + Interstitial%isd = isd + Interstitial%ied = ied + Interstitial%js = js + Interstitial%je = je + Interstitial%jsd = jsd + Interstitial%jed = jed + Interstitial%ng = ng + Interstitial%npz = npz + ! Set up links from CCPP_interstitial DDT to ATM DDT + Interstitial%delp => delp + Interstitial%delz => delz + Interstitial%area => area + Interstitial%peln => peln + Interstitial%phis => phis + Interstitial%pkz => pkz + Interstitial%pt => pt + Interstitial%qvi => qvi + Interstitial%qv => qv + Interstitial%ql => ql + Interstitial%qi => qi + Interstitial%qr => qr + Interstitial%qs => qs + Interstitial%qg => qg + if (do_qa) then + Interstitial%qc => qc + end if + Interstitial%q_con => q_con + ! + ! Number of OpenMP threads available for schemes + Interstitial%nthreads = nthreads + ! + ! For multi-gases physics + Interstitial%nwat = nwat + ! If ngas, rilist and cpilist are present, then + ! multi-gases physics are used. If not, set ngas=1 + ! (safe value), allocate rilist/cpilist and set to zero + if(present(ngas)) then + Interstitial%ngas = ngas + else + Interstitial%ngas = 1 + end if + allocate(Interstitial%rilist(0:Interstitial%ngas)) + allocate(Interstitial%cpilist(0:Interstitial%ngas)) + if (present(rilist)) then + Interstitial%rilist = rilist + Interstitial%cpilist = cpilist + else + Interstitial%rilist = 0.0 + Interstitial%cpilist = 0.0 + end if + ! + Interstitial%mpirank = mpirank + Interstitial%mpiroot = mpiroot + ! + ! Calculate vertical pressure levels + call interstitital_calculate_pressure_levels(Interstitial, npz, p_ref, ak, bk) + ! + ! Reset all other variables + call Interstitial%reset() + ! + end subroutine interstitial_create + + subroutine interstitital_calculate_pressure_levels(Interstitial, npz, p_ref, ak, bk) + + implicit none + + class(CCPP_interstitial_type) :: Interstitial + integer, intent(in) :: npz + real(kind_dyn), intent(in) :: p_ref + real(kind_dyn), intent(in) :: ak(:) + real(kind_dyn), intent(in) :: bk(:) + + real(kind_dyn) :: ph1 + real(kind_dyn) :: ph2 + integer :: k + +#ifdef SW_DYNAMICS + Interstitial%pfull(1) = 0.5*p_ref +#else + do k=1,npz + ph1 = ak(k ) + bk(k )*p_ref + ph2 = ak(k+1) + bk(k+1)*p_ref + Interstitial%pfull(k) = (ph2 - ph1) / log(ph2/ph1) + enddo +#endif + ! DH* This is copied from fv_mapz.F90, does it work with SW_DYNAMICS? + do k=1,npz + Interstitial%kmp = k + if ( Interstitial%pfull(k) > 10.E2 ) exit + enddo + end subroutine interstitital_calculate_pressure_levels + + subroutine interstitial_reset (Interstitial) + ! + implicit none + ! + class(CCPP_interstitial_type) :: Interstitial + ! + Interstitial%cappa = 0.0 + Interstitial%dtdt = 0.0 + Interstitial%fast_mp_consv = .false. + Interstitial%last_step = .false. + Interstitial%out_dt = .false. + Interstitial%te0_2d = 0.0 + Interstitial%te0 = 0.0 + ! + end subroutine interstitial_reset + + subroutine interstitial_print(Interstitial) + ! + implicit none + ! + class(CCPP_interstitial_type) :: Interstitial + ! + ! Print static variables + write (0,'(a)') 'Interstitial_print' + write (0,*) 'Interstitial_print: values that do not change' + write (0,*) 'Interstitial%akap = ', Interstitial%akap + write (0,*) 'Interstitial%bdt = ', Interstitial%bdt + write (0,*) 'Interstitial%kmp = ', Interstitial%kmp + write (0,*) 'Interstitial%mdt = ', Interstitial%mdt + write (0,*) 'sum(Interstitial%pfull) = ', sum(Interstitial%pfull) + write (0,*) 'Interstitial%zvir = ', Interstitial%zvir + write (0,*) 'Interstitial%do_qa = ', Interstitial%do_qa + write (0,*) 'Interstitial%do_sat_adj = ', Interstitial%do_sat_adj + write (0,*) 'Interstitial%is = ', Interstitial%is + write (0,*) 'Interstitial%ie = ', Interstitial%ie + write (0,*) 'Interstitial%isd = ', Interstitial%isd + write (0,*) 'Interstitial%ied = ', Interstitial%ied + write (0,*) 'Interstitial%js = ', Interstitial%js + write (0,*) 'Interstitial%je = ', Interstitial%je + write (0,*) 'Interstitial%jsd = ', Interstitial%jsd + write (0,*) 'Interstitial%jed = ', Interstitial%jed + write (0,*) 'sum(Interstitial%area) = ', sum(Interstitial%area) + write (0,*) 'Interstitial%ng = ', Interstitial%ng + write (0,*) 'Interstitial%npz = ', Interstitial%npz + ! Print all other variables + write (0,*) 'Interstitial_print: values that change' + write (0,*) 'sum(Interstitial%cappa) = ', sum(Interstitial%cappa) + write (0,*) 'sum(Interstitial%dtdt) = ', sum(Interstitial%dtdt) + write (0,*) 'Interstitial%fast_mp_consv = ', Interstitial%fast_mp_consv + write (0,*) 'Interstitial%last_step = ', Interstitial%last_step + write (0,*) 'Interstitial%out_dt = ', Interstitial%out_dt + write (0,*) 'sum(Interstitial%te0_2d) = ', sum(Interstitial%te0_2d) + write (0,*) 'sum(Interstitial%te0) = ', sum(Interstitial%te0) + write (0,*) 'sum(Interstitial%delp) = ', Interstitial%delp + write (0,*) 'sum(Interstitial%delz) = ', Interstitial%delz + write (0,*) 'sum(Interstitial%peln) = ', Interstitial%peln + write (0,*) 'sum(Interstitial%phis) = ', Interstitial%phis + write (0,*) 'sum(Interstitial%pkz) = ', Interstitial%pkz + write (0,*) 'sum(Interstitial%pt) = ', Interstitial%pt + write (0,*) 'sum(Interstitial%qvi) = ', Interstitial%qvi + write (0,*) 'sum(Interstitial%qv) = ', Interstitial%qv + write (0,*) 'sum(Interstitial%ql) = ', Interstitial%ql + write (0,*) 'sum(Interstitial%qi) = ', Interstitial%qi + write (0,*) 'sum(Interstitial%qr) = ', Interstitial%qr + write (0,*) 'sum(Interstitial%qs) = ', Interstitial%qs + write (0,*) 'sum(Interstitial%qg) = ', Interstitial%qg + if (associated(Interstitial%qc)) then + write (0,*) 'sum(Interstitial%qc) = ', Interstitial%qc + end if + write (0,*) 'sum(Interstitial%q_con) = ', Interstitial%q_con + write (0,*) 'Interstitial%hydrostatic = ', Interstitial%hydrostatic + write (0,*) 'Interstitial%nwat = ', Interstitial%nwat + write (0,*) 'Interstitial%ngas = ', Interstitial%ngas + write (0,*) 'Interstitial%rilist = ', Interstitial%rilist + write (0,*) 'Interstitial%cpilist = ', Interstitial%cpilist + write (0,*) 'Interstitial%mpirank = ', Interstitial%mpirank + write (0,*) 'Interstitial%mpiroot = ', Interstitial%mpiroot + write (0,*) 'Interstitial%nthreads = ', Interstitial%nthreads + write (0,*) 'Interstitial_print: end' + ! + end subroutine interstitial_print + +end module CCPP_typedefs + diff --git a/gfsphysics/GFS_layer/GFS_abstraction_layer.F90 b/gfsphysics/GFS_layer/GFS_abstraction_layer.F90 index 0ef1ac858..1a63a8d8a 100644 --- a/gfsphysics/GFS_layer/GFS_abstraction_layer.F90 +++ b/gfsphysics/GFS_layer/GFS_abstraction_layer.F90 @@ -11,11 +11,10 @@ module physics_abstraction_layer tbd_type => GFS_tbd_type, & cldprop_type => GFS_cldprop_type, & radtend_type => GFS_radtend_type, & -#ifdef CCPP - intdiag_type => GFS_diag_type, & - fastphys_type => GFS_fastphys_type -#else intdiag_type => GFS_diag_type +#ifdef CCPP + use GFS_typedefs, only: interstitial_type => GFS_interstitial_type, & + data_type => GFS_data_type #endif @@ -25,15 +24,23 @@ module physics_abstraction_layer use GFS_diagnostics, only: diagnostic_type => GFS_externaldiag_type, & diagnostic_populate => GFS_externaldiag_populate +#ifdef CCPP + use GFS_driver, only: initialize => GFS_initialize +#else use GFS_driver, only: initialize => GFS_initialize, & time_vary_step => GFS_time_vary_step, & radiation_step1 => GFS_radiation_driver, & physics_step1 => GFS_physics_driver, & physics_step2 => GFS_stochastic_driver +#endif +#ifndef CCPP + ! DH* even in the non-CCPP build, these don't get used (same for NAM physics) integer :: num_time_vary_steps = 1 integer :: num_rad_steps = 1 integer :: num_phys_steps = 2 + ! *DH +#endif !------------------------- ! public physics dataspec @@ -57,24 +64,30 @@ module physics_abstraction_layer public restart_type public diagnostic_type #ifdef CCPP - public fastphys_type + public interstitial_type #endif !------------------ ! public variables !------------------ +#ifndef CCPP + ! DH* even in the non-CCPP build, these don't get used (same for NAM physics) public num_time_vary_steps public num_rad_steps public num_phys_steps + ! *DH +#endif !-------------------------- ! public physics functions !-------------------------- public initialize +#ifndef CCPP public time_vary_step public radiation_step1 public physics_step1 public physics_step2 +#endif CONTAINS diff --git a/gfsphysics/GFS_layer/GFS_diagnostics.F90 b/gfsphysics/GFS_layer/GFS_diagnostics.F90 index 113cc392e..8e2c9c074 100644 --- a/gfsphysics/GFS_layer/GFS_diagnostics.F90 +++ b/gfsphysics/GFS_layer/GFS_diagnostics.F90 @@ -1770,9 +1770,19 @@ subroutine GFS_externaldiag_populate (ExtDiag, Model, Statein, Stateout, Sfcprop ExtDiag(idx)%unit = 'XXX' ExtDiag(idx)%mod_name = 'gfs_phys' allocate (ExtDiag(idx)%data(nblks)) - do nb = 1,nblks - ExtDiag(idx)%data(nb)%var2 => IntDiag(nb)%wet1(:) - enddo +#ifdef CCPP + if (Model%lsm==Model%lsm_ruc) then + do nb = 1,nblks + ExtDiag(idx)%data(nb)%var2 => Sfcprop(nb)%wetness(:) + enddo + else +#endif + do nb = 1,nblks + ExtDiag(idx)%data(nb)%var2 => IntDiag(nb)%wet1(:) + enddo +#ifdef CCPP + endif +#endif idx = idx + 1 ExtDiag(idx)%axes = 2 @@ -2610,6 +2620,32 @@ subroutine GFS_externaldiag_populate (ExtDiag, Model, Statein, Stateout, Sfcprop ExtDiag(idx)%data(nb)%var2 => Sfcprop(nb)%snowd(:) enddo +#ifdef CCPP + if (Model%lsm == Model%lsm_ruc) then + idx = idx + 1 + ExtDiag(idx)%axes = 2 + ExtDiag(idx)%name = 'snowfall_acc' + ExtDiag(idx)%desc = 'total accumulated frozen precipitation' + ExtDiag(idx)%unit = 'kg m-2' + ExtDiag(idx)%mod_name = 'gfs_sfc' + allocate (ExtDiag(idx)%data(nblks)) + do nb = 1,nblks + ExtDiag(idx)%data(nb)%var2 => Sfcprop(nb)%snowfallac(:) + enddo + + idx = idx + 1 + ExtDiag(idx)%axes = 2 + ExtDiag(idx)%name = 'swe_snowfall_acc' + ExtDiag(idx)%desc = 'accumulated water equivalent of frozen precipitation' + ExtDiag(idx)%unit = 'kg m-2' + ExtDiag(idx)%mod_name = 'gfs_sfc' + allocate (ExtDiag(idx)%data(nblks)) + do nb = 1,nblks + ExtDiag(idx)%data(nb)%var2 => Sfcprop(nb)%acsnow(:) + enddo + endif +#endif + idx = idx + 1 ExtDiag(idx)%axes = 2 ExtDiag(idx)%name = 'crain' @@ -2770,8 +2806,47 @@ subroutine GFS_externaldiag_populate (ExtDiag, Model, Statein, Stateout, Sfcprop ExtDiag(idx)%data(nb)%var2 => sfcprop(nb)%vfrac(:) enddo +#ifdef CCPP + if (Model%lsm == Model%lsm_ruc) then + do num = 1,Model%lsoil_lsm + write (xtra,'(i1)') num + idx = idx + 1 + ExtDiag(idx)%axes = 2 + ExtDiag(idx)%name = 'slc_'//trim(xtra) + ExtDiag(idx)%desc = 'liquid soil moisture ' // trim(soil_layer_depth(Model%lsm, Model%lsm_ruc, Model%lsm_noah, num)) + ExtDiag(idx)%unit = 'm**3/m**3' + ExtDiag(idx)%mod_name = 'gfs_sfc' + allocate (ExtDiag(idx)%data(nblks)) + do nb = 1,nblks + ExtDiag(idx)%data(nb)%var2 => sfcprop(nb)%sh2o(:,num) + enddo + enddo + else + do num = 1,Model%lsoil_lsm + write (xtra,'(i1)') num + idx = idx + 1 + ExtDiag(idx)%axes = 2 + ExtDiag(idx)%name = 'slc_'//trim(xtra) +! DH* Can't use correct unit/description because of the way +! bit for bit tests are conducted (using cmp -> test fails) +#if 0 + ExtDiag(idx)%desc = 'liquid soil moisture ' // trim(soil_layer_depth(Model%lsm, Model%lsm_ruc, Model%lsm_noah, num)) + ExtDiag(idx)%unit = 'm**3/m**3' +#else + ExtDiag(idx)%desc = 'liquid soil mositure at layer-'//trim(xtra) + ExtDiag(idx)%unit = 'xxx' +#endif +! *DH + ExtDiag(idx)%mod_name = 'gfs_sfc' + allocate (ExtDiag(idx)%data(nblks)) + do nb = 1,nblks + ExtDiag(idx)%data(nb)%var2 => sfcprop(nb)%slc(:,num) + enddo + enddo + endif +#else do num = 1,4 - write (xtra,'(i1)') num + write (xtra,'(i1)') num idx = idx + 1 ExtDiag(idx)%axes = 2 ExtDiag(idx)%name = 'slc_'//trim(xtra) @@ -2783,7 +2858,39 @@ subroutine GFS_externaldiag_populate (ExtDiag, Model, Statein, Stateout, Sfcprop ExtDiag(idx)%data(nb)%var2 => sfcprop(nb)%slc(:,num) enddo enddo +#endif +#ifdef CCPP + if (Model%lsm == Model%lsm_ruc) then + do num = 1,Model%lsoil_lsm + write (xtra,'(i1)') num + idx = idx + 1 + ExtDiag(idx)%axes = 2 + ExtDiag(idx)%name = 'soilw'//trim(xtra) + ExtDiag(idx)%desc = 'volumetric soil moisture ' // trim(soil_layer_depth(Model%lsm, Model%lsm_ruc, Model%lsm_noah, num)) + ExtDiag(idx)%unit = 'fraction' + ExtDiag(idx)%mod_name = 'gfs_sfc' + allocate (ExtDiag(idx)%data(nblks)) + do nb = 1,nblks + ExtDiag(idx)%data(nb)%var2 => sfcprop(nb)%smois(:,num) + enddo + enddo + else + do num = 1,Model%lsoil_lsm + write (xtra,'(i1)') num + idx = idx + 1 + ExtDiag(idx)%axes = 2 + ExtDiag(idx)%name = 'soilw'//trim(xtra) + ExtDiag(idx)%desc = 'volumetric soil moisture ' // trim(soil_layer_depth(Model%lsm, Model%lsm_ruc, Model%lsm_noah, num)) + ExtDiag(idx)%unit = 'fraction' + ExtDiag(idx)%mod_name = 'gfs_sfc' + allocate (ExtDiag(idx)%data(nblks)) + do nb = 1,nblks + ExtDiag(idx)%data(nb)%var2 => sfcprop(nb)%smc(:,num) + enddo + enddo + endif +#else idx = idx + 1 ExtDiag(idx)%axes = 2 ExtDiag(idx)%name = 'soilw1' @@ -2827,11 +2934,43 @@ subroutine GFS_externaldiag_populate (ExtDiag, Model, Statein, Stateout, Sfcprop do nb = 1,nblks ExtDiag(idx)%data(nb)%var2 => sfcprop(nb)%smc(:,4) enddo +#endif +#ifdef CCPP + if (Model%lsm == Model%lsm_ruc) then + do num = 1,Model%lsoil_lsm + write (xtra,'(i1)') num + idx = idx + 1 + ExtDiag(idx)%axes = 2 + ExtDiag(idx)%name = 'soilt'//trim(xtra) + ExtDiag(idx)%desc = 'soil temperature ' // trim(soil_layer_depth(Model%lsm, Model%lsm_ruc, Model%lsm_noah, num)) + ExtDiag(idx)%unit = 'K' + ExtDiag(idx)%mod_name = 'gfs_sfc' + allocate (ExtDiag(idx)%data(nblks)) + do nb = 1,nblks + ExtDiag(idx)%data(nb)%var2 => sfcprop(nb)%tslb(:,num) + enddo + enddo + else + do num = 1,Model%lsoil_lsm + write (xtra,'(i1)') num + idx = idx + 1 + ExtDiag(idx)%axes = 2 + ExtDiag(idx)%name = 'soilt'//trim(xtra) + ExtDiag(idx)%desc = 'soil temperature ' // trim(soil_layer_depth(Model%lsm, Model%lsm_ruc, Model%lsm_noah, num)) + ExtDiag(idx)%unit = 'K' + ExtDiag(idx)%mod_name = 'gfs_sfc' + allocate (ExtDiag(idx)%data(nblks)) + do nb = 1,nblks + ExtDiag(idx)%data(nb)%var2 => sfcprop(nb)%stc(:,num) + enddo + enddo + endif +#else idx = idx + 1 ExtDiag(idx)%axes = 2 ExtDiag(idx)%name = 'soilt1' - ExtDiag(idx)%desc = 'soil temperature 0-10cm' + ExtDiag(idx)%desc = 'soil temperature 0-10cm' ExtDiag(idx)%unit = 'K' ExtDiag(idx)%mod_name = 'gfs_sfc' allocate (ExtDiag(idx)%data(nblks)) @@ -2842,7 +2981,7 @@ subroutine GFS_externaldiag_populate (ExtDiag, Model, Statein, Stateout, Sfcprop idx = idx + 1 ExtDiag(idx)%axes = 2 ExtDiag(idx)%name = 'soilt2' - ExtDiag(idx)%desc = 'soil temperature 10-40cm' + ExtDiag(idx)%desc = 'soil temperature 10-40cm' ExtDiag(idx)%unit = 'K' ExtDiag(idx)%mod_name = 'gfs_sfc' allocate (ExtDiag(idx)%data(nblks)) @@ -2853,7 +2992,7 @@ subroutine GFS_externaldiag_populate (ExtDiag, Model, Statein, Stateout, Sfcprop idx = idx + 1 ExtDiag(idx)%axes = 2 ExtDiag(idx)%name = 'soilt3' - ExtDiag(idx)%desc = 'soil temperature 40-100cm' + ExtDiag(idx)%desc = 'soil temperature 40-100cm' ExtDiag(idx)%unit = 'K' ExtDiag(idx)%mod_name = 'gfs_sfc' allocate (ExtDiag(idx)%data(nblks)) @@ -2864,13 +3003,14 @@ subroutine GFS_externaldiag_populate (ExtDiag, Model, Statein, Stateout, Sfcprop idx = idx + 1 ExtDiag(idx)%axes = 2 ExtDiag(idx)%name = 'soilt4' - ExtDiag(idx)%desc = 'soil temperature 100-200cm' + ExtDiag(idx)%desc = 'soil temperature 100-200cm' ExtDiag(idx)%unit = 'K' ExtDiag(idx)%mod_name = 'gfs_sfc' allocate (ExtDiag(idx)%data(nblks)) do nb = 1,nblks ExtDiag(idx)%data(nb)%var2 => sfcprop(nb)%stc(:,4) enddo +#endif !--------------------------nsst variables if (model%nstf_name(1) > 0) then @@ -3075,6 +3215,210 @@ subroutine GFS_externaldiag_populate (ExtDiag, Model, Statein, Stateout, Sfcprop enddo !--------------------------nsst variables endif + +!--------------------------aerosols +#ifdef CCPP + if (Model%ntwa>0) then + idx = idx + 1 + ExtDiag(idx)%axes = 3 + ExtDiag(idx)%name = 'nwfa' + ExtDiag(idx)%desc = 'number concentration of water-friendly aerosols' + ExtDiag(idx)%unit = 'kg-1' + ExtDiag(idx)%mod_name = 'gfs_phys' + allocate (ExtDiag(idx)%data(nblks)) + do nb = 1,nblks + ExtDiag(idx)%data(nb)%var3 => Statein(nb)%qgrs(:,:,Model%ntwa) + enddo + + idx = idx + 1 + ExtDiag(idx)%axes = 2 + ExtDiag(idx)%name = 'nwfa2d' + ExtDiag(idx)%desc = 'water-friendly surface aerosol source' + ExtDiag(idx)%unit = 'kg-1 s-1' + ExtDiag(idx)%mod_name = 'gfs_sfc' + allocate (ExtDiag(idx)%data(nblks)) + do nb = 1,nblks + ExtDiag(idx)%data(nb)%var2 => Coupling(nb)%nwfa2d + enddo + endif + + if (Model%ntia>0) then + idx = idx + 1 + ExtDiag(idx)%axes = 3 + ExtDiag(idx)%name = 'nifa' + ExtDiag(idx)%desc = 'number concentration of ice-friendly aerosols' + ExtDiag(idx)%unit = 'kg-1' + ExtDiag(idx)%mod_name = 'gfs_phys' + allocate (ExtDiag(idx)%data(nblks)) + do nb = 1,nblks + ExtDiag(idx)%data(nb)%var3 => Statein(nb)%qgrs(:,:,Model%ntia) + enddo + + idx = idx + 1 + ExtDiag(idx)%axes = 2 + ExtDiag(idx)%name = 'nifa2d' + ExtDiag(idx)%desc = 'ice-friendly surface aerosol source' + ExtDiag(idx)%unit = 'kg-1 s-1' + ExtDiag(idx)%mod_name = 'gfs_sfc' + allocate (ExtDiag(idx)%data(nblks)) + do nb = 1,nblks + ExtDiag(idx)%data(nb)%var2 => Coupling(nb)%nifa2d + enddo + endif + + !! Cloud effective radii from Microphysics + !if (Model%imp_physics == Model%imp_physics_thompson .or. Model%imp_physics == Model%imp_physics_wsm6) then + ! idx = idx + 1 + ! ExtDiag(idx)%axes = 3 + ! ExtDiag(idx)%name = 'cleffr' + ! ExtDiag(idx)%desc = 'effective radius of cloud liquid water particle' + ! ExtDiag(idx)%unit = 'um' + ! ExtDiag(idx)%mod_name = 'gfs_phys' + ! allocate (ExtDiag(idx)%data(nblks)) + ! do nb = 1,nblks + ! ExtDiag(idx)%data(nb)%var3 => Tbd(nb)%phy_f3d(:,:,Model%nleffr) + ! enddo + ! idx = idx + 1 + ! ExtDiag(idx)%axes = 3 + ! ExtDiag(idx)%name = 'cieffr' + ! ExtDiag(idx)%desc = 'effective radius of stratiform cloud ice particle in um' + ! ExtDiag(idx)%unit = 'um' + ! ExtDiag(idx)%mod_name = 'gfs_phys' + ! allocate (ExtDiag(idx)%data(nblks)) + ! do nb = 1,nblks + ! ExtDiag(idx)%data(nb)%var3 => Tbd(nb)%phy_f3d(:,:,Model%nieffr) + ! enddo + ! idx = idx + 1 + ! ExtDiag(idx)%axes = 3 + ! ExtDiag(idx)%name = 'cseffr' + ! ExtDiag(idx)%desc = 'effective radius of stratiform cloud snow particle in um' + ! ExtDiag(idx)%unit = 'um' + ! ExtDiag(idx)%mod_name = 'gfs_phys' + ! allocate (ExtDiag(idx)%data(nblks)) + ! do nb = 1,nblks + ! ExtDiag(idx)%data(nb)%var3 => Tbd(nb)%phy_f3d(:,:,Model%nseffr) + ! enddo + !endif + + !MYNN + if (Model%do_mynnedmf) then + + !idx = idx + 1 + !ExtDiag(idx)%axes = 2 + !ExtDiag(idx)%name = 'ktop_shallow' + !ExtDiag(idx)%desc = 'k-level of plume top' + !ExtDiag(idx)%unit = 'n/a' + !ExtDiag(idx)%mod_name = 'gfs_sfc' + !allocate (ExtDiag(idx)%data(nblks)) + !do nb = 1,nblks + ! ExtDiag(idx)%data(nb)%var2 => real(IntDiag(nb)%ktop_shallow(:),kind=kind_phys) + !enddo + + idx = idx + 1 + ExtDiag(idx)%axes = 2 + ExtDiag(idx)%name = 'maxmf' + ExtDiag(idx)%desc = 'maximum mass-flux in column' + ExtDiag(idx)%unit = 'm s-1' + ExtDiag(idx)%mod_name = 'gfs_sfc' + allocate (ExtDiag(idx)%data(nblks)) + do nb = 1,nblks + ExtDiag(idx)%data(nb)%var2 => IntDiag(nb)%maxmf(:) + enddo + + !idx = idx + 1 + !ExtDiag(idx)%axes = 2 + !ExtDiag(idx)%name = 'nupdraft' + !ExtDiag(idx)%desc = 'number of plumes in grid column' + !ExtDiag(idx)%unit = 'n/a' + !ExtDiag(idx)%mod_name = 'gfs_sfc' + !allocate (ExtDiag(idx)%data(nblks)) + !do nb = 1,nblks + ! ExtDiag(idx)%data(nb)%var2 => real(IntDiag(nb)%nupdraft(:),kind=kind_phys) + !enddo + endif + + if (Model%do_mynnsfclay) then + idx = idx + 1 + ExtDiag(idx)%axes = 2 + ExtDiag(idx)%name = 'zol' + ExtDiag(idx)%desc = 'monin obukhov surface stability parameter' + ExtDiag(idx)%unit = 'n/a' + ExtDiag(idx)%mod_name = 'gfs_sfc' + allocate (ExtDiag(idx)%data(nblks)) + do nb = 1,nblks + ExtDiag(idx)%data(nb)%var2 => Sfcprop(nb)%zol(:) + enddo + + idx = idx + 1 + ExtDiag(idx)%axes = 2 + ExtDiag(idx)%name = 'flhc' + ExtDiag(idx)%desc = 'surface exchange coefficient for heat' + ExtDiag(idx)%unit = 'W m-2 K-1' + ExtDiag(idx)%mod_name = 'gfs_sfc' + allocate (ExtDiag(idx)%data(nblks)) + do nb = 1,nblks + ExtDiag(idx)%data(nb)%var2 => Sfcprop(nb)%flhc(:) + enddo + + idx = idx + 1 + ExtDiag(idx)%axes = 2 + ExtDiag(idx)%name = 'flqc' + ExtDiag(idx)%desc = 'surface exchange coefficient for moisture' + ExtDiag(idx)%unit = 'kg m-2 s-1' + ExtDiag(idx)%mod_name = 'gfs_sfc' + allocate (ExtDiag(idx)%data(nblks)) + do nb = 1,nblks + ExtDiag(idx)%data(nb)%var2 => Sfcprop(nb)%flqc(:) + enddo + endif + + if (Model%do_mynnedmf) then + idx = idx + 1 + ExtDiag(idx)%axes = 3 + ExtDiag(idx)%name = 'CLDFRA_BL' + ExtDiag(idx)%desc = 'subgrid cloud fraction' + ExtDiag(idx)%unit = 'frac' + ExtDiag(idx)%mod_name = 'gfs_phys' + allocate (ExtDiag(idx)%data(nblks)) + do nb = 1,nblks + ExtDiag(idx)%data(nb)%var3 => Tbd(nb)%CLDFRA_BL(:,:) + enddo + + idx = idx + 1 + ExtDiag(idx)%axes = 3 + ExtDiag(idx)%name = 'QC_BL' + ExtDiag(idx)%desc = 'subgrid cloud mixing ratio' + ExtDiag(idx)%unit = 'frac' + ExtDiag(idx)%mod_name = 'gfs_phys' + allocate (ExtDiag(idx)%data(nblks)) + do nb = 1,nblks + ExtDiag(idx)%data(nb)%var3 => Tbd(nb)%QC_BL(:,:) + enddo + + idx = idx + 1 + ExtDiag(idx)%axes = 3 + ExtDiag(idx)%name = 'EL_PBL' + ExtDiag(idx)%desc = 'turbulent mixing length' + ExtDiag(idx)%unit = 'm' + ExtDiag(idx)%mod_name = 'gfs_phys' + allocate (ExtDiag(idx)%data(nblks)) + do nb = 1,nblks + ExtDiag(idx)%data(nb)%var3 => Tbd(nb)%el_pbl(:,:) + enddo + + idx = idx + 1 + ExtDiag(idx)%axes = 3 + ExtDiag(idx)%name = 'QKE' + ExtDiag(idx)%desc = '2 X TKE (from mynn)' + ExtDiag(idx)%unit = 'm2 s-2' + ExtDiag(idx)%mod_name = 'gfs_phys' + allocate (ExtDiag(idx)%data(nblks)) + do nb = 1,nblks + ExtDiag(idx)%data(nb)%var3 => Tbd(nb)%QKE(:,:) + enddo + endif +#endif + ! print *,'in gfdl_diag_register,af all extdiag, idx=',idx ! -- chemistry diagnostic variables @@ -3276,6 +3620,59 @@ subroutine GFS_externaldiag_populate (ExtDiag, Model, Statein, Stateout, Sfcprop !rab ExtDiag(idx)%mod_name = 'gfs_phys' end subroutine GFS_externaldiag_populate + +#ifdef CCPP + function soil_layer_depth(lsm, lsm_ruc, lsm_noah, layer) result(layer_depth) + character(len=30) :: layer_depth + integer, intent(in) :: lsm, lsm_ruc, lsm_noah, layer + ! + continue + ! + if (lsm==lsm_ruc) then + select case (layer) + case (1) + layer_depth = 'at 0 cm depth' + case (2) + layer_depth = 'at 5 cm depth' + case (3) + layer_depth = 'at 20 cm depth' + case (4) + layer_depth = 'at 40 cm depth' + case (5) + layer_depth = 'at 60 cm depth' + case (6) + layer_depth = 'at 100 cm depth' + case (7) + layer_depth = 'at 160 cm depth' + case (8) + layer_depth = 'at 220 cm depth' + case (9) + layer_depth = 'at 300 cm depth' + case default + write (layer_depth,'(a,i0)') 'invalid layer ', layer + end select + else if (lsm==lsm_noah) then + select case (layer) + case (1) + layer_depth = '0-10cm' + case (2) + layer_depth = '10-40cm' + case (3) + layer_depth = '40-100cm' + case (4) + layer_depth = '100-200cm' + case default + write (layer_depth,'(a,i0)') 'invalid layer ', layer + end select + else + write (layer_depth,'(a,i0)') 'unknown layer ', layer + end if + ! + return + ! + end function soil_layer_depth +#endif + !------------------------------------------------------------------------- end module GFS_diagnostics diff --git a/gfsphysics/GFS_layer/GFS_driver.F90 b/gfsphysics/GFS_layer/GFS_driver.F90 index b534371ac..800ed4c24 100644 --- a/gfsphysics/GFS_layer/GFS_driver.F90 +++ b/gfsphysics/GFS_layer/GFS_driver.F90 @@ -7,10 +7,14 @@ module GFS_driver GFS_control_type, GFS_grid_type, & GFS_tbd_type, GFS_cldprop_type, & GFS_radtend_type, GFS_diag_type +#ifdef CCPP + use GFS_typedefs, only: GFS_interstitial_type +#else use module_radiation_driver, only: GFS_radiation_driver, radupdate use module_physics_driver, only: GFS_physics_driver use funcphys, only: gfuncphys use gfdl_cloud_microphys_mod, only: gfdl_cloud_microphys_init +#endif use physcons, only: gravit => con_g, rair => con_rd, & rh2o => con_rv, & tmelt => con_ttp, cpair => con_cp, & @@ -87,11 +91,12 @@ module GFS_driver ! Public entities !---------------- public GFS_initialize !< GFS initialization routine +#ifndef CCPP public GFS_time_vary_step !< perform operations needed prior radiation or physics public GFS_radiation_driver !< radiation_driver (was grrad) public GFS_physics_driver !< physics_driver (was gbphys) public GFS_stochastic_driver !< stochastic physics - +#endif CONTAINS !******************************************************************************************* @@ -102,8 +107,18 @@ module GFS_driver !-------------- subroutine GFS_initialize (Model, Statein, Stateout, Sfcprop, & Coupling, Grid, Tbd, Cldprop, Radtend, & +#ifdef CCPP + Diag, Interstitial, communicator, & + ntasks, Init_parm) +#else Diag, Init_parm) +#endif +#ifdef OPENMP + use omp_lib +#endif + +#ifndef CCPP ! use module_microphysics, only: gsmconst use cldwat2m_micro, only: ini_micro use micro_mg2_0, only: micro_mg_init2_0 => micro_mg_init @@ -112,8 +127,8 @@ subroutine GFS_initialize (Model, Statein, Stateout, Sfcprop, & use module_ras, only: ras_init use module_mp_thompson, only: thompson_init use module_mp_wsm6, only: wsm6init -!vay-2018 use cires_ugwp_module, only: cires_ugwp_init +#endif !--- interface variables type(GFS_control_type), intent(inout) :: Model @@ -126,24 +141,42 @@ subroutine GFS_initialize (Model, Statein, Stateout, Sfcprop, & type(GFS_cldprop_type), intent(inout) :: Cldprop(:) type(GFS_radtend_type), intent(inout) :: Radtend(:) type(GFS_diag_type), intent(inout) :: Diag(:) +#ifdef CCPP + type(GFS_interstitial_type), intent(inout) :: Interstitial(:) + integer, intent(in) :: communicator + integer, intent(in) :: ntasks +#endif type(GFS_init_type), intent(in) :: Init_parm !--- local variables integer :: nb integer :: nblks +#ifdef CCPP + integer :: nt + integer :: nthrds + logical :: non_uniform_blocks +#endif integer :: ntrac integer :: ix +#ifndef CCPP integer :: blocksize real(kind=kind_phys), allocatable :: si(:) real(kind=kind_phys), parameter :: p_ref = 101325.0d0 - +#endif nblks = size(Init_parm%blksz) ntrac = size(Init_parm%tracer_names) allocate (blksz(nblks)) blksz(:) = Init_parm%blksz(:) - !--- initializing stochastic physics + +#ifdef CCPP +#ifdef OPENMP + nthrds = omp_get_max_threads() +#else + nthrds = 1 +#endif +#endif !--- set control properties (including namelist read) call Model%init (Init_parm%nlunit, Init_parm%fn_nml, & @@ -155,22 +188,37 @@ subroutine GFS_initialize (Model, Statein, Stateout, Sfcprop, & Init_parm%dt_dycore, Init_parm%dt_phys, & Init_parm%bdat, Init_parm%cdat, & Init_parm%tracer_names, & - Init_parm%input_nml_file, Init_parm%tile_num) - - + Init_parm%input_nml_file, Init_parm%tile_num & +#ifdef CCPP + ,Init_parm%ak, Init_parm%bk, Init_parm%blksz, & + Init_parm%restart, Init_parm%hydrostatic, & + communicator, ntasks, nthrds & +#endif + ) + +! For CCPP, these are called automatically in GFS_phys_time_vary_init as part of CCPP physics init. +! The reason why these are in GFS_phys_time_vary_init and not in ozphys/h2ophys is that the ozone +! and h2o interpolation of the data read here is done in GFS_phys_time_vary_run, i.e. all work +! related to the ozone/h2o input data is in GFS_phys_time_vary, while ozphys/h2ophys are applying +! ozone/h2o forcing to the model state. +#ifndef CCPP call read_o3data (Model%ntoz, Model%me, Model%master) call read_h2odata (Model%h2o_phys, Model%me, Model%master) - if (Model%aero_in) then call read_aerdata (Model%me,Model%master,Model%iflip,Model%idate) endif if (Model%iccn) then call read_cidata ( Model%me, Model%master) endif +#endif - call init_stochastic_physics(Model,Init_parm,nblks,Grid) - +! For CCPP, stochastic_physics_init is called automatically as part of CCPP physics init +#ifndef CCPP + !--- initializing stochastic physics + call init_stochastic_physics(Model,Init_parm,nblks) if(Model%me == Model%master) print*,'do_skeb=',Model%do_skeb +#endif + do nb = 1,nblks ix = Init_parm%blksz(nb) ! write(0,*)' ix in gfs_driver=',ix,' nb=',nb @@ -179,21 +227,61 @@ subroutine GFS_initialize (Model, Statein, Stateout, Sfcprop, & call Sfcprop (nb)%create (ix, Model) call Coupling (nb)%create (ix, Model) call Grid (nb)%create (ix, Model) +#ifndef CCPP + call Tbd (nb)%create (ix, nb, Model) +#else call Tbd (nb)%create (ix, Model) +#endif call Cldprop (nb)%create (ix, Model) call Radtend (nb)%create (ix, Model) !--- internal representation of diagnostics call Diag (nb)%create (ix, Model) enddo +#ifdef CCPP +! This logic deals with non-uniform block sizes for CCPP. When non-uniform block sizes +! are used, it is required that only the last block has a different (smaller) size than +! all other blocks. This is the standard in FV3. If this is the case, set non_uniform_blocks +! to .true. and initialize nthreads+1 elements of the interstitial array. The extra element +! will be used by the thread that runs over the last, smaller block. + + if (minval(Init_parm%blksz)==maxval(Init_parm%blksz)) then + non_uniform_blocks = .false. + elseif (all(minloc(Init_parm%blksz)==(/size(Init_parm%blksz)/))) then + non_uniform_blocks = .true. + else + write(0,'(2a)') 'For non-uniform blocksizes, only the last element ', & + 'in Init_parm%blksz can be different from the others' + stop + endif + +! Initialize the Interstitial data type in parallel so that +! each thread creates (touches) its Interstitial(nt) first. +!$OMP parallel do default (shared) & +!$OMP schedule (static,1) & +!$OMP private (nt) + do nt=1,nthrds + call Interstitial (nt)%create (maxval(Init_parm%blksz), Model) + enddo +!$OMP end parallel do + + if (non_uniform_blocks) then + call Interstitial (nthrds+1)%create (Init_parm%blksz(nblks), Model) + end if +#endif !--- populate the grid components call GFS_grid_populate (Grid, Init_parm%xlon, Init_parm%xlat, Init_parm%area) +! For CCPP, stochastic_physics_sfc_init is called automatically as part of CCPP physics init +#ifndef CCPP ! get land surface perturbations here (move to GFS_time_vary if wanting to ! update each time-step call run_stochastic_physics_sfc(nblks,Model,Grid,Coupling) +#endif +! For CCPP, these are called automatically in GFS_phys_time_vary_init as part of CCPP physics init +#ifndef CCPP !--- read in and initialize ozone and water if (Model%ntoz > 0) then do nb = 1, nblks @@ -227,12 +315,20 @@ subroutine GFS_initialize (Model, Statein, Stateout, Sfcprop, & Grid(nb)%jindx2_h, Grid(nb)%ddy_h) enddo endif +#endif +! For CCPP, this is called automatically in GFS_time_vary_pre_init as part of CCPP physics init +#ifndef CCPP !--- Call gfuncphys (funcphys.f) to compute all physics function tables. call gfuncphys () +#endif ! call gsmconst (Model%dtp, Model%me, .TRUE.) ! This is for Ferrier microphysics - notused - moorthi +#ifdef CCPP + ! For CCPP, Model%si is calculated in Model%init, and rad_initialize + ! is run automatically as part of GFS_rrtmg_setup +#else !--- define sigma level for radiation initialization !--- The formula converting hybrid sigma pressure coefficients to sigma coefficients follows Eckermann (2009, MWR) !--- ps is replaced with p0. The value of p0 uses that in http://www.emc.ncep.noaa.gov/officenotes/newernotes/on461.pdf @@ -248,11 +344,13 @@ subroutine GFS_initialize (Model, Statein, Stateout, Sfcprop, & Model%isubc_lw, Model%icliq_sw, Model%crick_proof, Model%ccnorm,& Model%imp_physics, Model%norad_precip, Model%idate, Model%iflip, Model%me) deallocate (si) +#endif ! microphysics initialization calls ! --------------------------------- - if (Model%imp_physics == 10) then !--- initialize Morrison-Gettleman microphysics + if (Model%imp_physics == Model%imp_physics_mg) then !--- initialize Morrison-Gettelman microphysics +#ifndef CCPP if (Model%fprcp <= 0) then call ini_micro (Model%mg_dcs, Model%mg_qcvar, Model%mg_ts_auto_ice(1)) elseif (Model%fprcp == 1) then @@ -289,39 +387,52 @@ subroutine GFS_initialize (Model, Statein, Stateout, Sfcprop, & endif call aer_cloud_init () +#endif ! - elseif (Model%imp_physics == 8) then !--- initialize Thompson Cloud microphysics - if(Model%do_shoc) then + elseif (Model%imp_physics == Model%imp_physics_thompson) then !--- initialize Thompson Cloud microphysics + if(Model%do_shoc) then print *,'SHOC is not currently compatible with Thompson MP -- shutting down' stop endif - call thompson_init() !--- add aerosol version later +! For CCPP the Thompson MP init is called automatically as part of CCPP physics init +#ifndef CCPP + call thompson_init() !--- add aerosol version later if(Model%ltaerosol) then print *,'Aerosol awareness is not included in this version of Thompson MP -- shutting down' stop endif ! - elseif(Model%imp_physics == 6) then !--- initialize WSM6 Cloud microphysics + elseif(Model%imp_physics == Model%imp_physics_wsm6) then !--- initialize WSM6 Cloud microphysics if(Model%do_shoc) then print *,'SHOC is not currently compatible with WSM6 -- shutting down' stop endif call wsm6init() -! - else if(Model%imp_physics == 11) then !--- initialize GFDL Cloud microphysics +#endif +! + else if(Model%imp_physics == Model%imp_physics_gfdl) then !--- initialize GFDL Cloud microphysics +! For CCPP the GFDL MP init is called automatically as part of CCPP physics init +#ifndef CCPP if(Model%do_shoc) then print *,'SHOC is not currently compatible with GFDL MP -- shutting down' stop endif - call gfdl_cloud_microphys_init (Model%me, Model%master, Model%nlunit, Model%input_nml_file, & - Init_parm%logunit, Model%fn_nml) + call gfdl_cloud_microphys_init (Model%me, Model%master, Model%nlunit, Model%input_nml_file, & + Init_parm%logunit, Model%fn_nml) +#endif endif +#ifndef CCPP !--- initialize ras if (Model%ras) call ras_init (Model%levs, Model%me) +#endif +! DH* Even though this gets called through CCPP in lsm_noah_init, we also +! need to do this here as long as FV3GFS_io.F90 is calculating Sfcprop%sncovr +! when reading restart files (which it shouldn't, this should be moved to physics). !--- initialize soil vegetation call set_soilveg(Model%me, Model%isot, Model%ivegsrc, Model%nlunit) +! *DH !--- lsidea initialization if (Model%lsidea) then @@ -330,6 +441,7 @@ subroutine GFS_initialize (Model, Statein, Stateout, Sfcprop, & !--- NEED TO get the logic from the old phys/gloopb.f initialization area endif +#ifndef CCPP !---- initialization of cires_ugwp . ! if ( Model%me == Model%master) print *, ' VAY-nml ', Model%fn_nml ! if ( Model%me == Model%master) print *, ' VAY-nml2 ', Model%input_nml_file @@ -341,7 +453,10 @@ subroutine GFS_initialize (Model, Statein, Stateout, Sfcprop, & Init_parm%ak, Init_parm%bk, p_ref, Model%dtp, & Model%cdmbgwd, Model%cgwf, Model%prslrd0, Model%ral_ts) endif +#endif +! For CCPP, this is called automatically as part of CCPP_physics_init +#ifndef CCPP !--- Initialize cellular automata if(Model%do_ca)then blocksize=size(Grid(1)%xlon) @@ -350,15 +465,17 @@ subroutine GFS_initialize (Model, Statein, Stateout, Sfcprop, & Model%nseed, Model%nthresh, Model%ca_global, Model%ca_sgs, & Model%iseed_ca, Model%ca_smooth, Model%nspinup, blocksize) endif +#endif !--- sncovr may not exist in ICs from chgres. !--- FV3GFS handles this as part of the IC ingest - !--- this note is placed here alertng users to study + !--- this note is placed here to alert users to study !--- the FV3GFS_io.F90 module end subroutine GFS_initialize +#ifndef CCPP !------------------------------------------------------------------------- ! time_vary_step !------------------------------------------------------------------------- @@ -558,8 +675,8 @@ subroutine GFS_stochastic_driver (Model, Statein, Stateout, Sfcprop, Coupling, & !--- local variables integer :: k, i real(kind=kind_phys) :: upert, vpert, tpert, qpert, qnew,sppt_vwt - real(kind=kind_phys),dimension(size(Statein%tgrs,1),size(Statein%tgrs,2)) :: tconvtend, & - qconvtend,uconvtend,vconvtend + !real(kind=kind_phys),dimension(size(Statein%tgrs,1),size(Statein%tgrs,2)) :: tconvtend, & + ! qconvtend,uconvtend,vconvtend if (Model%do_sppt) then do k = 1,size(Statein%tgrs,2) @@ -858,6 +975,7 @@ subroutine GFS_phys_time_vary (Model, Grid, Tbd, Statein) endif end subroutine GFS_phys_time_vary +#endif !------------------ diff --git a/gfsphysics/GFS_layer/GFS_physics_driver.F90 b/gfsphysics/GFS_layer/GFS_physics_driver.F90 index 8b9854ad8..ec7a24ba6 100644 --- a/gfsphysics/GFS_layer/GFS_physics_driver.F90 +++ b/gfsphysics/GFS_layer/GFS_physics_driver.F90 @@ -23,6 +23,7 @@ module module_physics_driver use module_mp_thompson, only: mp_gt_driver use module_mp_wsm6, only: wsm6 use funcphys, only: ftdp + use surface_perturbation, only: cdfnor use module_sfc_diff, only: sfc_diff use module_sfc_ocean, only: sfc_ocean @@ -313,7 +314,7 @@ module module_physics_driver !! ## Calculate and apply the tendency of ozone. !! - Call the convective adjustment scheme for IDEA !! - Call 'ozphys_2015' or 'ozphys' depending on the value of pl_coeff, updating the ozone tracer within and outputing the tendency of ozone in dq3dt(:,:,6) -!! - Call 'h20phys' if necessary ("adaptation of NRL H20 phys for stratosphere and mesophere") +!! - Call 'h2ophys' if necessary ("adaptation of NRL H2O phys for stratosphere and mesophere") !! . !! ## Prepare input variables for physics routines that update the state variables within their subroutines. !! - If diagnostics is active, save the updated values of the state variables in 'dudt', 'dvdt', 'dTdt', and 'dqdt(:,:,1)' @@ -429,7 +430,7 @@ module module_physics_driver !! - Deallocate arrays for SHOC scheme, deep convective scheme, and Morrison et al. microphysics - public GFS_physics_driver, dgamln, cdfgam, cdfnor + public GFS_physics_driver CONTAINS !******************************************************************************************* @@ -494,10 +495,10 @@ subroutine GFS_physics_driver & islmsk_cice !--- LOGICAL VARIABLES - logical :: lprnt, revap, mg3_as_mg2 + logical :: lprnt, revap, mg3_as_mg2, skip_macro logical, dimension(size(Grid%xlon,1)) :: & - flag_iter, flag_guess, invrsn, skip_macro, & + flag_iter, flag_guess, invrsn, & !--- coupling inputs for physics flag_cice @@ -617,7 +618,7 @@ subroutine GFS_physics_driver & ! real(kind=kind_phys),parameter :: slope_mg = 0.02, slope_upmg = 0.02, & ! real(kind=kind_phys),parameter :: slope_mg = 0.02, slope_upmg = 0.04, & ! turnrhcrit = 0.900, turnrhcrit_upper = 0.150 -! in the folloing inverse of slope_mg and slope_upmg are specified +! in the following inverse of slope_mg and slope_upmg are specified real(kind=kind_phys),parameter :: slope_mg = 50.0_kind_phys, & slope_upmg = 25.0_kind_phys ! @@ -687,6 +688,28 @@ subroutine GFS_physics_driver & real :: julian,fjd integer :: iw3jdn +#ifdef TRANSITION + real(kind=kind_phys), volatile :: volatile_var1, volatile_var2 +#endif + + !! Initialize local variables (mainly for debugging purposes, because the + !! corresponding variables Interstitial(nt)%... are reset to zero every time); + !! these variables are only modified over parts of the entire domain (related + !! to land surface mask etc.) + !snowmt = 0. + !gamq = 0. + !gamt = 0. + !gflx = 0. + !hflx = 0. + ! + !! Strictly speaking, this is not required. But when + !! hunting for bit-for-bit differences, doing the same as + !! in GFS_suite_stateout_reset makes life a lot easier. + !Stateout%gt0(:,:) = Statein%tgrs(:,:) + !Stateout%gu0(:,:) = Statein%ugrs(:,:) + !Stateout%gv0(:,:) = Statein%vgrs(:,:) + !Stateout%gq0(:,:,:) = Statein%qgrs(:,:,:) + !===> ... begin here ldiag_ugwp = Model%ldiag_ugwp do_tofd = Model%do_tofd @@ -704,6 +727,7 @@ subroutine GFS_physics_driver & dtf = Model%dtf dtp = Model%dtp +! DH* this block not yet in CCPP !------- ! For COORDE-2019 averaging with fwindow, it was done before ! 3Diag fixes and averaging ingested using "fdaily"-factor @@ -718,6 +742,7 @@ subroutine GFS_physics_driver & print *, 'VAY Model%fhzero = 0., Bad Averaged-diagnostics ' endif !------- +! *DH kdt = Model%kdt lprnt = Model%lprnt @@ -746,7 +771,7 @@ subroutine GFS_physics_driver & nncl = ncld - if (imp_physics == 8) then + if (imp_physics == Model%imp_physics_thompson) then if (Model%ltaerosol) then nvdiff = 8 else @@ -754,7 +779,7 @@ subroutine GFS_physics_driver & endif if (Model%satmedmf) nvdiff = nvdiff + 1 nncl = 5 - elseif (imp_physics == 6) then + elseif (imp_physics == Model%imp_physics_wsm6) then nvdiff = ntrac -3 if (Model%satmedmf) nvdiff = nvdiff + 1 nncl = 5 @@ -762,11 +787,11 @@ subroutine GFS_physics_driver & nvdiff = ntrac - 1 endif - if (imp_physics == 11) then + if (imp_physics == Model%imp_physics_gfdl) then nncl = 5 endif - if (imp_physics == 10) then + if (imp_physics == Model%imp_physics_mg) then if (abs(Model%fprcp) == 1) then nncl = 4 ! MG2 with rain and snow mg3_as_mg2 = .false. @@ -796,6 +821,7 @@ subroutine GFS_physics_driver & if (ntke > 0) nvdiff = nvdiff + 1 ! adding tke to the list endif ! + ! For CCPP, this is in GFS_Interstitial%phys_reset(Model) in GFS_typedefs.F90 kdtminus1 = kdt - 1 reset = mod(kdtminus1, nint(Model%avg_max_length/dtp)) == 0 @@ -868,7 +894,11 @@ subroutine GFS_physics_driver & elseif (Model%npdf3d == 0 .and. Model%ncnvcld3d == 1) then num2 = Model%num_p3d + 1 endif + !CCPP: num2 = Model%ncnvw + !CCPP: num3 = Model%ncnvc endif +! +! DH* this block not yet in CCPP ! --- initization for those precip type used in Noah MP if (Model%lsm == 2) then do i=1,im @@ -891,6 +921,7 @@ subroutine GFS_physics_driver & ice_mp(i) = tem * Diag%ice(i) enddo endif +! *DH ! --- set initial quantities for stochastic physics deltas if (Model%do_sppt) then @@ -955,7 +986,7 @@ subroutine GFS_physics_driver & enddo endif ! - if (imp_physics == 8 ) then + if (imp_physics == Model%imp_physics_thompson) then if(Model%ltaerosol) then allocate(ice00(im,levs)) allocate(liq0(im,levs)) @@ -965,7 +996,7 @@ subroutine GFS_physics_driver & endif endif - if (imp_physics == 10) then ! For MGB double moment microphysics + if (imp_physics == Model%imp_physics_mg) then ! For MGB double moment microphysics allocate (qlcn(im,levs), qicn(im,levs), w_upi(im,levs), & cf_upi(im,levs), CNV_MFD(im,levs), & ! cf_upi(im,levs), CNV_MFD(im,levs), CNV_PRC3(im,levs), & @@ -992,7 +1023,7 @@ subroutine GFS_physics_driver & CNV_MFD(1,1), CNV_DQLDT(1,1), & ! CNV_MFD(1,1), CNV_PRC3(1,1), CNV_DQLDT(1,1), & clcn(1,1), cnv_fice(1,1), cnv_ndrop(1,1), cnv_nice(1,1)) - if (imp_physics == 11) then ! GFDL MP + if (imp_physics == Model%imp_physics_gfdl) then ! GFDL MP allocate (delp(im,1,levs), dz(im,1,levs), uin(im,1,levs), & vin(im,1,levs), pt(im,1,levs), qv1(im,1,levs), ql1(im,1,levs), & qr1(im,1,levs), qg1(im,1,levs), qa1(im,1,levs), qn1(im,1,levs), & @@ -1014,15 +1045,14 @@ subroutine GFS_physics_driver & Statein%tgrs, Statein%qgrs, del, del_gz) #endif - - +! DH* this block not yet in CCPP ! ! Julian day calculation (fcst day of the year) ! we need imn to init lai and sai and yearln and julian to ! pass to noah mp sflx, idate is init, jdat is fcst;idate = jdat when kdt=1 ! jdat is changing ! - if (Model%lsm == 2) then + if (Model%lsm == Model%lsm_noahmp) then imn = Model%idate(2) @@ -1058,7 +1088,8 @@ subroutine GFS_physics_driver & endif endif - endif ! if Model%lsm == 2 + endif ! if Model%lsm == Model%lsm_noahmp +! *DH ! --- ... frain=factor for centered difference scheme correction of rain amount. @@ -1114,6 +1145,7 @@ subroutine GFS_physics_driver & flag_cice(i) = .false. enddo ! +! DH* note: this block is not yet in CCPP if (Model%cplflx) then do i=1,im islmsk_cice(i) = nint(Coupling%slimskin_cpl(i)) @@ -1126,7 +1158,9 @@ subroutine GFS_physics_driver & dqsfc_cice(i) = Coupling%dqsfcin_cpl(i) enddo endif +! *DH +! DH* In CCPP, this is in GFS_surface_composites_pre do i = 1, IM frland(i) = Sfcprop%landfrac(i) fice(i) = Sfcprop%fice(i) ! ice wrt whole cell @@ -1150,6 +1184,7 @@ subroutine GFS_physics_driver & endif enddo endif +! *DH ! ! --- ... transfer soil moisture and temperature from global to local variables @@ -1161,8 +1196,9 @@ subroutine GFS_physics_driver & enddo enddo +! DH* note: this block is not yet in CCPP ! -- Noah MP 3D global to local - if (Model%lsm == 2) then + if (Model%lsm == Model%lsm_noahmp) then do k = -2,0 do i = 1,im @@ -1184,7 +1220,8 @@ subroutine GFS_physics_driver & enddo enddo - endif ! if Model%lsm == 2 + endif ! if Model%lsm == Model%lsm_noahmp +! *DH do k=1,levs do i=1,im @@ -1193,6 +1230,7 @@ subroutine GFS_physics_driver & dtdt(i,k) = 0. dtdtc(i,k) = 0. +! DH* note: this block is not yet in CCPP !vay-2018 ! Pure tendency arrays w/o accumulation of Phys-tendencies from each ! chain of GFS-physics (later add container for species) @@ -1208,6 +1246,7 @@ subroutine GFS_physics_driver & gw_dvdt(i,k) = 0. gw_dtdt(i,k) = 0. gw_kdis(i,k) = 0. +! *DH enddo enddo @@ -1219,6 +1258,7 @@ subroutine GFS_physics_driver & enddo enddo +! DH* note: this block is not yet in CCPP !----------------------------------------------- !vay-2018-19 ORO/UGWP process-oriented diagnostics ! @@ -1324,6 +1364,7 @@ subroutine GFS_physics_driver & endif endif !===========================Above Phys-tend Diag for COORDE ====================== +! *DH ! --- ... initialize dtdt with heating rate from dcyc2 @@ -1555,6 +1596,7 @@ subroutine GFS_physics_driver & enddo enddo +! DH* In CCPP, this is in GFS_surface_composites_pre if (.not. Model%cplflx .or. .not. Model%frac_grid) then do i=1,im Sfcprop%zorll(i) = Sfcprop%zorl(i) @@ -1600,6 +1642,7 @@ subroutine GFS_physics_driver & gflx3(i,2) = 0. endif enddo +! *DH ! --- ... lu: iter-loop over (sfc_diff,sfc_drv,sfc_ocean,sfc_sice) @@ -1714,7 +1757,7 @@ subroutine GFS_physics_driver & ! --- ... surface energy balance over land ! - if (Model%lsm == 1) then ! noah lsm call + if (Model%lsm == Model%lsm_noah) then ! noah lsm call ! if (lprnt) write(0,*)' tseal=',tseal(ipr),' tsurf=',tsurf(ipr),iter & ! ,' stsoil0=',stsoil(ipr,:) @@ -1744,9 +1787,10 @@ subroutine GFS_physics_driver & ! if (lprnt) write(0,*)' tseae=',tseal(ipr),' tsurf=',tsurf(ipr),iter ! &,' phy_f2d=',phy_f2d(ipr,num_p2d) +! DH* this block not yet in CCPP ! Noah MP call ! - elseif (Model%lsm == 2) then + elseif (Model%lsm == Model%lsm_noahmp) then call noahmpdrv & ! --- inputs: (im, lsoil,kdt, Statein%pgr, Statein%ugrs, Statein%vgrs, & @@ -1786,6 +1830,11 @@ subroutine GFS_physics_driver & ! if (lprnt) write(0,*)' tseae=',tsea(ipr),' tsurf=',tsurf(ipr),iter & ! &,' phy_f2d=',phy_f2d(ipr,num_p2d) +! *DH + + elseif (Model%lsm == Model%lsm_ruc) then + write (0,*) 'RUC LSM is available only in CCPP' + stop endif !lsm @@ -1801,7 +1850,8 @@ subroutine GFS_physics_driver & islmsk (i) = islmsk_cice(i) endif enddo -! + +! DH* this block not yet in CCPP ! call sfc_cice for sea ice points in the coupled model (i.e. islmsk=4) ! call sfc_cice & @@ -1813,6 +1863,8 @@ subroutine GFS_physics_driver & ! --- outputs: qss3(:,2), cmm3(:,2), chh3(:,2), evap3(:,2), hflx3(:,2)) endif +! *DH + ! ! call sfc_sice for lake ice and for the uncoupled case, sea ice (i.e. islmsk=2) ! @@ -1896,9 +1948,6 @@ subroutine GFS_physics_driver & Sfcprop%tsfc(i) = txl*tsfc3(i,1) + txi*tice(i) + txo*tsfc3(i,3) ! Sfcprop%tsfc(i) = txl*tsfc3(i,1) + txi*tsfc3(i,2) + txo*tsfc3(i,3) - Diag%cmm(i) = txl*cmm3(i,1) + txi*cmm3(i,2) + txo*cmm3(i,3) - Diag%chh(i) = txl*chh3(i,1) + txi*chh3(i,2) + txo*chh3(i,3) - Sfcprop%zorll(i) = zorl3(i,1) Sfcprop%zorlo(i) = zorl3(i,3) @@ -2005,7 +2054,8 @@ subroutine GFS_physics_driver & Tbd%phy_f2d(:,Model%num_p2d) = 0.0 - if (Model%lsm == 2) then +! DH* this block not yet in CCPP + if (Model%lsm == Model%lsm_noahmp) then do i=1,im if(dry(i)) then Sfcprop%t2m(i)=t2mmp(i) @@ -2013,6 +2063,7 @@ subroutine GFS_physics_driver & endif enddo endif ! if Model%lsm == 2 +! *DH if (Model%cplflx .or. Model%cplwav) then do i=1,im @@ -2146,8 +2197,10 @@ subroutine GFS_physics_driver & ! write(0,*)' before monsho hflx=',hflx,' me=',me ! write(0,*)' before monsho evap=',evap,' me=',me - if (nvdiff == ntrac) then + if (nvdiff == ntrac .or. Model%do_ysu .or. Model%shinhong) then ! + ntiwx = 0 + if (Model%do_shoc) then call moninshoc(ix, im, levs, nvdiff, ntcw, nncl, dvdt, dudt, dtdt, dqdt, & Statein%ugrs, Statein%vgrs, Statein%tgrs, Statein%qgrs, & @@ -2203,6 +2256,16 @@ subroutine GFS_physics_driver & Model%xkzminv, Model%moninq_fac) ! if (lprnt) write(0,*)' dtdtm=',(dtdt(ipr,k),k=1,15) ! if (lprnt) write(0,*)' dqdtm=',(dqdt(ipr,k,1),k=1,15) + !elseif (Model%do_ysu) then + ! if (Model%me==0) then + ! write(0,*) 'Error, ysuvdif only available through CCPP' + ! stop + ! end if + !elseif (Model%shinhong) then + ! if (Model%me==0) then + ! write(0,*) 'Error, shinhongvdif only available through CCPP' + ! stop + ! end if elseif (.not. Model%old_monin) then call moninq(ix, im, levs, nvdiff, ntcw, dvdt, dudt, dtdt, dqdt, & Statein%ugrs, Statein%vgrs, Statein%tgrs, Statein%qgrs, & @@ -2241,7 +2304,8 @@ subroutine GFS_physics_driver & dvdftra(:,:,:) = 0.0 ntiwx = 0 ! - if (imp_physics == 6) then ! WSM6 + if (imp_physics == Model%imp_physics_wsm6) then +! WSM6 do k=1,levs do i=1,im vdftra(i,k,1) = Statein%qgrs(i,k,1) @@ -2251,7 +2315,8 @@ subroutine GFS_physics_driver & enddo enddo ntiwx = 3 - elseif (imp_physics == 8) then ! Thompson + elseif (imp_physics == Model%imp_physics_thompson) then +! Thompson if(Model%ltaerosol) then do k=1,levs do i=1,im @@ -2278,7 +2343,7 @@ subroutine GFS_physics_driver & enddo ntiwx = 3 endif - elseif (imp_physics == 10) then ! MG3/2 + elseif (imp_physics == Model%imp_physics_mg) then ! MG3/2 if (ntgl > 0) then ! MG3 do k=1,levs do i=1,im @@ -2314,7 +2379,7 @@ subroutine GFS_physics_driver & endif ntiwx = 3 ! - elseif (imp_physics == 11) then ! GFDL MP + elseif (imp_physics == Model%imp_physics_gfdl) then! GFDL MP do k=1,levs do i=1,im vdftra(i,k,1) = Statein%qgrs(i,k,1) @@ -2439,7 +2504,7 @@ subroutine GFS_physics_driver & enddo enddo endif - if (imp_physics == 6) then ! WSM6 + if (imp_physics == Model%imp_physics_wsm6) then ! WSM6 do k=1,levs do i=1,im dqdt(i,k,1) = dvdftra(i,k,1) @@ -2448,14 +2513,14 @@ subroutine GFS_physics_driver & dqdt(i,k,ntoz) = dvdftra(i,k,4) enddo enddo - elseif (imp_physics == 8) then ! Thompson + elseif (imp_physics == Model%imp_physics_thompson) then ! Thompson if(Model%ltaerosol) then do k=1,levs do i=1,im dqdt(i,k,1) = dvdftra(i,k,1) dqdt(i,k,ntcw) = dvdftra(i,k,2) - dqdt(i,k,ntlnc) = dvdftra(i,k,3) - dqdt(i,k,ntiw) = dvdftra(i,k,4) + dqdt(i,k,ntiw) = dvdftra(i,k,3) + dqdt(i,k,ntlnc) = dvdftra(i,k,4) dqdt(i,k,ntinc) = dvdftra(i,k,5) dqdt(i,k,ntoz) = dvdftra(i,k,6) dqdt(i,k,ntwa) = dvdftra(i,k,7) @@ -2473,7 +2538,7 @@ subroutine GFS_physics_driver & enddo enddo endif - elseif (imp_physics == 10) then ! MG3/2 + elseif (imp_physics == Model%imp_physics_mg) then ! MG3/2 if (ntgl > 0) then ! MG do k=1,levs do i=1,im @@ -2508,7 +2573,7 @@ subroutine GFS_physics_driver & enddo endif ! - elseif (imp_physics == 11) then ! GFDL MP + elseif (imp_physics == Model%imp_physics_gfdl) then ! GFDL MP do k=1,levs do i=1,im dqdt(i,k,1) = dvdftra(i,k,1) @@ -2537,6 +2602,7 @@ subroutine GFS_physics_driver & endif +! DH* note: this block is not yet in CCPP if (Model%cplchm) then do i = 1, im tem1 = max(Diag%q1(i), 1.e-8) @@ -2545,6 +2611,7 @@ subroutine GFS_physics_driver & enddo Coupling%dkt (:,:) = dkt (:,:) endif +! *DH ! if (lprnt) then ! write(0,*) ' dusfc1=',dusfc1(ipr),' kdt=',kdt,' lat=',lat @@ -2557,6 +2624,7 @@ subroutine GFS_physics_driver & ! --- ... coupling insertion +! DH* this block not yet in CCPP (commented out in PBL_generic_post) if (Model%cplflx) then do i=1,im if (Sfcprop%oceanfrac(i) > 0.0) then ! Ocean only, NO LAKES @@ -2593,6 +2661,7 @@ subroutine GFS_physics_driver & endif ! Ocean only, NO LAKES enddo endif +! *DH !-------------------------------------------------------lssav if loop ---------- if (Model%lssav) then do i=1,im @@ -2654,6 +2723,7 @@ subroutine GFS_physics_driver & endif ! end if_lssav +! DH* this block not yet in CCPP ! if (ldiag_ugwp) then ! @@ -2670,6 +2740,7 @@ subroutine GFS_physics_driver & enddo enddo endif +! *DH !-------------------------------------------------------lssav if loop ---------- !============================================================= GW-physics start @@ -2677,6 +2748,10 @@ subroutine GFS_physics_driver & ! Orographic gravity wave drag parameterization ! --------------------------------------------- +! DH* this block, except for the UGWD parts, is in CCPP gwdps_pre; +! since it now applies to both gwpds and ugwd, it should be moved +! to a separate gwd_pre scheme and the missing UGWD bits added + if (nmtvr == 14) then ! current operational - as of 2014 do i=1,im ! vay-2018 @@ -2733,8 +2808,9 @@ subroutine GFS_physics_driver & elvmax = 0 endif ! end if_nmtvr +! *DH - +! DH* UGWD not yet in CCPP ! !===== UGWP-start: two versions V0 (knob_ugwp_version=0) and V1(knob_ugwp_version=1) ! @@ -2836,6 +2912,9 @@ subroutine GFS_physics_driver & do_congwd = .false. + +! *DH UGWD not yet in CCPP + ! ! if ( me == master) print *, ' ugwp time-step=', kdt ! @@ -2937,7 +3016,8 @@ subroutine GFS_physics_driver & ! Standard accum-Update before "moist physics" by "PBL + GWP + RF" as in GFS/GSM ! - +! DH* this is in GFS_suite_stateout_update (file GFS_suite_interstitital.F90), +! but without the gw_* terms do k=1,levs do i=1,im Stateout%gt0(i,k) = Statein%tgrs(i,k) + (dtdt(i,k)+gw_dtdt(i,k)) * dtp @@ -2946,7 +3026,9 @@ subroutine GFS_physics_driver & enddo enddo Stateout%gq0(1:im,:,:) = Statein%qgrs(1:im,:,:) + dqdt(1:im,:,:) * dtp +! *DH +! DH* this block not yet in CCPP !======================================================================= ! above: updates of the state by UGWP oro-GWS and RF-damp ! Diag%tav_ugwp & Diag%uav_ugwp(i,k)-Updated U-T state before moist/micro ! physics @@ -2961,6 +3043,7 @@ subroutine GFS_physics_driver & enddo enddo endif +! *DH !================================================================================ ! It is not clear Do we need it, "ideaca_up", having stability check inside UGWP-module @@ -3082,7 +3165,7 @@ subroutine GFS_physics_driver & enddo enddo - if(imp_physics == 8) then + if(imp_physics == Model%imp_physics_thompson) then if(Model%ltaerosol) then ice00 (:,:) = 0.0 liq0 (:,:) = 0.0 @@ -3137,11 +3220,12 @@ subroutine GFS_physics_driver & ! -------------------------------------------- if (ntcw > 0) then -! if (imp_physics == 10 .and. .not. Model%do_shoc) then ! compute rhc for GMAO macro physics cloud pdf - if (imp_physics == 10 .and. Model%crtrh(2) < 0.5) then ! compute rhc for GMAO macro physics cloud pdf +! if (imp_physics == Model%imp_physics_mg .and. .not. Model%do_shoc) then ! compute rhc for GMAO macro physics cloud pdf + if (imp_physics == Model%imp_physics_mg .and. Model%crtrh(2) < 0.5) then ! compute rhc for GMAO macro physics cloud pdf do i=1,im tx1(i) = 1.0 / Statein%prsi(i,1) tx2(i) = 1.0 - rhc_max*work1(i) - Model%crtrh(1)*work2(i) + kk = min(kinver(i), max(2,kpbl(i))) tx3(i) = Statein%prsi(i,kk)*tx1(i) tx4(i) = Model%crtrh(2) - Model%crtrh(3)*abs(cos(Grid%xlat(i))) @@ -3193,9 +3277,9 @@ subroutine GFS_physics_driver & clw(i,k,1) = Stateout%gq0(i,k,ntcw) enddo enddo - elseif (imp_physics == 11) then + elseif (imp_physics == Model%imp_physics_gfdl) then clw(1:im,:,1) = Stateout%gq0(1:im,:,ntcw) - elseif (imp_physics == 8) then + elseif (imp_physics == Model%imp_physics_thompson) then do k=1,levs do i=1,im clw(i,k,1) = Stateout%gq0(i,k,ntiw) ! ice @@ -3208,7 +3292,7 @@ subroutine GFS_physics_driver & else ice00(:,:) = clw(:,:,1) endif - elseif (imp_physics == 6 .or. imp_physics == 10) then + elseif (imp_physics == Model%imp_physics_wsm6 .or. imp_physics == Model%imp_physics_mg) then do k=1,levs do i=1,im clw(i,k,1) = Stateout%gq0(i,k,ntiw) ! ice @@ -3225,10 +3309,13 @@ subroutine GFS_physics_driver & ! ! Call SHOC if do_shoc is true and shocaftcnv is false ! +! DH* as of now, this is in CCPP's gcm_shoc if (Model%do_shoc .and. .not. Model%shocaftcnv) then - if (imp_physics == 10) then + if (imp_physics == Model%imp_physics_mg) then do k=1,levs do i=1,im +! DH* TODO - THESE WERE COMMENTED OUT IN EARLIER VERSIONS OF THE CCPP CODE IN gcm_shoc.F90 and I can't find the code elsewhere +! MAYBE THAT HAS BEEN MOVERD INTO m_micro_interstitial? *DH ! clw(i,k,1) = Stateout%gq0(i,k,ntiw) ! ice ! clw(i,k,2) = Stateout%gq0(i,k,ntcw) ! water ncpl(i,k) = Stateout%gq0(i,k,ntlnc) @@ -3251,7 +3338,7 @@ subroutine GFS_physics_driver & enddo enddo endif - elseif (imp_physics == 11) then ! GFDL MP - needs modify for condensation + elseif (imp_physics == Model%imp_physics_gfdl) then ! GFDL MP - needs modify for condensation do k=1,levs do i=1,im clw(i,k,1) = Stateout%gq0(i,k,ntiw) ! ice @@ -3273,6 +3360,7 @@ subroutine GFS_physics_driver & enddo enddo endif +! *DH ! if (lprnt) write(0,*)'gt01=',Stateout%gt0(ipr,:) ! if (lprnt) write(0,*)'gq01=',Stateout%gq0(ipr,:,1) @@ -3317,7 +3405,7 @@ subroutine GFS_physics_driver & ! enddo -! if (imp_physics == 10 .and. Model%fprcp > 1) then +! if (imp_physics == Model%imp_physics_mg .and. Model%fprcp > 1) then ! do k=1,levs ! do i=1,im ! clw(i,k,1) = clw(i,k,1) - Stateout%gq0(i,k,ntgl) @@ -3343,7 +3431,8 @@ subroutine GFS_physics_driver & ! &, Stateout%gq0(1:ix,1:levs,1),clw(1,1,2),clw(1,1,1) & ! &, ' shoc ', grid%xlon(1:im), grid%xlat(1:im)) - if (imp_physics == 10) then +! DH* as of now, this is in CCPP's gcm_shoc (but commented out because not needed) + if (imp_physics == Model%imp_physics_mg) then do k=1,levs do i=1,im Stateout%gq0(i,k,ntlnc) = ncpl(i,k) @@ -3351,6 +3440,7 @@ subroutine GFS_physics_driver & enddo enddo endif +! *DH ! do k=1,levs ! do i=1,im ! sgs_cld(i,k) = sgs_cld(i,k) + shoc_cld(i,k) @@ -3380,6 +3470,7 @@ subroutine GFS_physics_driver & ! ----------------------------------- if (Model%do_deep) then +! For CCPP compliant physics, this code is in GFS_DCNV_generic_pre if (Model%do_ca) then do k=1,levs do i=1,im @@ -3433,6 +3524,16 @@ subroutine GFS_physics_driver & Model%evfact_deep, Model%evfactl_deep, & Model%pgcon_deep, Model%asolfac_deep) ! if (lprnt) print *,' rain1=',rain1(ipr) + !elseif (Model%imfdeepcnv == 3) then + ! if (Model%me==0) then + ! write(0,*) 'Error, GF convection scheme only available through CCPP' + ! stop + ! end if + !elseif (Model%imfdeepcnv == 4) then + ! if (Model%me==0) then + ! write(0,*) 'Error, New Tiedtke convection scheme only available through CCPP' + ! stop + ! end if elseif (Model%imfdeepcnv == 0) then ! random cloud top call sascnv (im, ix, levs, Model%jcap, dtp, del, & Statein%prsl, Statein%pgr, Statein%phil, clw(:,:,1:2), & @@ -3465,6 +3566,7 @@ subroutine GFS_physics_driver & enddo endif + ! For CCPP, this is in GFS_DCNV_generic_post if(Model%do_ca) then Coupling%cape(:) = cld1d(:) endif @@ -3485,10 +3587,20 @@ subroutine GFS_physics_driver & ! dqdt(i,k,3) = clw(i,k,1) ! enddo ! enddo - + +! +! JLS NOTE: The convective mass fluxes (dt_mf, dd_mf and ud_mf) passed in and out of cs_conv have not been multiplied by +! the timestep (i.e, the are in kg/m2/sec) as they are in all other convective schemes. EMC is aware of this problem, +! and in the future will be fixing this discrepancy. In the meantime, CCPP will use the same mass flux standard_name +! and long_name as the other convective schemes, where the units are in kg/m2. (Aug 2018) +! + ! if (lprnt) write(0,*)'befcsgt0=',Stateout%gt0(ipr,:) ! if (lprnt) write(0,*)'befcstke=',clw(ipr,1:25,ntk) +! JLS NOTE: The variable rain1 output from cs_convr (called prec inside the subroutine) is a precipitation flux (kg/m2/sec), +! not meters LWE like the other schemes. It is converted to m after the call to cs_convr. + call cs_convr (ix, im, levs, ntrac+1, nn, tottracer+3, & Model%nctp, otspt(1:ntrac+1,1:2), 1, & kdt, Stateout%gt0, Stateout%gq0(:,:,1:1), rain1, & @@ -3539,6 +3651,8 @@ subroutine GFS_physics_driver & else ! ras version 2 +! DH* this code not yet in CCPP (belongs to GFS_DCNV_generic_pre?) + if (Model%ccwf(1) >= 0.0 .or. Model%ccwf(2) >= 0) then do i=1,im ccwfac(i) = Model%ccwf(1)*work1(i) + Model%ccwf(2)*work2(i) @@ -3554,6 +3668,7 @@ subroutine GFS_physics_driver & praur_l(i) = Model%prauras(1)*work1(i) + Model%prauras(2)*work2(i) enddo endif +! *DH ! if (lprnt) write(0,*) ' calling ras for kdt=',kdt,' me=',me & ! &, ' lprnt=',lprnt,' ccwfac=',ccwfac(ipr) @@ -3645,6 +3760,8 @@ subroutine GFS_physics_driver & endif ! end if_not_ras +! For CCPP compliant physics, this code is partially in GFS_DCNV_generic_post + if(Model%isppt_deep)then Coupling%tconvtend = Stateout%gt0 - savet Coupling%qconvtend = Stateout%gq0(:,:,1) - saveq @@ -3706,6 +3823,7 @@ subroutine GFS_physics_driver & ! enddo ! endif ! if (lgocart) ! +! DH* this block not yet in CCPP if (ldiag_ugwp) then do k=1,levs do i=1,im @@ -3734,6 +3852,7 @@ subroutine GFS_physics_driver & ! from previous time step we need: LH-release + cld_top/bot + precip ! ! endif +! *DH ! if (lprnt) write(7000,*)' bef cnvgwd gu0=',gu0(ipr,:) ! &,' lat=',lat,' kdt=',kdt,' me=',me @@ -3741,6 +3860,7 @@ subroutine GFS_physics_driver & ! !----------------Convective gravity wave drag parameterization starting -------- +! DH* this block is in gwdc_pre if (Model%cnvgwd .and. do_congwd) then ! call convective gravity wave drag ! --- ... calculate maximum convective heating rate @@ -3761,6 +3881,19 @@ subroutine GFS_physics_driver & do i=1,im if (work3(i) > 0.0) cumabs(i) = cumabs(i) / (dtp*work3(i)) enddo +! *DH + +! DH* 20180817 - note: the above non-CCPP code modifies work3, which until then was defined +! as the ratio of the exner function between midlayer and interface at lowest model layer: +! work3(i) = Statein%prsik(i,1) / Statein%prslk(i,1) +! This does not happen for the CCPP code, because gwdc_pre uses an internal array +! work3 (maybe not a good name, given that we have work1/2/3 in GFS_physics_driver and +! in the GFS_Interstitial DDT). Therefore, work3 is different from here on until the end +! of GFS_physics_driver. This is ok as long as Model%lgocart is set to .false. - if +! Model%lgocart is set to .true., sfc_diag is called again, which uses work3 as input. +! This work3 used in sfc_diag should be the ratio of the exner function, not the modified +! value derived in the non-CCPP code above. If we get different results for the surface +! diagnstics with Model%lgocart=.true., then the CCPP code is correct! *DH 20180817 ! do i = 1, im ! do k = kbot(i), ktop(i) @@ -3986,11 +4119,12 @@ subroutine GFS_physics_driver & Stateout%gq0(:,:,1), Stateout%gt0, & Stateout%gu0, Stateout%gv0, & rain1, kbot, ktop, kcnv, islmsk, garea, & - Statein%vvl, ncld, DIag%hpbl, ud_mf, & + Statein%vvl, ncld, Diag%hpbl, ud_mf, & dt_mf, cnvw, cnvc, & Model%clam_shal, Model%c0s_shal, Model%c1_shal, & Model%pgcon_shal, Model%asolfac_shal) +! DH* this block is in samfshalcnv_post do i=1,im Diag%rainc(i) = Diag%rainc(i) + frain * rain1(i) enddo @@ -4009,6 +4143,13 @@ subroutine GFS_physics_driver & enddo enddo endif +! *DH + + !elseif (Model%imfshalcnv == 3) then + !if (Model%me==0) write(0,*) "CCPP DEBUG: shallow convection of GF is called in gf_driver" + + !elseif (Model%imfshalcnv == 4) then + !if (Model%me==0) write(0,*) "CCPP DEBUG: shallow convection of New Tiedtke is called in cu_tiedtke" elseif (Model%imfshalcnv == 0) then ! modified Tiedtke Shallow convecton !----------------------------------- @@ -4076,7 +4217,7 @@ subroutine GFS_physics_driver & ! endif elseif (Model%shocaftcnv) then ! if do_shoc is true and shocaftcnv is true call shoc - if (imp_physics == 10) then + if (imp_physics == Model%imp_physics_mg) then do k=1,levs do i=1,im ncpl(i,k) = Stateout%gq0(i,k,ntlnc) @@ -4144,7 +4285,7 @@ subroutine GFS_physics_driver & lprnt, ipr, imp_physics, ncpl, ncpi) ! enddo - if (imp_physics == 10) then + if (imp_physics == Model%imp_physics_mg) then do k=1,levs do i=1,im Stateout%gq0(i,k,ntlnc) = ncpl(i,k) @@ -4198,7 +4339,7 @@ subroutine GFS_physics_driver & ! for microphysics if (imp_physics == 99 .or. imp_physics == 98 & - .or. imp_physics == 11) then + .or. imp_physics == Model%imp_physics_gfdl) then Stateout%gq0(1:im,:,ntcw) = clw(1:im,:,1) + clw(1:im,:,2) elseif (ntiw > 0) then do k=1,levs @@ -4207,7 +4348,7 @@ subroutine GFS_physics_driver & Stateout%gq0(i,k,ntcw) = clw(i,k,2) ! water enddo enddo - if (imp_physics == 8) then + if (imp_physics == Model%imp_physics_thompson) then if (Model%ltaerosol) then do k=1,levs do i=1,im @@ -4246,6 +4387,7 @@ subroutine GFS_physics_driver & call cnvc90 (Model%clstp, im, ix, Diag%rainc, kbot, ktop, levs, Statein%prsi, & Tbd%acv, Tbd%acvb, Tbd%acvt, Cldprop%cv, Cldprop%cvb, Cldprop%cvt) +! DH* - this block is not yet in CCPP if (Model%moist_adj) then ! moist convective adjustment ! --------------------------- ! @@ -4292,8 +4434,8 @@ subroutine GFS_physics_driver & ! enddo ! endif ! endif -! endif ! moist convective adjustment over +! *DH ! if (Model%ldiag3d .or. Model%do_aw) then do k=1,levs @@ -4308,6 +4450,7 @@ subroutine GFS_physics_driver & endif ! dqdt_v : instaneous moisture tendency (kg/kg/sec) + !GF* the following code is executed in GFS_suite_interstitial_4 (relevant for shallow and deep convection) if (Model%lgocart) then do k=1,levs do i=1,im @@ -4315,6 +4458,7 @@ subroutine GFS_physics_driver & enddo enddo endif + !*GF ! ! grid-scale condensation/precipitations and microphysics parameterization ! ------------------------------------------------------------------------ @@ -4384,7 +4528,7 @@ subroutine GFS_physics_driver & ! if (lprnt) write(0,*) ' rain1=',rain1(ipr),' rainc=',rainc(ipr),' lat=',lat - elseif (imp_physics == 8) then ! Thompson MP + elseif (imp_physics == Model%imp_physics_thompson) then ! Thompson MP ! ------------ ims = 1 ; ime = ix ; kms = 1 ; kme = levs ; its = 1 ; ite = ix ; kts = 1 ; kte = levs @@ -4399,7 +4543,7 @@ subroutine GFS_physics_driver & ! Stateout%gq0(1:im,1:im,Model%ntrnc), & ! Stateout%gt0, Statein%prsl, Statein%vvl, del, dtp, kdt, & ! rain1, & -! diag%sr, & +! Diag%sr, & !! Diag%refl_10cm, Model%lradar, & !! Tbd%phy_f3d(:,:,1),Tbd%phy_f3d(:,:,2),Tbd%phy_f3d(:,:,3), & !has_reqc, has_reqi, has_reqs, !! ims,ime,kms,kme,its,ite,kts,kte) @@ -4419,13 +4563,13 @@ subroutine GFS_physics_driver & !2014v Stateout%gt0, Statein%prsl, Statein%vvl, del, dtp, kdt, & Stateout%gt0, Statein%prsl, del, dtp, kdt, & rain1, & - diag%sr, & + Diag%sr, & islmsk, & Diag%refl_10cm, Model%lradar, & Tbd%phy_f3d(:,:,1),Tbd%phy_f3d(:,:,2),Tbd%phy_f3d(:,:,3),me,Statein%phii) endif - elseif (imp_physics == 6) then ! WSM6 + elseif (imp_physics == Model%imp_physics_wsm6) then ! WSM6 ! ----- ims = 1 ; ime = ix ; kms = 1 ; kme = levs ; its = 1 ; ite = ix ; kts = 1 ; kte = levs @@ -4437,14 +4581,15 @@ subroutine GFS_physics_driver & Stateout%gq0(1:im,1:levs,Model%ntsw), & Stateout%gq0(1:im,1:levs,Model%ntgl), & Statein%prsl, del, dtp, rain1, & - diag%sr, & + Diag%sr, & islmsk, & Tbd%phy_f3d(:,:,1),Tbd%phy_f3d(:,:,2),Tbd%phy_f3d(:,:,3), & ims,ime, kms,kme, & its,ite, kts,kte) ! - elseif (imp_physics == 10) then ! MGB double-moment microphysics - ! ------------------------------ + elseif (imp_physics == Model%imp_physics_mg) then ! MGB double-moment microphysics + ! ------------------------------ + kk = 5 if (Model%fprcp >= 2) kk = 6 @@ -4652,8 +4797,8 @@ subroutine GFS_physics_driver & ! if (lprnt) write(0,*)' qglba',qgl(ipr,:),' kdt=',kdt ! - elseif (imp_physics == 11) then ! GFDL MP - ! ------- + elseif (imp_physics == Model%imp_physics_gfdl) then ! GFDL MP + ! ------- do i = 1, im land (i,1) = frland(i) area (i,1) = Grid%area(i) @@ -4726,17 +4871,36 @@ subroutine GFS_physics_driver & graupel0(i,1) = 0.0 endif +#ifdef TRANSITION + volatile_var1 = rain0(i,1)+snow0(i,1)+ice0(i,1)+graupel0(i,1) + volatile_var2 = snow0(i,1)+ice0(i,1)+graupel0(i,1) + rain1(i) = volatile_var1 * tem +#else rain1(i) = (rain0(i,1)+snow0(i,1)+ice0(i,1)+graupel0(i,1)) * tem +#endif Diag%ice(i) = ice0 (i,1) * tem Diag%snow(i) = snow0 (i,1) * tem Diag%graupel(i) = graupel0(i,1) * tem +#ifdef TRANSITION + if ( volatile_var1 * tem > rainmin ) then + Diag%sr(i) = volatile_var2 / volatile_var1 +#else if ( rain1(i) > rainmin ) then - Diag%sr(i) = (snow0(i,1) + ice0(i,1) + graupel0(i,1)) & - / (rain0(i,1) + snow0(i,1) + ice0(i,1) + graupel0(i,1)) + Diag%sr(i) = (snow0(i,1) + ice0(i,1) + graupel0(i,1)) & + / (rain0(i,1) + snow0(i,1) + ice0(i,1) + graupel0(i,1)) +#endif else - Diag%sr(i) = 0.0 + Diag%sr(i) = 0.0 endif enddo +#if defined(TRANSITION) || defined(REPRO) + ! Convert rain0, ice0, graupel0 and snow0 from mm/day to m/physics-timestep + ! for later use (approx. lines 7970, calculation of srflag) + rain0 = tem*rain0 + ice0 = tem*ice0 + snow0 = tem*snow0 + graupel0 = tem*graupel0 +#endif do k = 1, levs kk = levs-k+1 do i=1,im @@ -4762,7 +4926,7 @@ subroutine GFS_physics_driver & endif enddo !Calculate hourly max 1-km agl and -10C reflectivity - if(Model%lradar .and. (imp_physics == 11 .or. imp_physics == 8)) then + if(Model%lradar .and. (imp_physics == Model%imp_physics_gfdl .or. imp_physics == Model%imp_physics_thompson)) then allocate(refd(im)) allocate(refd263k(im)) call max_fields(Statein%phil,Diag%refl_10cm,con_g,im,levs,refd,Stateout%gt0,refd263k) @@ -4835,7 +4999,7 @@ subroutine GFS_physics_driver & enddo enddo ! add convective clouds if shoc is true and not MG microphysics - if (Model%do_shoc .and. imp_physics /= 10) then + if (Model%do_shoc .and. imp_physics /= Model%imp_physics_mg) then do k = 1,levs do i = 1,im Tbd%phy_f3d(i,k,ntot3d-2) = min(1.0, Tbd%phy_f3d(i,k,ntot3d-2) & @@ -4881,7 +5045,7 @@ subroutine GFS_physics_driver & ! end do ! HCHUANG: use new precipitation type to decide snow flag for LSM snow accumulation - if (Model%imp_physics /= 11) then + if (Model%imp_physics /= Model%imp_physics_gfdl) then do i=1,im Sfcprop%tprcp(i) = max(0.0, Diag%rain(i) ) if(doms(i) > 0.0 .or. domip(i) > 0.0) then @@ -4930,6 +5094,7 @@ subroutine GFS_physics_driver & endif endif +! DH* this block not yet in CCPP !-------------------------------- ! vay-2018 for Dycore-Tendencies save Stateout%X => Diag%dX3dt_cgw ! @@ -4939,6 +5104,7 @@ subroutine GFS_physics_driver & Diag%du3dt_cgw = Stateout%gu0 endif !-------------------------------- +! *DH ! --- ... estimate t850 for rain-snow decision @@ -4954,7 +5120,7 @@ subroutine GFS_physics_driver & enddo enddo - if (Model%imp_physics == 11) then + if (Model%imp_physics == Model%imp_physics_gfdl) then ! determine convective rain/snow by surface temperature ! determine large-scale rain/snow by rain/snow coming out directly from MP tem = dtp * con_p001 / con_day @@ -4973,14 +5139,23 @@ subroutine GFS_physics_driver & ! Sfcprop%srflag(i) = 1. ! clu: set srflag to 'snow' (i.e. 1) ! endif ! compute fractional srflag +#if defined(TRANSITION) || defined(REPRO) + ! For bit-for-bit identical results with CCPP code, snow0/ice0/graupel0/rain0 + ! were converted from mm per day to m per physics timestep previously in the code + total_precip = snow0(i,1)+ice0(i,1)+graupel0(i,1)+rain0(i,1)+Diag%rainc(i) + if (total_precip > rainmin) then + Sfcprop%srflag(i) = (snow0(i,1)+ice0(i,1)+graupel0(i,1)+csnow)/total_precip + endif +#else tem1 = snow0(i,1)+ice0(i,1)+graupel0(i,1) total_precip = (tem1+rain0(i,1)) * tem + Diag%rainc(i) if (total_precip > rainmin) then Sfcprop%srflag(i) = (tem1*tem+csnow) / total_precip endif +#endif enddo elseif( .not. Model%cal_pre) then - if (Model%imp_physics == 10) then ! MG microphysics + if (Model%imp_physics == Model%imp_physics_mg) then ! MG microphysics do i=1,im if (Diag%rain(i)*tem > rainmin) then Sfcprop%srflag(i) = max(zero, min(one, (Diag%rain(i)-Diag%rainc(i))*Diag%sr(i)/Diag%rain(i))) @@ -5024,20 +5199,24 @@ subroutine GFS_physics_driver & !!! this change allows gocart to use filtered wind fields !!! if (Model%lgocart) then + ! DH* 20180817 - see my comment further up (around gwdc_pre) that + ! work3 for the non-CCPP code is incorrect (CCPP code is correct) *DH call sfc_diag (im, Statein%pgr, Stateout%gu0, Stateout%gv0, & Stateout%gt0, Stateout%gq0, Sfcprop%tsfc, qss, & Sfcprop%f10m, Diag%u10m, Diag%v10m, Sfcprop%t2m, & Sfcprop%q2m, work3, evap, Sfcprop%ffmm, & Sfcprop%ffhh, fm10, fh2) - if (Model%lsm == 2) then +! DH* this block not yet in CCPP + if (Model%lsm == Model%lsm_noahmp) then do i=1,im if (dry(i)) then Sfcprop%t2m(i)=t2mmp(i) Sfcprop%q2m(i)=q2mp(i) endif enddo - endif ! if Model%lsm == 2 + endif ! if Model%lsm == Model%lsm_noahmp +! *DH if (Model%lssav) then do i=1,im @@ -5061,6 +5240,7 @@ subroutine GFS_physics_driver & endif endif + ! CCPP: this code is now in GFS_surface_generic_post ! --- ... total runoff is composed of drainage into water table and ! runoff at the surface and is accumulated in unit of meters if (Model%lssav) then @@ -5080,8 +5260,9 @@ subroutine GFS_physics_driver & enddo enddo +! DH* this block not yet in CCPP ! Noah MP - if (Model%lsm == 2) then + if (Model%lsm == Model%lsm_noahmp) then do k = 1, lsoil do i = 1, im @@ -5103,8 +5284,8 @@ subroutine GFS_physics_driver & enddo enddo - endif ! if Model%lsm == 2 - + endif ! if Model%lsm == Model%lsm_noahmp +! *DH ! --- ... calculate column precipitable water "pwat" Diag%pwat(:) = 0.0 @@ -5197,7 +5378,7 @@ subroutine GFS_physics_driver & ! deallocate (qlcn, qicn, w_upi, cf_upi, CNV_MFD, CNV_PRC3, & deallocate (qlcn, qicn, w_upi, cf_upi, CNV_MFD, & CNV_DQLDT, clcn, cnv_fice, cnv_ndrop, cnv_nice) - if (imp_physics == 11) then + if (imp_physics == Model%imp_physics_gfdl) then deallocate (delp, dz, uin, vin, pt, qv1, ql1, qr1, & qg1, qa1, qn1, qi1, qs1, pt_dt, qa_dt, udt, vdt, & w, qv_dt, ql_dt, qr_dt, qi_dt, qs_dt, qg_dt,p123,refl) @@ -5435,162 +5616,6 @@ subroutine moist_bud2(im,ix,ix2,levs,me,kdt,grav,dtp,delp,rain, & end subroutine moist_bud2 -! mg, sfc-perts *** -! the routines below are used in the percentile matching algorithm for the -! albedo and vegetation fraction perturbations - subroutine cdfnor(z,cdfz) - use machine - - implicit none - real(kind=kind_phys), intent(out) :: cdfz - real(kind=kind_phys),intent(in) :: z -! local vars - integer iflag - real(kind=kind_phys) del,x,cdfx,eps - - eps = 1.0E-5 - - - ! definition of passed parameters ! - ! z = value for which the normal CDF is to be computed - ! eps = the absolute accuracy requirment for the CDF - ! iflag = error indicator on output 0->no errors, 1->errorflag from - ! cdfgam, 2->errorflag from cdfgam - ! cdfz = the CDF of the standard normal distribution evaluated at z - - del = 2.0*eps - if (z.eq.0.0) then - cdfz = 0.5 - else - x = 0.5*z*z - call cdfgam(x,0.5,del,iflag, cdfx) - if (iflag.ne.0) return - if (z.gt.0.0) then - cdfz = 0.5+0.5*cdfx - else - cdfz = 0.5-0.5*cdfx - endif - endif - - return - end - - subroutine cdfgam(x,alpha,eps,iflag,cdfx) - use machine - - implicit none - real(kind=kind_phys), intent(out) :: cdfx - real(kind=kind_phys),intent(in) :: x, alpha, eps -! local vars - integer iflag,i,j,k, imax - logical LL - real(kind=kind_phys) dx, dgln, p,u,epsx,pdfl, eta, bl, uflo - data imax, uflo / 5000, 1.0E-37 / - - - ! definition of passed parameters ! - ! x = value for which the CDF is to be computed - ! alpha = parameter of gamma function (>0) - ! eps = the absolute accuracy requirment for the CDF - ! iflag = error indicator on output 0->no errors, 1->either alpha or eps - ! is <= oflo, 2->number of terms evaluated in the infinite series exceeds - ! imax. - ! cdf = the CDF evaluated at x - - cdfx = 0.0 - - if (alpha.le.uflo.or.eps.le.uflo) then - iflag=1 - return - endif - iflag=0 - - ! check for special case of x - if (x.le.0) return - - dx = x - call dgamln(alpha,dgln) - pdfl = (alpha-1.0)*log(dx)-dx-dgln - if (pdfl.lt.log(uflo)) then - if (x.ge.alpha) cdfx = 1.0 - else - p = alpha - u = exp(pdfl) - LL = .true. - if (x.ge.p) then - k = int(p) - if (p.le.real(k)) k = k-1 - eta = p - real(k) - call dgamln(eta,dgln) - bl = (eta-1)*log(dx)-dx-dgln - LL = bl.gt.log(eps) - endif - epsx = eps/x - if (LL) then - do i=0,imax - if (u.le.epsx*(p-x)) return - u = x*u/p - cdfx = cdfx+u - p = p+1.0 - enddo - iflag = 2 - else - do j=1,k - p=p-1.0 - if (u.le.epsx*(x-p)) continue - cdfx = cdfx+u - u = p*u/x - enddo - cdfx = 1.0-cdfx - endif - endif - return - end subroutine cdfgam - - subroutine dgamln(x,dgamlnout) - - use machine - implicit none - real(kind=kind_phys), intent(in) :: x - real(kind=kind_phys), intent(out) :: dgamlnout -! local vars - integer i, n - real(kind=kind_phys) absacc, b1, b2, b3, b4, b5, b6, b7, b8 - real(kind=kind_phys) c, dx, q, r, xmin, xn - data xmin, absacc / 6.894d0, 1.0E-15 / - data c / 0.918938533204672741780329736d0 / - data b1 / 0.833333333333333333333333333d-1 / - data b2 / - 0.277777777777777777777777778d-2 / - data b3 / 0.793650793650793650793650794d-3 / - data b4 / - 0.595238095238095238095238095d-3 / - data b5 / 0.841750841750841750841750842d-3 / - data b6 / - 0.191752691752691752691752692d-2 / - data b7 / 0.641025641025641025641025641d-2 / - data b8 / - 0.295506535947712418300653595d-1 / - - if (x.le.0.0) stop '*** x<=0.0 in function dgamln ***' - dx = x - n = max(0,int(xmin - dx + 1.0d0) ) - xn = dx + n - r = 1.0d0/xn - q = r*r - dgamlnout = r*( b1+q*( b2+q*( b3+q*( b4+q*( b5+q*( b6+q*( b7+q*b8 ) ) ) ) ) ) ) +c + (xn-0.5d0)*log(xn)-xn - - if (n.gt.0) then - q = 1.0d0 - do i=0, n-1 - q = q*(dx+i) - enddo - dgamlnout = dgamlnout-log(q) - endif - - if (dgamlnout + absacc.eq.dgamlnout) then - print *,' ********* WARNING FROM FUNCTION DGAMLN *********' - print *,' REQUIRED ABSOLUTE ACCURACY NOT ATTAINED FOR X = ',x - endif - return - end subroutine dgamln - ! *** mg, sfc-perts diff --git a/gfsphysics/GFS_layer/GFS_radiation_driver.F90 b/gfsphysics/GFS_layer/GFS_radiation_driver.F90 index cefd98541..9db2f3312 100644 --- a/gfsphysics/GFS_layer/GFS_radiation_driver.F90 +++ b/gfsphysics/GFS_layer/GFS_radiation_driver.F90 @@ -354,7 +354,7 @@ module module_radiation_driver ! GFS_radtend_type, & GFS_diag_type - use module_physics_driver, only: dgamln, cdfgam, cdfnor + use surface_perturbation, only: cdfnor ! implicit none ! @@ -1577,7 +1577,7 @@ subroutine GFS_radiation_driver & ! --- ... obtain cloud information for radiation calculations ! if (ntcw > 0) then ! prognostic cloud schemes - + ccnd = 0.0_kind_phys if (Model%ncnd == 1) then ! Zhao_Carr_Sundqvist do k=1,LMK do i=1,IM diff --git a/gfsphysics/GFS_layer/GFS_restart.F90 b/gfsphysics/GFS_layer/GFS_restart.F90 index aa68c5fe2..59ff6fff8 100644 --- a/gfsphysics/GFS_layer/GFS_restart.F90 +++ b/gfsphysics/GFS_layer/GFS_restart.F90 @@ -17,7 +17,8 @@ module GFS_restart type GFS_restart_type integer :: num2d !< current number of registered 2D restart variables integer :: num3d !< current number of registered 3D restart variables - integer :: ndiag !< current number of diagnostic fields in restart file + integer :: fdiag !< index of first diagnostic field in restart file + integer :: ldiag !< index of last diagnostic field in restart file character(len=32), allocatable :: name2d(:) !< variable name as it will appear in the restart file character(len=32), allocatable :: name3d(:) !< variable name as it will appear in the restart file @@ -91,9 +92,41 @@ subroutine GFS_restart_populate (Restart, Model, Statein, Stateout, Sfcprop, & endif enddo - Restart%ndiag = ndiag_rst + ! Store first and last index of diagnostic fields: + Restart%fdiag = 3 + Model%ntot2d + Model%nctp + 1 + Restart%ldiag = 3 + Model%ntot2d + Model%nctp + ndiag_rst Restart%num2d = 3 + Model%ntot2d + Model%nctp + ndiag_rst + +#ifdef CCPP + ! GF + if (Model%imfdeepcnv == 3) then + Restart%num2d = Restart%num2d + 1 + endif + ! RUC + if (Model%lsm == Model%lsm_ruc) then + Restart%num2d = Restart%num2d + 5 + endif + ! MYNN SFC + if (Model%do_mynnsfclay) then + Restart%num2d = Restart%num2d + 1 + endif + ! Thompson aerosol-aware + if (Model%imp_physics == Model%imp_physics_thompson .and. Model%ltaerosol) then + Restart%num2d = Restart%num2d + 2 + endif +#endif + Restart%num3d = Model%ntot3d +#ifdef CCPP + ! GF + if (Model%imfdeepcnv == 3) then + Restart%num3d = Restart%num3d + 2 + endif + ! MYNN PBL + if (Model%do_mynnedmf) then + Restart%num3d = Restart%num3d + 8 + endif +#endif allocate (Restart%name2d(Restart%num2d)) allocate (Restart%name3d(Restart%num3d)) @@ -146,6 +179,68 @@ subroutine GFS_restart_populate (Restart, Model, Statein, Stateout, Sfcprop, & ! print *,'in restart 2d field, Restart%name2d(',offset+idx,')=',trim(Restart%name2d(offset+idx)) enddo +#ifdef CCPP + !--- RAP/HRRR-specific variables, 2D + num = offset + ndiag_rst + ! GF + if (Model%imfdeepcnv == 3) then + num = num + 1 + Restart%name2d(num) = 'gf_2d_conv_act' + do nb = 1,nblks + Restart%data(nb,num)%var2p => Sfcprop(nb)%conv_act(:) + enddo + endif + ! RUC + if (Model%lsm == Model%lsm_ruc) then + num = num + 1 + Restart%name2d(num) = 'ruc_2d_raincprv' + do nb = 1,nblks + Restart%data(nb,num)%var2p => Tbd(nb)%raincprv(:) + enddo + num = num + 1 + Restart%name2d(num) = 'ruc_2d_rainncprv' + do nb = 1,nblks + Restart%data(nb,num)%var2p => Tbd(nb)%rainncprv(:) + enddo + num = num + 1 + Restart%name2d(num) = 'ruc_2d_iceprv' + do nb = 1,nblks + Restart%data(nb,num)%var2p => Tbd(nb)%iceprv(:) + enddo + num = num + 1 + Restart%name2d(num) = 'ruc_2d_snowprv' + do nb = 1,nblks + Restart%data(nb,num)%var2p => Tbd(nb)%snowprv(:) + enddo + num = num + 1 + Restart%name2d(num) = 'ruc_2d_graupelprv' + do nb = 1,nblks + Restart%data(nb,num)%var2p => Tbd(nb)%graupelprv(:) + enddo + endif + ! MYNN SFC + if (Model%do_mynnsfclay) then + num = num + 1 + Restart%name2d(num) = 'mynn_2d_uustar' + do nb = 1,nblks + Restart%data(nb,num)%var2p => Sfcprop(nb)%uustar(:) + enddo + endif + ! Thompson aerosol-aware + if (Model%imp_physics == Model%imp_physics_thompson .and. Model%ltaerosol) then + num = num + 1 + Restart%name2d(num) = 'thompson_2d_nwfa2d' + do nb = 1,nblks + Restart%data(nb,num)%var2p => Coupling(nb)%nwfa2d(:) + enddo + num = num + 1 + Restart%name2d(num) = 'thompson_2d_nifa2d' + do nb = 1,nblks + Restart%data(nb,num)%var2p => Coupling(nb)%nifa2d(:) + enddo + endif +#endif + !--- phy_f3d variables do num = 1,Model%ntot3d !--- set the variable name @@ -156,6 +251,68 @@ subroutine GFS_restart_populate (Restart, Model, Statein, Stateout, Sfcprop, & enddo enddo +#ifdef CCPP + !--- RAP/HRRR-specific variables, 3D + num = Model%ntot3d + + ! GF + if (Model%imfdeepcnv == 3) then + num = num + 1 + Restart%name3d(num) = 'gf_3d_prevst' + do nb = 1,nblks + Restart%data(nb,num)%var3p => Tbd(nb)%prevst(:,:) + enddo + num = num + 1 + Restart%name3d(num) = 'gf_3d_prevsq' + do nb = 1,nblks + Restart%data(nb,num)%var3p => Tbd(nb)%prevsq(:,:) + enddo + endif + ! MYNN PBL + if (Model%do_mynnedmf) then + num = num + 1 + Restart%name3d(num) = 'mynn_3d_cldfra_bl' + do nb = 1,nblks + Restart%data(nb,num)%var3p => Tbd(nb)%cldfra_bl(:,:) + enddo + num = num + 1 + Restart%name3d(num) = 'mynn_3d_qc_bl' + do nb = 1,nblks + Restart%data(nb,num)%var3p => Tbd(nb)%qc_bl(:,:) + enddo + num = num + 1 + Restart%name3d(num) = 'mynn_3d_el_pbl' + do nb = 1,nblks + Restart%data(nb,num)%var3p => Tbd(nb)%el_pbl(:,:) + enddo + num = num + 1 + Restart%name3d(num) = 'mynn_3d_sh3d' + do nb = 1,nblks + Restart%data(nb,num)%var3p => Tbd(nb)%sh3d(:,:) + enddo + num = num + 1 + Restart%name3d(num) = 'mynn_3d_qke' + do nb = 1,nblks + Restart%data(nb,num)%var3p => Tbd(nb)%qke(:,:) + enddo + num = num + 1 + Restart%name3d(num) = 'mynn_3d_tsq' + do nb = 1,nblks + Restart%data(nb,num)%var3p => Tbd(nb)%tsq(:,:) + enddo + num = num + 1 + Restart%name3d(num) = 'mynn_3d_qsq' + do nb = 1,nblks + Restart%data(nb,num)%var3p => Tbd(nb)%qsq(:,:) + enddo + num = num + 1 + Restart%name3d(num) = 'mynn_3d_cov' + do nb = 1,nblks + Restart%data(nb,num)%var3p => Tbd(nb)%cov(:,:) + enddo + endif +#endif + end subroutine GFS_restart_populate end module GFS_restart diff --git a/gfsphysics/GFS_layer/GFS_typedefs.F90 b/gfsphysics/GFS_layer/GFS_typedefs.F90 index c578423ce..db7fa960f 100644 --- a/gfsphysics/GFS_layer/GFS_typedefs.F90 +++ b/gfsphysics/GFS_layer/GFS_typedefs.F90 @@ -3,14 +3,93 @@ module GFS_typedefs use machine, only: kind_phys +#ifdef CCPP + use physcons, only: con_cp, con_fvirt, con_g, & + con_hvap, con_hfus, con_pi, con_rd, con_rv, & + con_t0c, con_cvap, con_cliq, con_eps, & + con_epsm1, con_ttp, rlapse, con_jcal, con_rhw0, & + con_sbc, con_tice, cimin + use module_radsw_parameters, only: topfsw_type, sfcfsw_type, cmpfsw_type, NBDSW + use module_radlw_parameters, only: topflw_type, sfcflw_type, NBDLW +#else use module_radsw_parameters, only: topfsw_type, sfcfsw_type use module_radlw_parameters, only: topflw_type, sfcflw_type use ozne_def, only: levozp, oz_coeff use h2o_def, only: levh2o, h2o_coeff use aerclm_def, only: ntrcaer, ntrcaerm +#endif implicit none +#ifdef CCPP + ! To ensure that these values match what's in the physics, + ! array sizes are compared during model init in GFS_rrtmg_setup_init() + private :: NF_AESW, NF_AELW, NSPC, NSPC1, NF_CLDS, NF_VGAS, NF_ALBD, ntrcaerm + ! from module_radiation_aerosols + integer, parameter :: NF_AESW = 3 + integer, parameter :: NF_AELW = 3 + integer, parameter :: NSPC = 5 + integer, parameter :: NSPC1 = NSPC + 1 + ! from module_radiation_clouds + integer, parameter :: NF_CLDS = 9 + ! from module_radiation_gases + integer, parameter :: NF_VGAS = 10 + ! from module_radiation_surface + integer, parameter :: NF_ALBD = 4 + ! from aerclm_def + integer, parameter :: ntrcaerm = 15 + + ! These will be set later in GFS_Control%initialize, + ! since they depend on the runtime config (e.g. Model%ntoz, Model%h2o_phys, Model%aero_in) + private :: levozp, oz_coeff, levh2o, h2o_coeff, ntrcaer + integer :: levozp, oz_coeff, levh2o, h2o_coeff, ntrcaer +#endif + +#if 0 +!> \section arg_table_GFS_typedefs +!! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional | +!! |---------------------------------|----------------------------------------------------------|---------------------------------------------------------|---------------|------|-----------------------|-----------|--------|----------| +!! | GFS_cldprop_type | GFS_cldprop_type | definition of type GFS_cldprop_type | DDT | 0 | GFS_cldprop_type | | none | F | +!! | GFS_control_type | GFS_control_type | definition of type GFS_control_type | DDT | 0 | GFS_control_type | | none | F | +!! | GFS_coupling_type | GFS_coupling_type | definition of type GFS_coupling_type | DDT | 0 | GFS_coupling_type | | none | F | +!! | GFS_data_type | GFS_data_type | definition of type GFS_data_type | DDT | 0 | GFS_data_type | | none | F | +!! | GFS_diag_type | GFS_diag_type | definition of type GFS_diag_type | DDT | 0 | GFS_diag_type | | none | F | +!! | GFS_grid_type | GFS_grid_type | definition of type GFS_grid_type | DDT | 0 | GFS_grid_type | | none | F | +!! | GFS_interstitial_type | GFS_interstitial_type | definition of type GFS_interstitial_type | DDT | 0 | GFS_interstitial_type | | none | F | +!! | GFS_radtend_type | GFS_radtend_type | definition of type GFS_radtend_type | DDT | 0 | GFS_radtend_type | | none | F | +!! | GFS_sfcprop_type | GFS_sfcprop_type | definition of type GFS_sfcprop_type | DDT | 0 | GFS_sfcprop_type | | none | F | +!! | GFS_statein_type | GFS_statein_type | definition of type GFS_statein_type | DDT | 0 | GFS_statein_type | | none | F | +!! | GFS_stateout_type | GFS_stateout_type | definition of type GFS_stateout_type | DDT | 0 | GFS_stateout_type | | none | F | +!! | GFS_tbd_type | GFS_tbd_type | definition of type GFS_tbd_type | DDT | 0 | GFS_tbd_type | | none | F | +!! | cmpfsw_type | cmpfsw_type | definition of type cmpfsw_type | DDT | 0 | cmpfsw_type | | none | F | +!! | sfcflw_type | sfcflw_type | definition of type sfcflw_type | DDT | 0 | sfcflw_type | | none | F | +!! | sfcfsw_type | sfcfsw_type | definition of type sfcfsw_type | DDT | 0 | sfcfsw_type | | none | F | +!! | topflw_type | topflw_type | definition of type topflw_type | DDT | 0 | topflw_type | | none | F | +!! | topfsw_type | topfsw_type | definition of type topfsw_type | DDT | 0 | topfsw_type | | none | F | +!! | LTP | extra_top_layer | extra top layer for radiation | none | 0 | integer | | none | F | +!! | con_cliq | specific_heat_of_liquid_water_at_constant_pressure | specific heat of liquid water at constant pressure | J kg-1 K-1 | 0 | real | kind_phys | none | F | +!! | con_cp | specific_heat_of_dry_air_at_constant_pressure | specific heat of dry air at constant pressure | J kg-1 K-1 | 0 | real | kind_phys | none | F | +!! | con_cvap | specific_heat_of_water_vapor_at_constant_pressure | specific heat of water vapor at constant pressure | J kg-1 K-1 | 0 | real | kind_phys | none | F | +!! | con_eps | ratio_of_dry_air_to_water_vapor_gas_constants | rd/rv | none | 0 | real | kind_phys | none | F | +!! | con_epsm1 | ratio_of_dry_air_to_water_vapor_gas_constants_minus_one | (rd/rv) - 1 | none | 0 | real | kind_phys | none | F | +!! | con_fvirt | ratio_of_vapor_to_dry_air_gas_constants_minus_one | (rv/rd) - 1 (rv = ideal gas constant for water vapor) | none | 0 | real | kind_phys | none | F | +!! | con_g | gravitational_acceleration | gravitational acceleration | m s-2 | 0 | real | kind_phys | none | F | +!! | con_hvap | latent_heat_of_vaporization_of_water_at_0C | latent heat of evaporation/sublimation | J kg-1 | 0 | real | kind_phys | none | F | +!! | con_hfus | latent_heat_of_fusion_of_water_at_0C | latent heat of fusion | J kg-1 | 0 | real | kind_phys | none | F | +!! | con_pi | pi | ratio of a circle's circumference to its diameter | radians | 0 | real | kind_phys | none | F | +!! | con_rd | gas_constant_dry_air | ideal gas constant for dry air | J kg-1 K-1 | 0 | real | kind_phys | none | F | +!! | con_rv | gas_constant_water_vapor | ideal gas constant for water vapor | J kg-1 K-1 | 0 | real | kind_phys | none | F | +!! | con_t0c | temperature_at_zero_celsius | temperature at 0 degrees Celsius | K | 0 | real | kind_phys | none | F | +!! | con_ttp | triple_point_temperature_of_water | triple point temperature of water | K | 0 | real | kind_phys | none | F | +!! | cimin | minimum_sea_ice_concentration | minimum sea ice concentration | frac | 0 | real | kind_phys | none | F | +!! | rlapse | air_temperature_lapse_rate_constant | environmental air temperature lapse rate constant | K m-1 | 0 | real | kind_phys | none | F | +!! | con_jcal | joules_per_calorie_constant | joules per calorie constant | J cal-1 | 0 | real | kind_phys | none | F | +!! | con_rhw0 | sea_water_reference_density | sea water reference density | kg m-3 | 0 | real | kind_phys | none | F | +!! | con_sbc | steffan_boltzmann_constant | Steffan-Boltzmann constant | W m-2 K-4 | 0 | real | kind_phys | none | F | +!! | con_tice | freezing_point_temperature_of_seawater | freezing point temperature of seawater | K | 0 | real | kind_phys | none | F | +!! +#endif + !--- version of physics character(len=64) :: phys_version = 'v2018 FV3GFS BETA VERSION PHYSICS' @@ -24,6 +103,16 @@ module GFS_typedefs real(kind=kind_phys), parameter :: cn_100 = 100._kind_phys real(kind=kind_phys), parameter :: cn_th = 1000._kind_phys real(kind=kind_phys), parameter :: cn_hr = 3600._kind_phys +#ifdef CCPP + ! optional extra top layer on top of low ceiling models + ! this parameter was originally defined in the radiation driver + ! (and is still for standard non-CCPP builds), but is required + ! here for CCPP to allocate arrays used for the interstitial + ! calculations previously in GFS_{physics,radiation}_driver.F90 + ! LTP=0: no extra top layer + integer, parameter :: LTP = 0 ! no extra top layer + !integer, parameter :: LTP = 1 ! add an extra top layer +#endif !---------------- ! Data Containers @@ -39,9 +128,13 @@ module GFS_typedefs ! GFS_control_type !< model control parameters ! GFS_grid_type !< grid and interpolation related data ! GFS_tbd_type !< to be determined data that doesn't fit in any one container -! GFS_clprop_type !< cloud fields needed by radiation from physics +! GFS_cldprop_type !< cloud fields needed by radiation from physics ! GFS_radtend_type !< radiation tendencies needed in physics ! GFS_diag_type !< fields targetted for diagnostic output +#ifdef CCPP +! GFS_interstitial_type !< fields required to replace interstitial code in GFS_{physics,radiation}_driver.F90 in CCPP +! GFS_data_type !< combined type of all of the above except GFS_control_type and GFS_interstitial_type +#endif !-------------------------------------------------------------------------------- ! GFS_init_type @@ -49,6 +142,41 @@ module GFS_typedefs ! This container is the minimum set of data required from the dycore/atmosphere ! component to allow proper initialization of the GFS physics !-------------------------------------------------------------------------------- +#if 0 +!! \section arg_table_GFS_init_type +!! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional | +!! |----------------|--------------------------------------------------------|---------------------------------------------------------|---------------|------|----------|-----------|--------|----------| +!! | me | | current MPI-rank | none | 0 | integer | | none | F | +!! | master | | master MPI-rank | none | 0 | integer | | none | F | +!! | tile_num | | tile number | none | 0 | integer | | none | F | +!! | isc | | starting i-index for this MPI-domain | index | 0 | integer | | none | F | +!! | jsc | | starting j-index for this MPI-domain | index | 0 | integer | | none | F | +!! | nx | | number of points in i-dir for this MPI rank | count | 0 | integer | | none | F | +!! | ny | | number of points in j-dir for this MPI rank | count | 0 | integer | | none | F | +!! | levs | | number of vertical levels | count | 0 | integer | | none | F | +!! | cnx | | number of points in i-dir for this cubed-sphere face | count | 0 | integer | | none | F | +!! | cny | | number of points in j-dir for this cubed-sphere face | count | 0 | integer | | none | F | +!! | gnx | | number of global points in x-dir (i) along the equator | count | 0 | integer | | none | F | +!! | gny | | number of global points in y-dir (j) along any meridian | count | 0 | integer | | none | F | +!! | nlunit | | fortran unit number for file opens | none | 0 | integer | | none | F | +!! | logunit | | fortran unit number for writing logfile | none | 0 | integer | | none | F | +!! | bdat | | model begin date in GFS format (same as idat) | none | 0 | integer | | none | F | +!! | cdat | | model current date in GFS format (same as jdat) | none | 0 | integer | | none | F | +!! | dt_dycore | | dynamics time step in seconds | s | 0 | real | kind_phys | none | F | +!! | dt_phys | | physics time step in seconds | s | 0 | real | kind_phys | none | F | +!! | restart | | flag for restart (warmstart) or coldstart | flag | 0 | logical | | none | F | +!! | hydrostatic | | flag for hydrostatic solver from dynamics | flag | 0 | logical | | none | F | +!! | blksz | | for explicit data blocking | count | 1 | integer | | none | F | +!! | ak | | a parameter for sigma pressure level calculations | Pa | 1 | real | kind_phys | none | F | +!! | bk | | b parameter for sigma pressure level calculations | none | 1 | real | kind_phys | none | F | +!! | xlon | | column longitude for MPI rank | radians | 2 | real | kind_phys | none | F | +!! | xlat | | column latitude for MPI rank | radians | 2 | real | kind_phys | none | F | +!! | area | | column area for length scale calculations | m2 | 2 | real | kind_phys | none | F | +!! | tracer_names | | tracers names to dereference tracer id | none | 1 | charater | len=32 | none | F | +!! | fn_nml | | namelist filename | none | 0 | charater | len=65 | none | F | +!! | input_nml_file | | namelist filename for internal file reads | none | 0 | charater | len=256 | none | F | +!! +#endif type GFS_init_type integer :: me !< my MPI-rank integer :: master !< master MPI-rank @@ -61,7 +189,7 @@ module GFS_typedefs integer :: cnx !< number of points in i-dir for this cubed-sphere face !< equal to gnx for lat-lon grids integer :: cny !< number of points in j-dir for this cubed-sphere face - !< equal to gny*2 for lat-lon grids + !< equal to gny for lat-lon grids integer :: gnx !< number of global points in x-dir (i) along the equator integer :: gny !< number of global points in y-dir (j) along any meridian integer :: nlunit !< fortran unit number for file opens @@ -70,6 +198,12 @@ module GFS_typedefs integer :: cdat(8) !< model current date in GFS format (same as jdat) real(kind=kind_phys) :: dt_dycore !< dynamics time step in seconds real(kind=kind_phys) :: dt_phys !< physics time step in seconds +#ifdef CCPP +!--- restart information + logical :: restart !< flag whether this is a coldstart (.false.) or a warmstart/restart (.true.) +!--- hydrostatic/non-hydrostatic flag + logical :: hydrostatic !< flag whether this is a hydrostatic or non-hydrostatic run +#endif !--- blocking data integer, pointer :: blksz(:) !< for explicit data blocking !< default blksz(1)=[nx*ny] @@ -93,6 +227,51 @@ module GFS_typedefs ! GFS_statein_type ! prognostic state variables with layer and level specific data !---------------------------------------------------------------- +#if 0 +!! \section arg_table_GFS_statein_type +!! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional | +!! |-----------------------------------------------------------|-----------------------------------------------------------|-------------------------------------------------------------------------------------|---------------|------|---------|-----------|--------|----------| +!! | GFS_Data(cdata%blk_no)%Statein%phii | geopotential_at_interface | geopotential at model layer interfaces | m2 s-2 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%prsi | air_pressure_at_interface | air pressure at model layer interfaces | Pa | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%prsik | dimensionless_exner_function_at_model_interfaces | dimensionless Exner function at model layer interfaces | none | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%prsik(:,1) | dimensionless_exner_function_at_lowest_model_interface | dimensionless Exner function at lowest model interface | none | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%phil | geopotential | geopotential at model layer centers | m2 s-2 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%prsl | air_pressure | mean layer pressure | Pa | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%prsl(:,1) | air_pressure_at_lowest_model_layer | mean pressure at lowest model layer | Pa | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%prslk | dimensionless_exner_function_at_model_layers | dimensionless Exner function at model layer centers | none | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%prslk(:,1) | dimensionless_exner_function_at_lowest_model_layer | dimensionless Exner function at lowest model layer | none | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%pgr | surface_air_pressure | surface pressure | Pa | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%ugrs | x_wind | zonal wind | m s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%ugrs(:,1) | x_wind_at_lowest_model_layer | zonal wind at lowest model layer | m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%vgrs | y_wind | meridional wind | m s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%vgrs(:,1) | y_wind_at_lowest_model_layer | meridional wind at lowest model layer | m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%vvl | omega | layer mean vertical velocity | Pa s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%tgrs | air_temperature | model layer mean temperature | K | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%tgrs(:,1) | air_temperature_at_lowest_model_layer | mean temperature at lowest model layer | K | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%qgrs | tracer_concentration | model layer mean tracer concentration | kg kg-1 | 3 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%qgrs(:,:,GFS_Control%ntqv) | water_vapor_specific_humidity | water vapor specific humidity | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%qgrs(:,1,GFS_Control%ntqv) | water_vapor_specific_humidity_at_lowest_model_layer | water vapor specific humidity at lowest model layer | kg kg-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%qgrs(:,:,GFS_Control%ntcw) | cloud_condensed_water_mixing_ratio | moist (dry+vapor, no condensates) mixing ratio of cloud water (condensate) | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%qgrs(:,1,GFS_Control%ntcw) | cloud_condensed_water_mixing_ratio_at_lowest_model_layer | moist (dry+vapor, no condensates) mixing ratio of cloud water at lowest model layer | kg kg-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%qgrs(:,:,GFS_Control%ntiw) | ice_water_mixing_ratio | moist (dry+vapor, no condensates) mixing ratio of ice water | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%qgrs(:,:,GFS_Control%ntrw) | rain_water_mixing_ratio | moist (dry+vapor, no condensates) mixing ratio of rain water | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%qgrs(:,:,GFS_Control%ntsw) | snow_water_mixing_ratio | moist (dry+vapor, no condensates) mixing ratio of snow water | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%qgrs(:,:,GFS_Control%ntgl) | graupel_mixing_ratio | moist (dry+vapor, no condensates) mixing ratio of graupel | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%qgrs(:,:,GFS_Control%ntoz) | ozone_mixing_ratio | ozone mixing ratio | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%qgrs(:,:,GFS_Control%ntwa) | water_friendly_aerosol_number_concentration | number concentration of water-friendly aerosols | kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%qgrs(:,:,GFS_Control%ntia) | ice_friendly_aerosol_number_concentration | number concentration of ice-friendly aerosols | kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%qgrs(:,:,GFS_Control%ntlnc)| cloud_droplet_number_concentration | number concentration of cloud droplets (liquid) | kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%qgrs(:,:,GFS_Control%ntinc)| ice_number_concentration | number concentration of ice | kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%qgrs(:,:,GFS_Control%ntrnc)| rain_number_concentration | number concentration of rain | kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%qgrs(:,:,GFS_Control%ntsnc)| snow_number_concentration | number concentration of snow | kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%qgrs(:,:,GFS_Control%ntgnc)| graupel_number_concentration | number concentration of graupel | kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%qgrs(:,:,GFS_Control%ntke) | turbulent_kinetic_energy | turbulent kinetic energy | J | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%diss_est | dissipation_estimate_of_air_temperature_at_model_layers | dissipation estimate model layer mean temperature | K | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%smc | | total soil moisture | frac | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%stc | | soil temperature | K | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Statein%slc | | liquid soil moisture | frac | 2 | real | kind_phys | none | F | +!! +#endif type GFS_statein_type !--- level geopotential and pressures @@ -128,6 +307,35 @@ module GFS_typedefs ! GFS_stateout_type ! prognostic state or tendencies after physical parameterizations !------------------------------------------------------------------ +#if 0 +!! \section arg_table_GFS_stateout_type +!! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional | +!! |--------------------------------------------------------------|------------------------------------------------------------------------|--------------------------------------------------------------------------------------------|---------|------|---------|-----------|--------|----------| +!! | GFS_Data(cdata%blk_no)%Stateout%gu0 | x_wind_updated_by_physics | zonal wind updated by physics | m s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Stateout%gu0(:,1) | x_wind_at_lowest_model_layer_updated_by_physics | zonal wind at lowest model level updated by physics | m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Stateout%gv0 | y_wind_updated_by_physics | meridional wind updated by physics | m s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Stateout%gv0(:,1) | y_wind_at_lowest_model_layer_updated_by_physics | meridional wind at lowest model level updated by physics | m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Stateout%gt0 | air_temperature_updated_by_physics | temperature updated by physics | K | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Stateout%gt0(:,1) | air_temperature_at_lowest_model_layer_updated_by_physics | temperature at lowest model layer updated by physics | K | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Stateout%gq0 | tracer_concentration_updated_by_physics | tracer concentration updated by physics | kg kg-1 | 3 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Stateout%gq0(:,:,GFS_Control%ntqv) | water_vapor_specific_humidity_updated_by_physics | water vapor specific humidity updated by physics | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Stateout%gq0(:,1,GFS_Control%ntqv) | water_vapor_specific_humidity_at_lowest_model_layer_updated_by_physics | water vapor specific humidity at lowest model layer updated by physics | kg kg-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Stateout%gq0(:,:,GFS_Control%ntoz) | ozone_concentration_updated_by_physics | ozone concentration updated by physics | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Stateout%gq0(:,:,GFS_Control%ntcw) | cloud_condensed_water_mixing_ratio_updated_by_physics | moist (dry+vapor, no condensates) mixing ratio of cloud condensed water updated by physics | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Stateout%gq0(:,:,GFS_Control%ntiw) | ice_water_mixing_ratio_updated_by_physics | moist (dry+vapor, no condensates) mixing ratio of ice water updated by physics | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Stateout%gq0(:,:,GFS_Control%ntrw) | rain_water_mixing_ratio_updated_by_physics | moist (dry+vapor, no condensates) mixing ratio of rain water updated by physics | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Stateout%gq0(:,:,GFS_Control%ntsw) | snow_water_mixing_ratio_updated_by_physics | moist (dry+vapor, no condensates) mixing ratio of snow water updated by physics | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Stateout%gq0(:,:,GFS_Control%ntgl) | graupel_mixing_ratio_updated_by_physics | moist (dry+vapor, no condensates) mixing ratio of graupel updated by physics | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Stateout%gq0(:,:,GFS_Control%ntwa) | water_friendly_aerosol_number_concentration_updated_by_physics | number concentration of water-friendly aerosols updated by physics | kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Stateout%gq0(:,:,GFS_Control%ntia) | ice_friendly_aerosol_number_concentration_updated_by_physics | number concentration of ice-friendly aerosols updated by physics | kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Stateout%gq0(:,:,GFS_Control%ntlnc) | cloud_droplet_number_concentration_updated_by_physics | number concentration of cloud droplets updated by physics | kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Stateout%gq0(:,:,GFS_Control%ntinc) | ice_number_concentration_updated_by_physics | number concentration of ice updated by physics | kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Stateout%gq0(:,:,GFS_Control%ntrnc) | rain_number_concentration_updated_by_physics | number concentration of rain updated by physics | kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Stateout%gq0(:,:,GFS_Control%ntsnc) | snow_number_concentration_updated_by_physics | number concentration of snow updated by physics | kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Stateout%gq0(:,:,GFS_Control%ntgnc) | graupel_number_concentration_updated_by_physics | number concentration of graupel updated by physics | kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Stateout%gq0(:,:,GFS_Control%ntclamt) | cloud_fraction_updated_by_physics | cloud fraction updated by physics | frac | 2 | real | kind_phys | none | F | +!! +#endif type GFS_stateout_type !-- Out (physics only) @@ -145,6 +353,101 @@ module GFS_typedefs ! GFS_sfcprop_type ! surface properties that may be read in and/or updated by climatology or observations !--------------------------------------------------------------------------------------- +#if 0 +!! \section arg_table_GFS_sfcprop_type +!! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional | +!! |--------------------------------------------|------------------------------------------------------------------------|--------------------------------------------------------|---------------|------|---------|-----------|--------|----------| +!! | GFS_Data(cdata%blk_no)%Sfcprop%slmsk | sea_land_ice_mask_real | landmask: sea/land/ice=0/1/2 | flag | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%oceanfrac | sea_area_fraction | fraction of horizontal grid area occupied by ocean | frac | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%landfrac | land_area_fraction | fraction of horizontal grid area occupied by land | frac | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%lakefrac | lake_area_fraction | fraction of horizontal grid area occupied by lake | frac | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%tsfc | surface_skin_temperature | surface skin temperature | K | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%tsfco | sea_surface_temperature | sea surface temperature | K | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%tsfcl | surface_skin_temperature_over_land | surface skin temperature over land | K | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%tisfc | sea_ice_temperature | sea ice surface skin temperature | K | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%snowd | surface_snow_thickness_water_equivalent | water equivalent snow depth | mm | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%zorl | surface_roughness_length | surface roughness length | cm | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%zorlo | surface_roughness_length_over_ocean | surface roughness length over ocean | cm | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%zorll | surface_roughness_length_over_land | surface roughness length over land | cm | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%fice | sea_ice_concentration | ice fraction over open water | frac | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%hprim | | topographic standard deviation | m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%hprime | statistical_measures_of_subgrid_orography | orographic metrics | various | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%sncovr | surface_snow_area_fraction_over_land | surface snow area fraction | frac | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%snoalb | upper_bound_on_max_albedo_over_deep_snow | maximum snow albedo | frac | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%alvsf | | mean vis albedo with strong cosz dependency | frac | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%alnsf | | mean nir albedo with strong cosz dependency | frac | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%alvwf | mean_vis_albedo_with_weak_cosz_dependency | mean vis albedo with weak cosz dependency | frac | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%alnwf | mean_nir_albedo_with_weak_cosz_dependency | mean nir albedo with weak cosz dependency | frac | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%facsf | | fractional coverage with strong cosz dependency | frac | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%facwf | | fractional coverage with weak cosz dependency | frac | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%slope | surface_slope_classification_real | sfc slope type for lsm | index | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%shdmin | minimum_vegetation_area_fraction | min fractional coverage of green vegetation | frac | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%shdmax | maximum_vegetation_area_fraction | max fractional coverage of green vegetation | frac | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%tg3 | deep_soil_temperature | deep soil temperature | K | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%vfrac | vegetation_area_fraction | areal fractional cover of green vegetation | frac | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%vtype | vegetation_type_classification_real | vegetation type for lsm | index | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%stype | soil_type_classification_real | soil type for lsm | index | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%uustar | surface_friction_velocity | boundary layer parameter | m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%oro | orography | orography | m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%oro_uf | orography_unfiltered | unfiltered orography | m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%conv_act | gf_memory_counter | Memory counter for GF | none | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%hice | sea_ice_thickness | sea ice thickness | m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%weasd | water_equivalent_accumulated_snow_depth | water equiv of acc snow depth over land and sea ice | mm | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%canopy | canopy_water_amount | canopy water amount | kg m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%ffmm | Monin-Obukhov_similarity_function_for_momentum | Monin-Obukhov similarity function for momentum | none | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%ffhh | Monin-Obukhov_similarity_function_for_heat | Monin-Obukhov similarity function for heat | none | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%f10m | ratio_of_wind_at_lowest_model_layer_and_wind_at_10m | ratio of sigma level 1 wind and 10m wind | ratio | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%tprcp | nonnegative_lwe_thickness_of_precipitation_amount_on_dynamics_timestep | total precipitation amount in each time step | m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%srflag | flag_for_precipitation_type | snow/rain flag for precipitation | flag | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%slc | volume_fraction_of_unfrozen_soil_moisture | liquid soil moisture | frac | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%smc | volume_fraction_of_soil_moisture | total soil moisture | frac | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%stc | soil_temperature | soil temperature | K | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%t2m | temperature_at_2m | 2 meter temperature | K | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%th2m | potential_temperature_at_2m | 2 meter potential temperature | K | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%q2m | specific_humidity_at_2m | 2 meter specific humidity | kg kg-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%tref | sea_surface_reference_temperature | sea surface reference temperature | K | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%z_c | sub-layer_cooling_thickness | sub-layer cooling thickness | m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%c_0 | coefficient_c_0 | coefficient 1 to calculate d(Tz)/d(Ts) | none | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%c_d | coefficient_c_d | coefficient 2 to calculate d(Tz)/d(Ts) | none | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%w_0 | coefficient_w_0 | coefficient 3 to calculate d(Tz)/d(Ts) | none | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%w_d | coefficient_w_d | coefficient 4 to calculate d(Tz)/d(Ts) | none | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%xt | diurnal_thermocline_layer_heat_content | heat content in diurnal thermocline layer | K m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%xs | sea_water_salinity | salinity content in diurnal thermocline layer | ppt m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%xu | diurnal_thermocline_layer_x_current | u-current content in diurnal thermocline layer | m2 s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%xv | diurnal_thermocline_layer_y_current | v-current content in diurnal thermocline layer | m2 s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%xz | diurnal_thermocline_layer_thickness | diurnal thermocline layer thickness | m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%zm | ocean_mixed_layer_thickness | mixed layer thickness | m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%xtts | sensitivity_of_dtl_heat_content_to_surface_temperature | d(xt)/d(ts) | m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%xzts | sensitivity_of_dtl_thickness_to_surface_temperature | d(xz)/d(ts) | m K-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%d_conv | free_convection_layer_thickness | thickness of free convection layer (FCL) | m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%ifd | index_of_dtlm_start | index to start dtlm run or not | index | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%dt_cool | sub-layer_cooling_amount | sub-layer cooling amount | K | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%qrain | sensible_heat_flux_due_to_rainfall | sensible heat flux due to rainfall | W | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%wetness | normalized_soil_wetness_for_land_surface_model | normalized soil wetness for lsm | frac | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%sh2o | volume_fraction_of_unfrozen_soil_moisture_for_land_surface_model | volume fraction of unfrozen soil moisture for lsm | frac | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%keepsmfr | volume_fraction_of_frozen_soil_moisture_for_land_surface_model | volume fraction of frozen soil moisture for lsm | frac | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%smois | volume_fraction_of_soil_moisture_for_land_surface_model | volumetric fraction of soil moisture for lsm | frac | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%tslb | soil_temperature_for_land_surface_model | soil temperature for land surface model | K | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%zs | depth_of_soil_levels_for_land_surface_model | depth of soil levels for land surface model | m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%clw_surf | cloud_condensed_water_mixing_ratio_at_surface | moist cloud water mixing ratio at surface | kg kg-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%qwv_surf | water_vapor_mixing_ratio_at_surface | water vapor mixing ratio at surface | kg kg-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%cndm_surf | surface_condensation_mass | surface condensation mass | kg m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%flag_frsoil | flag_for_frozen_soil_physics | flag for frozen soil physics (RUC) | flag | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%rhofr | density_of_frozen_precipitation | density of frozen precipitation | kg m-3 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%tsnow | snow_temperature_bottom_first_layer | snow temperature at the bottom of the first snow layer | K | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%snowfallac | total_accumulated_snowfall | run-total snow accumulation on the ground | kg m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%acsnow | accumulated_water_equivalent_of_frozen_precip | snow water equivalent of run-total frozen precip | kg m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%ustm | surface_friction_velocity_drag | friction velocity isolated for momentum only | m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%zol | surface_stability_parameter | monin obukhov surface stability parameter | none | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%mol | theta_star | temperature flux divided by ustar (temperature scale) | K | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%rmol | reciprocal_of_obukhov_length | one over obukhov length | m-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%flhc | surface_exchange_coefficient_for_heat | surface exchange coefficient for heat | W m-2 K-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%flqc | surface_exchange_coefficient_for_moisture | surface exchange coefficient for moisture | kg m-2 s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%chs2 | surface_exchange_coefficient_for_heat_at_2m | exchange coefficient for heat at 2 meters | m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%cqs2 | surface_exchange_coefficient_for_moisture_at_2m | exchange coefficient for moisture at 2 meters | m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Sfcprop%lh | surface_latent_heat | latent heating at the surface (pos = up) | W m-2 | 1 | real | kind_phys | none | F | +!! +#endif type GFS_sfcprop_type !--- In (radiation and physics) @@ -152,17 +455,17 @@ module GFS_typedefs real (kind=kind_phys), pointer :: oceanfrac(:) => null() !< ocean fraction [0:1] real (kind=kind_phys), pointer :: landfrac(:) => null() !< land fraction [0:1] real (kind=kind_phys), pointer :: lakefrac(:) => null() !< lake fraction [0:1] - real (kind=kind_phys), pointer :: tsfc (:) => null() !< surface air temperature in k + real (kind=kind_phys), pointer :: tsfc (:) => null() !< surface air temperature in K !< [tsea in gbphys.f] - real (kind=kind_phys), pointer :: tsfco (:) => null() !< sst in k - real (kind=kind_phys), pointer :: tsfcl (:) => null() !< surface land temperature in k + real (kind=kind_phys), pointer :: tsfco (:) => null() !< sst in K + real (kind=kind_phys), pointer :: tsfcl (:) => null() !< surface land temperature in K real (kind=kind_phys), pointer :: tisfc (:) => null() !< surface temperature over ice fraction real (kind=kind_phys), pointer :: snowd (:) => null() !< snow depth water equivalent in mm ; same as snwdph real (kind=kind_phys), pointer :: zorl (:) => null() !< composite surface roughness in cm real (kind=kind_phys), pointer :: zorlo (:) => null() !< ocean surface roughness in cm real (kind=kind_phys), pointer :: zorll (:) => null() !< land surface roughness in cm real (kind=kind_phys), pointer :: fice (:) => null() !< ice fraction over open water grid - real (kind=kind_phys), pointer :: hprim (:) => null() !< topographic standard deviation in m ! + real (kind=kind_phys), pointer :: hprim (:) => null() !< topographic standard deviation in m real (kind=kind_phys), pointer :: hprime (:,:) => null() !< orographic metrics !--- In (radiation only) @@ -188,6 +491,9 @@ module GFS_typedefs real (kind=kind_phys), pointer :: oro_uf (:) => null() !< unfiltered orography !-- In/Out +#ifdef CCPP + real (kind=kind_phys), pointer :: conv_act(:) => null() !< convective activity counter hli 09/2017 +#endif real (kind=kind_phys), pointer :: hice (:) => null() !< sea ice thickness real (kind=kind_phys), pointer :: weasd (:) => null() !< water equiv of accumulated snow depth (kg/m**2) !< over land and sea ice @@ -203,6 +509,9 @@ module GFS_typedefs !--- Out real (kind=kind_phys), pointer :: t2m (:) => null() !< 2 meter temperature +#ifdef CCPP + real (kind=kind_phys), pointer :: th2m (:) => null() !< 2 meter potential temperature +#endif real (kind=kind_phys), pointer :: q2m (:) => null() !< 2 meter humidity ! -- In/Out for Noah MP @@ -264,6 +573,36 @@ module GFS_typedefs real (kind=kind_phys), pointer :: dt_cool(:) => null() !< nst_fld%dt_cool Sub layer cooling amount real (kind=kind_phys), pointer :: qrain (:) => null() !< nst_fld%qrain sensible heat flux due to rainfall (watts) +#ifdef CCPP + ! Soil properties for RUC LSM (number of levels different from NOAH 4-layer model) + real (kind=kind_phys), pointer :: wetness(:) => null() !< normalized soil wetness for lsm + real (kind=kind_phys), pointer :: sh2o(:,:) => null() !< volume fraction of unfrozen soil moisture for lsm + real (kind=kind_phys), pointer :: keepsmfr(:,:) => null() !< RUC LSM: frozen moisture in soil + real (kind=kind_phys), pointer :: smois(:,:) => null() !< volumetric fraction of soil moisture for lsm + real (kind=kind_phys), pointer :: tslb(:,:) => null() !< soil temperature for land surface model + real (kind=kind_phys), pointer :: flag_frsoil(:,:) => null() !< RUC LSM: flag for frozen soil physics + ! + real (kind=kind_phys), pointer :: zs(:) => null() !< depth of soil levels for land surface model + real (kind=kind_phys), pointer :: clw_surf(:) => null() !< RUC LSM: moist cloud water mixing ratio at surface + real (kind=kind_phys), pointer :: qwv_surf(:) => null() !< RUC LSM: water vapor mixing ratio at surface + real (kind=kind_phys), pointer :: cndm_surf(:) => null() !< RUC LSM: surface condensation mass + real (kind=kind_phys), pointer :: rhofr(:) => null() !< RUC LSM: density of frozen precipitation + real (kind=kind_phys), pointer :: tsnow(:) => null() !< RUC LSM: snow temperature at the bottom of the first soil layer + real (kind=kind_phys), pointer :: snowfallac(:) => null() !< ruc lsm diagnostics + real (kind=kind_phys), pointer :: acsnow(:) => null() !< ruc lsm diagnostics + + ! MYNN surface layer + real (kind=kind_phys), pointer :: ustm (:) => null() !u* including drag + real (kind=kind_phys), pointer :: zol(:) => null() !surface stability parameter + real (kind=kind_phys), pointer :: mol(:) => null() !theta star + real (kind=kind_phys), pointer :: rmol(:) => null() !reciprocal of obukhov length + real (kind=kind_phys), pointer :: flhc(:) => null() !drag coeff for heat + real (kind=kind_phys), pointer :: flqc(:) => null() !drag coeff for moisture + real (kind=kind_phys), pointer :: chs2(:) => null() !exch coeff for heat at 2m + real (kind=kind_phys), pointer :: cqs2(:) => null() !exch coeff for moisture at 2m + real (kind=kind_phys), pointer :: lh(:) => null() !latent heating at the surface +#endif + contains procedure :: create => sfcprop_create !< allocate array data end type GFS_sfcprop_type @@ -273,6 +612,106 @@ module GFS_typedefs ! GFS_coupling_type ! fields to/from other coupled components (e.g. land/ice/ocean/etc.) !--------------------------------------------------------------------- +#if 0 +!! \section arg_table_GFS_coupling_type +!! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional | +!! |--------------------------------------|-------------------------------------------------------------------------------------------|------------------------------------------------------|---------------|------|---------|-----------|--------|----------| +!! | GFS_Data(cdata%blk_no)%Coupling%nirbmdi | surface_downwelling_direct_near_infrared_shortwave_flux_on_radiation_time_step | sfc nir beam sw downward flux | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%nirdfdi | surface_downwelling_diffuse_near_infrared_shortwave_flux_on_radiation_time_step | sfc nir diff sw downward flux | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%visbmdi | surface_downwelling_direct_ultraviolet_and_visible_shortwave_flux_on_radiation_time_step | sfc uv+vis beam sw downward flux | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%visdfdi | surface_downwelling_diffuse_ultraviolet_and_visible_shortwave_flux_on_radiation_time_step | sfc uv+vis diff sw downward flux | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%nirbmui | surface_upwelling_direct_near_infrared_shortwave_flux_on_radiation_time_step | sfc nir beam sw upward flux | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%nirdfui | surface_upwelling_diffuse_near_infrared_shortwave_flux_on_radiation_time_step | sfc nir diff sw upward flux | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%visbmui | surface_upwelling_direct_ultraviolet_and_visible_shortwave_flux_on_radiation_time_step | sfc uv+vis beam sw upward flux | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%visdfui | surface_upwelling_diffuse_ultraviolet_and_visible_shortwave_flux_on_radiation_time_step | sfc uv+vis diff sw upward flux | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%sfcdsw | surface_downwelling_shortwave_flux_on_radiation_time_step | total sky sfc downward sw flux | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%sfcnsw | surface_net_downwelling_shortwave_flux_on_radiation_time_step | total sky sfc netsw flx into ground | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%sfcdlw | surface_downwelling_longwave_flux_on_radiation_time_step | total sky sfc downward lw flux | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%dusfcin_cpl | | aoi_fld%dusfcin(item,lan) | | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%dvsfcin_cpl | | aoi_fld%dvsfcin(item,lan) | | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%dtsfcin_cpl | | aoi_fld%dtsfcin(item,lan) | | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%dqsfcin_cpl | | aoi_fld%dqsfcin(item,lan) | | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%ulwsfcin_cpl | | aoi_fld%ulwsfcin(item,lan) | | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%tseain_cpl | | aoi_fld%tseain(item,lan) | | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%tisfcin_cpl | | aoi_fld%tisfcin(item,lan) | | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%ficein_cpl | | aoi_fld%ficein(item,lan) | | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%hicein_cpl | | aoi_fld%hicein(item,lan) | | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%hsnoin_cpl | | aoi_fld%hsnoin(item,lan) | | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%slimskin_cpl | | aoi_fld%slimskin(item,lan) | | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%rain_cpl | lwe_thickness_of_precipitation_amount_for_coupling | total rain precipitation | m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%rainc_cpl | lwe_thickness_of_convective_precipitation_amount_for_coupling | total convective precipitation | m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%snow_cpl | lwe_thickness_of_snow_amount_for_coupling | total snow precipitation | m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%dusfc_cpl | cumulative_surface_x_momentum_flux_for_coupling_multiplied_by_timestep | cumulative sfc x momentum flux multiplied by timestep| Pa s | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%dvsfc_cpl | cumulative_surface_y_momentum_flux_for_coupling_multiplied_by_timestep | cumulative sfc y momentum flux multiplied by timestep| Pa s | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%dtsfc_cpl | cumulative_surface_upward_sensible_heat_flux_for_coupling_multiplied_by_timestep | cumulative sfc sensible heat flux multiplied by timestep | W m-2 s | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%dqsfc_cpl | cumulative_surface_upward_latent_heat_flux_for_coupling_multiplied_by_timestep | cumulative sfc latent heat flux multiplied by timestep | W m-2 s | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%dlwsfc_cpl | cumulative_surface_downwelling_longwave_flux_for_coupling_multiplied_by_timestep | cumulative sfc downward lw flux mulitplied by timestep | W m-2 s | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%dswsfc_cpl | cumulative_surface_downwelling_shortwave_flux_for_coupling_multiplied_by_timestep | cumulative sfc downward sw flux multiplied by timestep | W m-2 s | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%dnirbm_cpl | cumulative_surface_downwelling_direct_near_infrared_shortwave_flux_for_coupling_multiplied_by_timestep | cumulative sfc nir beam downward sw flux multiplied by timestep | W m-2 s | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%dnirdf_cpl | cumulative_surface_downwelling_diffuse_near_infrared_shortwave_flux_for_coupling_multiplied_by_timestep | cumulative sfc nir diff downward sw flux multiplied by timestep | W m-2 s | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%dvisbm_cpl | cumulative_surface_downwelling_direct_ultraviolet_and_visible_shortwave_flux_for_coupling_multiplied_by_timestep | cumulative sfc uv+vis beam dnwd sw flux multiplied by timestep | W m-2 s | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%dvisdf_cpl | cumulative_surface_downwelling_diffuse_ultraviolet_and_visible_shortwave_flux_for_coupling_multiplied_by_timestep | cumulative sfc uv+vis diff dnwd sw flux multiplied by timestep | W m-2 s | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%nlwsfc_cpl | cumulative_surface_net_downward_longwave_flux_for_coupling_multiplied_by_timestep | cumulative net downward lw flux multiplied by timestep | W m-2 s | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%nswsfc_cpl | cumulative_surface_net_downward_shortwave_flux_for_coupling_multiplied_by_timestep | cumulative net downward sw flux multiplied by timestep | W m-2 s | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%nnirbm_cpl | cumulative_surface_net_downward_direct_near_infrared_shortwave_flux_for_coupling_multiplied_by_timestep | cumulative net nir beam downward sw flux multiplied by timestep | W m-2 s | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%nnirdf_cpl | cumulative_surface_net_downward_diffuse_near_infrared_shortwave_flux_for_coupling_multiplied_by_timestep | cumulative net nir diff downward sw flux multiplied by timestep | W m-2 s | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%nvisbm_cpl | cumulative_surface_net_downward_direct_ultraviolet_and_visible_shortwave_flux_for_coupling_multiplied_by_timestep | cumulative net uv+vis beam downward sw rad flux multiplied by timestep | W m-2 s | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%nvisdf_cpl | cumulative_surface_net_downward_diffuse_ultraviolet_and_visible_shortwave_flux_for_coupling_multiplied_by_timestep | cumulative net uv+vis diff downward sw rad flux multiplied by timestep | W m-2 s | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%dusfci_cpl | instantaneous_surface_x_momentum_flux_for_coupling | instantaneous sfc x momentum flux | Pa | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%dvsfci_cpl | instantaneous_surface_y_momentum_flux_for_coupling | instantaneous sfc y momentum flux | Pa | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%dtsfci_cpl | instantaneous_surface_upward_sensible_heat_flux_for_coupling | instantaneous sfc sensible heat flux | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%dqsfci_cpl | instantaneous_surface_upward_latent_heat_flux_for_coupling | instantaneous sfc latent heat flux | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%dlwsfci_cpl | instantaneous_surface_downwelling_longwave_flux_for_coupling | instantaneous sfc downward lw flux | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%dswsfci_cpl | instantaneous_surface_downwelling_shortwave_flux_for_coupling | instantaneous sfc downward sw flux | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%dnirbmi_cpl | instantaneous_surface_downwelling_direct_near_infrared_shortwave_flux_for_coupling | instantaneous sfc nir beam downward sw flux | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%dnirdfi_cpl | instantaneous_surface_downwelling_diffuse_near_infrared_shortwave_flux_for_coupling | instantaneous sfc nir diff downward sw flux | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%dvisbmi_cpl | instantaneous_surface_downwelling_direct_ultraviolet_and_visible_shortwave_flux_for_coupling | instantaneous sfc uv+vis beam downward sw flux | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%dvisdfi_cpl | instantaneous_surface_downwelling_diffuse_ultraviolet_and_visible_shortwave_flux_for_coupling | instantaneous sfc uv+vis diff downward sw flux | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%nlwsfci_cpl | instantaneous_surface_net_downward_longwave_flux_for_coupling | instantaneous net sfc downward lw flux | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%nswsfci_cpl | instantaneous_surface_net_downward_shortwave_flux_for_coupling | instantaneous net sfc downward sw flux | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%nnirbmi_cpl | instantaneous_surface_net_downward_direct_near_infrared_shortwave_flux_for_coupling | instantaneous net nir beam sfc downward sw flux | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%nnirdfi_cpl | instantaneous_surface_net_downward_diffuse_near_infrared_shortwave_flux_for_coupling | instantaneous net nir diff sfc downward sw flux | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%nvisbmi_cpl | instantaneous_surface_net_downward_direct_ultraviolet_and_visible_shortwave_flux_for_coupling | instantaneous net uv+vis beam downward sw flux | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%nvisdfi_cpl | instantaneous_surface_net_downward_diffuse_ultraviolet_and_visible_shortwave_flux_for_coupling | instantaneous net uv+vis diff downward sw flux | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%t2mi_cpl | instantaneous_temperature_at_2m_for_coupling | instantaneous T2m | K | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%q2mi_cpl | instantaneous_specific_humidity_at_2m_for_coupling | instantaneous Q2m | kg kg-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%u10mi_cpl | instantaneous_x_wind_at_10m_for_coupling | instantaneous U10m | m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%v10mi_cpl | instantaneous_y_wind_at_10m_for_coupling | instantaneous V10m | m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%tsfci_cpl | instantaneous_surface_skin_temperature_for_coupling | instantaneous sfc temperature | K | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%psurfi_cpl | instantaneous_surface_air_pressure_for_coupling | instantaneous sfc pressure | Pa | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%oro_cpl | | orography | | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%slmsk_cpl | | land/sea/ice mask | | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%tconvtend | tendency_of_air_temperature_due_to_deep_convection_for_coupling_on_physics_timestep | tendency of air temperature due to deep convection | K | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%qconvtend | tendency_of_water_vapor_specific_humidity_due_to_deep_convection_for_coupling_on_physics_timestep | tendency of specific humidity due to deep convection| kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%uconvtend | tendency_of_x_wind_due_to_deep_convection_for_coupling_on_physics_timestep | tendency_of_x_wind_due_to_deep_convection | m s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%vconvtend | tendency_of_y_wind_due_to_deep_convection_for_coupling_on_physics_timestep | tendency_of_y_wind_due_to_deep_convection | m s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%ca_out | | | | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%ca_deep | fraction_of_cellular_automata_for_deep_convection | fraction of cellular automata for deep convection | frac | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%ca_turb | | | | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%ca_shal | | | | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%ca_rad | | | | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%ca_micro | | | | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%cape | convective_available_potential_energy_for_coupling | convective available potential energy for coupling | m2 s-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%shum_wts | weights_for_stochastic_shum_perturbation | weights for stochastic shum perturbation | none | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%sppt_wts | weights_for_stochastic_sppt_perturbation | weights for stochastic sppt perturbation | none | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%skebu_wts | weights_for_stochastic_skeb_perturbation_of_x_wind | weights for stochastic skeb perturbation of x wind | none | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%skebv_wts | weights_for_stochastic_skeb_perturbation_of_y_wind | weights for stochastic skeb perturbation of y wind | none | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%sfc_wts | weights_for_stochastic_surface_physics_perturbation | weights for stochastic surface physics perturbation | none | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%nsfcpert | | number of surface perturbations (redundant? Model%...) | | 0 | integer | | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%vcu_wts | | | | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%vcv_wts | | | | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%dqdti | instantaneous_water_vapor_specific_humidity_tendency_due_to_convection | instantaneous moisture tendency due to convection | kg kg-1 s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%cnvqci | instantaneous_deep_convective_cloud_condensate_mixing_ratio_on_dynamics_time_step | instantaneous total convective condensate mixing ratio | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%upd_mfi | instantaneous_atmosphere_updraft_convective_mass_flux_on_dynamics_timestep | (updraft mass flux) * delt | kg m-2 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%dwn_mfi | instantaneous_atmosphere_downdraft_convective_mass_flux_on_dynamics_timestep | (downdraft mass flux) * delt | kg m-2 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%det_mfi | instantaneous_atmosphere_detrainment_convective_mass_flux_on_dynamics_timestep | (detrainment mass flux) * delt | kg m-2 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%cldcovi | | instantaneous 3D cloud fraction | | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%nwfa2d | tendency_of_water_friendly_aerosols_at_surface | instantaneous water-friendly sfc aerosol source | kg-1 s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%nifa2d | tendency_of_ice_friendly_aerosols_at_surface | instantaneous ice-friendly sfc aerosol source | kg-1 s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%ushfsfci | instantaneous_upward_sensible_heat_flux | instantaneous upward sensible heat flux | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Coupling%dkt | instantaneous_atmosphere_heat_diffusivity | instantaneous atmospheric heat diffusivity | m2 s-1 | 2 | real | kind_phys | none | F | +!! +#endif type GFS_coupling_type !--- Out (radiation only) @@ -385,7 +824,8 @@ module GFS_typedefs real (kind=kind_phys), pointer :: dwn_mfi (:,:) => null() !< instantaneous convective downdraft mass flux real (kind=kind_phys), pointer :: det_mfi (:,:) => null() !< instantaneous convective detrainment mass flux real (kind=kind_phys), pointer :: cldcovi (:,:) => null() !< instantaneous 3D cloud fraction - real (kind=kind_phys), pointer :: nwfa2d (:) => null() !< instantaneous sfc aerosol source + real (kind=kind_phys), pointer :: nwfa2d (:) => null() !< instantaneous water-friendly sfc aerosol source + real (kind=kind_phys), pointer :: nifa2d (:) => null() !< instantaneous ice-friendly sfc aerosol source !--- instantaneous quantities for GSDCHEM coupling real (kind=kind_phys), pointer :: ushfsfci(:) => null() !< instantaneous upward sensible heat flux (w/m**2) @@ -396,33 +836,373 @@ module GFS_typedefs end type GFS_coupling_type -#ifdef CCPP -! DH* for testing of CCPP integration -!! \section arg_table_GFS_control_type -!! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional | -!! |---------------------|----------------------------|------------------------------------------------|-------|------|-----------|---------|--------|----------| -!! | IPD_Control%me | mpi_rank | current MPI-rank | index | 0 | integer | | none | F | -!! -#endif !---------------------------------------------------------------------------------- ! GFS_control_type ! model control parameters input from a namelist and/or derived from others ! list of those that can be modified during the run are at the bottom of the list !---------------------------------------------------------------------------------- +#if 0 +!! \section arg_table_GFS_control_type +!! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional | +!! |--------------------------------------|-------------------------------------------------------------------------------|---------------------------------------------------------|---------------|------|-----------|-----------|--------|----------| +!! | GFS_Control%me | mpi_rank | current MPI-rank | index | 0 | integer | | none | F | +!! | GFS_Control%master | mpi_root | master MPI-rank | index | 0 | integer | | none | F | +!! | GFS_Control%communicator | mpi_comm | MPI communicator | index | 0 | integer | | none | F | +!! | GFS_Control%ntasks | mpi_size | number of MPI tasks in communicator | count | 0 | integer | | none | F | +!! | GFS_Control%nthreads | omp_threads | number of OpenMP threads available for physics schemes | count | 0 | integer | | none | F | +!! | GFS_Control%nlunit | iounit_namelist | fortran unit number for file opens | none | 0 | integer | | none | F | +!! | GFS_Control%fn_nml | namelist_filename | namelist filename | none | 0 | character | len=64 | none | F | +!! | GFS_Control%input_nml_file | namelist_filename_for_internal_file_reads | namelist filename for internal file reads | none | 1 | character | len=256 | none | F | +!! | GFS_Control%logunit | iounit_log | fortran unit number for logfile | none | 0 | integer | | none | F | +!! | GFS_Control%fhzero | | hours between clearing of diagnostic buckets | h | 0 | real | kind_phys | none | F | +!! | GFS_Control%ldiag3d | flag_diagnostics_3D | flag for 3d diagnostic fields | flag | 0 | logical | | none | F | +!! | GFS_Control%lssav | flag_diagnostics | logical flag for storing diagnostics | flag | 0 | logical | | none | F | +!! | GFS_Control%fhcyc | | frequency for surface data cycling (hours) | h | 0 | real | kind_phys | none | F | +!! | GFS_Control%lgocart | flag_gocart | flag for 3d diagnostic fields for gocart 1 | flag | 0 | logical | | none | F | +!! | GFS_Control%fhgoc3d | | hours between calls to gocart | h | 0 | real | kind_phys | none | F | +!! | GFS_Control%thermodyn_id | | valid for GFS only for get_prs/phi | index | 0 | integer | | none | F | +!! | GFS_Control%sfcpress_id | | valid for GFS only for get_prs/phi | index | 0 | integer | | none | F | +!! | GFS_Control%gen_coord_hybrid | | flag for Henry's gen coord | flag | 0 | logical | | none | F | +!! | GFS_Control%isc | | starting i-index for this MPI-domain | index | 0 | integer | | none | F | +!! | GFS_Control%jsc | | starting j-index for this MPI-domain | index | 0 | integer | | none | F | +!! | GFS_Control%nx | | number of points in i-dir for this MPI rank | count | 0 | integer | | none | F | +!! | GFS_Control%ny | | number of points in j-dir for this MPI rank | count | 0 | integer | | none | F | +!! | GFS_Control%levs | vertical_dimension | number of vertical levels | count | 0 | integer | | none | F | +!! | GFS_Control%ak | | a parameter for sigma pressure level calculations | Pa | 1 | real | kind_phys | none | F | +!! | GFS_Control%bk | | b parameter for sigma pressure level calculations | none | 1 | real | kind_phys | none | F | +!! | GFS_Control%cnx | | number of points in i-dir for this cubed-sphere face | count | 0 | integer | | none | F | +!! | GFS_Control%cny | | number of points in j-dir for this cubed-sphere face | count | 0 | integer | | none | F | +!! | GFS_Control%lonr | number_of_equatorial_longitude_points | number of global points in x-dir (i) along the equator | count | 0 | integer | | none | F | +!! | GFS_Control%latr | | number of global points in y-dir (j) along the meridian | count | 0 | integer | | none | F | +!! | GFS_Control%blksz | horizontal_block_size | for explicit data blocking: block sizes of all blocks | count | 1 | integer | | none | F | +!! | GFS_Control%blksz(cdata%blk_no) | horizontal_loop_extent | horizontal loop extent | count | 0 | integer | | none | F | +!! | GFS_Control%blksz(cdata%blk_no) | horizontal_dimension | horizontal dimension | count | 0 | integer | | none | F | +!! | GFS_Control%tile_num | number_of_tile | tile number | none | 0 | integer | | none | F | +!! | GFS_Control%cplflx | flag_for_flux_coupling | flag controlling cplflx collection (default off) | flag | 0 | logical | | none | F | +!! | GFS_Control%cplwav | flag_for_wave_coupling | flag controlling cplwav collection (default off) | flag | 0 | logical | | none | F | +!! | GFS_Control%cplchm | flag_for_chemistry_coupling | flag controlling cplchm collection (default off) | flag | 0 | logical | | none | F | +!! | GFS_Control%lsidea | flag_idealized_physics | flag for idealized physics | flag | 0 | logical | | none | F | +!! | GFS_Control%dtp | time_step_for_physics | physics timestep | s | 0 | real | kind_phys | none | F | +!! | GFS_Control%dtf | time_step_for_dynamics | dynamics timestep | s | 0 | real | kind_phys | none | F | +!! | GFS_Control%nscyc | | trigger for surface data cycling | | 0 | integer | | none | F | +!! | GFS_Control%nszero | | trigger for zeroing diagnostic buckets | | 0 | integer | | none | F | +!! | GFS_Control%idat | date_and_time_at_model_initialization | initialization date and time | none | 1 | integer | | none | F | +!! | GFS_Control%idate | date_and_time_at_model_initialization_reordered | initial date with different size and ordering | none | 1 | integer | | none | F | +!! | GFS_Control%fhswr | frequency_for_shortwave_radiation | frequency for shortwave radiation | s | 0 | real | kind_phys | none | F | +!! | GFS_Control%fhlwr | frequency_for_longwave_radiation | frequency for longwave radiation | s | 0 | real | kind_phys | none | F | +!! | GFS_Control%nsswr | | integer trigger for shortwave radiation | | 0 | integer | | none | F | +!! | GFS_Control%nslwr | | integer trigger for longwave radiation | | 0 | integer | | none | F | +!! | GFS_Control%levr | number_of_vertical_layers_for_radiation_calculations | number of vertical levels for radiation calculations | count | 0 | integer | | none | F | +!! | GFS_Control%nfxr | | second dimension for fluxr diagnostic variable | | 0 | integer | | none | F | +!! | GFS_Control%aero_in | flag_for_aerosol_input_MG | flag for using aerosols in Morrison-Gettelman microphysics | flag | 0 | logical | | none | F | +!! | GFS_Control%lmfshal | | parameter for radiation | | 0 | logical | | none | F | +!! | GFS_Control%lmfdeep2 | | parameter for radiation | | 0 | logical | | none | F | +!! | GFS_Control%nrcm | array_dimension_of_random_number | second dimension of random number stream for RAS | count | 0 | integer | | none | F | +!! | GFS_Control%iflip | flag_for_vertical_index_direction_control | iflip - is not the same as flipv | flag | 0 | integer | | none | F | +!! | GFS_Control%isol | flag_for_solar_constant | use prescribed solar constant | flag | 0 | integer | | none | F | +!! | GFS_Control%ico2 | flag_for_using_prescribed_global_mean_co2_value | prescribed global mean value (old opernl) | flag | 0 | integer | | none | F | +!! | GFS_Control%ialb | flag_for_using_climatology_albedo | flag for using climatology alb, based on sfc type | flag | 0 | integer | | none | F | +!! | GFS_Control%iems | flag_for_surface_emissivity_control | surface emissivity control flag, use fixed value of 1 | flag | 0 | integer | | none | F | +!! | GFS_Control%iaer | flag_for_default_aerosol_effect_in_shortwave_radiation | default aerosol effect in sw only | flag | 0 | integer | | none | F | +!! | GFS_Control%icliq_sw | flag_for_optical_property_for_liquid_clouds_for_shortwave_radiation | sw optical property for liquid clouds | flag | 0 | integer | | none | F | +!! | GFS_Control%iovr_sw | flag_for_max-random_overlap_clouds_for_shortwave_radiation | sw: max-random overlap clouds | flag | 0 | integer | | none | F | +!! | GFS_Control%iovr_lw | flag_for_max-random_overlap_clouds_for_longwave_radiation | lw: max-random overlap clouds | flag | 0 | integer | | none | F | +!! | GFS_Control%ictm | flag_for_initial_time-date_control | flag for initial conditions and forcing | flag | 0 | integer | | none | F | +!! | GFS_Control%isubc_sw | flag_for_sw_clouds_without_sub-grid_approximation | flag for sw clouds without sub-grid approximation | flag | 0 | integer | | none | F | +!! | GFS_Control%isubc_lw | flag_for_lw_clouds_without_sub-grid_approximation | flag for lw clouds without sub-grid approximation | flag | 0 | integer | | none | F | +!! | GFS_Control%crick_proof | flag_for_CRICK-proof_cloud_water | flag for CRICK-Proof cloud water | flag | 0 | logical | | none | F | +!! | GFS_Control%ccnorm | flag_for_cloud_condensate_normalized_by_cloud_cover | flag for cloud condensate normalized by cloud cover | flag | 0 | logical | | none | F | +!! | GFS_Control%norad_precip | flag_for_precipitation_effect_on_radiation | radiation precip flag for Ferrier/Moorthi | flag | 0 | logical | | none | F | +!! | GFS_Control%lwhtr | flag_for_output_of_longwave_heating_rate | flag to output lw heating rate (Radtend%lwhc) | flag | 0 | logical | | none | F | +!! | GFS_Control%swhtr | flag_for_output_of_shortwave_heating_rate | flag to output sw heating rate (Radtend%swhc) | flag | 0 | logical | | none | F | +!! | GFS_Control%ncld | number_of_hydrometeors | choice of cloud scheme / number of hydrometeors | count | 0 | integer | | none | F | +!! | GFS_Control%imp_physics | flag_for_microphysics_scheme | choice of microphysics scheme | flag | 0 | integer | | none | F | +!! | GFS_Control%imp_physics_gfdl | flag_for_gfdl_microphysics_scheme | choice of GFDL microphysics scheme | flag | 0 | integer | | none | F | +!! | GFS_Control%imp_physics_thompson | flag_for_thompson_microphysics_scheme | choice of Thompson microphysics scheme | flag | 0 | integer | | none | F | +!! | GFS_Control%imp_physics_wsm6 | flag_for_wsm6_microphysics_scheme | choice of WSM6 microphysics scheme | flag | 0 | integer | | none | F | +!! | GFS_Control%imp_physics_zhao_carr | flag_for_zhao_carr_microphysics_scheme | choice of Zhao-Carr microphysics scheme | flag | 0 | integer | | none | F | +!! | GFS_Control%imp_physics_zhao_carr_pdf| flag_for_zhao_carr_pdf_microphysics_scheme | choice of Zhao-Carr microphysics scheme with PDF clouds | flag | 0 | integer | | none | F | +!! | GFS_Control%imp_physics_mg | flag_for_morrison_gettelman_microphysics_scheme | choice of Morrison-Gettelman microphysics scheme | flag | 0 | integer | | none | F | +!! | GFS_Control%psautco | coefficient_from_cloud_ice_to_snow | auto conversion coeff from ice to snow | none | 1 | real | kind_phys | none | F | +!! | GFS_Control%prautco | coefficient_from_cloud_water_to_rain | auto conversion coeff from cloud to rain | none | 1 | real | kind_phys | none | F | +!! | GFS_Control%evpco | coefficient_for_evaporation_of_rainfall | coeff for evaporation of largescale rain | none | 0 | real | kind_phys | none | F | +!! | GFS_Control%wminco | cloud_condensed_water_conversion_threshold | water and ice minimum threshold for Zhao | none | 1 | real | kind_phys | none | F | +!! | GFS_Control%avg_max_length | time_interval_for_maximum_hourly_fields | reset time interval for maximum hourly fields | s | 0 | real | kind_phys | none | F | +!! | GFS_Control%fprcp | number_of_frozen_precipitation_species | number of frozen precipitation species | count | 0 | integer | | none | F | +!! | GFS_Control%pdfflag | flag_for_pdf_for_morrison_gettelman_microphysics_scheme | pdf flag for MG macrophysics | flag | 0 | integer | | none | F | +!! | GFS_Control%mg_dcs | mg_autoconversion_size_threshold_ice_snow | autoconversion size threshold for cloud ice to snow for MG microphysics | um | 0 | real | kind_phys | none | F | +!! | GFS_Control%mg_qcvar | mg_cloud_water_variance | cloud water relative variance for MG microphysics | | 0 | real | kind_phys | none | F | +!! | GFS_Control%mg_ts_auto_ice | mg_time_scale_for_autoconversion_of_ice | autoconversion time scale for ice for MG microphysics | s | 1 | real | kind_phys | none | F | +!! | GFS_Control%mg_rhmini | mg_minimum_rh_for_ice | relative humidity threshold parameter for nucleating ice for MG microphysics | none | 0 | real | kind_phys | none | F | +!! | GFS_Control%mg_ncnst | mg_drop_concentration_constant | droplet concentration constant for MG microphysics | m-3 | 0 | real | kind_phys | none | F | +!! | GFS_Control%mg_ninst | mg_ice_concentration_constant | ice concentration constant for MG microphysics | m-3 | 0 | real | kind_phys | none | F | +!! | GFS_Control%mg_ngnst | mg_graupel_concentration_constant | graupel concentration constant for MG microphysics | m-3 | 0 | real | kind_phys | none | F | +!! | GFS_Control%mg_berg_eff_factor | mg_bergeron_efficiency_factor | bergeron efficiency factor for MG microphysics | frac | 0 | real | kind_phys | none | F | +!! | GFS_Control%mg_alf | mg_tuning_factor_for_alphas | tuning factor for alphas (alpha = 1 - critical relative humidity) | none | 0 | real | kind_phys | none | F | +!! | GFS_Control%mg_qcmin | mg_minimum_cloud_condensed_water_and_ice_mixing_ratio | minimum cloud condensed water and ice mixing ratio in MG macro clouds | kg kg-1 | 1 | real | kind_phys | none | F | +!! | GFS_Control%mg_qcmin(1) | mg_minimum_cloud_condensed_water_mixing_ratio | minimum cloud condensed water mixing ratio in MG macro clouds | kg kg-1 | 0 | real | kind_phys | none | F | +!! | GFS_Control%mg_qcmin(2) | mg_minimum_ice_mixing_ratio | minimum ice mixing ratio in MG macro clouds | kg kg-1 | 0 | real | kind_phys | none | F | +!! | GFS_Control%mg_precip_frac_method | mg_type_of_precip_fraction_method | type of precip fraction method for MG microphysics (in_cloud or max_overlap) | none | 0 | character | len=16 | none | F | +!! | GFS_Control%tf | frozen_cloud_threshold_temperature | threshold temperature below which all cloud is ice | K | 0 | real | kind_phys | none | F | +!! | GFS_Control%tcr | cloud_phase_transition_threshold_temperature | threshold temperature below which cloud starts to freeze | K | 0 | real | kind_phys | none | F | +!! | GFS_Control%tcrf | cloud_phase_transition_denominator | denominator in cloud phase transition = 1/(tcr-tf) | K-1 | 0 | real | kind_phys | none | F | +!! | GFS_Control%effr_in | flag_for_cloud_effective_radii | flag for cloud effective radii calculations in GFDL microphysics | | 0 | logical | | none | F | +!! | GFS_Control%microp_uniform | mg_flag_for_uniform_subcolumns | flag for uniform subcolumns for MG microphysics | flag | 0 | logical | | none | F | +!! | GFS_Control%do_cldliq | | | | 0 | logical | | none | F | +!! | GFS_Control%do_cldice | mg_flag_for_cloud_ice_processes | flag for cloud ice processes for MG microphysics | flag | 0 | logical | | none | F | +!! | GFS_Control%hetfrz_classnuc | mg_flag_for_heterogeneous_freezing | flag for heterogeneous freezing for MG microphysics | flag | 0 | logical | | none | F | +!! | GFS_Control%mg_nccons | mg_flag_drop_concentration_constant | flag for constant droplet concentration for MG microphysics | flag | 0 | logical | | none | F | +!! | GFS_Control%mg_nicons | mg_flag_ice_concentration_constant | flag for constant ice concentration for MG microphysics | flag | 0 | logical | | none | F | +!! | GFS_Control%mg_ngcons | mg_flag_graupel_concentration_constant | flag for constant graupel concentration for MG microphysics | flag | 0 | logical | | none | F | +!! | GFS_Control%sed_supersat | mg_allow_supersat_after_sed | allow supersaturation after sedimentation for MG microphysics | flag | 0 | logical | | none | F | +!! | GFS_Control%do_sb_physics | mg_flag_for_sb2001_autoconversion | flag for SB 2001 autoconversion or accretion for MG microphysics | flag | 0 | logical | | none | F | +!! | GFS_Control%mg_do_graupel | mg_flag_for_graupel | flag for graupel for MG microphysics (hail possible if false) | flag | 0 | logical | | none | F | +!! | GFS_Control%mg_do_hail | mg_flag_for_hail | flag for hail for MG microphysics (graupel possible if false) | flag | 0 | logical | | none | F | +!! | GFS_Control%mg_do_ice_gmao | mg_flag_for_gmao_ice_formulation | flag for gmao ice formulation | flag | 0 | logical | | none | F | +!! | GFS_Control%mg_do_liq_liu | mg_flag_for_liu_liquid_treatment | flag for liu liquid treatment | flag | 0 | logical | | none | F | +!! | GFS_Control%shoc_parm(1) | shoc_tke_dissipatation_pressure_threshold | pressure below which extra TKE diss. is applied in SHOC | Pa | 0 | real | kind_phys | none | F | +!! | GFS_Control%shoc_parm(2) | shoc_tke_dissipation_tunable_parameter | mult. tuning parameter for TKE diss. in SHOC | none | 0 | real | kind_phys | none | F | +!! | GFS_Control%shoc_parm(3) | shoc_tke_dissipation_tunable_parameter_near_surface | mult. tuning parameter for TKE diss. at surface in SHOC | none | 0 | real | kind_phys | none | F | +!! | GFS_Control%shoc_parm(4) | shoc_implicit_TKE_integration_uncentering_term | uncentering term for TKE integration in SHOC | none | 0 | real | kind_phys | none | F | +!! | GFS_Control%shoc_parm(5) | shoc_flag_for_optional_surface_TKE_dissipation | flag for alt. TKE diss. near surface in SHOC (>0 = ON) | none | 0 | real | kind_phys | none | F | +!! | GFS_Control%ncnd | number_of_cloud_condensate_types | number of cloud condensate types | count | 0 | integer | | none | F | +!! | GFS_Control%make_number_concentrations | flag_for_initial_number_concentration_calculation | flag for initial number concentration calculation for Thompson MP | flag | 0 | logical | | none | F | +!! | GFS_Control%ltaerosol | flag_for_aerosol_physics | flag for aerosol physics | flag | 0 | logical | | none | F | +!! | GFS_Control%lradar | flag_for_radar_reflectivity | flag for radar reflectivity | flag | 0 | logical | | none | F | +!! | GFS_Control%ttendlim | limit_for_temperature_tendency_for_microphysics | temperature tendency limiter per physics time step | K s-1 | 0 | real | kind_phys | none | F | +!! | GFS_Control%lgfdlmprad | | flag for GFDL mp scheme and radiation consistency | | 0 | logical | | none | F | +!! | GFS_Control%lsm | flag_for_land_surface_scheme | flag for land surface model | flag | 0 | integer | | none | F | +!! | GFS_Control%lsm_noah | flag_for_noah_land_surface_scheme | flag for NOAH land surface model | flag | 0 | integer | | none | F | +!! | GFS_Control%lsm_noahmp | flag_for_noahmp_land_surface_scheme | flag for NOAH MP land surface model | flag | 0 | integer | | none | F | +!! | GFS_Control%lsm_ruc | flag_for_ruc_land_surface_scheme | flag for RUC land surface model | flag | 0 | integer | | none | F | +!! | GFS_Control%lsoil | soil_vertical_dimension | number of soil layers | count | 0 | integer | | none | F | +!! | GFS_Control%lsoil_lsm | soil_vertical_dimension_for_land_surface_model | number of soil layers for land surface model | count | 0 | integer | | none | F | +!! | GFS_Control%ivegsrc | vegetation_type_dataset_choice | land use dataset choice | index | 0 | integer | | none | F | +!! | GFS_Control%isot | soil_type_dataset_choice | soil type dataset choice | index | 0 | integer | | none | F | +!! | GFS_Control%mom4ice | flag_for_mom4_coupling | flag controls mom4 sea ice | flag | 0 | logical | | none | F | +!! | GFS_Control%use_ufo | | flag for gcycle surface option | | 0 | logical | | none | F | +!! | GFS_Control%ras | flag_for_ras_deep_convection | flag for ras convection scheme | flag | 0 | logical | | none | F | +!! | GFS_Control%flipv | flag_flip | vertical flip logical | flag | 0 | logical | | none | F | +!! | GFS_Control%trans_trac | flag_for_convective_transport_of_tracers | flag for convective transport of tracers | flag | 0 | logical | | none | F | +!! | GFS_Control%old_monin | flag_for_old_PBL_scheme | flag for using old PBL schemes | flag | 0 | logical | | none | F | +!! | GFS_Control%cnvgwd | flag_convective_gravity_wave_drag | flag for conv gravity wave drag | flag | 0 | logical | | none | F | +!! | GFS_Control%mstrat | flag_for_moorthi_stratus | flag for moorthi approach for stratus | flag | 0 | logical | | none | F | +!! | GFS_Control%moist_adj | | flag for moist convective adjustment | | 0 | logical | | none | F | +!! | GFS_Control%cscnv | flag_for_Chikira_Sugiyama_deep_convection | flag for Chikira-Sugiyama convection | flag | 0 | logical | | none | F | +!! | GFS_Control%satmedmf | flag_for_scale_aware_TKE_moist_EDMF_PBL | flag for scale-aware TKE moist EDMF PBL scheme | flag | 0 | logical | | none | F | +!! | GFS_Control%shinhong | flag_for_scale_aware_Shinhong_PBL | flag for scale-aware Shinhong PBL scheme | flag | 0 | logical | | none | F | +!! | GFS_Control%do_ysu | flag_for_ysu | flag for YSU PBL scheme | flag | 0 | logical | | none | F | +!! | GFS_Control%cal_pre | flag_for_precipitation_type_algorithm | flag controls precip type algorithm | flag | 0 | logical | | none | F | +!! | GFS_Control%do_aw | flag_for_Arakawa_Wu_adjustment | flag for Arakawa Wu scale-aware adjustment | flag | 0 | logical | | none | F | +!! | GFS_Control%do_awdd | flag_arakawa_wu_downdraft | AW scale-aware option in cs convection downdraft | flag | 0 | logical | | none | F | +!! | GFS_Control%flx_form | flag_flux_form_CS | enable use of flux form of equations in CS scheme | flag | 0 | logical | | none | F | +!! | GFS_Control%do_shoc | flag_for_shoc | flag for SHOC | flag | 0 | logical | | none | F | +!! | GFS_Control%shocaftcnv | flag_for_shoc_after_convection | flag to execute SHOC after convection | flag | 0 | logical | | none | F | +!! | GFS_Control%shoc_cld | | flag for clouds | | 0 | logical | | none | F | +!! | GFS_Control%uni_cld | | flag for clouds in grrad | | 0 | logical | | none | F | +!! | GFS_Control%oz_phys | flag_for_ozone_physics | flag for old (2006) ozone physics | flag | 0 | logical | | none | F | +!! | GFS_Control%oz_phys_2015 | flag_for_2015_ozone_physics | flag for new (2015) ozone physics | flag | 0 | logical | | none | F | +!! | GFS_Control%h2o_phys | | flag for stratosphere h2o | | 0 | logical | | none | F | +!! | GFS_Control%pdfcld | | flag for pdfcld | | 0 | logical | | none | F | +!! | GFS_Control%shcnvcw | flag_shallow_convective_cloud | flag for shallow convective cloud | | 0 | logical | | none | F | +!! | GFS_Control%redrag | flag_for_reduced_drag_coefficient_over_sea | flag for reduced drag coeff. over sea | flag | 0 | logical | | none | F | +!! | GFS_Control%hybedmf | flag_for_hedmf | flag for hybrid edmf pbl scheme (moninedmf) | flag | 0 | logical | | none | F | +!! | GFS_Control%dspheat | flag_TKE_dissipation_heating | flag for tke dissipative heating | flag | 0 | logical | | none | F | +!! | GFS_Control%lheatstrg | flag_for_canopy_heat_storage | flag for canopy heat storage parameterization | flag | 0 | logical | | none | F | +!! | GFS_Control%cnvcld | | | | 0 | logical | | none | F | +!! | GFS_Control%random_clds | | flag controls whether clouds are random | | 0 | logical | | none | F | +!! | GFS_Control%shal_cnv | flag_for_shallow_convection | flag for calling shallow convection | flag | 0 | logical | | none | F | +!! | GFS_Control%do_deep | | whether to do deep convection | | 0 | logical | | none | F | +!! | GFS_Control%imfshalcnv | flag_for_mass_flux_shallow_convection_scheme | flag for mass-flux shallow convection scheme | flag | 0 | integer | | none | F | +!! | GFS_Control%imfdeepcnv | flag_for_mass_flux_deep_convection_scheme | flag for mass-flux deep convection scheme | flag | 0 | integer | | none | F | +!! | GFS_Control%nmtvr | number_of_statistical_measures_of_subgrid_orography | number of topographic variables in GWD | count | 0 | integer | | none | F | +!! | GFS_Control%jcap | | number of spectral wave trancation | | 0 | integer | | none | F | +!! | GFS_Control%cs_parm | | tunable parameters for Chikira-Sugiyama convection | | 1 | real | kind_phys | none | F | +!! | GFS_Control%cs_parm(1) | updraft_velocity_tunable_parameter_1_CS | tunable parameter 1 for Chikira-Sugiyama convection | m s-1 | 0 | real | kind_phys | none | F | +!! | GFS_Control%cs_parm(2) | updraft_velocity_tunable_parameter_2_CS | tunable parameter 2 for Chikira-Sugiyama convection | m s-1 | 0 | real | kind_phys | none | F | +!! | GFS_Control%cs_parm(3) | detrainment_and_precipitation_tunable_parameter_3_CS | partition water between detrainment and precipitation (decrease for more precipitation) | m | 0 | real | kind_phys | none | F | +!! | GFS_Control%cs_parm(4) | detrainment_and_precipitation_tunable_parameter_4_CS | partition water between detrainment and precipitation (decrease for more precipitation) | m | 0 | real | kind_phys | none | F | +!! | GFS_Control%cs_parm(9) | entrainment_efficiency_tunable_parameter_9_CS | entrainment efficiency | none | 0 | real | kind_phys | none | F | +!! | GFS_Control%flgmin | | [in] ice fraction bounds | | 1 | real | kind_phys | none | F | +!! | GFS_Control%cgwf | multiplication_factors_for_convective_gravity_wave_drag | multiplication factor for convective GWD | none | 1 | real | kind_phys | none | F | +!! | GFS_Control%ccwf | | multiplication factor for critical cloud workfunction | none | 1 | real | kind_phys | none | F | +!! | GFS_Control%cdmbgwd | multiplication_factors_for_mountain_blocking_and_orographic_gravity_wave_drag | multiplication factors for cdmb and gwd | none | 1 | real | kind_phys | none | F | +!! | GFS_Control%sup | ice_supersaturation_threshold | ice supersaturation parameter for PDF clouds | none | 0 | real | kind_phys | none | F | +!! | GFS_Control%ctei_rm | critical_cloud_top_entrainment_instability_criteria | critical cloud top entrainment instability criteria | none | 1 | real | kind_phys | none | F | +!! | GFS_Control%crtrh | | critical relative humidity at SFC, PBL top and TOA | frac | 1 | real | kind_phys | none | F | +!! | GFS_Control%crtrh(1) | critical_relative_humidity_at_surface | critical relative humidity at the surface | frac | 0 | real | kind_phys | none | F | +!! | GFS_Control%crtrh(2) | critical_relative_humidity_at_PBL_top | critical relative humidity at the PBL top | frac | 0 | real | kind_phys | none | F | +!! | GFS_Control%crtrh(3) | critical_relative_humidity_at_top_of_atmosphere | critical relative humidity at the top of atmosphere | frac | 0 | real | kind_phys | none | F | +!! | GFS_Control%dlqf | | factor for cloud condensate detrainment from cloud edges| | 1 | real | kind_phys | none | F | +!! | GFS_Control%psauras | | auto conversion coeff from ice to snow in ras | | 1 | real | kind_phys | none | F | +!! | GFS_Control%prauras | | auto conversion coeff from cloud to rain in ras | | 1 | real | kind_phys | none | F | +!! | GFS_Control%wminras | | water and ice minimum threshold for ras | | 1 | real | kind_phys | none | F | +!! | GFS_Control%seed0 | | random seed for radiation | | 0 | integer | | none | F | +!! | GFS_Control%rbcr | | Critical Richardson Number in the PBL scheme | | 0 | real | kind_phys | none | F | +!! | GFS_Control%prslrd0 | pressure_cutoff_for_rayleigh_damping | pressure level from which Rayleigh Damping is applied | Pa | 0 | real | kind_phys | none | F | +!! | GFS_Control%ral_ts | time_scale_for_rayleigh_damping | time scale for Rayleigh damping in days | d | 0 | real | kind_phys | none | F | +!! | GFS_Control%clam_deep | entrainment_rate_coefficient_deep_convection | entrainment rate coefficient for deep conv. | none | 0 | real | kind_phys | none | F | +!! | GFS_Control%c0s_deep | rain_conversion_parameter_deep_convection | convective rain conversion parameter for deep conv. | m-1 | 0 | real | kind_phys | none | F | +!! | GFS_Control%c1_deep | detrainment_conversion_parameter_deep_convection | convective detrainment conversion parameter for deep conv. | m-1 | 0 | real | kind_phys | none | F | +!! | GFS_Control%betal_deep | downdraft_fraction_reaching_surface_over_land_deep_convection | downdraft fraction reaching surface over land for deep conv. | frac | 0 | real | kind_phys | none | F | +!! | GFS_Control%betas_deep | downdraft_fraction_reaching_surface_over_ocean_deep_convection | downdraft fraction reaching surface over ocean for deep conv. | frac | 0 | real | kind_phys | none | F | +!! | GFS_Control%evfact_deep | rain_evaporation_coefficient_deep_convection | convective rain evaporation coefficient for deep conv. | frac | 0 | real | kind_phys | none | F | +!! | GFS_Control%evfactl_deep | rain_evaporation_coefficient_over_land_deep_convection | convective rain evaporation coefficient over land for deep conv. | frac | 0 | real | kind_phys | none | F | +!! | GFS_Control%pgcon_deep | momentum_transport_reduction_factor_pgf_deep_convection | reduction factor in momentum transport due to deep conv. induced pressure gradient force | frac | 0 | real | kind_phys | none | F | +!! | GFS_Control%asolfac_deep | aerosol_aware_parameter_deep_convection | aerosol-aware parameter inversely proportional to CCN number concentraion from Lim (2011) for deep conv. | none | 0 | real | kind_phys | none | F | +!! | GFS_Control%clam_shal | entrainment_rate_coefficient_shallow_convection | entrainment rate coefficient for shal conv. | none | 0 | real | kind_phys | none | F | +!! | GFS_Control%c0s_shal | rain_conversion_parameter_shallow_convection | convective rain conversion parameter for shal conv. | m-1 | 0 | real | kind_phys | none | F | +!! | GFS_Control%c1_shal | detrainment_conversion_parameter_shallow_convection | convective detrainment conversion parameter for shal conv. | m-1 | 0 | real | kind_phys | none | F | +!! | GFS_Control%pgcon_shal | momentum_transport_reduction_factor_pgf_shallow_convection | reduction factor in momentum transport due to shal conv. induced pressure gradient force | frac | 0 | real | kind_phys | none | F | +!! | GFS_Control%asolfac_shal | aerosol_aware_parameter_shallow_convection | aerosol-aware parameter inversely proportional to CCN number concentraion from Lim (2011) for shal conv. | none | 0 | real | kind_phys | none | F | +!! | GFS_Control%nst_anl | | flag for NSSTM analysis in gcycle/sfcsub | | 0 | logical | | none | F | +!! | GFS_Control%lsea | | | | 0 | integer | | none | F | +!! | GFS_Control%xkzm_m | atmosphere_momentum_diffusivity_background | background vertical diffusion for momentum | m2 s-1 | 0 | real | kind_phys | none | F | +!! | GFS_Control%xkzm_h | atmosphere_heat_diffusivity_background | background vertical diffusion for heat q | m2 s-1 | 0 | real | kind_phys | none | F | +!! | GFS_Control%xkzm_s | diffusivity_background_sigma_level | sigma threshold for background mom. diffusion | none | 0 | real | kind_phys | none | F | +!! | GFS_Control%nstf_name | | | | 1 | integer | | none | F | +!! | GFS_Control%nstf_name(1) | flag_for_nsstm_run | NSSTM flag: off/uncoupled/coupled=0/1/2 | flag | 0 | integer | | none | F | +!! | GFS_Control%nstf_name(4) | vertical_temperature_average_range_lower_bound | zsea1 in mm | mm | 0 | integer | | none | F | +!! | GFS_Control%nstf_name(5) | vertical_temperature_average_range_upper_bound | zsea2 in mm | mm | 0 | integer | | none | F | +!! | GFS_Control%frac_grid | flag_for_fractional_grid | flag for fractional grid | flag | 0 | logical | | none | F | +!! | GFS_Control%xkzminv | atmosphere_heat_diffusivity_background_maximum | maximum background value of heat diffusivity | m2 s-1 | 0 | real | kind_phys | none | F | +!! | GFS_Control%moninq_fac | atmosphere_diffusivity_coefficient_factor | multiplicative constant for atmospheric diffusivities | none | 0 | real | kind_phys | none | F | +!! | GFS_Control%nca | number_of_independent_cellular_automata | number of independent cellular automata | count | 0 | integer | | none | F | +!! | GFS_Control%nlives | cellular_automata_lifetime | cellular automata lifetime | count | 0 | integer | | none | F | +!! | GFS_Control%ncells | cellular_automata_finer_grid | cellular automata finer grid | count | 0 | integer | | none | F | +!! | GFS_Control%nfracseed | cellular_automata_seed_probability | cellular automata seed probability | fraction | 0 | real | kind_phys | none | F | +!! | GFS_Control%nseed | cellular_automata_seed_frequency | cellular automata seed frequency in units of time steps | count | 0 | integer | | none | F | +!! | GFS_Control%do_ca | flag_for_cellular_automata | cellular automata main switch | flag | 0 | logical | | none | F | +!! | GFS_Control%ca_sgs | flag_for_sgs_cellular_automata | switch for sgs ca | flag | 0 | logical | | none | F | +!! | GFS_Control%ca_global | flag_for_global_cellular_automata | switch for global ca | flag | 0 | logical | | none | F | +!! | GFS_Control%ca_smooth | flag_for_gaussian_spatial_filter | switch for gaussian spatial filter | flag | 0 | logical | | none | F | +!! | GFS_Control%isppt_deep | flag_for_combination_of_sppt_with_isppt_deep | switch for combination with isppt_deep. | flag | 0 | logical | | none | F | +!! | GFS_Control%iseed_ca | seed_for_random_number_generation_in_cellular_automata_scheme | seed for random number generation in ca scheme | none | 0 | integer | | none | F | +!! | GFS_Control%nspinup | number_of_iterations_to_spin_up_cellular_automata | number of iterations to spin up the ca | count | 0 | integer | | none | F | +!! | GFS_Control%nthresh | threshold_for_perturbed_vertical_velocity | threshold used for perturbed vertical velocity | m s-1 | 0 | real | kind_phys | none | F | +!! | GFS_Control%do_sppt | flag_for_stochastic_surface_physics_perturbations | flag for stochastic surface physics perturbations | flag | 0 | logical | | none | F | +!! | GFS_Control%use_zmtnblck | flag_for_mountain_blocking | flag for mountain blocking | flag | 0 | logical | | none | F | +!! | GFS_Control%do_shum | flag_for_stochastic_shum_option | flag for stochastic shum option | flag | 0 | logical | | none | F | +!! | GFS_Control%do_skeb | flag_for_stochastic_skeb_option | flag for stochastic skeb option | flag | 0 | logical | | none | F | +!! | GFS_Control%skeb_npass | | | | 0 | integer | | none | F | +!! | GFS_Control%do_sfcperts | flag_for_stochastic_surface_perturbations | flag for stochastic surface perturbations option | flag | 0 | logical | | none | F | +!! | GFS_Control%nsfcpert | number_of_surface_perturbations | number of surface perturbations | count | 0 | integer | | none | F | +!! | GFS_Control%pertz0 | magnitude_of_perturbation_of_momentum_roughness_length | magnitude of perturbation of momentum roughness length | frac | 1 | real | kind_phys | none | F | +!! | GFS_Control%pertzt | magnitude_of_perturbation_of_heat_to_momentum_roughness_length_ratio | magnitude of perturbation of heat to momentum roughness length ratio | frac | 1 | real | kind_phys | none | F | +!! | GFS_Control%pertshc | magnitude_of_perturbation_of_soil_type_b_parameter | magnitude of perturbation of soil type b parameter | frac | 1 | real | kind_phys | none | F | +!! | GFS_Control%pertlai | magnitude_of_perturbation_of_leaf_area_index | magnitude of perturbation of leaf area index | frac | 1 | real | kind_phys | none | F | +!! | GFS_Control%pertalb | magnitude_of_surface_albedo_perturbation | magnitude of surface albedo perturbation | frac | 1 | real | kind_phys | none | F | +!! | GFS_Control%pertvegf | magnitude_of_perturbation_of_vegetation_fraction | magnitude of perturbation of vegetation fraction | frac | 1 | real | kind_phys | none | F | +!! | GFS_Control%tracer_names | | array of initialized tracers from dynamic core | | 1 | character | | none | F | +!! | GFS_Control%ntrac | number_of_tracers | number of tracers | count | 0 | integer | | none | F | +!! | GFS_Control%ntracp1 | number_of_tracers_plus_one | number of tracers plus one | count | 0 | integer | | none | F | +!! | GFS_Control%ntqv | index_for_water_vapor | tracer index for water vapor (specific humidity) | index | 0 | integer | | none | F | +!! | GFS_Control%ntoz | index_for_ozone | tracer index for ozone mixing ratio | index | 0 | integer | | none | F | +!! | GFS_Control%ntcw | index_for_liquid_cloud_condensate | tracer index for cloud condensate (or liquid water) | index | 0 | integer | | none | F | +!! | GFS_Control%ntiw | index_for_ice_cloud_condensate | tracer index for ice water | index | 0 | integer | | none | F | +!! | GFS_Control%ntrw | index_for_rain_water | tracer index for rain water | index | 0 | integer | | none | F | +!! | GFS_Control%ntsw | index_for_snow_water | tracer index for snow water | index | 0 | integer | | none | F | +!! | GFS_Control%ntgl | index_for_graupel | tracer index for graupel | index | 0 | integer | | none | F | +!! | GFS_Control%ntclamt | index_for_cloud_amount | tracer index for cloud amount integer | index | 0 | integer | | none | F | +!! | GFS_Control%ntlnc | index_for_liquid_cloud_number_concentration | tracer index for liquid number concentration | index | 0 | integer | | none | F | +!! | GFS_Control%ntinc | index_for_ice_cloud_number_concentration | tracer index for ice number concentration | index | 0 | integer | | none | F | +!! | GFS_Control%ntrnc | index_for_rain_number_concentration | tracer index for rain number concentration | index | 0 | integer | | none | F | +!! | GFS_Control%ntsnc | index_for_snow_number_concentration | tracer index for snow number concentration | index | 0 | integer | | none | F | +!! | GFS_Control%ntgnc | index_for_graupel_number_concentration | tracer index for graupel number concentration | index | 0 | integer | | none | F | +!! | GFS_Control%ntke | index_for_turbulent_kinetic_energy | tracer index for turbulent kinetic energy | index | 0 | integer | | none | F | +!! | GFS_Control%nto | | tracer index for oxygen ion | | 0 | integer | | none | F | +!! | GFS_Control%nto2 | | tracer index for oxygen | | 0 | integer | | none | F | +!! | GFS_Control%ntwa | index_for_water_friendly_aerosols | tracer index for water friendly aerosol | index | 0 | integer | | none | F | +!! | GFS_Control%ntia | index_for_ice_friendly_aerosols | tracer index for ice friendly aerosol | index | 0 | integer | | none | F | +!! | GFS_Control%ntchm | number_of_chemical_tracers | number of chemical tracers | count | 0 | integer | | none | F | +!! | GFS_Control%ntchs | index_for_first_chemical_tracer | tracer index for first chemical tracer | index | 0 | integer | | none | F | +!! | GFS_Control%ntdiag | diagnostics_control_for_chemical_tracers | array to control diagnostics for chemical tracers | flag | 1 | logical | | none | F | +!! | GFS_Control%ntot2d | | total number of variables for phyf2d | | 0 | integer | | none | F | +!! | GFS_Control%ntot3d | | total number of variables for phyf3d | | 0 | integer | | none | F | +!! | GFS_Control%indcld | index_for_cloud_fraction_in_3d_arrays_for_microphysics | index of cloud fraction in phyf3d (used only for SHOC or MG) | index | 0 | integer | | none | F | +!! | GFS_Control%num_p2d | array_dimension_of_2d_arrays_for_microphysics | number of 2D arrays needed for microphysics | count | 0 | integer | | none | F | +!! | GFS_Control%num_p3d | array_dimension_of_3d_arrays_for_microphysics | number of 3D arrays needed for microphysics | count | 0 | integer | | none | F | +!! | GFS_Control%nshoc_2d | | number of 2d fields for SHOC | | 0 | integer | | none | F | +!! | GFS_Control%nshoc_3d | | number of 3d fields for SHOC | | 0 | integer | | none | F | +!! | GFS_Control%ncnvcld3d | number_of_convective_3d_cloud_fields | number of convective 3d clouds fields | count | 0 | integer | | none | F | +!! | GFS_Control%npdf3d | number_of_3d_arrays_associated_with_pdf-based_clouds | number of 3d arrays associated with pdf based clouds/mp | count | 0 | integer | | none | F | +!! | GFS_Control%nctp | number_of_cloud_types_CS | number of cloud types in Chikira-Sugiyama scheme | count | 0 | integer | | none | F | +!! | GFS_Control%ncnvw | | the index of cnvw in phy_f3d | | 0 | integer | | none | F | +!! | GFS_Control%ncnvc | | the index of cnvc in phy_f3d | | 0 | integer | | none | F | +!! | GFS_Control%nleffr | index_for_cloud_liquid_water_effective_radius | the index of cloud liquid water effective radius in phy_f3d | | 0 | integer | | none | F | +!! | GFS_Control%nieffr | index_for_ice_effective_radius | the index of ice effective radius in phy_f3d | | 0 | integer | | none | F | +!! | GFS_Control%nreffr | index_for_rain_effective_radius | the index of rain effective radius in phy_f3d | | 0 | integer | | none | F | +!! | GFS_Control%nseffr | index_for_snow_effective_radius | the index of snow effective radius in phy_f3d | | 0 | integer | | none | F | +!! | GFS_Control%ngeffr | index_for_graupel_effective_radius | the index of graupel effective radius in phy_f3d | | 0 | integer | | none | F | +!! | GFS_Control%debug | | debug flag | | 0 | logical | | none | F | +!! | GFS_Control%pre_rad | | flag for testing purpose | | 0 | logical | | none | F | +!! | GFS_Control%ipt | | index for diagnostic printout point | | 0 | integer | | none | F | +!! | GFS_Control%lprnt | flag_print | control flag for diagnostic print out | flag | 0 | logical | | none | F | +!! | GFS_Control%lsswr | flag_to_calc_sw | logical flags for sw radiation calls | flag | 0 | logical | | none | F | +!! | GFS_Control%lslwr | flag_to_calc_lw | logical flags for lw radiation calls | flag | 0 | logical | | none | F | +!! | GFS_Control%solhr | forecast_hour | hour time after 00z at the t-step | h | 0 | real | kind_phys | none | F | +!! | GFS_Control%solcon | solar_constant | solar constant (sun-earth distant adjusted) | W m-2 | 0 | real | kind_phys | none | F | +!! | GFS_Control%slag | equation_of_time | equation of time (radian) | radians | 0 | real | kind_phys | none | F | +!! | GFS_Control%sdec | sine_of_solar_declination_angle | sin of the solar declination angle | none | 0 | real | kind_phys | none | F | +!! | GFS_Control%cdec | cosine_of_solar_declination_angle | cos of the solar declination angle | none | 0 | real | kind_phys | none | F | +!! | GFS_Control%clstp | convective_cloud_switch | index used by cnvc90 (for convective clouds) | none | 0 | real | kind_phys | none | F | +!! | GFS_Control%phour | | previous forecast time | h | 0 | real | kind_phys | none | F | +!! | GFS_Control%fhour | forecast_time | curent forecast time | h | 0 | real | kind_phys | none | F | +!! | GFS_Control%zhour | | previous hour diagnostic buckets emptied | h | 0 | real | kind_phys | none | F | +!! | GFS_Control%kdt | index_of_time_step | current forecast iteration | index | 0 | integer | | none | F | +!! | GFS_Control%first_time_step | flag_for_first_time_step | flag for first time step for time integration loop (cold/warmstart) | flag | 0 | logical | | none | F | +!! | GFS_Control%restart | flag_for_restart | flag for restart (warmstart) or coldstart | flag | 0 | logical | | none | F | +!! | GFS_Control%hydrostatic | flag_for_hydrostatic_solver | flag for hydrostatic solver from dynamics | flag | 0 | logical | | none | F | +!! | GFS_Control%jdat | forecast_date_and_time | current forecast date and time | none | 1 | integer | | none | F | +!! | GFS_Control%iccn | flag_for_in_ccn_forcing_for_morrison_gettelman_microphysics | flag for IN and CCN forcing for morrison gettelman microphysics | flag | 0 | logical | | none | F | +!! | GFS_Control%sec | seconds_elapsed_since_model_initialization | seconds elapsed since model initialization | s | 0 | real | kind_phys | none | F | +!! | GFS_Control%si | vertical_sigma_coordinate_for_radiation_initialization | vertical sigma coordinate for radiation initialization | none | 1 | real | kind_phys | none | F | +!! | GFS_Control%iau_delthrs | | iau time interval (to scale increments) in hours | | 0 | real | kind_phys | none | F | +!! | GFS_Control%iau_inc_files | | list of increment files | | 1 | character | len=240 | none | F | +!! | GFS_Control%iaufhrs | | forecast hours associated with increment files | | 1 | real | kind_phys | none | F | +!! | GFS_Control%iau_filter_increments | | | | 0 | logical | | none | F | +!! | GFS_Control%dxinv | inverse_scaling_factor_for_critical_relative_humidity | inverse scaling factor for critical relative humidity | rad2 m-2 | 0 | real | kind_phys | none | F | +!! | GFS_Control%dxmax | maximum_scaling_factor_for_critical_relative_humidity | maximum scaling factor for critical relative humidity | m2 rad-2 | 0 | real | kind_phys | none | F | +!! | GFS_Control%dxmin | minimum_scaling_factor_for_critical_relative_humidity | minimum scaling factor for critical relative humidity | m2 rad-2 | 0 | real | kind_phys | none | F | +!! | GFS_Control%rhcmax | maximum_critical_relative_humidity | maximum critical relative humidity | frac | 0 | real | kind_phys | none | F | +!! | GFS_Control%do_mynnedmf | do_mynnedmf | flag to activate MYNN-EDMF | flag | 0 | logical | | none | F | +!! | GFS_Control%do_mynnsfclay | do_mynnsfclay | flag to activate MYNN surface layer | flag | 0 | logical | | none | F | +!! | GFS_Control%grav_settling | grav_settling | flag to activate gravitational setting of fog | flag | 0 | integer | | none | F | +!! | GFS_Control%bl_mynn_tkebudget | tke_budget | flag for activating TKE budget | flag | 0 | integer | | none | F | +!! | GFS_Control%bl_mynn_tkeadvect | tke_advect | flag for activating TKE advection | flag | 0 | logical | | none | F | +!! | GFS_Control%bl_mynn_cloudpdf | cloudpdf | flag to determine which cloud PDF to use | flag | 0 | integer | | none | F | +!! | GFS_Control%bl_mynn_mixlength | mixing_length_flag | flag to determine which mixing length form to use | flag | 0 | integer | | none | F | +!! | GFS_Control%bl_mynn_edmf | edmf_flag | flag to activate the mass-flux scheme | flag | 0 | integer | | none | F | +!! | GFS_Control%bl_mynn_edmf_mom | edmf_momentum_transport_flag | flag to activate the transport of momentum | flag | 0 | integer | | none | F | +!! | GFS_Control%bl_mynn_edmf_tke | edmf_tke_transport_flag | flag to activate the transport of TKE | flag | 0 | integer | | none | F | +!! | GFS_Control%bl_mynn_edmf_part | edmf_partition_flag | flag to partitioning og the MF and ED areas | flag | 0 | integer | | none | F | +!! | GFS_Control%bl_mynn_cloudmix | cloud_specie_mix_flag | flag to activate mixing of cloud species | flag | 0 | integer | | none | F | +!! | GFS_Control%bl_mynn_mixqt | mix_total_water_flag | flag to mix total water or individual species | flag | 0 | integer | | none | F | +!! | GFS_Control%icloud_bl | couple_sgs_clouds_to_radiation_flag | flag for coupling sgs clouds to radiation | flag | 0 | integer | | none | F | +!! +#endif type GFS_control_type integer :: me !< MPI rank designator integer :: master !< MPI rank of master atmosphere processor +#ifdef CCPP + integer :: communicator !< MPI communicator + integer :: ntasks !< MPI size in communicator + integer :: nthreads !< OpenMP threads available for physics +#endif integer :: nlunit !< unit for namelist character(len=64) :: fn_nml !< namelist filename for surface data cycling character(len=256), pointer :: input_nml_file(:) !< character string containing full namelist - !< for use with internal file reads - real(kind=kind_phys) :: fhzero !< seconds between clearing of diagnostic buckets + !< for use with internal file reads +#ifdef CCPP + integer :: logunit +#endif + real(kind=kind_phys) :: fhzero !< hours between clearing of diagnostic buckets logical :: ldiag3d !< flag for 3d diagnostic fields logical :: lssav !< logical flag for storing diagnostics - real(kind=kind_phys) :: fhcyc !< frequency for surface data cycling (secs) + real(kind=kind_phys) :: fhcyc !< frequency for surface data cycling (hours) logical :: lgocart !< flag for 3d diagnostic fields for gocart 1 - real(kind=kind_phys) :: fhgoc3d !< seconds between calls to gocart + real(kind=kind_phys) :: fhgoc3d !< hours between calls to gocart integer :: thermodyn_id !< valid for GFS only for get_prs/phi integer :: sfcpress_id !< valid for GFS only for get_prs/phi logical :: gen_coord_hybrid!< for Henry's gen coord @@ -433,11 +1213,19 @@ module GFS_typedefs integer :: nx !< number of points in the i-dir for this MPI-domain integer :: ny !< number of points in the j-dir for this MPI-domain integer :: levs !< number of vertical levels +#ifdef CCPP + !--- ak/bk for pressure level calculations + real(kind=kind_phys), pointer :: ak(:) !< from surface (k=1) to TOA (k=levs) + real(kind=kind_phys), pointer :: bk(:) !< from surface (k=1) to TOA (k=levs) +#endif integer :: cnx !< number of points in the i-dir for this cubed-sphere face integer :: cny !< number of points in the j-dir for this cubed-sphere face integer :: lonr !< number of global points in x-dir (i) along the equator integer :: latr !< number of global points in y-dir (j) along any meridian integer :: tile_num +#ifdef CCPP + integer, pointer :: blksz(:) !< for explicit data blocking: block sizes of all blocks +#endif !--- coupling parameters logical :: cplflx !< default no cplflx collection @@ -507,9 +1295,15 @@ module GFS_typedefs logical :: swhtr !< flag to output sw heating rate (Radtend%swhc) !--- microphysical switch - integer :: ncld !< cnoice of cloud scheme + integer :: ncld !< choice of cloud scheme !--- new microphysical switch - integer :: imp_physics !< cnoice of cloud scheme + integer :: imp_physics !< choice of microphysics scheme + integer :: imp_physics_gfdl = 11 !< choice of GFDL microphysics scheme + integer :: imp_physics_thompson = 8 !< choice of Thompson microphysics scheme + integer :: imp_physics_wsm6 = 6 !< choice of WSMG microphysics scheme + integer :: imp_physics_zhao_carr = 99 !< choice of Zhao-Carr microphysics scheme + integer :: imp_physics_zhao_carr_pdf = 98 !< choice of Zhao-Carr microphysics scheme with PDF clouds + integer :: imp_physics_mg = 10 !< choice of Morrison-Gettelman microphysics scheme !--- Z-C microphysical parameters real(kind=kind_phys) :: psautco(2) !< [in] auto conversion coeff from ice to snow real(kind=kind_phys) :: prautco(2) !< [in] auto conversion coeff from cloud to rain @@ -519,9 +1313,12 @@ module GFS_typedefs !--- M-G microphysical parameters integer :: fprcp !< no prognostic rain and snow (MG) integer :: pdfflag !< pdf flag for MG macrophysics - real(kind=kind_phys) :: mg_dcs !< Morrison-Gettleman microphysics parameters + real(kind=kind_phys) :: mg_dcs !< Morrison-Gettelman microphysics parameters real(kind=kind_phys) :: mg_qcvar real(kind=kind_phys) :: mg_ts_auto_ice(2) !< ice auto conversion time scale +#ifdef CCPP + real(kind=kind_phys) :: mg_rhmini !< relative humidity threshold parameter for nucleating ice +#endif real(kind=kind_phys) :: mg_ncnst !< constant droplet num concentration (m-3) real(kind=kind_phys) :: mg_ninst !< constant ice num concentration (m-3) @@ -530,7 +1327,11 @@ module GFS_typedefs real(kind=kind_phys) :: mg_alf !< tuning factor for alphs in MG macrophysics real(kind=kind_phys) :: mg_qcmin(2) !< min liquid and ice mixing ratio in Mg macro clouds character(len=16) :: mg_precip_frac_method ! type of precipitation fraction method - +#ifdef CCPP + real(kind=kind_phys) :: tf + real(kind=kind_phys) :: tcr + real(kind=kind_phys) :: tcrf +#endif ! logical :: effr_in !< eg to turn on ffective radii for MG logical :: microp_uniform @@ -551,16 +1352,25 @@ module GFS_typedefs real(kind=kind_phys) :: shoc_parm(5) !< critical pressure in Pa for tke dissipation in shoc integer :: ncnd !< number of cloud condensate types - !--- Thompson's microphysical paramters - logical :: ltaerosol !< flag for aerosol version, currently not working yet + !--- Thompson's microphysical parameters + logical :: make_number_concentrations !< flag to calculate initial number concentrations + !< from mass concentrations if not in ICs/BCs + logical :: ltaerosol !< flag for aerosol version logical :: lradar !< flag for radar reflectivity + real(kind=kind_phys) :: ttendlim !< temperature tendency limiter per time step in K/s !--- GFDL microphysical paramters logical :: lgfdlmprad !< flag for GFDL mp scheme and radiation consistency !--- land/surface model parameters integer :: lsm !< flag for land surface model lsm=1 for noah lsm + integer :: lsm_noah=1 !< flag for NOAH land surface model + integer :: lsm_noahmp=2 !< flag for NOAH land surface model + integer :: lsm_ruc=3 !< flag for RUC land surface model integer :: lsoil !< number of soil layers +#ifdef CCPP + integer :: lsoil_lsm !< number of soil layers internal to land surface model +#endif integer :: ivegsrc !< ivegsrc = 0 => USGS, !< ivegsrc = 1 => IGBP (20 category) !< ivegsrc = 2 => UMD (13 category) @@ -601,6 +1411,10 @@ module GFS_typedefs logical :: shocaftcnv !< flag for SHOC logical :: shoc_cld !< flag for clouds logical :: uni_cld !< flag for clouds in grrad +#ifdef CCPP + logical :: oz_phys !< flag for old (2006) ozone physics + logical :: oz_phys_2015 !< flag for new (2015) ozone physics +#endif logical :: h2o_phys !< flag for stratosphere h2o logical :: pdfcld !< flag for pdfcld logical :: shcnvcw !< flag for shallow convective cloud @@ -608,6 +1422,8 @@ module GFS_typedefs logical :: hybedmf !< flag for hybrid edmf pbl scheme logical :: satmedmf !< flag for scale-aware TKE-based moist edmf !< vertical turbulent mixing scheme + logical :: shinhong !< flag for scale-aware Shinhong vertical turbulent mixing scheme + logical :: do_ysu !< flag for YSU turbulent mixing scheme logical :: dspheat !< flag for tke dissipative heating logical :: lheatstrg !< flag for canopy heat storage parameterization logical :: cnvcld @@ -651,6 +1467,25 @@ module GFS_typedefs integer :: seed0 !< random seed for radiation real(kind=kind_phys) :: rbcr !< Critical Richardson Number in the PBL scheme +#ifdef CCPP + !--- MYNN parameters/switches + logical :: do_mynnedmf + logical :: do_mynnsfclay + ! DH* TODO - move this to MYNN namelist section + integer :: grav_settling !< flag for initalizing fist time step + integer :: bl_mynn_tkebudget !< flag for activating TKE budget + logical :: bl_mynn_tkeadvect !< activate computation of TKE advection (not yet in use for FV3) + integer :: bl_mynn_cloudpdf !< flag to determine which cloud PDF to use + integer :: bl_mynn_mixlength !< flag for different version of mixing length formulation + integer :: bl_mynn_edmf !< flag to activate the mass-flux scheme + integer :: bl_mynn_edmf_mom !< flag to activate the transport of momentum + integer :: bl_mynn_edmf_tke !< flag to activate the transport of TKE + integer :: bl_mynn_edmf_part !< flag to partitioning og the MF and ED areas + integer :: bl_mynn_cloudmix !< flag to activate mixing of cloud species + integer :: bl_mynn_mixqt !< flag to mix total water or individual species + integer :: icloud_bl !< flag for coupling sgs clouds to radiation + ! *DH +#endif !--- Rayleigh friction real(kind=kind_phys) :: prslrd0 !< pressure level from which Rayleigh Damping is applied @@ -741,6 +1576,10 @@ module GFS_typedefs !--- tracer handling character(len=32), pointer :: tracer_names(:) !< array of initialized tracers from dynamic core integer :: ntrac !< number of tracers +#ifdef CCPP + integer :: ntracp1 !< number of tracers plus one + integer :: ntqv !< tracer index for water vapor (specific humidity) +#endif integer :: ntoz !< tracer index for ozone mixing ratio integer :: ntcw !< tracer index for cloud condensate (or liquid water) integer :: ntiw !< tracer index for ice water @@ -765,7 +1604,7 @@ module GFS_typedefs !--- derived totals for phy_f*d integer :: ntot2d !< total number of variables for phyf2d integer :: ntot3d !< total number of variables for phyf3d - integer :: indcld !< location of cloud fraction in phyf3d (used ony for SHOC or MG) + integer :: indcld !< location of cloud fraction in phyf3d (used only for SHOC or MG) integer :: num_p2d !< number of 2D arrays needed for microphysics integer :: num_p3d !< number of 3D arrays needed for microphysics integer :: nshoc_2d !< number of 2d fields for SHOC @@ -774,6 +1613,12 @@ module GFS_typedefs integer :: npdf3d !< number of 3d arrays associated with pdf based clouds/microphysics integer :: nctp !< number of cloud types in Chikira-Sugiyama scheme integer :: ncnvw !< the index of cnvw in phy_f3d + integer :: ncnvc !< the index of cnvc in phy_f3d + integer :: nleffr !< the index of cloud liquid water effective radius in phy_f3d + integer :: nieffr !< the index of ice effective radius in phy_f3d + integer :: nreffr !< the index of rain effective radius in phy_f3d + integer :: nseffr !< the index of snow effective radius in phy_f3d + integer :: ngeffr !< the index of graupel effective radius in phy_f3d !--- debug flag logical :: debug @@ -795,9 +1640,18 @@ module GFS_typedefs real(kind=kind_phys) :: fhour !< curent forecast hour real(kind=kind_phys) :: zhour !< previous hour diagnostic buckets emptied integer :: kdt !< current forecast iteration +#ifdef CCPP + logical :: first_time_step !< flag signaling first time step for time integration routine + logical :: restart !< flag whether this is a coldstart (.false.) or a warmstart/restart (.true.) + logical :: hydrostatic !< flag whether this is a hydrostatic or non-hydrostatic run +#endif integer :: jdat(1:8) !< current forecast date and time !< (yr, mon, day, t-zone, hr, min, sec, mil-sec) logical :: iccn !< using IN CCN forcing for MG2/3 +#ifdef CCPP + real(kind=kind_phys) :: sec !< seconds since model initialization + real(kind=kind_phys), pointer :: si(:) !< vertical sigma coordinate for model initialization +#endif !--- IAU real(kind=kind_phys) :: iau_delthrs ! iau time interval (to scale increments) in hours @@ -805,6 +1659,14 @@ module GFS_typedefs real(kind=kind_phys) :: iaufhrs(7) ! forecast hours associated with increment files logical :: iau_filter_increments +#ifdef CCPP + ! From physcons.F90, updated/set in control_initialize + real(kind=kind_phys) :: dxinv ! inverse scaling factor for critical relative humidity, replaces dxinv in physcons.F90 + real(kind=kind_phys) :: dxmax ! maximum scaling factor for critical relative humidity, replaces dxmax in physcons.F90 + real(kind=kind_phys) :: dxmin ! minimum scaling factor for critical relative humidity, replaces dxmin in physcons.F90 + real(kind=kind_phys) :: rhcmax ! maximum critical relative humidity, replaces rhc_max in physcons.F90 +#endif + contains procedure :: init => control_initialize procedure :: print => control_print @@ -815,6 +1677,18 @@ module GFS_typedefs ! GFS_grid_type ! grid data needed for interpolations and length-scale calculations !-------------------------------------------------------------------- +#if 0 +!! \section arg_table_GFS_grid_type +!! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional | +!! |--------------------------------------|-----------------------------------------------------------------|-------------------------------------|---------------|------|----------|-----------|--------|----------| +!! | GFS_Data(cdata%blk_no)%Grid%area | cell_area | area of the grid cell | m2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Grid%dx | cell_size | relative dx for the grid cell | m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Grid%xlat | latitude | latitude | radians | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Grid%xlon | longitude | longitude | radians | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Grid%coslat | cosine_of_latitude | cosine of latitude | none | 1 | real | kind_phys | in | F | +!! | GFS_Data(cdata%blk_no)%Grid%sinlat | sine_of_latitude | sine of latitude | none | 1 | real | kind_phys | in | F | +!! +#endif type GFS_grid_type real (kind=kind_phys), pointer :: xlon (:) => null() !< grid longitude in radians, ok for both 0->2pi @@ -864,6 +1738,73 @@ module GFS_typedefs ! GFS_tbd_type ! data not yet assigned to a defined container !----------------------------------------------- +#if 0 +!! \section arg_table_GFS_tbd_type +!! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional | +!! |-------------------------------------------------------------|------------------------------------------------------------------------------------------------|---------------------------------------------------------|---------------|------|---------|-----------|--------|----------| +!! | GFS_Data(cdata%blk_no)%Tbd%icsdsw | seed_random_numbers_sw | random seeds for sub-column cloud generators sw | none | 1 | integer | | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%icsdlw | seed_random_numbers_lw | random seeds for sub-column cloud generators lw | none | 1 | integer | | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%ozpl | ozone_forcing | ozone forcing data | various | 3 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%h2opl | h2o_forcing | water forcing data | various | 3 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%in_nm | in_number_concentration | IN number concentration | kg-1? | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%ccn_nm | ccn_number_concentration | CCN number concentration | kg-1? | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%aer_nm | aerosol_number_concentration_from_gocart_aerosol_climatology | GOCART aerosol climatology number concentration | kg-1? | 3 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%imap | map_of_block_column_number_to_global_i_index | map of local index ix to global index i for this block | none | 1 | integer | | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%jmap | map_of_block_column_number_to_global_j_index | map of local index ix to global index j for this block | none | 1 | integer | | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%rann | random_number_array | random number array (0-1) | none | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%acv | accumulated_lwe_thickness_of_convective_precipitation_amount_cnvc90 | accumulated convective rainfall amount for cnvc90 only | m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%acvb | smallest_cloud_base_vertical_index_encountered_thus_far | smallest cloud base vertical index encountered thus far | index | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%acvt | largest_cloud_top_vertical_index_encountered_thus_far | largest cloud top vertical index encountered thus far | index | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%dtdtr | tendency_of_air_temperature_due_to_radiative_heating_on_physics_time_step | temp. change due to radiative heating per time step | K | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%dtotprcp | | change in totprcp (diag_type) | | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%dcnvprcp | | change in cnvprcp (diag_type) | | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%drain_cpl | tendency_of_lwe_thickness_of_precipitation_amount_for_coupling | change in rain_cpl (coupling_type) | m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%dsnow_cpl | tendency_of_lwe_thickness_of_snow_amount_for_coupling | change in show_cpl (coupling_type) | m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%phy_fctd | cloud_base_mass_flux | cloud base mass flux for CS convection | kg m-2 s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%phy_f2d | | 2d arrays saved for restart | | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%phy_f2d(:,1) | surface_air_pressure_two_time_steps_back | surface air pressure two time steps back | Pa | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%phy_f2d(:,2) | surface_air_pressure_at_previous_time_step | surface air pressure at previous time step | Pa | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%phy_f2d(:,GFS_Control%num_p2d) | surface_wind_enhancement_due_to_convection | surface wind enhancement due to convection | m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%phy_f3d | | 3d arrays saved for restart | | 3 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%phy_f3d(:,:,1) | air_temperature_two_time_steps_back | air temperature two time steps back | K | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%phy_f3d(:,:,2) | water_vapor_specific_humidity_two_time_steps_back | water vapor specific humidity two time steps back | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%phy_f3d(:,:,3) | air_temperature_at_previous_time_step | air temperature at previous time step | K | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%phy_f3d(:,:,4) | water_vapor_specific_humidity_at_previous_time_step | water vapor specific humidity at previous time step | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%phy_f3d(:,:,GFS_Control%ncnvw) | convective_cloud_water_mixing_ratio_in_phy_f3d | convective cloud water mixing ratio in the phy_f3d array| kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%phy_f3d(:,:,GFS_Control%ncnvc) | convective_cloud_cover_in_phy_f3d | convective cloud cover in the phy_f3d array | frac | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%phy_f3d(:,:,GFS_Control%ntot3d) | kinematic_buoyancy_flux_from_shoc | upward kinematic buoyancy flux from the SHOC scheme | K m s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%phy_f3d(:,:,GFS_Control%ntot3d-1)| atmosphere_heat_diffusivity_from_shoc | diffusivity for heat from the SHOC scheme | m2 s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%phy_f3d(:,:,GFS_Control%ntot3d-2)| subgrid_scale_cloud_fraction_from_shoc | subgrid-scale cloud fraction from the SHOC scheme | frac | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%phy_f3d(:,:,GFS_Control%indcld) | cloud_fraction_for_MG | cloud fraction used by Morrison-Gettelman MP | frac | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%phy_f3d(:,:,GFS_Control%nleffr) | effective_radius_of_stratiform_cloud_liquid_water_particle_in_um | eff. radius of cloud liquid water particle in micrometer| um | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%phy_f3d(:,:,GFS_Control%nieffr) | effective_radius_of_stratiform_cloud_ice_particle_in_um | eff. radius of cloud ice water particle in micrometer | um | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%phy_f3d(:,:,GFS_Control%nreffr) | effective_radius_of_stratiform_cloud_rain_particle_in_um | effective radius of cloud rain particle in micrometers | um | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%phy_f3d(:,:,GFS_Control%nseffr) | effective_radius_of_stratiform_cloud_snow_particle_in_um | effective radius of cloud snow particle in micrometers | um | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%phy_f3d(:,:,GFS_Control%ngeffr) | effective_radius_of_stratiform_cloud_graupel_particle_in_um | eff. radius of cloud graupel particle in micrometer | um | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%htlwc | tendency_of_air_temperature_due_to_longwave_heating_on_radiation_time_step | total sky heating rate due to longwave radiation | K s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%htlw0 | tendency_of_air_temperature_due_to_longwave_heating_assuming_clear_sky_on_radiation_time_step | clear sky heating rate due to longwave radiation | K s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%htswc | tendency_of_air_temperature_due_to_shortwave_heating_on_radiation_time_step | total sky heating rate due to shortwave radiation | K s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%htsw0 | tendency_of_air_temperature_due_to_shortwave_heating_assuming_clear_sky_on_radiation_time_step | clear sky heating rates due to shortwave radiation | K s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%forcet | temperature_tendency_due_to_dynamics | temperature tendency due to dynamics only | K s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%forceq | moisture_tendency_due_to_dynamics | moisture tendency due to dynamics only | kg kg-1 s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%prevst | temperature_from_previous_timestep | temperature from previous time step | K | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%prevsq | moisture_from_previous_timestep | moisture from previous time step | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%cactiv | conv_activity_counter | convective activity memory | none | 1 | integer | | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%raincprv | lwe_thickness_of_explicit_rainfall_amount_from_previous_timestep | explicit rainfall from previous timestep | m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%rainncprv | lwe_thickness_of_convective_precipitation_amount_from_previous_timestep | convective_precipitation_amount from previous timestep | m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%iceprv | lwe_thickness_of_ice_amount_from_previous_timestep | ice amount from previous timestep | m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%snowprv | lwe_thickness_of_snow_amount_from_previous_timestep | snow amount from previous timestep | m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%graupelprv | lwe_thickness_of_graupel_amount_from_previous_timestep | graupel amount from previous timestep | m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%CLDFRA_BL | subgrid_cloud_fraction_pbl | subgrid cloud fraction from PBL scheme | frac | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%QC_BL | subgrid_cloud_mixing_ratio_pbl | subgrid cloud cloud mixing ratio from PBL scheme | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%el_pbl | mixing_length | mixing length in meters | m | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%Sh3D | stability_function_for_heat | stability function for heat | none | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%qke | tke_at_mass_points | 2 x tke at mass points | m2 s-2 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%tsq | t_prime_squared | temperature fluctuation squared | K2 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%qsq | q_prime_squared | water vapor fluctuation squared | kg2 kg-2 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Tbd%cov | t_prime_q_prime | covariance of temperature and moisture | K kg kg-1 | 2 | real | kind_phys | none | F | +!! +#endif type GFS_tbd_type !--- radiation random seeds @@ -880,6 +1821,10 @@ module GFS_typedefs real (kind=kind_phys), pointer :: aer_nm (:,:,:) => null() !< GOCART aerosol climo !--- active when ((.not. newsas .or. cal_pre) .and. random_clds) +#ifdef CCPP + integer, pointer :: imap (:) => null() !< map of local index ix to global index i for this block + integer, pointer :: jmap (:) => null() !< map of local index ix to global index j for this block +#endif real (kind=kind_phys), pointer :: rann (:,:) => null() !< random number array (0-1) !--- In/Out @@ -895,10 +1840,47 @@ module GFS_typedefs real (kind=kind_phys), pointer :: dsnow_cpl (:) => null() !< change in show_cpl (coupling_type) !--- phy_f*d variables needed for seamless restarts and moving data between grrad and gbphys - real (kind=kind_phys), pointer :: phy_fctd (:,:) => null() !< For CS convection + real (kind=kind_phys), pointer :: phy_fctd (:,:) => null() !< cloud base mass flux for CS convection real (kind=kind_phys), pointer :: phy_f2d (:,:) => null() !< 2d arrays saved for restart real (kind=kind_phys), pointer :: phy_f3d (:,:,:) => null() !< 3d arrays saved for restart +#ifndef CCPP +!--- for explicit data blocking + integer :: blkno !< block number of this block +#endif + +#ifdef CCPP + !--- radiation variables that need to be carried over from radiation to physics + real (kind=kind_phys), pointer :: htlwc(:,:) => null() !< + real (kind=kind_phys), pointer :: htlw0(:,:) => null() !< + real (kind=kind_phys), pointer :: htswc(:,:) => null() !< + real (kind=kind_phys), pointer :: htsw0(:,:) => null() !< + + !--- dynamical forcing variables for Grell-Freitas convection + real (kind=kind_phys), pointer :: forcet (:,:) => null() !< + real (kind=kind_phys), pointer :: forceq (:,:) => null() !< + real (kind=kind_phys), pointer :: prevst (:,:) => null() !< + real (kind=kind_phys), pointer :: prevsq (:,:) => null() !< + integer, pointer :: cactiv (:) => null() !< convective activity memory contour + + !---- precipitation amounts from previous time step for RUC LSM + real (kind=kind_phys), pointer :: raincprv (:) => null() !< explicit rainfall from previous timestep + real (kind=kind_phys), pointer :: rainncprv (:) => null() !< convective_precipitation_amount from previous timestep + real (kind=kind_phys), pointer :: iceprv (:) => null() !< ice amount from previous timestep + real (kind=kind_phys), pointer :: snowprv (:) => null() !< snow amount from previous timestep + real (kind=kind_phys), pointer :: graupelprv(:) => null() !< graupel amount from previous timestep + + !--- MYNN prognostic variables that can't be in the Intdiag or Interstitial DDTs + real (kind=kind_phys), pointer :: CLDFRA_BL (:,:) => null() ! + real (kind=kind_phys), pointer :: QC_BL (:,:) => null() ! + real (kind=kind_phys), pointer :: el_pbl (:,:) => null() ! + real (kind=kind_phys), pointer :: Sh3D (:,:) => null() ! + real (kind=kind_phys), pointer :: qke (:,:) => null() ! + real (kind=kind_phys), pointer :: tsq (:,:) => null() ! + real (kind=kind_phys), pointer :: qsq (:,:) => null() ! + real (kind=kind_phys), pointer :: cov (:,:) => null() ! +#endif + contains procedure :: create => tbd_create !< allocate array data end type GFS_tbd_type @@ -908,6 +1890,15 @@ module GFS_typedefs ! GFS_cldprop_type ! cloud properties and tendencies needed by radiation from physics !------------------------------------------------------------------ +#if 0 +!! \section arg_table_GFS_cldprop_type +!! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional | +!! |-------------------------------------------|---------------------------------------------------------|---------------------------------------------------------|---------------|------|---------|-----------|--------|----------| +!! | GFS_Data(cdata%blk_no)%Cldprop%cv | fraction_of_convective_cloud | fraction of convective cloud | frac | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Cldprop%cvt | pressure_at_top_of_convective_cloud | convective cloud top pressure | Pa | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Cldprop%cvb | pressure_at_bottom_of_convective_cloud | convective cloud bottom pressure | Pa | 1 | real | kind_phys | none | F | +!! +#endif type GFS_cldprop_type !--- In (radiation) @@ -925,6 +1916,24 @@ module GFS_typedefs ! GFS_radtend_type ! radiation tendencies needed by physics !----------------------------------------- +#if 0 +!! \section arg_table_GFS_radtend_type +!! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional | +!! |-------------------------------------------|-----------------------------------------------------------------------------------------------|---------------------------------------------------------|---------------|------|-------------|-----------|--------|----------| +!! | GFS_Data(cdata%blk_no)%Radtend%sfcfsw | sw_fluxes_sfc | sw radiation fluxes at sfc | W m-2 | 1 | sfcfsw_type | | none | F | +!! | GFS_Data(cdata%blk_no)%Radtend%sfcflw | lw_fluxes_sfc | lw radiation fluxes at sfc | W m-2 | 1 | sfcflw_type | | none | F | +!! | GFS_Data(cdata%blk_no)%Radtend%htrsw | tendency_of_air_temperature_due_to_shortwave_heating_on_radiation_timestep | total sky sw heating rate | K s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Radtend%htrlw | tendency_of_air_temperature_due_to_longwave_heating_on_radiation_timestep | total sky lw heating rate | K s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Radtend%sfalb | surface_diffused_shortwave_albedo | mean surface diffused sw albedo | frac | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Radtend%coszen | cosine_of_zenith_angle | mean cos of zenith angle over rad call period | none | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Radtend%tsflw | surface_midlayer_air_temperature_in_longwave_radiation | surface air temp during lw calculation | K | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Radtend%semis | surface_longwave_emissivity | surface lw emissivity in fraction | frac | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Radtend%coszdg | | daytime mean cosz over rad call period | none | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Radtend%swhc | tendency_of_air_temperature_due_to_shortwave_heating_assuming_clear_sky_on_radiation_timestep | clear sky sw heating rates | K s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Radtend%lwhc | tendency_of_air_temperature_due_to_longwave_heating_assuming_clear_sky_on_radiation_timestep | clear sky lw heating rates | K s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Radtend%lwhd | tendency_of_air_temperature_due_to_longwave_heating_for_idea | idea sky lw heating rates | K s-1 | 3 | real | kind_phys | none | F | +!! +#endif type GFS_radtend_type type (sfcfsw_type), pointer :: sfcfsw(:) => null() !< sw radiation fluxes at sfc @@ -968,6 +1977,163 @@ module GFS_typedefs ! GFS_diag_type ! internal diagnostic type used as arguments to gbphys and grrad !---------------------------------------------------------------- +#if 0 +!! \section arg_table_GFS_diag_type +!! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional | +!! |-----------------------------------------------------|-------------------------------------------------------------------------|-----------------------------------------------------------------|---------------|------|-------------|-----------|--------|----------| +!! | GFS_Data(cdata%blk_no)%Intdiag%fluxr | | accumulated 2-d fields, opt. includes aerosols | | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%topfsw | sw_fluxes_top_atmosphere | sw radiation fluxes at toa | W m-2 | 1 | topfsw_type | | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%topflw | lw_fluxes_top_atmosphere | lw radiation fluxes at top | W m-2 | 1 | topflw_type | | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%srunoff | surface_runoff | surface water runoff (from lsm) | kg m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%evbsa | cumulative_soil_upward_latent_heat_flux_multiplied_by_timestep | cumulative soil upward latent heat flux multiplied by timestep | W m-2 s | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%evcwa | cumulative_canopy_upward_latent_heat_flu_multiplied_by_timestep | cumulative canopy upward latent heat flux multiplied by timestep| W m-2 s | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%snohfa | cumulative_snow_freezing_rain_upward_latent_heat_flux_multiplied_by_timestep | cumulative latent heat flux due to snow and frz rain multiplied by timestep | W m-2 s | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%transa | cumulative_transpiration_flux_multiplied_by_timestep | cumulative total plant transpiration rate multiplied by timestep | kg m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%sbsnoa | cumulative_snow_deposition_sublimation_upward_latent_heat_flux_multiplied_by_timestep | cumulative latent heat flux from snow depo/subl multiplied by timestep | W m-2 s | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%snowca | cumulative_surface_snow_area_fraction_multiplied_by_timestep | cumulative surface snow area fraction multiplied by timestep | s | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%soilm | soil_moisture_content | soil moisture | kg m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%tmpmin | minimum_temperature_at_2m | min temperature at 2m height | K | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%tmpmax | maximum_temperature_at_2m | max temperature at 2m height | K | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dusfc | cumulative_surface_x_momentum_flux_for_diag_multiplied_by_timestep | cumulative sfc x momentum flux multiplied by timestep | Pa s | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dvsfc | cumulative_surface_y_momentum_flux_for_diag_multiplied_by_timestep | cumulative sfc y momentum flux multiplied by timestep | Pa s | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dtsfc | cumulative_surface_upward_sensible_heat_flux_for_diag_multiplied_by_timestep | cumulative sfc sensible heat flux multiplied by timestep | W m-2 s | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dqsfc | cumulative_surface_upward_latent_heat_flux_for_diag_multiplied_by_timestep | cumulative sfc latent heat flux multiplied by timestep | W m-2 s | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%totprcp | accumulated_lwe_thickness_of_precipitation_amount | accumulated total precipitation | m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%totice | accumulated_lwe_thickness_of_ice_amount | accumulated ice precipitation | kg m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%totsnw | accumulated_lwe_thickness_of_snow_amount | accumulated snow precipitation | kg m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%totgrp | accumulated_lwe_thickness_of_graupel_amount | accumulated graupel precipitation | kg m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%totprcpb | accumulated_lwe_thickness_of_precipitation_amount_in_bucket | accumulated total precipitation in bucket | m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%toticeb | accumulated_lwe_thickness_of_ice_amount_in_bucket | accumulated ice precipitation in bucket | kg m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%totsnwb | accumulated_lwe_thickness_of_snow_amount_in_bucket | accumulated snow precipitation in bucket | kg m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%totgrpb | accumulated_lwe_thickness_of_graupel_amount_in_bucket | accumulated graupel precipitation in bucket | kg m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%gflux | cumulative_surface_ground_heat_flux_multiplied_by_timestep | cumulative groud conductive heat flux multiplied by timestep | W m-2 s | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dlwsfc | cumulative_surface_downwelling_longwave_flux_multiplied_by_timestep | cumulative surface downwelling LW flux multiplied by timestep | W m-2 s | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%ulwsfc | cumulative_surface_upwelling_longwave_flux_multiplied_by_timestep | cumulative surface upwelling LW flux multiplied by timestep | W m-2 s | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%suntim | duration_of_sunshine | sunshine duration time | s | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%runoff | total_runoff | total water runoff | kg m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%ep | cumulative_surface_upward_potential_latent_heat_flux_multiplied_by_timestep | cumulative surface upward potential latent heat flux multiplied by timestep | W m-2 s | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%cldwrk | cumulative_cloud_work_function | cumulative cloud work function (valid only with sas) | m2 s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dugwd | time_integral_of_x_stress_due_to_gravity_wave_drag | vertically integrated u change by OGWD | Pa s | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dvgwd | time_integral_of_y_stress_due_to_gravity_wave_drag | vertically integrated v change by OGWD | Pa s | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%psmean | cumulative_surface_pressure_multiplied_by_timestep | cumulative surface pressure multiplied by timestep | Pa s | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%cnvprcp | cumulative_lwe_thickness_of_convective_precipitation_amount | cumulative convective precipitation | m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%cnvprcpb | cumulative_lwe_thickness_of_convective_precipitation_amount_in_bucket | cumulative convective precipitation in bucket | m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%spfhmin | minimum_specific_humidity_at_2m | minimum specific humidity at 2m height | kg kg-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%spfhmax | maximum_specific_humidity_at_2m | maximum specific humidity at 2m height | kg kg-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%u10mmax | maximum_x_wind_at_10m | maximum x wind at 10 m | m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%v10mmax | maximum_y_wind_at_10m | maximum y wind at 10 m | m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%wind10mmax | maximum_wind_at_10m | maximum wind speed at 10 m | m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%u10max | maximum_u_wind_at_10m_over_maximum_hourly_time_interval | maximum u wind at 10m over maximum hourly time interval | m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%v10max | maximum_v_wind_at_10m_over_maximum_hourly_time_interval | maximum v wind at 10m over maximum hourly time interval | m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%spd10max | maximum_wind_at_10m_over_maximum_hourly_time_interval | maximum wind at 10m over maximum hourly time interval | m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%rain | lwe_thickness_of_precipitation_amount_on_dynamics_timestep | total rain at this time step | m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%rainc | lwe_thickness_of_convective_precipitation_amount_on_dynamics_timestep | convective rain at this time step | m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%ice | lwe_thickness_of_ice_amount_on_dynamics_timestep | ice fall at this time step | m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%snow | lwe_thickness_of_snow_amount_on_dynamics_timestep | snow fall at this time step | m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%graupel | lwe_thickness_of_graupel_amount_on_dynamics_timestep | graupel fall at this time step | m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%u10m | x_wind_at_10m | 10 meter u wind speed | m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%v10m | y_wind_at_10m | 10 meter v wind speed | m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dpt2m | dewpoint_temperature_at_2m | 2 meter dewpoint temperature | K | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%zlvl | height_above_ground_at_lowest_model_layer | layer 1 height above ground (not MSL) | m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%psurf | surface_air_pressure_diag | surface air pressure diagnostic | Pa | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%hpbl | atmosphere_boundary_layer_thickness | pbl height | m | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%pwat | column_precipitable_water | precipitable water | kg m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%t1 | air_temperature_at_lowest_model_layer_for_diag | layer 1 temperature for diag | K | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%q1 | water_vapor_specific_humidity_at_lowest_model_layer_for_diag | layer 1 specific humidity for diag | kg kg-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%u1 | x_wind_at_lowest_model_layer_for_diag | layer 1 x wind for diag | m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%v1 | y_wind_at_lowest_model_layer_for_diag | layer 1 y wind for diag | m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%chh | surface_drag_mass_flux_for_heat_and_moisture_in_air | thermal exchange coefficient | kg m-2 s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%cmm | surface_drag_wind_speed_for_momentum_in_air | momentum exchange coefficient | m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dlwsfci | surface_downwelling_longwave_flux | surface downwelling longwave flux at current time | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%ulwsfci | surface_upwelling_longwave_flux | surface upwelling longwave flux at current time | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dswsfci | surface_downwelling_shortwave_flux | surface downwelling shortwave flux at current time | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%nswsfci | surface_net_downwelling_shortwave_flux | surface net downwelling shortwave flux at current time | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%uswsfci | surface_upwelling_shortwave_flux | surface upwelling shortwave flux at current time | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dusfci | instantaneous_surface_x_momentum_flux_for_diag | instantaneous sfc x momentum flux multiplied by timestep | Pa | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dvsfci | instantaneous_surface_y_momentum_flux_for_diag | instantaneous sfc y momentum flux multiplied by timestep | Pa | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dtsfci | instantaneous_surface_upward_sensible_heat_flux_for_diag | instantaneous sfc sensible heat flux multiplied by timestep | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dqsfci | instantaneous_surface_upward_latent_heat_flux_for_diag | instantaneous sfc latent heat flux multiplied by timestep | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%gfluxi | instantaneous_surface_ground_heat_flux | instantaneous sfc ground heat flux | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%epi | instantaneous_surface_potential_evaporation | instantaneous sfc potential evaporation | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%smcwlt2 | volume_fraction_of_condensed_water_in_soil_at_wilting_point | wilting point (volumetric) | frac | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%smcref2 | threshold_volume_fraction_of_condensed_water_in_soil | soil moisture threshold (volumetric) | frac | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%sr | ratio_of_snowfall_to_rainfall | snow ratio: ratio of snow to total precipitation (explicit only)| frac | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%wet1 | normalized_soil_wetness | normalized soil wetness | frac | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%tdomr | dominant_rain_type | dominant rain type | none | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%tdomzr | dominant_freezing_rain_type | dominant freezing rain type | none | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%tdomip | dominant_sleet_type | dominant sleet type | none | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%tdoms | dominant_snow_type | dominant snow type | none | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%ca_out | | cellular automata fraction | | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%ca_deep | | cellular automata fraction | | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%ca_turb | | cellular automata fraction | | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%ca_shal | | cellular automata fraction | | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%ca_rad | | cellular automata fraction | | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%ca_micro | | cellular automata fraction | | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%skebu_wts | weights_for_stochastic_skeb_perturbation_of_x_wind_flipped | weights for stochastic skeb perturbation of x wind, flipped | none | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%skebv_wts | weights_for_stochastic_skeb_perturbation_of_y_wind_flipped | weights for stochastic skeb perturbation of y wind, flipped | none | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%sppt_wts | weights_for_stochastic_sppt_perturbation_flipped | weights for stochastic sppt perturbation, flipped | none | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%shum_wts | weights_for_stochastic_shum_perturbation_flipped | weights for stochastic shum perturbation, flipped | none | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%zmtnblck | level_of_dividing_streamline | level of the dividing streamline | none | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%du3dt | | u momentum change due to physics | | 3 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%du3dt(:,:,1) | cumulative_change_in_x_wind_due_to_PBL | cumulative change in x wind due to PBL | m s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%du3dt(:,:,2) | cumulative_change_in_x_wind_due_to_orographic_gravity_wave_drag | cumulative change in x wind due to orographic gravity wave drag | m s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%du3dt(:,:,3) | cumulative_change_in_x_wind_due_to_deep_convection | cumulative change in x wind due to deep convection | m s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%du3dt(:,:,4) | cumulative_change_in_x_wind_due_to_convective_gravity_wave_drag | cumulative change in x wind due to convective gravity wave drag | m s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dv3dt | | v momentum change due to physics | | 3 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dv3dt(:,:,1) | cumulative_change_in_y_wind_due_to_PBL | cumulative change in y wind due to PBL | m s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dv3dt(:,:,2) | cumulative_change_in_y_wind_due_to_orographic_gravity_wave_drag | cumulative change in y wind due to orographic gravity wave drag | m s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dv3dt(:,:,3) | cumulative_change_in_y_wind_due_to_deep_convection | cumulative change in y wind due to deep convection | m s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dv3dt(:,:,4) | cumulative_change_in_y_wind_due_to_convective_gravity_wave_drag | cumulative change in y wind due to convective gravity wave drag | m s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dt3dt | | temperature change due to physics | | 3 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dt3dt(:,:,1) | cumulative_change_in_temperature_due_to_longwave_radiation | cumulative change in temperature due to longwave radiation | K | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dt3dt(:,:,2) | cumulative_change_in_temperature_due_to_shortwave_radiation | cumulative change in temperature due to shortwave radiation | K | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dt3dt(:,:,3) | cumulative_change_in_temperature_due_to_PBL | cumulative change in temperature due to PBL | K | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dt3dt(:,:,4) | cumulative_change_in_temperature_due_to_deep_convection | cumulative change in temperature due to deep conv. | K | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dt3dt(:,:,5) | cumulative_change_in_temperature_due_to_shal_convection | cumulative change in temperature due to shal conv. | K | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dt3dt(:,:,6) | cumulative_change_in_temperature_due_to_microphysics | cumulative change in temperature due to microphysics | K | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dt3dt(:,:,7) | cumulative_change_in_temperature_due_to_orographic_gravity_wave_drag | cumulative change in temperature due to orographic gravity wave drag | K | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dq3dt | | cumulative change in water vapor specific humidity due to physics | kg kg-1 | 3 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dq3dt(:,:,1) | cumulative_change_in_water_vapor_specific_humidity_due_to_PBL | cumulative change in water vapor specific humidity due to PBL | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dq3dt(:,:,2) | cumulative_change_in_water_vapor_specific_humidity_due_to_deep_convection | cumulative change in water vapor specific humidity due to deep conv. | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dq3dt(:,:,3) | cumulative_change_in_water_vapor_specific_humidity_due_to_shal_convection | cumulative change in water vapor specific humidity due to shal conv. | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dq3dt(:,:,4) | cumulative_change_in_water_vapor_specific_humidity_due_to_microphysics | cumulative change in water vapor specific humidity due to microphysics | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dq3dt(:,:,5) | cumulative_change_in_ozone_mixing_ratio_due_to_PBL | cumulative change in ozone mixing ratio due to PBL | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dq3dt(:,:,6) | cumulative_change_in_ozone_concentration_due_to_production_and_loss_rate | cumulative change in ozone concentration due to production and loss rate | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dq3dt(:,:,7) | cumulative_change_in_ozone_concentration_due_to_ozone_mixing_ratio | cumulative change in ozone concentration due to ozone mixing ratio | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dq3dt(:,:,8) | cumulative_change_in_ozone_concentration_due_to_temperature | cumulative change in ozone concentration due to temperature | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dq3dt(:,:,9) | cumulative_change_in_ozone_concentration_due_to_overhead_ozone_column | cumulative change in ozone concentration due to overhead ozone column | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%refdmax | maximum_reflectivity_at_1km_agl_over_maximum_hourly_time_interval | maximum reflectivity at 1km agl over maximum hourly time interval | dBZ | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%refdmax263k | maximum_reflectivity_at_minus10c_over_maximum_hourly_time_interval | maximum reflectivity at minus10c over maximum hourly time interval | dBZ | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%t02max | maximum_temperature_at_2m_over_maximum_hourly_time_interval | maximum temperature at 2m over maximum hourly time interval | K | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%t02min | minimum_temperature_at_2m_over_maximum_hourly_time_interval | minumum temperature at 2m over maximum hourly time interval | K | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%rh02max | maximum_relative_humidity_at_2m_over_maximum_hourly_time_interval | maximum relative humidity at 2m over maximum hourly time interval | % | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%rh02min | minimum_relative_humidity_at_2m_over_maximum_hourly_time_interval | minumum relative humidity at 2m over maximum hourly time interval | % | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%upd_mf | cumulative_atmosphere_updraft_convective_mass_flux | cumulative updraft mass flux | Pa | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%dwn_mf | cumulative_atmosphere_downdraft_convective_mass_flux | cumulative downdraft mass flux | Pa | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%det_mf | cumulative_atmosphere_detrainment_convective_mass_flux | cumulative detrainment mass flux | Pa | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%cldcov | | instantaneous 3D cloud fraction | | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%refl_10cm | radar_reflectivity_10cm | instantaneous refl_10cm | dBZ | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%duem | instantaneous_dust_emission_flux | instantaneous dust emission flux | kg m-2 s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%ssem | instantaneous_seasalt_emission_flux | instantaneous sea salt emission flux | kg m-2 s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%sedim | instantaneous_sedimentation | instantaneous sedimentation | kg m-2 s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%drydep | instantaneous_dry_deposition | instantaneous dry deposition | kg m-2 s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%wetdpl | instantaneous_large-scale_wet_deposition | instantaneous large-scale wet deposition | kg m-2 s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%wetdpc | instantaneous_convective-scale_wet_deposition | instantaneous convective-scale wet deposition | kg m-2 s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%abem | instantaneous_anthopogenic_and_biomass_burning_emissions | instantaneous anthopogenic and biomass burning emissions for black carbon, organic carbon, and sulfur dioxide | ug m-2 s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%aecm | instantaneous_aerosol_column_mass_densities | instantaneous aerosol column mass densities for pm2.5, black carbon, organic carbon, sulfate, dust, sea salt | g m-2 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%edmf_a | emdf_updraft_area | updraft area from mass flux scheme | frac | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%edmf_w | emdf_updraft_vertical_velocity | updraft vertical velocity from mass flux scheme | m s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%edmf_qt | emdf_updraft_total_water | updraft total water from mass flux scheme | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%edmf_thl | emdf_updraft_theta_l | updraft theta-l from mass flux scheme | K | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%edmf_ent | emdf_updraft_entrainment_rate | updraft entranment rate from mass flux scheme | s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%edmf_qc | emdf_updraft_cloud_water | updraft cloud water from mass flux scheme | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%nupdraft | number_of_plumes | number of plumes per grid column | count | 1 | integer | | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%maxMF | maximum_mass_flux | maximum mass flux within a column | m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%ktop_shallow | k_level_of_highest_reaching_plume | k-level of highest reaching plume | count | 1 | integer | | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%exch_h | atmosphere_heat_diffusivity_for_mynnpbl | diffusivity for heat for MYNN PBL (defined for all mass levels) | m2 s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Data(cdata%blk_no)%Intdiag%exch_m | atmosphere_momentum_diffusivity_for_mynnpbl | diffusivity for momentum for MYNN PBL (defined for all mass levels) | m2 s-1 | 2 | real | kind_phys | none | F | +!! +#endif type GFS_diag_type !! Input/Output only in radiation @@ -1030,9 +2196,24 @@ module GFS_typedefs real (kind=kind_phys), pointer :: totsnwb(:) => null() !< accumulated snow precipitation in bucket (kg/m2) real (kind=kind_phys), pointer :: totgrpb(:) => null() !< accumulated graupel precipitation in bucket (kg/m2) +#ifdef CCPP + !--- MYNN variables + real (kind=kind_phys), pointer :: edmf_a (:,:) => null() ! + real (kind=kind_phys), pointer :: edmf_w (:,:) => null() ! + real (kind=kind_phys), pointer :: edmf_qt (:,:) => null() ! + real (kind=kind_phys), pointer :: edmf_thl (:,:) => null() ! + real (kind=kind_phys), pointer :: edmf_ent (:,:) => null() ! + real (kind=kind_phys), pointer :: edmf_qc (:,:) => null() ! + real (kind=kind_phys), pointer :: maxMF (:) => null() ! + integer, pointer :: nupdraft (:) => null() ! + integer, pointer :: ktop_shallow (:) => null() ! + real (kind=kind_phys), pointer :: exch_h (:,:) => null() ! + real (kind=kind_phys), pointer :: exch_m (:,:) => null() ! +#endif + ! Output - only in physics - real (kind=kind_phys), pointer :: u10m (:) => null() !< 10 meater u/v wind speed - real (kind=kind_phys), pointer :: v10m (:) => null() !< 10 meater u/v wind speed + real (kind=kind_phys), pointer :: u10m (:) => null() !< 10 meter u/v wind speed + real (kind=kind_phys), pointer :: v10m (:) => null() !< 10 meter u/v wind speed real (kind=kind_phys), pointer :: dpt2m (:) => null() !< 2 meter dew point temperature real (kind=kind_phys), pointer :: zlvl (:) => null() !< layer 1 height (m) real (kind=kind_phys), pointer :: psurf (:) => null() !< surface pressure (Pa) @@ -1047,6 +2228,9 @@ module GFS_typedefs real (kind=kind_phys), pointer :: dlwsfci(:) => null() !< instantaneous sfc dnwd lw flux ( w/m**2 ) real (kind=kind_phys), pointer :: ulwsfci(:) => null() !< instantaneous sfc upwd lw flux ( w/m**2 ) real (kind=kind_phys), pointer :: dswsfci(:) => null() !< instantaneous sfc dnwd sw flux ( w/m**2 ) +#ifdef CCPP + real (kind=kind_phys), pointer :: nswsfci(:) => null() !< instantaneous sfc net dnwd sw flux ( w/m**2 ) +#endif real (kind=kind_phys), pointer :: uswsfci(:) => null() !< instantaneous sfc upwd sw flux ( w/m**2 ) real (kind=kind_phys), pointer :: dusfci (:) => null() !< instantaneous u component of surface stress real (kind=kind_phys), pointer :: dvsfci (:) => null() !< instantaneous v component of surface stress @@ -1058,10 +2242,10 @@ module GFS_typedefs real (kind=kind_phys), pointer :: smcref2(:) => null() !< soil moisture threshold (volumetric) real (kind=kind_phys), pointer :: wet1 (:) => null() !< normalized soil wetness real (kind=kind_phys), pointer :: sr (:) => null() !< snow ratio : ratio of snow to total precipitation - real (kind=kind_phys), pointer :: tdomr (:) => null() !< accumulated rain type - real (kind=kind_phys), pointer :: tdomzr (:) => null() !< accumulated freezing rain type - real (kind=kind_phys), pointer :: tdomip (:) => null() !< accumulated sleet type - real (kind=kind_phys), pointer :: tdoms (:) => null() !< accumulated snow type + real (kind=kind_phys), pointer :: tdomr (:) => null() !< dominant accumulated rain type + real (kind=kind_phys), pointer :: tdomzr (:) => null() !< dominant accumulated freezing rain type + real (kind=kind_phys), pointer :: tdomip (:) => null() !< dominant accumulated sleet type + real (kind=kind_phys), pointer :: tdoms (:) => null() !< dominant accumulated snow type real (kind=kind_phys), pointer :: ca_out (:) => null() !< cellular automata fraction real (kind=kind_phys), pointer :: ca_deep (:) => null() !< cellular automata fraction @@ -1070,10 +2254,10 @@ module GFS_typedefs real (kind=kind_phys), pointer :: ca_rad (:) => null() !< cellular automata fraction real (kind=kind_phys), pointer :: ca_micro (:) => null() !< cellular automata fraction - real (kind=kind_phys), pointer :: skebu_wts(:,:) => null() !< 10 meater u/v wind speed - real (kind=kind_phys), pointer :: skebv_wts(:,:) => null() !< 10 meater u/v wind speed - real (kind=kind_phys), pointer :: sppt_wts(:,:) => null() !< 10 meater u/v wind speed - real (kind=kind_phys), pointer :: shum_wts(:,:) => null() !< 10 meater u/v wind speed + real (kind=kind_phys), pointer :: skebu_wts(:,:) => null() !< 10 meter u wind speed + real (kind=kind_phys), pointer :: skebv_wts(:,:) => null() !< 10 meter v wind speed + real (kind=kind_phys), pointer :: sppt_wts(:,:) => null() !< + real (kind=kind_phys), pointer :: shum_wts(:,:) => null() !< real (kind=kind_phys), pointer :: zmtnblck(:) => null() ! null() !< u momentum change due to physics real (kind=kind_phys), pointer :: dv3dt (:,:,:) => null() !< v momentum change due to physics @@ -1188,27 +2372,632 @@ module GFS_typedefs end type GFS_diag_type #ifdef CCPP -! DH* for testing of CCPP integration -!! \section arg_table_GFS_fastphys_type -!! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional | -!! |---------------------|----------------------------|------------------------------------------------|-------|------|-----------|---------|--------|----------| -!! | IPD_fastphys%dummy | FV3_ccpp_integration_dummy | dummy variable to test CCPP integration in FV3 | none | 0 | integer | | none | F | -!! | IPD_fastphys%errmsg | error_message | error message for error handling in CCPP | none | 0 | character | len=512 | none | F | -!! | IPD_fastphys%errflg | error_flag | error flag for error handling in CCPP | flag | 0 | integer | | none | F | +!--------------------------------------------------------------------- +! GFS_interstitial_type +! fields required for interstitial code in CCPP schemes, previously +! in GFS_{physics,radiation}_driver.F90 +!--------------------------------------------------------------------- +#if 0 +!! \section arg_table_GFS_interstitial_type +!! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional | +!! |---------------------------------------------------------------|------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|---------------|------|-------------|-----------|--------|----------| +!! | GFS_Interstitial(cdata%thrd_no)%adjnirbmd | surface_downwelling_direct_near_infrared_shortwave_flux | surface downwelling beam near-infrared shortwave flux at current time | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%adjnirbmu | surface_upwelling_direct_near_infrared_shortwave_flux | surface upwelling beam near-infrared shortwave flux at current time | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%adjnirdfd | surface_downwelling_diffuse_near_infrared_shortwave_flux | surface downwelling diffuse near-infrared shortwave flux at current time | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%adjnirdfu | surface_upwelling_diffuse_near_infrared_shortwave_flux | surface upwelling diffuse near-infrared shortwave flux at current time | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%adjvisbmd | surface_downwelling_direct_ultraviolet_and_visible_shortwave_flux | surface downwelling beam ultraviolet plus visible shortwave flux at current time | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%adjvisbmu | surface_upwelling_direct_ultraviolet_and_visible_shortwave_flux | surface upwelling beam ultraviolet plus visible shortwave flux at current time | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%adjvisdfu | surface_upwelling_diffuse_ultraviolet_and_visible_shortwave_flux | surface upwelling diffuse ultraviolet plus visible shortwave flux at current time | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%adjvisdfd | surface_downwelling_diffuse_ultraviolet_and_visible_shortwave_flux | surface downwelling diffuse ultraviolet plus visible shortwave flux at current time | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%aerodp | atmosphere_optical_thickness_due_to_ambient_aerosol_particles | vertical integrated optical depth for various aerosol species | none | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%alb1d | surface_albedo_perturbation | surface albedo perturbation | frac | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%bexp1d | perturbation_of_soil_type_b_parameter | perturbation of soil type "b" parameter | frac | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%cd | surface_drag_coefficient_for_momentum_in_air | surface exchange coeff for momentum | none | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%cd_ocean | surface_drag_coefficient_for_momentum_in_air_over_ocean | surface exchange coeff for momentum over ocean | none | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%cd_land | surface_drag_coefficient_for_momentum_in_air_over_land | surface exchange coeff for momentum over land | none | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%cd_ice | surface_drag_coefficient_for_momentum_in_air_over_ice | surface exchange coeff for momentum over ice | none | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%cdq | surface_drag_coefficient_for_heat_and_moisture_in_air | surface exchange coeff heat & moisture | none | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%cdq_ocean | surface_drag_coefficient_for_heat_and_moisture_in_air_over_ocean | surface exchange coeff heat & moisture over ocean | none | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%cdq_land | surface_drag_coefficient_for_heat_and_moisture_in_air_over_land | surface exchange coeff heat & moisture over land | none | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%cdq_ice | surface_drag_coefficient_for_heat_and_moisture_in_air_over_ice | surface exchange coeff heat & moisture over ice | none | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%chh_ocean | surface_drag_mass_flux_for_heat_and_moisture_in_air_over_ocean | thermal exchange coefficient over ocean | kg m-2 s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%chh_land | surface_drag_mass_flux_for_heat_and_moisture_in_air_over_land | thermal exchange coefficient over land | kg m-2 s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%chh_ice | surface_drag_mass_flux_for_heat_and_moisture_in_air_over_ice | thermal exchange coefficient over ice | kg m-2 s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%cf_upi | convective_cloud_fraction_for_microphysics | convective cloud fraction for microphysics | frac | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%clcn | convective_cloud_volume_fraction | convective cloud volume fraction | frac | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%cldf | cloud_area_fraction | fraction of grid box area in which updrafts occur | frac | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%cldsa | cloud_area_fraction_for_radiation | fraction of clouds for low, middle, high, total and BL | frac | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%cldtaulw | cloud_optical_depth_layers_at_10mu_band | approx 10mu band layer cloud optical depth | none | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%cldtausw | cloud_optical_depth_layers_at_0.55mu_band | approx .55mu band layer cloud optical depth | none | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%cld1d | cloud_work_function | cloud work function | m2 s-2 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%clouds | | | various | 3 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%clouds(:,:,1) | total_cloud_fraction | layer total cloud fraction | frac | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%clouds(:,:,2) | cloud_liquid_water_path | layer cloud liquid water path | g m-2 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%clouds(:,:,3) | mean_effective_radius_for_liquid_cloud | mean effective radius for liquid cloud | micron | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%clouds(:,:,4) | cloud_ice_water_path | layer cloud ice water path | g m-2 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%clouds(:,:,5) | mean_effective_radius_for_ice_cloud | mean effective radius for ice cloud | micron | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%clouds(:,:,6) | cloud_rain_water_path | cloud rain water path | g m-2 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%clouds(:,:,7) | mean_effective_radius_for_rain_drop | mean effective radius for rain drop | micron | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%clouds(:,:,8) | cloud_snow_water_path | cloud snow water path | g m-2 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%clouds(:,:,9) | mean_effective_radius_for_snow_flake | mean effective radius for snow flake | micron | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%clw | convective_transportable_tracers | array to contain cloud water and other convective trans. tracers | kg kg-1 | 3 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%clw(:,:,1) | ice_water_mixing_ratio_convective_transport_tracer | moist (dry+vapor, no condensates) mixing ratio of ice water in the convectively transported tracer array | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%clw(:,:,2) | cloud_condensed_water_mixing_ratio_convective_transport_tracer | moist (dry+vapor, no condensates) mixing ratio of cloud water (condensate) in the convectively transported tracer array | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%clw(:,:,GFS_Interstitial(cdata%thrd_no)%ntk) | turbulent_kinetic_energy_convective_transport_tracer | turbulent kinetic energy in the convectively transported tracer array | m2 s-2 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%clx | fraction_of_grid_box_with_subgrid_orography_higher_than_critical_height | frac. of grid box with by subgrid orography higher than critical height | frac | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%cmm_ocean | surface_drag_wind_speed_for_momentum_in_air_over_ocean | momentum exchange coefficient over ocean | m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%cmm_land | surface_drag_wind_speed_for_momentum_in_air_over_land | momentum exchange coefficient over land | m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%cmm_ice | surface_drag_wind_speed_for_momentum_in_air_over_ice | momentum exchange coefficient over ice | m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%cnv_dqldt | tendency_of_cloud_water_due_to_convective_microphysics | tendency of cloud water due to convective microphysics | kg m-2 s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%cnv_fice | ice_fraction_in_convective_tower | ice fraction in convective tower | frac | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%cnv_mfd | detrained_mass_flux | detrained mass flux | kg m-2 s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%cnv_ndrop | number_concentration_of_cloud_liquid_water_particles_for_detrainment | droplet number concentration in convective detrainment | m-3 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%cnv_nice | number_concentration_of_ice_crystals_for_detrainment | crystal number concentration in convective detrainment | m-3 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%cnvc | convective_cloud_cover | convective cloud cover | frac | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%cnvw | convective_cloud_water_mixing_ratio | moist convective cloud water mixing ratio | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%ctei_r | cloud_top_entrainment_instability_value | cloud top entrainment instability value | none | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%ctei_rml | grid_sensitive_critical_cloud_top_entrainment_instability_criteria | grid sensitive critical cloud top entrainment instability criteria | none | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%cumabs | maximum_column_heating_rate | maximum heating rate in column | K s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%dd_mf | instantaneous_atmosphere_downdraft_convective_mass_flux | (downdraft mass flux) * delt | kg m-2 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%de_lgth | cloud_decorrelation_length | cloud decorrelation length | km | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%del | air_pressure_difference_between_midlayers | air pressure difference between midlayers | Pa | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%del_gz | geopotential_difference_between_midlayers_divided_by_midlayer_virtual_temperature | difference between mid-layer geopotentials divided by mid-layer virtual temperature | m2 s-2 K-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%delr | layer_pressure_thickness_for_radiation | layer pressure thickness on radiation levels | hPa | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%dkt | atmosphere_heat_diffusivity | diffusivity for heat | m2 s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%dlength | characteristic_grid_length_scale | representative horizontal length scale of grid box | m | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%dqdt | tendency_of_tracers_due_to_model_physics | updated tendency of the tracers due to model physics | kg kg-1 s-1 | 3 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%dqdt(:,:,GFS_Control%ntqv) | tendency_of_water_vapor_specific_humidity_due_to_model_physics | water vapor specific humidity tendency due to model physics | kg kg-1 s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%dqdt(:,:,GFS_Control%ntcw) | tendency_of_liquid_cloud_water_mixing_ratio_due_to_model_physics | cloud condensed water mixing ratio tendency due to model physics | kg kg-1 s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%dqdt(:,:,GFS_Control%ntiw) | tendency_of_ice_cloud_water_mixing_ratio_due_to_model_physics | cloud condensed water mixing ratio tendency due to model physics | kg kg-1 s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%dqdt(:,:,GFS_Control%ntoz) | tendency_of_ozone_mixing_ratio_due_to_model_physics | ozone mixing ratio tendency due to model physics | kg kg-1 s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%dqdt(:,:,GFS_Control%ntlnc) | tendency_of_cloud_droplet_number_concentration_due_to_model_physics | number concentration of cloud droplets (liquid) tendency due to model physics | kg-1 s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%dqdt(:,:,GFS_Control%ntinc) | tendency_of_ice_number_concentration_due_to_model_physics | number concentration of ice tendency due to model physics | kg-1 s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%dqdt(:,:,GFS_Control%ntwa) | tendency_of_water_friendly_aerosol_number_concentration_due_to_model_physics | number concentration of water-friendly aerosols tendency due to model physics | kg-1 s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%dqdt(:,:,GFS_Control%ntia) | tendency_of_ice_friendly_aerosol_number_concentration_due_to_model_physics | number concentration of ice-friendly aerosols tendency due to model physics | kg-1 s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%dqdt(:,:,GFS_Control%ntrw) | tendency_of_rain_water_mixing_ratio_due_to_model_physics | moist (dry+vapor, no condensates) mixing ratio of rain water tendency due to model physics | kg kg-1 s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%dqdt(:,:,GFS_Control%ntsw) | tendency_of_snow_water_mixing_ratio_due_to_model_physics | moist (dry+vapor, no condensates) mixing ratio of snow water tendency due to model physics | kg kg-1 s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%dqdt(:,:,GFS_Control%ntgl) | tendency_of_graupel_mixing_ratio_due_to_model_physics | moist (dry+vapor, no condensates) mixing ratio of graupel tendency due to model physics | kg kg-1 s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%dqdt(:,:,GFS_Control%ntke) | tendency_of_turbulent_kinetic_energy_due_to_model_physics | turbulent kinetic energy tendency due to model physics | J s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%dqsfc1 | instantaneous_surface_upward_latent_heat_flux | surface upward latent heat flux | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%drain | subsurface_runoff_flux | subsurface runoff flux | g m-2 s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%dtdt | tendency_of_air_temperature_due_to_model_physics | air temperature tendency due to model physics | K s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%dtdtc | tendency_of_air_temperature_due_to_radiative_heating_assuming_clear_sky | clear sky radiative (shortwave + longwave) heating rate at current time | K s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%dtsfc1 | instantaneous_surface_upward_sensible_heat_flux | surface upward sensible heat flux | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%dtzm | mean_change_over_depth_in_sea_water_temperature | mean of dT(z) (zsea1 to zsea2) | K | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%dt_mf | instantaneous_atmosphere_detrainment_convective_mass_flux | (detrainment mass flux) * delt | kg m-2 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%dudt | tendency_of_x_wind_due_to_model_physics | zonal wind tendency due to model physics | m s-2 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%dusfcg | instantaneous_x_stress_due_to_gravity_wave_drag | zonal surface stress due to orographic gravity wave drag | Pa | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%dusfc1 | instantaneous_surface_x_momentum_flux | x momentum flux | Pa | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%dvdftra | tendency_of_vertically_diffused_tracer_concentration | updated tendency of the tracers due to vertical diffusion in PBL scheme | kg kg-1 s-1 | 3 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%dvdt | tendency_of_y_wind_due_to_model_physics | meridional wind tendency due to model physics | m s-2 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%dvsfcg | instantaneous_y_stress_due_to_gravity_wave_drag | meridional surface stress due to orographic gravity wave drag | Pa | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%dvsfc1 | instantaneous_surface_y_momentum_flux | y momentum flux | Pa | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%dzlyr | layer_thickness_for_radiation | layer thickness on radiation levels | km | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%elvmax | maximum_subgrid_orography | maximum of subgrid orography | m | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%ep1d | surface_upward_potential_latent_heat_flux | surface upward potential latent heat flux | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%ep1d_ocean | surface_upward_potential_latent_heat_flux_over_ocean | surface upward potential latent heat flux over ocean | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%ep1d_land | surface_upward_potential_latent_heat_flux_over_land | surface upward potential latent heat flux over land | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%ep1d_ice | surface_upward_potential_latent_heat_flux_over_ice | surface upward potential latent heat flux over ice | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%evap | kinematic_surface_upward_latent_heat_flux | kinematic surface upward latent heat flux | kg kg-1 m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%evap_ocean | kinematic_surface_upward_latent_heat_flux_over_ocean | kinematic surface upward latent heat flux over ocean | kg kg-1 m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%evap_land | kinematic_surface_upward_latent_heat_flux_over_land | kinematic surface upward latent heat flux over land | kg kg-1 m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%evap_ice | kinematic_surface_upward_latent_heat_flux_over_ice | kinematic surface upward latent heat flux over ice | kg kg-1 m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%evbs | soil_upward_latent_heat_flux | soil upward latent heat flux | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%evcw | canopy_upward_latent_heat_flux | canopy upward latent heat flux | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%faerlw | aerosol_optical_properties_for_longwave_bands_01-16 | aerosol optical properties for longwave bands 01-16 | various | 4 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%faerlw(:,:,:,1) | aerosol_optical_depth_for_longwave_bands_01-16 | aerosol optical depth for longwave bands 01-16 | none | 3 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%faerlw(:,:,:,2) | aerosol_single_scattering_albedo_for_longwave_bands_01-16 | aerosol single scattering albedo for longwave bands 01-16 | frac | 3 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%faerlw(:,:,:,3) | aerosol_asymmetry_parameter_for_longwave_bands_01-16 | aerosol asymmetry parameter for longwave bands 01-16 | none | 3 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%faersw | aerosol_optical_properties_for_shortwave_bands_01-16 | aerosol optical properties for shortwave bands 01-16 | various | 4 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%faersw(:,:,:,1) | aerosol_optical_depth_for_shortwave_bands_01-16 | aerosol optical depth for shortwave bands 01-16 | none | 3 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%faersw(:,:,:,2) | aerosol_single_scattering_albedo_for_shortwave_bands_01-16 | aerosol single scattering albedo for shortwave bands 01-16 | frac | 3 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%faersw(:,:,:,3) | aerosol_asymmetry_parameter_for_shortwave_bands_01-16 | aerosol asymmetry parameter for shortwave bands 01-16 | none | 3 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%ffhh_ocean | Monin-Obukhov_similarity_function_for_heat_over_ocean | Monin-Obukhov similarity function for heat over ocean | none | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%ffhh_land | Monin-Obukhov_similarity_function_for_heat_over_land | Monin-Obukhov similarity function for heat over land | none | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%ffhh_ice | Monin-Obukhov_similarity_function_for_heat_over_ice | Monin-Obukhov similarity function for heat over ice | none | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%fh2 | Monin-Obukhov_similarity_function_for_heat_at_2m | Monin-Obukhov similarity parameter for heat at 2m | none | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%fh2_ocean | Monin-Obukhov_similarity_function_for_heat_at_2m_over_ocean | Monin-Obukhov similarity parameter for heat at 2m over ocean | none | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%fh2_land | Monin-Obukhov_similarity_function_for_heat_at_2m_over_land | Monin-Obukhov similarity parameter for heat at 2m over land | none | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%fh2_ice | Monin-Obukhov_similarity_function_for_heat_at_2m_over_ice | Monin-Obukhov similarity parameter for heat at 2m over ice | none | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%flag_cice | flag_for_cice | flag for cice | flag | 1 | logical | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%flag_guess | flag_for_guess_run | flag for guess run | flag | 1 | logical | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%flag_iter | flag_for_iteration | flag for iteration | flag | 1 | logical | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%ffmm_ocean | Monin-Obukhov_similarity_function_for_momentum_over_ocean | Monin-Obukhov similarity function for momentum over ocean | none | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%ffmm_land | Monin-Obukhov_similarity_function_for_momentum_over_land | Monin-Obukhov similarity function for momentum over land | none | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%ffmm_ice | Monin-Obukhov_similarity_function_for_momentum_over_ice | Monin-Obukhov similarity function for momentum over ice | none | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%fm10 | Monin-Obukhov_similarity_function_for_momentum_at_10m | Monin-Obukhov similarity parameter for momentum at 10m | none | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%fm10_ocean | Monin-Obukhov_similarity_function_for_momentum_at_10m_over_ocean | Monin-Obukhov similarity parameter for momentum at 10m over ocean | none | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%fm10_land | Monin-Obukhov_similarity_function_for_momentum_at_10m_over_land | Monin-Obukhov similarity parameter for momentum at 10m over land | none | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%fm10_ice | Monin-Obukhov_similarity_function_for_momentum_at_10m_over_ice | Monin-Obukhov similarity parameter for momentum at 10m over ice | none | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%frain | dynamics_to_physics_timestep_ratio | ratio of dynamics timestep to physics timestep | none | 0 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%frland | land_area_fraction_for_microphysics | land area fraction used in microphysics schemes | frac | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%fscav | fraction_of_tracer_scavenged | fraction of the tracer (aerosols) that is scavenged by convection | km-1 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%fswtr | fraction_of_cloud_top_water_scavenged | fraction of the tracer (cloud top water) that is scavenged by convection | km-1 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%gabsbdlw | surface_downwelling_longwave_flux_absorbed_by_ground | total sky surface downward longwave flux absorbed by the ground | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%gamma | anisotropy_of_subgrid_orography | anisotropy of subgrid orography | none | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%gamq | countergradient_mixing_term_for_water_vapor | countergradient mixing term for water vapor | kg kg-1 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%gamt | countergradient_mixing_term_for_temperature | countergradient mixing term for temperature | K | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%gasvmr | | gas volume mixing ratios | kg kg-1 | 3 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%gasvmr(:,:,1) | volume_mixing_ratio_co2 | volume mixing ratio co2 | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%gasvmr(:,:,2) | volume_mixing_ratio_n2o | volume mixing ratio no2 | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%gasvmr(:,:,3) | volume_mixing_ratio_ch4 | volume mixing ratio ch4 | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%gasvmr(:,:,4) | volume_mixing_ratio_o2 | volume mixing ratio o2 | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%gasvmr(:,:,5) | volume_mixing_ratio_co | volume mixing ratio co | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%gasvmr(:,:,6) | volume_mixing_ratio_cfc11 | volume mixing ratio cfc11 | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%gasvmr(:,:,7) | volume_mixing_ratio_cfc12 | volume mixing ratio cfc12 | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%gasvmr(:,:,8) | volume_mixing_ratio_cfc22 | volume mixing ratio cfc22 | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%gasvmr(:,:,9) | volume_mixing_ratio_ccl4 | volume mixing ratio ccl4 | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%gasvmr(:,:,10) | volume_mixing_ratio_cfc113 | volume mixing ratio cfc113 | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%gflx | upward_heat_flux_in_soil | soil heat flux | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%gflx_ocean | upward_heat_flux_in_soil_over_ocean | soil heat flux over ocean | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%gflx_land | upward_heat_flux_in_soil_over_land | soil heat flux over land | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%gflx_ice | upward_heat_flux_in_soil_over_ice | soil heat flux over ice | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%graupelmp | lwe_thickness_of_graupel_amount | explicit graupel fall on physics timestep | m | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%gwdcu | tendency_of_x_wind_due_to_convective_gravity_wave_drag | zonal wind tendency due to convective gravity wave drag | m s-2 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%gwdcv | tendency_of_y_wind_due_to_convective_gravity_wave_drag | meridional wind tendency due to convective gravity wave drag | m s-2 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%h2o_coeff | number_of_coefficients_in_h2o_forcing_data | number of coefficients in h2o forcing data | index | 0 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%h2o_pres | natural_log_of_h2o_forcing_data_pressure_levels | natural log of h2o forcing data pressure levels | log(Pa) | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%hflx | kinematic_surface_upward_sensible_heat_flux | kinematic surface upward sensible heat flux | K m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%hflx_ocean | kinematic_surface_upward_sensible_heat_flux_over_ocean | kinematic surface upward sensible heat flux over ocean | K m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%hflx_land | kinematic_surface_upward_sensible_heat_flux_over_land | kinematic surface upward sensible heat flux over land | K m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%hflx_ice | kinematic_surface_upward_sensible_heat_flux_over_ice | kinematic surface upward sensible heat flux over ice | K m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%hprime1 | standard_deviation_of_subgrid_orography | standard deviation of subgrid orography | m | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%icemp | lwe_thickness_of_ice_amount | explicit ice fall on physics timestep | m | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%dry | flag_nonzero_land_surface_fraction | flag indicating presence of some land surface area fraction | flag | 1 | logical | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%idxday | daytime_points | daytime points | index | 1 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%icy | flag_nonzero_sea_ice_surface_fraction | flag indicating presence of some sea ice surface area fraction | flag | 1 | logical | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%lake | flag_nonzero_lake_surface_fraction | flag indicating presence of some lake surface area fraction | flag | 1 | logical | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%im | horizontal_loop_extent_OLD_NOW_MODEL_PERCENT_BLKSZ_OF_NB | horizontal loop extent | count | 0 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%ocean | flag_nonzero_ocean_surface_fraction | flag indicating presence of some ocean surface area fraction | flag | 1 | logical | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%ipr | horizontal_index_of_printed_column | horizontal index of printed column | index | 0 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%islmsk | sea_land_ice_mask | sea/land/ice mask (=0/1/2) | flag | 1 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%wet | flag_nonzero_wet_surface_fraction | flag indicating presence of some ocean or lake surface area fraction | flag | 1 | logical | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%ix | horizontal_dimension_OLD_NOW_MODEL_PERCENT_BLKSZ_OF_NB | horizontal dimension | count | 0 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%kb | vertical_index_difference_between_layer_and_lower_bound | vertical index difference between layer and lower bound | index | 0 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%kbot | vertical_index_at_cloud_base | vertical index at cloud base | index | 1 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%kcnv | flag_deep_convection | flag indicating whether convection occurs in column (0 or 1) | flag | 1 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%kd | vertical_index_difference_between_inout_and_local | vertical index difference between in/out and local | index | 0 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%kinver | index_of_highest_temperature_inversion | index of highest temperature inversion | index | 1 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%kpbl | vertical_index_at_top_of_atmosphere_boundary_layer | vertical index at top atmospheric boundary layer | index | 1 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%kt | vertical_index_difference_between_layer_and_upper_bound | vertical index difference between layer and upper bound | index | 0 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%ktop | vertical_index_at_cloud_top | vertical index at cloud top | index | 1 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%latidxprnt | latitude_index_in_debug_printouts | latitude index in debug printouts | index | 0 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%levi | vertical_interface_dimension | vertical interface dimension | count | 0 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%levh2o | vertical_dimension_of_h2o_forcing_data | number of vertical layers in h2o forcing data | count | 0 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%levozp | vertical_dimension_of_ozone_forcing_data | number of vertical layers in ozone forcing data | count | 0 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%lm | vertical_layer_dimension_for_radiation | number of vertical layers for radiation | count | 0 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%lmk | adjusted_vertical_layer_dimension_for_radiation | adjusted number of vertical layers for radiation | count | 0 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%lmp | adjusted_vertical_level_dimension_for_radiation | adjusted number of vertical levels for radiation | count | 0 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%mbota | model_layer_number_at_cloud_base | vertical indices for low, middle and high cloud bases | index | 2 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%mg3_as_mg2 | flag_mg3_as_mg2 | flag for controlling prep for Morrison-Gettelman microphysics | flag | 0 | logical | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%mtopa | model_layer_number_at_cloud_top | vertical indices for low, middle and high cloud tops | index | 2 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%ncstrac | number_of_tracers_for_CS | number of convectively transported tracers in Chikira-Sugiyama deep conv. scheme | count | 0 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%nday | daytime_points_dimension | daytime points dimension | count | 0 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%nn | number_of_tracers_for_convective_transport | number of tracers for convective transport | count | 0 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%nncl | number_of_tracers_for_cloud_condensate | number of tracers for cloud condensate | count | 0 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%nsamftrac | number_of_tracers_for_samf | number of tracers for scale-aware mass flux schemes | count | 0 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%ncgl | local_graupel_number_concentration | number concentration of graupel local to physics | kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%ncpi | local_ice_number_concentration | number concentration of ice local to physics | kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%ncpl | local_condesed_water_number_concentration | number concentration of condensed water local to physics | kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%ncpr | local_rain_number_concentration | number concentration of rain local to physics | kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%ncps | local_snow_number_concentration | number concentration of snow local to physics | kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%ntiwx | index_for_ice_cloud_condensate_vertical_diffusion_tracer | index for ice cloud condensate n the vertically diffused tracer array | index | 0 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%ntk | index_for_turbulent_kinetic_energy_convective_transport_tracer | index for turbulent kinetic energy in the convectively transported tracer array | index | 0 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%ntkev | index_for_turbulent_kinetic_energy_vertical_diffusion_tracer | index for turbulent kinetic energy in the vertically diffused tracer array | index | 0 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%nvdiff | number_of_vertical_diffusion_tracers | number of tracers to diffuse vertically | count | 0 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%oa4 | asymmetry_of_subgrid_orography | asymmetry of subgrid orography | none | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%oc | convexity_of_subgrid_orography | convexity of subgrid orography | none | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%olyr | ozone_concentration_at_layer_for_radiation | ozone concentration layer | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%otspt | flag_convective_tracer_transport | flag to enable tracer transport by updrafts/downdrafts[(:,1)] or subsidence [(:,2)] | flag | 2 | logical | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%oz_coeff | number_of_coefficients_in_ozone_forcing_data | number of coefficients in ozone forcing data | index | 0 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%oz_pres | natural_log_of_ozone_forcing_data_pressure_levels | natural log of ozone forcing data pressure levels | log(Pa) | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%phys_hydrostatic | flag_for_hydrostatic_heating_from_physics | flag for use of hydrostatic heating in physics | flag | 0 | logical | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%plvl | air_pressure_at_interface_for_radiation_in_hPa | air pressure at vertical interface for radiation calculation | hPa | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%plyr | air_pressure_at_layer_for_radiation_in_hPa | air pressure at vertical layer for radiation calculation | hPa | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%prnum | prandtl_number | turbulent Prandtl number | none | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%qgl | local_graupel_mixing_ratio | moist (dry+vapor, no condensates) mixing ratio of graupel local to physics | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%qicn | mass_fraction_of_convective_cloud_ice | mass fraction of convective cloud ice water | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%qlcn | mass_fraction_of_convective_cloud_liquid_water | mass fraction of convective cloud liquid water | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%qlyr | water_vapor_specific_humidity_at_layer_for_radiation | specific humidity layer | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%qrn | local_rain_water_mixing_ratio | moist (dry+vapor, no condensates) mixing ratio of rain water local to physics | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%qsnw | local_snow_water_mixing_ratio | moist (dry+vapor, no condensates) mixing ratio of snow water local to physics | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%prcpmp | lwe_thickness_of_explicit_precipitation_amount | explicit precipitation (rain, ice, snow, graupel, ...) on physics timestep | m | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%qss | surface_specific_humidity | surface air saturation specific humidity | kg kg-1 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%qss_ocean | surface_specific_humidity_over_ocean | surface air saturation specific humidity over ocean | kg kg-1 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%qss_land | surface_specific_humidity_over_land | surface air saturation specific humidity over land | kg kg-1 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%qss_ice | surface_specific_humidity_over_ice | surface air saturation specific humidity over ice | kg kg-1 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%raddt | time_step_for_radiation | radiation time step | s | 0 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%raincd | lwe_thickness_of_deep_convective_precipitation_amount | deep convective rainfall amount on physics timestep | m | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%raincs | lwe_thickness_of_shallow_convective_precipitation_amount | shallow convective rainfall amount on physics timestep | m | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%rainmcadj | lwe_thickness_of_moist_convective_adj_precipitation_amount | adjusted moist convective rainfall amount on physics timestep | m | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%rainmp | lwe_thickness_of_explicit_rain_amount | explicit rain on physics timestep | m | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%rainp | tendency_of_rain_water_mixing_ratio_due_to_microphysics | tendency of rain water mixing ratio due to microphysics | kg kg-1 s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%rb | bulk_richardson_number_at_lowest_model_level | bulk Richardson number at the surface | none | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%rb_ocean | bulk_richardson_number_at_lowest_model_level_over_ocean | bulk Richardson number at the surface over ocean | none | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%rb_land | bulk_richardson_number_at_lowest_model_level_over_land | bulk Richardson number at the surface over land | none | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%rb_ice | bulk_richardson_number_at_lowest_model_level_over_ice | bulk Richardson number at the surface over ice | none | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%reset | flag_reset_maximum_hourly_fields | flag for resetting maximum hourly fields | flag | 0 | logical | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%rhc | critical_relative_humidity | critical relative humidity | frac | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%runoff | surface_runoff_flux | surface runoff flux | g m-2 s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%save_q(:,:,GFS_Control%ntcw) | cloud_condensed_water_mixing_ratio_save | moist (dry+vapor, no condensates) mixing ratio of cloud water (condensate) before entering a physics scheme | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%save_q(:,:,GFS_Control%ntiw) | ice_water_mixing_ratio_save | cloud ice water mixing ratio before entering a physics scheme | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%save_q(:,:,1) | water_vapor_specific_humidity_save | water vapor specific humidity before entering a physics scheme | kg kg-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%save_q | tracer_concentration_save | tracer concentration before entering a physics scheme | kg kg-1 | 3 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%save_t | air_temperature_save | air temperature before entering a physics scheme | K | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%save_u | x_wind_save | x-wind before entering a physics scheme | m s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%save_v | y_wind_save | y-wind before entering a physics scheme | m s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%sbsno | snow_deposition_sublimation_upward_latent_heat_flux | latent heat flux from snow depo/subl | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%scmpsw | components_of_surface_downward_shortwave_fluxes | derived type for special components of surface downward shortwave fluxes | W m-2 | 1 | cmpfsw_type | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%sfcalb | | | frac | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%sfcalb(:,1) | surface_albedo_due_to_near_IR_direct | surface albedo due to near IR direct beam | frac | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%sfcalb(:,2) | surface_albedo_due_to_near_IR_diffused | surface albedo due to near IR diffused beam | frac | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%sfcalb(:,3) | surface_albedo_due_to_UV_and_VIS_direct | surface albedo due to UV+VIS direct beam | frac | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%sfcalb(:,4) | surface_albedo_due_to_UV_and_VIS_diffused | surface albedo due to UV+VIS diffused beam | frac | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%sigma | slope_of_subgrid_orography | slope of subgrid orography | none | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%sigmaf | bounded_vegetation_area_fraction | areal fractional cover of green vegetation bounded on the bottom | frac | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%sigmafrac | convective_updraft_area_fraction | convective updraft area fraction | frac | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%sigmatot | convective_updraft_area_fraction_at_model_interfaces | convective updraft area fraction at model interfaces | frac | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%skip_macro | flag_skip_macro | flag to skip cloud macrophysics in Morrison scheme | flag | 0 | logical | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%slopetype | surface_slope_classification | surface slope type at each grid cell | index | 1 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%snowc | surface_snow_area_fraction | surface snow area fraction | frac | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%snowd_ocean | surface_snow_thickness_water_equivalent_over_ocean | water equivalent snow depth over ocean | mm | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%snowd_land | surface_snow_thickness_water_equivalent_over_land | water equivalent snow depth over land | mm | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%snowd_ice | surface_snow_thickness_water_equivalent_over_ice | water equivalent snow depth over ice | mm | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%snohf | snow_freezing_rain_upward_latent_heat_flux | latent heat flux due to snow and frz rain | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%snowmp | lwe_thickness_of_snow_amount | explicit snow fall on physics timestep | m | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%snowmt | surface_snow_melt | snow melt during timestep | m | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%soiltype | soil_type_classification | soil type at each grid cell | index | 1 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%stress | surface_wind_stress | surface wind stress | m2 s-2 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%stress_ocean | surface_wind_stress_over_ocean | surface wind stress over ocean | m2 s-2 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%stress_land | surface_wind_stress_over_land | surface wind stress over land | m2 s-2 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%stress_ice | surface_wind_stress_over_ice | surface wind stress over ice | m2 s-2 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%theta | angle_from_east_of_maximum_subgrid_orographic_variations | angle with_respect to east of maximum subgrid orographic variations | degrees | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%tice | sea_ice_temperature_interstitial | sea ice surface skin temperature use as interstitial | K | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%tlvl | air_temperature_at_interface_for_radiation | air temperature at vertical interface for radiation calculation | K | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%tlyr | air_temperature_at_layer_for_radiation | air temperature at vertical layer for radiation calculation | K | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%tprcp_ocean | nonnegative_lwe_thickness_of_precipitation_amount_on_dynamics_timestep_over_ocean | total precipitation amount in each time step over ocean | m | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%tprcp_land | nonnegative_lwe_thickness_of_precipitation_amount_on_dynamics_timestep_over_land | total precipitation amount in each time step over land | m | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%tprcp_ice | nonnegative_lwe_thickness_of_precipitation_amount_on_dynamics_timestep_over_ice | total precipitation amount in each time step over ice | m | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%tracers_start_index | start_index_of_other_tracers | beginning index of the non-water tracer species | index | 0 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%tracers_total | number_of_total_tracers | total number of tracers | count | 0 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%trans | transpiration_flux | total plant transpiration rate | kg m-2 s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%tseal | surface_skin_temperature_for_nsst | ocean surface skin temperature | K | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%tsfa | surface_air_temperature_for_radiation | lowest model layer air temperature for radiation | K | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%tsfc_ocean | surface_skin_temperature_over_ocean_interstitial | surface skin temperature over ocean (temporary use as interstitial) | K | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%tsfc_land | surface_skin_temperature_over_land_interstitial | surface skin temperature over land (temporary use as interstitial) | K | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%tsfc_ice | surface_skin_temperature_over_ice_interstitial | surface skin temperature over ice (temporary use as interstitial) | K | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%tsfg | surface_ground_temperature_for_radiation | surface ground temperature for radiation | K | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%tsurf | surface_skin_temperature_after_iteration | surface skin temperature after iteration | K | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%tsurf_ocean | surface_skin_temperature_after_iteration_over_ocean | surface skin temperature after iteration over ocean | K | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%tsurf_land | surface_skin_temperature_after_iteration_over_land | surface skin temperature after iteration over land | K | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%tsurf_ice | surface_skin_temperature_after_iteration_over_ice | surface skin temperature after iteration over ice | K | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%tracers_water | number_of_water_tracers | number of water-related tracers | count | 0 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%ud_mf | instantaneous_atmosphere_updraft_convective_mass_flux | (updraft mass flux) * delt | kg m-2 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%ulwsfc_cice | surface_upwelling_longwave_flux_for_cice | surface upwelling longwave flux for cice | W m-2 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%uustar_ocean | surface_friction_velocity_over_ocean | surface friction velocity over ocean | m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%uustar_land | surface_friction_velocity_over_land | surface friction velocity over land | m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%uustar_ice | surface_friction_velocity_over_ice | surface friction velocity over ice | m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%vdftra | vertically_diffused_tracer_concentration | tracer concentration diffused by PBL scheme | kg kg-1 | 3 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%vegf1d | perturbation_of_vegetation_fraction | perturbation of vegetation fraction | frac | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%vegtype | vegetation_type_classification | vegetation type at each grid cell | index | 1 | integer | | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%w_upi | vertical_velocity_for_updraft | vertical velocity for updraft | m s-1 | 2 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%wcbmax | maximum_updraft_velocity_at_cloud_base | maximum updraft velocity at cloud base | m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%weasd_ocean | water_equivalent_accumulated_snow_depth_over_ocean | water equiv of acc snow depth over ocean | mm | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%weasd_land | water_equivalent_accumulated_snow_depth_over_land | water equiv of acc snow depth over land | mm | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%weasd_ice | water_equivalent_accumulated_snow_depth_over_ice | water equiv of acc snow depth over ice | mm | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%wind | wind_speed_at_lowest_model_layer | wind speed at lowest model level | m s-1 | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%work1 | grid_size_related_coefficient_used_in_scale-sensitive_schemes | grid size related coefficient used in scale-sensitive schemes | none | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%work2 | grid_size_related_coefficient_used_in_scale-sensitive_schemes_complement | complement to work1 | none | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%work3 | ratio_of_exner_function_between_midlayer_and_interface_at_lowest_model_layer | Exner function ratio bt midlayer and interface at 1st layer | ratio | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%xcosz | instantaneous_cosine_of_zenith_angle | cosine of zenith angle at current time | none | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%xlai1d | perturbation_of_leaf_area_index | perturbation of leaf area index | frac | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%xmu | zenith_angle_temporal_adjustment_factor_for_shortwave_fluxes | zenith angle temporal adjustment factor for shortwave | none | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%z01d | perturbation_of_momentum_roughness_length | perturbation of momentum roughness length | frac | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%zorl_ocean | surface_roughness_length_over_ocean_interstitial | surface roughness length over ocean (temporary use as interstitial) | cm | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%zorl_land | surface_roughness_length_over_land_interstitial | surface roughness length over land (temporary use as interstitial) | cm | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%zorl_ice | surface_roughness_length_over_ice_interstitial | surface roughness length over ice (temporary use as interstitial) | cm | 1 | real | kind_phys | none | F | +!! | GFS_Interstitial(cdata%thrd_no)%zt1d | perturbation_of_heat_to_momentum_roughness_length_ratio | perturbation of heat to momentum roughness length ratio | frac | 1 | real | kind_phys | none | F | !! -!---------------------------------------------------------------- -! GFS_fastphys_type -! data type holding interstitial variables for fast physics -!---------------------------------------------------------------- - type GFS_fastphys_type +#endif + type GFS_interstitial_type + + real (kind=kind_phys), pointer :: adjnirbmd(:) => null() !< + real (kind=kind_phys), pointer :: adjnirbmu(:) => null() !< + real (kind=kind_phys), pointer :: adjnirdfd(:) => null() !< + real (kind=kind_phys), pointer :: adjnirdfu(:) => null() !< + real (kind=kind_phys), pointer :: adjvisbmd(:) => null() !< + real (kind=kind_phys), pointer :: adjvisbmu(:) => null() !< + real (kind=kind_phys), pointer :: adjvisdfu(:) => null() !< + real (kind=kind_phys), pointer :: adjvisdfd(:) => null() !< + real (kind=kind_phys), pointer :: aerodp(:,:) => null() !< + real (kind=kind_phys), pointer :: alb1d(:) => null() !< + real (kind=kind_phys), pointer :: bexp1d(:) => null() !< + real (kind=kind_phys), pointer :: cd(:) => null() !< + real (kind=kind_phys), pointer :: cd_ice(:) => null() !< + real (kind=kind_phys), pointer :: cd_land(:) => null() !< + real (kind=kind_phys), pointer :: cd_ocean(:) => null() !< + real (kind=kind_phys), pointer :: cdq(:) => null() !< + real (kind=kind_phys), pointer :: cdq_ice(:) => null() !< + real (kind=kind_phys), pointer :: cdq_land(:) => null() !< + real (kind=kind_phys), pointer :: cdq_ocean(:) => null() !< + real (kind=kind_phys), pointer :: cf_upi(:,:) => null() !< + real (kind=kind_phys), pointer :: chh_ice(:) => null() !< + real (kind=kind_phys), pointer :: chh_land(:) => null() !< + real (kind=kind_phys), pointer :: chh_ocean(:) => null() !< + real (kind=kind_phys), pointer :: clcn(:,:) => null() !< + real (kind=kind_phys), pointer :: cldf(:) => null() !< + real (kind=kind_phys), pointer :: cldsa(:,:) => null() !< + real (kind=kind_phys), pointer :: cldtaulw(:,:) => null() !< + real (kind=kind_phys), pointer :: cldtausw(:,:) => null() !< + real (kind=kind_phys), pointer :: cld1d(:) => null() !< + real (kind=kind_phys), pointer :: clouds(:,:,:) => null() !< + real (kind=kind_phys), pointer :: clw(:,:,:) => null() !< + real (kind=kind_phys), pointer :: clw_surf(:) => null() !< + real (kind=kind_phys), pointer :: clx(:,:) => null() !< + real (kind=kind_phys), pointer :: cmm_ice(:) => null() !< + real (kind=kind_phys), pointer :: cmm_land(:) => null() !< + real (kind=kind_phys), pointer :: cmm_ocean(:) => null() !< + real (kind=kind_phys), pointer :: cndm_surf(:) => null() !< + real (kind=kind_phys), pointer :: cnv_dqldt(:,:) => null() !< + real (kind=kind_phys), pointer :: cnv_fice(:,:) => null() !< + real (kind=kind_phys), pointer :: cnv_mfd(:,:) => null() !< + real (kind=kind_phys), pointer :: cnv_ndrop(:,:) => null() !< + real (kind=kind_phys), pointer :: cnv_nice(:,:) => null() !< + real (kind=kind_phys), pointer :: cnvc(:,:) => null() !< + real (kind=kind_phys), pointer :: cnvw(:,:) => null() !< + real (kind=kind_phys), pointer :: ctei_r(:) => null() !< + real (kind=kind_phys), pointer :: ctei_rml(:) => null() !< + real (kind=kind_phys), pointer :: cumabs(:) => null() !< + real (kind=kind_phys), pointer :: dd_mf(:,:) => null() !< + real (kind=kind_phys), pointer :: de_lgth(:) => null() !< + real (kind=kind_phys), pointer :: del(:,:) => null() !< + real (kind=kind_phys), pointer :: del_gz(:,:) => null() !< + real (kind=kind_phys), pointer :: delr(:,:) => null() !< + real (kind=kind_phys), pointer :: dkt(:,:) => null() !< + real (kind=kind_phys), pointer :: dlength(:) => null() !< + real (kind=kind_phys), pointer :: dqdt(:,:,:) => null() !< + real (kind=kind_phys), pointer :: dqsfc1(:) => null() !< + real (kind=kind_phys), pointer :: drain(:) => null() !< + real (kind=kind_phys), pointer :: dtdt(:,:) => null() !< + real (kind=kind_phys), pointer :: dtdtc(:,:) => null() !< + real (kind=kind_phys), pointer :: dtsfc1(:) => null() !< + real (kind=kind_phys), pointer :: dtzm(:) => null() !< + real (kind=kind_phys), pointer :: dt_mf(:,:) => null() !< + real (kind=kind_phys), pointer :: dudt(:,:) => null() !< + real (kind=kind_phys), pointer :: dusfcg(:) => null() !< + real (kind=kind_phys), pointer :: dusfc1(:) => null() !< + real (kind=kind_phys), pointer :: dvdftra(:,:,:) => null() !< + real (kind=kind_phys), pointer :: dvdt(:,:) => null() !< + real (kind=kind_phys), pointer :: dvsfcg(:) => null() !< + real (kind=kind_phys), pointer :: dvsfc1(:) => null() !< + real (kind=kind_phys), pointer :: dzlyr(:,:) => null() !< + real (kind=kind_phys), pointer :: elvmax(:) => null() !< + real (kind=kind_phys), pointer :: ep1d(:) => null() !< + real (kind=kind_phys), pointer :: ep1d_ice(:) => null() !< + real (kind=kind_phys), pointer :: ep1d_land(:) => null() !< + real (kind=kind_phys), pointer :: ep1d_ocean(:) => null() !< + real (kind=kind_phys), pointer :: evap(:) => null() !< + real (kind=kind_phys), pointer :: evap_ice(:) => null() !< + real (kind=kind_phys), pointer :: evap_land(:) => null() !< + real (kind=kind_phys), pointer :: evap_ocean(:) => null() !< + real (kind=kind_phys), pointer :: evbs(:) => null() !< + real (kind=kind_phys), pointer :: evcw(:) => null() !< + real (kind=kind_phys), pointer :: faerlw(:,:,:,:) => null() !< + real (kind=kind_phys), pointer :: faersw(:,:,:,:) => null() !< + real (kind=kind_phys), pointer :: ffhh_ice(:) => null() !< + real (kind=kind_phys), pointer :: ffhh_land(:) => null() !< + real (kind=kind_phys), pointer :: ffhh_ocean(:) => null() !< + real (kind=kind_phys), pointer :: fh2(:) => null() !< + real (kind=kind_phys), pointer :: fh2_ice(:) => null() !< + real (kind=kind_phys), pointer :: fh2_land(:) => null() !< + real (kind=kind_phys), pointer :: fh2_ocean(:) => null() !< + logical, pointer :: flag_cice(:) => null() !< + logical, pointer :: flag_guess(:) => null() !< + logical, pointer :: flag_iter(:) => null() !< + real (kind=kind_phys), pointer :: ffmm_ice(:) => null() !< + real (kind=kind_phys), pointer :: ffmm_land(:) => null() !< + real (kind=kind_phys), pointer :: ffmm_ocean(:) => null() !< + real (kind=kind_phys), pointer :: fm10(:) => null() !< + real (kind=kind_phys), pointer :: fm10_ice(:) => null() !< + real (kind=kind_phys), pointer :: fm10_land(:) => null() !< + real (kind=kind_phys), pointer :: fm10_ocean(:) => null() !< + real (kind=kind_phys) :: frain !< + real (kind=kind_phys), pointer :: frland(:) => null() !< + real (kind=kind_phys), pointer :: fscav(:) => null() !< + real (kind=kind_phys), pointer :: fswtr(:) => null() !< + real (kind=kind_phys), pointer :: gabsbdlw(:) => null() !< + real (kind=kind_phys), pointer :: gamma(:) => null() !< + real (kind=kind_phys), pointer :: gamq(:) => null() !< + real (kind=kind_phys), pointer :: gamt(:) => null() !< + real (kind=kind_phys), pointer :: gasvmr(:,:,:) => null() !< + real (kind=kind_phys), pointer :: gflx(:) => null() !< + real (kind=kind_phys), pointer :: gflx_ice(:) => null() !< + real (kind=kind_phys), pointer :: gflx_land(:) => null() !< + real (kind=kind_phys), pointer :: gflx_ocean(:) => null() !< + real (kind=kind_phys), pointer :: graupelmp(:) => null() !< + real (kind=kind_phys), pointer :: gwdcu(:,:) => null() !< + real (kind=kind_phys), pointer :: gwdcv(:,:) => null() !< + integer :: h2o_coeff !< + real (kind=kind_phys), pointer :: h2o_pres(:) => null() !< + real (kind=kind_phys), pointer :: hflx(:) => null() !< + real (kind=kind_phys), pointer :: hflx_ice(:) => null() !< + real (kind=kind_phys), pointer :: hflx_land(:) => null() !< + real (kind=kind_phys), pointer :: hflx_ocean(:) => null() !< + real (kind=kind_phys), pointer :: hprime1(:) => null() !< + real (kind=kind_phys), pointer :: icemp(:) => null() !< + logical, pointer :: dry(:) => null() !< + integer, pointer :: idxday(:) => null() !< + logical, pointer :: icy(:) => null() !< + logical, pointer :: lake(:) => null() !< + integer :: im !< + logical, pointer :: ocean(:) => null() !< + integer :: ipr !< + integer, pointer :: islmsk(:) => null() !< + logical, pointer :: wet(:) => null() !< + integer :: ix !< + integer :: kb !< + integer, pointer :: kbot(:) => null() !< + integer, pointer :: kcnv(:) => null() !< + integer :: kd !< + integer, pointer :: kinver(:) => null() !< + integer, pointer :: kpbl(:) => null() !< + integer :: kt !< + integer, pointer :: ktop(:) => null() !< + integer :: latidxprnt !< + integer :: levi !< + integer :: levh2o !< + integer :: levozp !< + integer :: lm !< + integer :: lmk !< + integer :: lmp !< + integer, pointer :: mbota(:,:) => null() !< + logical :: mg3_as_mg2 !< + integer, pointer :: mtopa(:,:) => null() !< + real (kind=kind_phys), pointer :: ncgl(:,:) => null() !< + real (kind=kind_phys), pointer :: ncpi(:,:) => null() !< + real (kind=kind_phys), pointer :: ncpl(:,:) => null() !< + real (kind=kind_phys), pointer :: ncpr(:,:) => null() !< + real (kind=kind_phys), pointer :: ncps(:,:) => null() !< + integer :: ncstrac !< + integer :: nday !< + integer :: nn !< + integer :: nncl !< + integer :: nsamftrac !< + integer :: ntiwx !< + integer :: ntk !< + integer :: ntkev !< + integer :: nvdiff !< + real (kind=kind_phys), pointer :: oa4(:,:) => null() !< + real (kind=kind_phys), pointer :: oc(:) => null() !< + real (kind=kind_phys), pointer :: olyr(:,:) => null() !< + logical , pointer :: otspt(:,:) => null() !< + integer :: oz_coeff !< + real (kind=kind_phys), pointer :: oz_pres(:) => null() !< + logical :: phys_hydrostatic !< + real (kind=kind_phys), pointer :: plvl(:,:) => null() !< + real (kind=kind_phys), pointer :: plyr(:,:) => null() !< + real (kind=kind_phys), pointer :: prcpmp(:) => null() !< + real (kind=kind_phys), pointer :: prnum(:,:) => null() !< + real (kind=kind_phys), pointer :: qgl(:,:) => null() !< + real (kind=kind_phys), pointer :: qicn(:,:) => null() !< + real (kind=kind_phys), pointer :: qlcn(:,:) => null() !< + real (kind=kind_phys), pointer :: qlyr(:,:) => null() !< + real (kind=kind_phys), pointer :: qrn(:,:) => null() !< + real (kind=kind_phys), pointer :: qsnw(:,:) => null() !< + real (kind=kind_phys), pointer :: qss(:) => null() !< + real (kind=kind_phys), pointer :: qss_ice(:) => null() !< + real (kind=kind_phys), pointer :: qss_land(:) => null() !< + real (kind=kind_phys), pointer :: qss_ocean(:) => null() !< + real (kind=kind_phys) :: raddt !< + real (kind=kind_phys), pointer :: rainmp(:) => null() !< + real (kind=kind_phys), pointer :: raincd(:) => null() !< + real (kind=kind_phys), pointer :: raincs(:) => null() !< + real (kind=kind_phys), pointer :: rainmcadj(:) => null() !< + real (kind=kind_phys), pointer :: rainp(:,:) => null() !< + real (kind=kind_phys), pointer :: rb(:) => null() !< + real (kind=kind_phys), pointer :: rb_ice(:) => null() !< + real (kind=kind_phys), pointer :: rb_land(:) => null() !< + real (kind=kind_phys), pointer :: rb_ocean(:) => null() !< + logical :: reset + real (kind=kind_phys), pointer :: rhc(:,:) => null() !< + real (kind=kind_phys), pointer :: runoff(:) => null() !< + real (kind=kind_phys), pointer :: save_q(:,:,:) => null() !< + real (kind=kind_phys), pointer :: save_t(:,:) => null() !< + real (kind=kind_phys), pointer :: save_u(:,:) => null() !< + real (kind=kind_phys), pointer :: save_v(:,:) => null() !< + real (kind=kind_phys), pointer :: sbsno(:) => null() !< + type (cmpfsw_type), pointer :: scmpsw(:) => null() !< + real (kind=kind_phys), pointer :: sfcalb(:,:) => null() !< + real (kind=kind_phys), pointer :: sigma(:) => null() !< + real (kind=kind_phys), pointer :: sigmaf(:) => null() !< + real (kind=kind_phys), pointer :: sigmafrac(:,:) => null() !< + real (kind=kind_phys), pointer :: sigmatot(:,:) => null() !< + logical :: skip_macro !< + integer, pointer :: slopetype(:) => null() !< + real (kind=kind_phys), pointer :: snowc(:) => null() !< + real (kind=kind_phys), pointer :: snowd_ice(:) => null() !< + real (kind=kind_phys), pointer :: snowd_land(:) => null() !< + real (kind=kind_phys), pointer :: snowd_ocean(:) => null() !< + real (kind=kind_phys), pointer :: snohf(:) => null() !< + real (kind=kind_phys), pointer :: snowmp(:) => null() !< + real (kind=kind_phys), pointer :: snowmt(:) => null() !< + integer, pointer :: soiltype(:) => null() !< + real (kind=kind_phys), pointer :: stress(:) => null() !< + real (kind=kind_phys), pointer :: stress_ice(:) => null() !< + real (kind=kind_phys), pointer :: stress_land(:) => null() !< + real (kind=kind_phys), pointer :: stress_ocean(:) => null() !< + real (kind=kind_phys), pointer :: theta(:) => null() !< + real (kind=kind_phys), pointer :: tice(:) => null() !< + real (kind=kind_phys), pointer :: tlvl(:,:) => null() !< + real (kind=kind_phys), pointer :: tlyr(:,:) => null() !< + real (kind=kind_phys), pointer :: tprcp_ice(:) => null() !< + real (kind=kind_phys), pointer :: tprcp_land(:) => null() !< + real (kind=kind_phys), pointer :: tprcp_ocean(:) => null() !< + integer :: tracers_start_index !< + integer :: tracers_total !< + integer :: tracers_water !< + real (kind=kind_phys), pointer :: trans(:) => null() !< + real (kind=kind_phys), pointer :: tseal(:) => null() !< + real (kind=kind_phys), pointer :: tsfa(:) => null() !< + real (kind=kind_phys), pointer :: tsfc_ice(:) => null() !< + real (kind=kind_phys), pointer :: tsfc_land(:) => null() !< + real (kind=kind_phys), pointer :: tsfc_ocean(:) => null() !< + real (kind=kind_phys), pointer :: tsfg(:) => null() !< + real (kind=kind_phys), pointer :: tsnow(:) => null() !< + real (kind=kind_phys), pointer :: tsurf(:) => null() !< + real (kind=kind_phys), pointer :: tsurf_ice(:) => null() !< + real (kind=kind_phys), pointer :: tsurf_land(:) => null() !< + real (kind=kind_phys), pointer :: tsurf_ocean(:) => null() !< + real (kind=kind_phys), pointer :: ud_mf(:,:) => null() !< + real (kind=kind_phys), pointer :: ulwsfc_cice(:) => null() !< + real (kind=kind_phys), pointer :: uustar_ice(:) => null() !< + real (kind=kind_phys), pointer :: uustar_land(:) => null() !< + real (kind=kind_phys), pointer :: uustar_ocean(:) => null() !< + real (kind=kind_phys), pointer :: vdftra(:,:,:) => null() !< + real (kind=kind_phys), pointer :: vegf1d(:) => null() !< + integer, pointer :: vegtype(:) => null() !< + real (kind=kind_phys), pointer :: w_upi(:,:) => null() !< + real (kind=kind_phys), pointer :: wcbmax(:) => null() !< + real (kind=kind_phys), pointer :: weasd_ocean(:) => null() !< + real (kind=kind_phys), pointer :: weasd_land(:) => null() !< + real (kind=kind_phys), pointer :: weasd_ice(:) => null() !< + real (kind=kind_phys), pointer :: wind(:) => null() !< + real (kind=kind_phys), pointer :: work1(:) => null() !< + real (kind=kind_phys), pointer :: work2(:) => null() !< + real (kind=kind_phys), pointer :: work3(:) => null() !< + real (kind=kind_phys), pointer :: xcosz(:) => null() !< + real (kind=kind_phys), pointer :: xlai1d(:) => null() !< + real (kind=kind_phys), pointer :: xmu(:) => null() !< + real (kind=kind_phys), pointer :: z01d(:) => null() !< + real (kind=kind_phys), pointer :: zorl_ice(:) => null() !< + real (kind=kind_phys), pointer :: zorl_land(:) => null() !< + real (kind=kind_phys), pointer :: zorl_ocean(:) => null() !< + real (kind=kind_phys), pointer :: zt1d(:) => null() !< - integer :: dummy - character(len=512) :: errmsg - integer :: errflg + contains + procedure :: create => interstitial_create !< allocate array data + procedure :: rad_reset => interstitial_rad_reset !< reset array data for radiation + procedure :: phys_reset => interstitial_phys_reset !< reset array data for physics + procedure :: mprint => interstitial_print !< print array data - contains - procedure :: create => fastphys_create - end type GFS_fastphys_type + end type GFS_interstitial_type +#endif + +!------------------------- +! GFS sub-containers +!------------------------- +#ifdef CCPP + type GFS_data_type + type(GFS_statein_type) :: Statein + type(GFS_stateout_type) :: Stateout + type(GFS_sfcprop_type) :: Sfcprop + type(GFS_coupling_type) :: Coupling + type(GFS_grid_type) :: Grid + type(GFS_tbd_type) :: Tbd + type(GFS_cldprop_type) :: Cldprop + type(GFS_radtend_type) :: Radtend + type(GFS_diag_type) :: Intdiag + end type GFS_data_type #endif !---------------- @@ -1219,6 +3008,9 @@ module GFS_typedefs GFS_coupling_type public GFS_control_type, GFS_grid_type, GFS_tbd_type, & GFS_cldprop_type, GFS_radtend_type, GFS_diag_type +#ifdef CCPP + public GFS_interstitial_type +#endif !******************************************************************************************* CONTAINS @@ -1425,9 +3217,15 @@ subroutine sfcprop_create (Sfcprop, IM, Model) !--- Out allocate (Sfcprop%t2m (IM)) +#ifdef CCPP + allocate (Sfcprop%th2m(IM)) +#endif allocate (Sfcprop%q2m (IM)) Sfcprop%t2m = clear_val +#ifdef CCPP + Sfcprop%th2m = clear_val +#endif Sfcprop%q2m = clear_val if (Model%nstf_name(1) > 0) then @@ -1472,7 +3270,7 @@ subroutine sfcprop_create (Sfcprop, IM, Model) ! Noah MP allocate and init when used ! - if (Model%lsm > 1 ) then + if (Model%lsm == Model%lsm_noahmp ) then allocate (Sfcprop%snowxy (IM)) allocate (Sfcprop%tvxy (IM)) @@ -1547,6 +3345,69 @@ subroutine sfcprop_create (Sfcprop, IM, Model) endif +#ifdef CCPP + if (Model%lsm == Model%lsm_ruc) then + ! For land surface models with different numbers of levels than the four NOAH levels + allocate (Sfcprop%wetness (IM)) + allocate (Sfcprop%sh2o (IM,Model%lsoil_lsm)) + allocate (Sfcprop%keepsmfr (IM,Model%lsoil_lsm)) + allocate (Sfcprop%smois (IM,Model%lsoil_lsm)) + allocate (Sfcprop%tslb (IM,Model%lsoil_lsm)) + allocate (Sfcprop%flag_frsoil (IM,Model%lsoil_lsm)) + allocate (Sfcprop%zs (Model%lsoil_lsm)) + allocate (Sfcprop%clw_surf (IM)) + allocate (Sfcprop%qwv_surf (IM)) + allocate (Sfcprop%cndm_surf (IM)) + allocate (Sfcprop%rhofr (IM)) + allocate (Sfcprop%tsnow (IM)) + allocate (Sfcprop%snowfallac (IM)) + allocate (Sfcprop%acsnow (IM)) + ! + Sfcprop%wetness = clear_val + Sfcprop%sh2o = clear_val + Sfcprop%keepsmfr = clear_val + Sfcprop%smois = clear_val + Sfcprop%tslb = clear_val + Sfcprop%zs = clear_val + Sfcprop%clw_surf = clear_val + Sfcprop%qwv_surf = clear_val + Sfcprop%cndm_surf = clear_val + Sfcprop%flag_frsoil = clear_val + Sfcprop%rhofr = clear_val + Sfcprop%tsnow = clear_val + Sfcprop%snowfallac = clear_val + Sfcprop%acsnow = clear_val + end if + if (Model%do_mynnsfclay) then + ! For MYNN surface layer scheme + !print*,"Allocating all MYNN-sfclay variables" + allocate (Sfcprop%ustm (IM )) + allocate (Sfcprop%zol (IM )) + allocate (Sfcprop%mol (IM )) + allocate (Sfcprop%rmol (IM )) + allocate (Sfcprop%flhc (IM )) + allocate (Sfcprop%flqc (IM )) + allocate (Sfcprop%chs2 (IM )) + allocate (Sfcprop%cqs2 (IM )) + allocate (Sfcprop%lh (IM )) + ! + !print*,"Initializing all MYNN-SfcLay variables with ",clear_val + Sfcprop%ustm = clear_val + Sfcprop%zol = clear_val + Sfcprop%mol = clear_val + Sfcprop%rmol = clear_val + Sfcprop%flhc = clear_val + Sfcprop%flqc = clear_val + Sfcprop%chs2 = clear_val + Sfcprop%cqs2 = clear_val + Sfcprop%lh = clear_val + end if + if (Model%imfdeepcnv == 3) then + allocate (Sfcprop%conv_act(IM)) + Sfcprop%conv_act = zero + end if +#endif + end subroutine sfcprop_create @@ -1798,10 +3659,12 @@ subroutine coupling_create (Coupling, IM, Model) Coupling%cldcovi = clear_val endif - !--- needed for Thompson's aerosol option - if(Model%imp_physics == 8.and.Model%ltaerosol) then + !--- needed for Thompson's aerosol option + if(Model%imp_physics == Model%imp_physics_thompson .and. Model%ltaerosol) then allocate (Coupling%nwfa2d (IM)) + allocate (Coupling%nifa2d (IM)) Coupling%nwfa2d = clear_val + Coupling%nifa2d = clear_val endif end subroutine coupling_create @@ -1814,15 +3677,29 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & logunit, isc, jsc, nx, ny, levs, & cnx, cny, gnx, gny, dt_dycore, & dt_phys, idat, jdat, tracer_names, & - input_nml_file, tile_num) + input_nml_file, tile_num & +#ifdef CCPP + ,ak, bk, blksz, & + restart, hydrostatic, & + communicator, ntasks, nthreads & +#endif + ) !--- modules +#ifdef CCPP + use physcons, only: con_rerth, con_pi +#else use physcons, only: dxmax, dxmin, dxinv, con_rerth, con_pi, rhc_max +#endif use mersenne_twister, only: random_setseed, random_number +#ifndef CCPP use module_ras, only: nrcmax +#endif use parse_tracers, only: get_tracer_index +#ifndef CCPP use wam_f107_kp_mod, only: f107_kp_size, f107_kp_interval, & f107_kp_skip_size, f107_kp_data_size +#endif implicit none !--- interface variables @@ -1848,6 +3725,16 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & integer, intent(in) :: jdat(8) character(len=32), intent(in) :: tracer_names(:) character(len=256), intent(in), pointer :: input_nml_file(:) +#ifdef CCPP + real(kind=kind_phys), dimension(:), intent(in) :: ak + real(kind=kind_phys), dimension(:), intent(in) :: bk + integer, intent(in) :: blksz(:) + logical, intent(in) :: restart + logical, intent(in) :: hydrostatic + integer, intent(in) :: communicator + integer, intent(in) :: ntasks + integer, intent(in) :: nthreads +#endif !--- local variables integer :: n integer :: ios @@ -1857,9 +3744,12 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & real(kind=kind_phys) :: rinc(5) real(kind=kind_phys) :: wrk(1) real(kind=kind_phys), parameter :: con_hr = 3600. +#ifdef CCPP + real(kind=kind_phys), parameter :: p_ref = 101325.0d0 +#endif !--- BEGIN NAMELIST VARIABLES - real(kind=kind_phys) :: fhzero = 0.0 !< seconds between clearing of diagnostic buckets + real(kind=kind_phys) :: fhzero = 0.0 !< hours between clearing of diagnostic buckets logical :: ldiag3d = .false. !< flag for 3d diagnostic fields logical :: lssav = .false. !< logical flag for storing diagnostics @@ -1868,9 +3758,9 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & logical :: do_ugwp = .false. !< flag do UGWP+RF logical :: do_tofd = .false. !< flag do Turb oro Form Drag - real(kind=kind_phys) :: fhcyc = 0. !< frequency for surface data cycling (secs) + real(kind=kind_phys) :: fhcyc = 0. !< frequency for surface data cycling (hours) logical :: lgocart = .false. !< flag for 3d diagnostic fields for gocart 1 - real(kind=kind_phys) :: fhgoc3d = 0.0 !< seconds between calls to gocart + real(kind=kind_phys) :: fhgoc3d = 0.0 !< hours between calls to gocart integer :: thermodyn_id = 1 !< valid for GFS only for get_prs/phi integer :: sfcpress_id = 1 !< valid for GFS only for get_prs/phi @@ -1923,8 +3813,8 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & logical :: swhtr = .true. !< flag to output sw heating rate (Radtend%swhc) !--- Z-C microphysical parameters - integer :: ncld = 1 !< cnoice of cloud scheme - integer :: imp_physics = 99 !< cnoice of cloud scheme + integer :: ncld = 1 !< choice of cloud scheme + integer :: imp_physics = 99 !< choice of cloud scheme real(kind=kind_phys) :: psautco(2) = (/6.0d-4,3.0d-4/) !< [in] auto conversion coeff from ice to snow real(kind=kind_phys) :: prautco(2) = (/1.0d-4,1.0d-4/) !< [in] auto conversion coeff from cloud to rain real(kind=kind_phys) :: evpco = 2.0d-5 !< [in] coeff for evaporation of largescale rain @@ -1935,9 +3825,12 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & !--- M-G microphysical parameters integer :: fprcp = 0 !< no prognostic rain and snow (MG) integer :: pdfflag = 4 !< pdf flag for MG macro physics - real(kind=kind_phys) :: mg_dcs = 200.0 !< Morrison-Gettleman microphysics parameters + real(kind=kind_phys) :: mg_dcs = 200.0 !< Morrison-Gettelman microphysics parameters real(kind=kind_phys) :: mg_qcvar = 1.0 real(kind=kind_phys) :: mg_ts_auto_ice(2) = (/180.0,180.0/) !< ice auto conversion time scale +#ifdef CCPP + real(kind=kind_phys) :: mg_rhmini = 1.01 !< relative humidity threshold parameter for nucleating ice +#endif real(kind=kind_phys) :: mg_ncnst = 100.e6 !< constant droplet num concentration (m-3) real(kind=kind_phys) :: mg_ninst = 0.15e6 !< constant ice num concentration (m-3) real(kind=kind_phys) :: mg_ngnst = 0.10e6 !< constant graupel/hail num concentration (m-3) = 0.1e6_r8 @@ -1945,6 +3838,10 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & real(kind=kind_phys) :: mg_qcmin(2) = (/1.0d-9,1.0d-9/) !< min liquid and ice mixing ratio in Mg macro clouds real(kind=kind_phys) :: mg_berg_eff_factor = 2.0 !< berg efficiency factor character(len=16) :: mg_precip_frac_method = 'max_overlap' !< type of precipitation fraction method +#ifdef CCPP + real(kind=kind_phys) :: tf = 258.16d0 + real(kind=kind_phys) :: tcr = 273.16d0 +#endif ! logical :: effr_in = .false. !< flag to use effective radii of cloud species in radiation logical :: microp_uniform = .true. @@ -1959,19 +3856,25 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & logical :: mg_do_graupel = .true. !< set .true. to turn on prognostic grapuel (with fprcp=2) logical :: mg_do_hail = .false. !< set .true. to turn on prognostic hail (with fprcp=2) logical :: mg_do_ice_gmao = .false. !< set .true. to turn on gmao ice formulation - logical :: mg_do_liq_liu = .true. !< set .true. to turn on liq liquid treatment + logical :: mg_do_liq_liu = .true. !< set .true. to turn on liu liquid treatment !--- Thompson microphysical parameters + logical :: make_number_concentrations = .false.!< flag to calculate initial number concentrations + !< from mass concentrations if not in ICs/BCs logical :: ltaerosol = .false. !< flag for aerosol version logical :: lradar = .false. !< flag for radar reflectivity + real(kind=kind_phys) :: ttendlim = -999.0 !< temperature tendency limiter, set to <0 to deactivate !--- GFDL microphysical parameters logical :: lgfdlmprad = .false. !< flag for GFDLMP radiation interaction !--- land/surface model parameters - integer :: lsm = 1 !< flag for land surface model to use =0 for osu lsm; =1 for noah lsm + integer :: lsm = 1 !< flag for land surface model to use =0 for osu lsm; =1 for noah lsm; =2 for noah mp lsm; =3 for RUC lsm integer :: lsoil = 4 !< number of soil layers +#ifdef CCPP + integer :: lsoil_lsm = -1 !< number of soil layers internal to land surface model; -1 use lsoil +#endif integer :: ivegsrc = 2 !< ivegsrc = 0 => USGS, !< ivegsrc = 1 => IGBP (20 category) !< ivegsrc = 2 => UMD (13 category) @@ -2013,6 +3916,10 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & logical :: do_shoc = .false. !< flag for SHOC logical :: shocaftcnv = .false. !< flag for SHOC logical :: shoc_cld = .false. !< flag for SHOC in grrad +#ifdef CCPP + logical :: oz_phys = .true. !< flag for old (2006) ozone physics + logical :: oz_phys_2015 = .false. !< flag for new (2015) ozone physics +#endif logical :: h2o_phys = .false. !< flag for stratosphere h2o logical :: pdfcld = .false. !< flag for pdfcld logical :: shcnvcw = .false. !< flag for shallow convective cloud @@ -2020,6 +3927,8 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & logical :: hybedmf = .false. !< flag for hybrid edmf pbl scheme logical :: satmedmf = .false. !< flag for scale-aware TKE-based moist edmf !< vertical turbulent mixing scheme + logical :: shinhong = .false. !< flag for scale-aware Shinhong vertical turbulent mixing scheme + logical :: do_ysu = .false. !< flag for YSU vertical turbulent mixing scheme logical :: dspheat = .false. !< flag for tke dissipative heating logical :: lheatstrg = .false. !< flag for canopy heat storage parameterization logical :: cnvcld = .false. @@ -2029,16 +3938,38 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & !< 1: July 2010 version of mass-flux shallow conv scheme !< current operational version as of 2016 !< 2: scale- & aerosol-aware mass-flux shallow conv scheme (2017) + !< 3: scale- & aerosol-aware Grell-Freitas scheme (GSD) + !< 4: New Tiedtke scheme (CAPS) !< 0: modified Tiedtke's eddy-diffusion shallow conv scheme !< -1: no shallow convection used integer :: imfdeepcnv = 1 !< flag for mass-flux deep convection scheme !< 1: July 2010 version of SAS conv scheme !< current operational version as of 2016 !< 2: scale- & aerosol-aware mass-flux deep conv scheme (2017) + !< 3: scale- & aerosol-aware Grell-Freitas scheme (GSD) + !< 4: New Tiedtke scheme (CAPS) integer :: isatmedmf = 0 !< flag for scale-aware TKE-based moist edmf scheme !< 0: initial version of satmedmf (Nov. 2018) !< 1: updated version of satmedmf (as of May 2019) logical :: do_deep = .true. !< whether to do deep convection +#ifdef CCPP + logical :: do_mynnedmf = .false. !< flag for MYNN-EDMF + logical :: do_mynnsfclay = .false. !< flag for MYNN Surface Layer Scheme + ! DH* TODO - move to MYNN namelist section + integer :: grav_settling = 0 + integer :: bl_mynn_tkebudget = 0 + logical :: bl_mynn_tkeadvect = .false. + integer :: bl_mynn_cloudpdf = 2 + integer :: bl_mynn_mixlength = 2 + integer :: bl_mynn_edmf = 0 + integer :: bl_mynn_edmf_mom = 1 + integer :: bl_mynn_edmf_tke = 0 + integer :: bl_mynn_edmf_part = 0 + integer :: bl_mynn_cloudmix = 1 + integer :: bl_mynn_mixqt = 0 + integer :: icloud_bl = 1 + ! *DH +#endif integer :: nmtvr = 14 !< number of topographic variables such as variance etc !< used in the GWD parameterization integer :: jcap = 1 !< number of spectral wave trancation used only by sascnv shalcnv @@ -2181,28 +4112,50 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & iccn, & !--- microphysical parameterizations ncld, imp_physics, psautco, prautco, evpco, wminco, & +#ifdef CCPP + fprcp, pdfflag, mg_dcs, mg_qcvar, mg_ts_auto_ice, mg_rhmini, & + effr_in, tf, tcr, & +#else fprcp, pdfflag, mg_dcs, mg_qcvar, mg_ts_auto_ice, effr_in, & +#endif microp_uniform, do_cldice, hetfrz_classnuc, & mg_do_graupel, mg_do_hail, mg_nccons, mg_nicons, mg_ngcons, & mg_ncnst, mg_ninst, mg_ngnst, sed_supersat, do_sb_physics, & mg_alf, mg_qcmin, mg_do_ice_gmao, mg_do_liq_liu, & - ltaerosol, lradar, lgfdlmprad, & + make_number_concentrations, & + ltaerosol, lradar, ttendlim, lgfdlmprad, & !--- max hourly avg_max_length, & !--- land/surface model control +#ifdef CCPP + lsm, lsoil, lsoil_lsm, nmtvr, ivegsrc, use_ufo, & +#else lsm, lsoil, nmtvr, ivegsrc, use_ufo, & +#endif ! Noah MP options iopt_dveg,iopt_crs,iopt_btr,iopt_run,iopt_sfc, iopt_frz, & iopt_inf, iopt_rad,iopt_alb,iopt_snf,iopt_tbot,iopt_stc, & !--- physical parameterizations ras, trans_trac, old_monin, cnvgwd, mstrat, moist_adj, & cscnv, cal_pre, do_aw, do_shoc, shocaftcnv, shoc_cld, & +#ifdef CCPP + oz_phys, oz_phys_2015, & + do_mynnedmf, do_mynnsfclay, & + ! DH* TODO - move to MYNN namelist section + bl_mynn_cloudpdf, bl_mynn_edmf, bl_mynn_edmf_mom, & + bl_mynn_edmf_tke, bl_mynn_edmf_part, bl_mynn_cloudmix, & + bl_mynn_mixqt, icloud_bl, bl_mynn_tkeadvect, & + ! *DH +#endif h2o_phys, pdfcld, shcnvcw, redrag, hybedmf, satmedmf, & - dspheat, lheatstrg, cnvcld, & + shinhong, do_ysu, dspheat, dspheat, lheatstrg, cnvcld, & random_clds, shal_cnv, imfshalcnv, imfdeepcnv, isatmedmf, & do_deep, jcap, & cs_parm, flgmin, cgwf, ccwf, cdmbgwd, sup, ctei_rm, crtrh, & dlqf, rbcr, shoc_parm, psauras, prauras, wminras, & +#ifdef CCPP + do_sppt, do_shum, do_skeb, do_sfcperts, & +#endif !--- Rayleigh friction prslrd0, ral_ts, ldiag_ugwp, do_ugwp, do_tofd, & !--- mass flux deep convection @@ -2240,7 +4193,6 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & !--- read in the namelist - !--- read in the namelist #ifdef INTERNAL_FILE_NML Model%input_nml_file => input_nml_file read(Model%input_nml_file, nml=gfs_physics_nml) @@ -2266,8 +4218,16 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & !--- MPI parameters Model%me = me Model%master = master +#ifdef CCPP + Model%communicator = communicator + Model%ntasks = ntasks + Model%nthreads = nthreads +#endif Model%nlunit = nlunit Model%fn_nml = fn_nml +#ifdef CCPP + Model%logunit = logunit +#endif Model%fhzero = fhzero Model%ldiag3d = ldiag3d ! @@ -2276,6 +4236,12 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & Model%ldiag_ugwp = ldiag_ugwp Model%do_ugwp = do_ugwp Model%do_tofd = do_tofd +#ifdef CCPP + if (Model%ldiag_ugwp .or. Model%do_ugwp .or. Model%do_tofd) then + print *, "Error, unified gravity wavedrag parameterization not yet available in CCPP" + stop + endif +#endif ! Model%lssav = lssav Model%fhcyc = fhcyc @@ -2292,10 +4258,20 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & Model%nx = nx Model%ny = ny Model%levs = levs +#ifdef CCPP + allocate(Model%ak(1:size(ak))) + allocate(Model%bk(1:size(bk))) + Model%ak = ak + Model%bk = bk +#endif Model%cnx = cnx Model%cny = cny Model%lonr = gnx ! number longitudinal points Model%latr = gny ! number of latitudinal points from pole to pole +#ifdef CCPP + allocate(Model%blksz(1:size(blksz))) + Model%blksz = blksz +#endif !--- coupling parameters Model%cplflx = cplflx @@ -2308,7 +4284,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & !--- calendars and time parameters and activation triggers Model%dtp = dt_phys Model%dtf = dt_dycore - Model%nscyc = nint(fhcyc*3600./Model%dtp) + Model%nscyc = nint(Model%fhcyc*con_hr/Model%dtp) Model%nszero = nint(Model%fhzero*con_hr/Model%dtp) Model%idat(1:8) = idat(1:8) Model%idate = 0 @@ -2336,6 +4312,9 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & endif Model%iccn = iccn if (Model%aero_in) Model%iccn = .false. + ! further down: set Model%iccn to .false. + ! for all microphysics schemes except + ! MG2/3 (these are the only ones using ICCN) Model%iflip = iflip Model%isol = isol Model%ico2 = ico2 @@ -2352,10 +4331,22 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & Model%ccnorm = ccnorm Model%lwhtr = lwhtr Model%swhtr = swhtr +#ifdef CCPP + ! The CCPP versions of the RRTMG lw/sw schemes are configured + ! such that lw and sw heating rate are output, i.e. they rely + ! on the corresponding arrays to be allocated. + if (.not.lwhtr .or. .not.swhtr) then + write(0,*) "Logic error, the CCPP version of RRTMG lwrad/swrad require the output" // & + " of the lw/sw heating rates to be turned on (namelist options lwhtr and swhtr)" + stop + end if +#endif !--- microphysical switch Model%ncld = ncld Model%imp_physics = imp_physics + ! turn off ICCN interpolation when MG2/3 are not used + if (.not. Model%imp_physics==Model%imp_physics_mg) Model%iccn = .false. !--- Zhao-Carr MP parameters Model%psautco = psautco Model%prautco = prautco @@ -2363,12 +4354,15 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & Model%wminco = wminco !--- Max hourly Model%avg_max_length = avg_max_length -!--- Morroson-Gettleman MP parameters +!--- Morrison-Gettelman MP parameters Model%fprcp = fprcp Model%pdfflag = pdfflag Model%mg_dcs = mg_dcs Model%mg_qcvar = mg_qcvar Model%mg_ts_auto_ice = mg_ts_auto_ice +#ifdef CCPP + Model%mg_rhmini = mg_rhmini +#endif Model%mg_alf = mg_alf Model%mg_qcmin = mg_qcmin Model%effr_in = effr_in @@ -2389,16 +4383,36 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & Model%do_sb_physics = do_sb_physics Model%mg_precip_frac_method = mg_precip_frac_method Model%mg_berg_eff_factor = mg_berg_eff_factor +#ifdef CCPP + Model%tf = tf + Model%tcr = tcr + Model%tcrf = 1.0/(tcr-tf) +#endif !--- Thompson MP parameters + Model%make_number_concentrations = make_number_concentrations Model%ltaerosol = ltaerosol Model%lradar = lradar + Model%ttendlim = ttendlim !--- gfdl MP parameters Model%lgfdlmprad = lgfdlmprad !--- land/surface model parameters Model%lsm = lsm Model%lsoil = lsoil +#ifdef CCPP + ! Consistency check for RUC LSM + if (Model%lsm == Model%lsm_ruc .and. Model%nscyc>0) then + write(0,*) 'Logic error: RUC LSM cannot be used with surface data cycling at this point (fhcyc>0)' + stop + end if + ! Set surface layers for CCPP physics + if (lsoil_lsm==-1) then + Model%lsoil_lsm = lsoil + else + Model%lsoil_lsm = lsoil_lsm + end if +#endif Model%ivegsrc = ivegsrc Model%isot = isot Model%use_ufo = use_ufo @@ -2431,15 +4445,44 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & Model%do_aw = do_aw Model%cs_parm = cs_parm Model%do_shoc = do_shoc +#ifdef CCPP + if (Model%do_shoc) then + print *, "Error, update of SHOC from May 22 2019 not yet in CCPP" + stop + end if +#endif Model%shoc_parm = shoc_parm Model%shocaftcnv = shocaftcnv Model%shoc_cld = shoc_cld +#ifdef CCPP + if (oz_phys .and. oz_phys_2015) then + write(*,*) 'Logic error: can only use one ozone physics option (oz_phys or oz_phys_2015), not both. Exiting.' + stop + end if + Model%oz_phys = oz_phys + Model%oz_phys_2015 = oz_phys_2015 +#endif Model%h2o_phys = h2o_phys +#ifdef CCPP + ! To ensure that these values match what's in the physics, + ! array sizes are compared during model init in GFS_phys_time_vary_init() + ! + ! from module h2ointerp + if (h2o_phys) then + levh2o = 72 + h2o_coeff = 3 + else + levh2o = 1 + h2o_coeff = 1 + end if +#endif Model%pdfcld = pdfcld Model%shcnvcw = shcnvcw Model%redrag = redrag Model%hybedmf = hybedmf Model%satmedmf = satmedmf + Model%shinhong = shinhong + Model%do_ysu = do_ysu Model%dspheat = dspheat Model%lheatstrg = lheatstrg Model%cnvcld = cnvcld @@ -2463,7 +4506,23 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & Model%prauras = prauras Model%wminras = wminras Model%rbcr = rbcr - +#ifdef CCPP + Model%do_mynnedmf = do_mynnedmf + Model%do_mynnsfclay = do_mynnsfclay + ! DH* TODO - move to MYNN namelist section + Model%bl_mynn_cloudpdf = bl_mynn_cloudpdf + Model%bl_mynn_mixlength = bl_mynn_mixlength + Model%bl_mynn_edmf = bl_mynn_edmf + Model%bl_mynn_edmf_mom = bl_mynn_edmf_mom + Model%bl_mynn_edmf_tke = bl_mynn_edmf_tke + Model%bl_mynn_cloudmix = bl_mynn_cloudmix + Model%bl_mynn_mixqt = bl_mynn_mixqt + Model%bl_mynn_edmf_part = bl_mynn_edmf_part + Model%bl_mynn_tkeadvect = bl_mynn_tkeadvect + Model%grav_settling = grav_settling + Model%icloud_bl = icloud_bl + ! *DH +#endif !--- Rayleigh friction Model%prslrd0 = prslrd0 @@ -2503,6 +4562,21 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & Model%moninq_fac = moninq_fac !--- stochastic physics options + ! DH* 20180730 + ! For the standard/non-CCPP build, do_sppt, do_shum, do_skeb and do_sfcperts + ! are set to false here and updated later as part of init_stochastic_physics, + ! depending on values of other namelist parameters. Since these values are used + ! as conditionals for allocating components of Coupling and other DDTs, the call + ! to init_stochastic_physics is placed between creating the "Model" DDT and the + ! other DDTs. + ! This is confusing and not compatible with CCPP, because the CCPP physics init + ! can happen only after ALL DDTs are created and added to the CCPP data structure + ! (cdata). Hence, for CCPP do_sppt, do_shum, do_skeb and do_sfcperts are additional + ! namelist variables in group physics that are parsed here and then compared in + ! stochastic_physics_init (the CCPP version of init_stochastic_physics) to the + ! stochastic physics namelist parameters to ensure consistency. + ! DH* 20190518 - the same functionality is needed for separating stochastic_physics + ! from both IPD and CCPP, i.e. keep this code *DH Model%do_sppt = do_sppt Model%use_zmtnblck = use_zmtnblck Model%do_shum = do_shum @@ -2515,6 +4589,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & Model%pertlai = pertlai Model%pertalb = pertalb Model%pertvegf = pertvegf + ! *DH 20180730 !--- cellular automata options Model%nca = nca @@ -2524,6 +4599,14 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & Model%nseed = nseed Model%ca_global = ca_global Model%do_ca = do_ca +#ifdef CCPP + if(Model%do_ca)then + print *,'Cellular automata cannot be used when CCPP is turned on until' + print *,'the stochastic physics pattern generation code has been pulled' + print *,'out of the FV3 repository and updated with the CCPP version.' + stop + endif +#endif Model%ca_sgs = ca_sgs Model%iseed_ca = iseed_ca Model%ca_smooth = ca_smooth @@ -2540,8 +4623,14 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & !--- tracer handling Model%ntrac = size(tracer_names) +#ifdef CCPP + Model%ntracp1 = Model%ntrac + 1 +#endif allocate (Model%tracer_names(Model%ntrac)) Model%tracer_names(:) = tracer_names(:) +#ifdef CCPP + Model%ntqv = 1 +#endif #ifdef MULTI_GASES Model%nto = get_tracer_index(Model%tracer_names, 'spfo', Model%me, Model%master, Model%debug) Model%nto2 = get_tracer_index(Model%tracer_names, 'spfo2', Model%me, Model%master, Model%debug) @@ -2582,6 +4671,33 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & endif endif +#ifdef CCPP + ! To ensure that these values match what's in the physics, + ! array sizes are compared during model init in GFS_phys_time_vary_init() + ! + ! from module ozinterp + if (Model%ntoz>0) then + if (Model%oz_phys) then + levozp = 80 + oz_coeff = 4 + else if (Model%oz_phys_2015) then + levozp = 53 + oz_coeff = 6 + else + write(*,*) 'Logic error, ntoz>0 but no ozone physics selected' + stop + end if + else + if (Model%oz_phys .or. Model%oz_phys_2015) then + write(*,*) 'Logic error, ozone physics are selected, but ntoz<=0' + stop + else + levozp = 1 + oz_coeff = 0 + end if + end if +#endif + !--- quantities to be used to derive phy_f*d totals Model%nshoc_2d = nshoc_2d Model%nshoc_3d = nshoc_3d @@ -2609,17 +4725,47 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & Model%fhour = (rinc(4) + Model%dtp)/con_hr Model%zhour = mod(Model%phour,Model%fhzero) Model%kdt = 0 +#ifdef CCPP + Model%first_time_step = .true. + Model%restart = restart + Model%hydrostatic = hydrostatic +#endif Model%jdat(1:8) = jdat(1:8) +#ifdef CCPP + Model%sec = 0 + allocate(Model%si(Model%levr+1)) + !--- Define sigma level for radiation initialization + !--- The formula converting hybrid sigma pressure coefficients to sigma coefficients follows Eckermann (2009, MWR) + !--- ps is replaced with p0. The value of p0 uses that in http://www.emc.ncep.noaa.gov/officenotes/newernotes/on461.pdf + !--- ak/bk have been flipped from their original FV3 orientation and are defined sfc -> toa + Model%si = (ak + bk * p_ref - ak(Model%levr+1)) / (p_ref - ak(Model%levr+1)) +#endif +#ifndef CCPP + ! Beware! The values set here reside in wam_f107_kp_mod and determine sizes of arrays + ! inside that module. These arrays get used later in modules idea_tracer.f, idea_ion.f, + ! idea_solar_heating.f, efield.f, and idea_composition.f. + ! Since in wam_f107_kp_mod no default values are assigned to the four integers below, not + ! setting them here can lead to memory corruption that is hard to detect. !--- stored in wam_f107_kp module f107_kp_size = 56 f107_kp_skip_size = 0 f107_kp_data_size = 56 f107_kp_interval = 10800 +#endif !--- BEGIN CODE FROM GFS_PHYSICS_INITIALIZE !--- define physcons module variables tem = con_rerth*con_rerth*(con_pi+con_pi)*con_pi +#ifdef CCPP + Model%dxmax = log(tem/(max_lon*max_lat)) + Model%dxmin = log(tem/(min_lon*min_lat)) + Model%dxinv = 1.0d0 / (Model%dxmax-Model%dxmin) + Model%rhcmax = rhcmax + if (Model%me == Model%master) write(*,*)' dxmax=',Model%dxmax,' dxmin=',Model%dxmin,' dxinv=',Model%dxinv, & + 'max_lon=',max_lon,' max_lat=',max_lat,' min_lon=',min_lon,' min_lat=',min_lat, & + ' rhc_max=',Model%rhcmax +#else dxmax = log(tem/(max_lon*max_lat)) dxmin = log(tem/(min_lon*min_lat)) dxinv = 1.0d0 / (dxmax-dxmin) @@ -2627,14 +4773,19 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & if (Model%me == Model%master) write(*,*)' dxmax=',dxmax,' dxmin=',dxmin,' dxinv=',dxinv, & 'max_lon=',max_lon,' max_lat=',max_lat,' min_lon=',min_lon,' min_lat=',min_lat, & ' rhc_max=',rhc_max +#endif !--- set nrcm +#ifndef CCPP if (Model%ras) then Model%nrcm = min(nrcmax, Model%levs-1) * (Model%dtp/1200.d0) + 0.10001d0 else Model%nrcm = 2 endif +#else + Model%nrcm = 2 +#endif !--- cal_pre if (Model%cal_pre) then @@ -2659,6 +4810,29 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & ' ntke=',Model%ntke,' shoc_parm=',shoc_parm endif +#ifdef CCPP + !--- mynn-edmf scheme + if (Model%do_mynnedmf) then + if (Model%do_shoc .or. Model%hybedmf .or. Model%satmedmf) then + print *,' Logic error: MYNN EDMF cannot be run with SHOC, HEDMF or SATMEDMF' + stop + end if +! Model%shal_cnv = .false. +! Model%imfshalcnv = -1 + ! DH* substitute for MYNN namelist section + Model%icloud_bl = 1 + !Model%bl_mynn_tkeadvect = .true. + Model%bl_mynn_edmf = 1 + !Model%bl_mynn_edmf_mom = 1 + ! *DH + if (Model%me == Model%master) print *,' MYNN-EDMF scheme is used for both', & + ' boundary layer turbulence and shallow convection', & + ' bl_mynn_cloudpdf=',Model%bl_mynn_cloudpdf, & + ' bl_mynn_mixlength=',Model%bl_mynn_mixlength, & + ' bl_mynn_edmf=',Model%bl_mynn_edmf + endif +#endif + !--- set number of cloud types if (Model%cscnv) then Model%nctp = nint(Model%cs_parm(5)) @@ -2677,7 +4851,21 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & elseif (Model%lsm == 0) then print *,' OSU no longer supported - job aborted' stop - elseif (Model%lsm == 2) then +#ifdef CCPP + elseif (Model%lsm == Model%lsm_ruc) then + print *,' RUC Land Surface Model used' + elseif (Model%lsm == Model%lsm_noahmp) then + print *,' Error, NOAH MP Land Surface Model not yet available in CCPP - job aborted' + stop +#else + elseif (Model%lsm == Model%lsm_noahmp) then + if (Model%ivegsrc /= 1) then + print *,'Vegetation type must be IGBP if Noah MP is used' + stop + elseif (Model%isot /= 1) then + print *,'Soil type must be STATSGO if Noah MP is used' + stop + endif print *, 'New Noah MP Land Surface Model will be used' print *, 'The Physics options are' @@ -2693,20 +4881,17 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & print *,'iopt_snf = ', Model%iopt_snf print *,'iopt_tbot = ',Model%iopt_tbot print *,'iopt_stc = ', Model%iopt_stc - - elseif (Model%lsm == 2 .and. Model%ivegsrc /= 1) then - print *,'Vegetation type must be IGBP if Noah MP is used' - stop - elseif (Model%lsm == 2 .and. Model%isot /= 1) then - print *,'Soil type must be STATSGO if Noah MP is used' + elseif (Model%lsm == Model%lsm_ruc) then + print *,' RUC Land Surface Model only available through CCPP - job aborted' stop +#endif else print *,' Unsupported LSM type - job aborted - lsm=',Model%lsm stop endif - if (Model%lsm == 2 .and. Model%iopt_snf == 4) then - if (Model%imp_physics /= 11) stop 'iopt_snf == 4 must use GFDL MP' + if (Model%lsm == Model%lsm_noahmp .and. Model%iopt_snf == 4) then + if (Model%imp_physics /= Model%imp_physics_gfdl) stop 'iopt_snf == 4 must use GFDL MP' endif print *,' nst_anl=',Model%nst_anl,' use_ufo=',Model%use_ufo,' frac_grid=',Model%frac_grid @@ -2719,6 +4904,23 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & print *,' nstf_name(5)=',Model%nstf_name(5) endif if (Model%do_deep) then +#ifdef CCPP + ! Consistency check for NTDK convection: deep and shallow convection are bundled + ! and cannot be combined with any other deep or shallow convection scheme + if ( (Model%imfdeepcnv == 4 .or. Model%imfshalcnv == 4) .and. & + .not. (Model%imfdeepcnv == 4 .and. Model%imfshalcnv == 4) ) then + write(0,*) "Logic error: if NTDK deep convection is used, must also use NTDK shallow convection (and vice versa)" + stop + end if +#else + if (Model%imfdeepcnv == 3 .or. Model%imfshalcnv == 3) then + write(0,*) "Error, GF convection scheme only available through CCPP" + stop + else if (Model%imfdeepcnv == 4 .or. Model%imfshalcnv == 4) then + write(0,*) "Error, NTDK convection scheme only available through CCPP" + stop + end if +#endif if (.not. Model%cscnv) then if (Model%ras) then print *,' RAS Convection scheme used with ccwf=',Model%ccwf @@ -2730,6 +4932,10 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & print *,' July 2010 version of SAS conv scheme used' elseif(Model%imfdeepcnv == 2) then print *,' scale & aerosol-aware mass-flux deep conv scheme' + elseif(Model%imfdeepcnv == 3) then + print *,' Grell-Freitas scale & aerosol-aware mass-flux deep conv scheme' + elseif(Model%imfdeepcnv == 4) then + print *,' New Tiedtke cumulus scheme' endif endif else @@ -2748,12 +4954,21 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & if (Model%isatmedmf == 0) then print *,' initial version (Nov 2018) of sale-aware TKE-based moist EDMF scheme used' elseif(Model%isatmedmf == 1) then +#ifdef CCPP + print *,' Error: updated version (May 2019) of sale-aware TKE-based moist EDMF scheme not yet available in CCPP' + stop +#else print *,' update version (May 2019) of sale-aware TKE-based moist EDMF scheme used' +#endif endif elseif (Model%hybedmf) then print *,' scale-aware hybrid edmf PBL scheme used' elseif (Model%old_monin) then print *,' old (old_monin) PBL scheme used' +#ifdef CCPP + elseif (Model%do_mynnedmf) then + print *,' MYNN PBL scheme used' +#endif endif if (.not. Model%shal_cnv) then Model%imfshalcnv = -1 @@ -2765,6 +4980,10 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & print *,' July 2010 version of mass-flux shallow conv scheme used' elseif (Model%imfshalcnv == 2) then print *,' scale- & aerosol-aware mass-flux shallow conv scheme (2017)' + elseif (Model%imfshalcnv == 3) then + print *,' Grell-Freitas scale- & aerosol-aware mass-flux shallow conv scheme (2013)' + elseif (Model%imfshalcnv == 4) then + print *,' New Tiedtke cumulus scheme' else print *,' unknown mass-flux scheme in use - defaulting to no shallow convection' Model%imfshalcnv = -1 @@ -2798,7 +5017,12 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & endif !--- set up cloud schemes and tracer elements - if (Model%imp_physics == 99) then + Model%nleffr = -999 + Model%nieffr = -999 + Model%nreffr = -999 + Model%nseffr = -999 + Model%ngeffr = -999 + if (Model%imp_physics == Model%imp_physics_zhao_carr) then Model%npdf3d = 0 Model%num_p3d = 4 Model%num_p2d = 3 @@ -2806,7 +5030,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & Model%ncnd = 1 ! ncnd is the number of cloud condensate types if (Model%me == Model%master) print *,' Using Zhao/Carr/Sundqvist Microphysics' - elseif (Model%imp_physics == 98) then !Zhao Microphysics with PDF cloud + elseif (Model%imp_physics == Model%imp_physics_zhao_carr_pdf) then !Zhao Microphysics with PDF cloud Model%npdf3d = 3 Model%num_p3d = 4 Model%num_p2d = 3 @@ -2817,39 +5041,45 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & print *,' Ferrier Microphysics scheme has been deprecated - job aborted' stop - elseif (Model%imp_physics == 6) then !WSM6 microphysics + elseif (Model%imp_physics == Model%imp_physics_wsm6) then !WSM6 microphysics Model%npdf3d = 0 Model%num_p3d = 3 Model%num_p2d = 1 Model%pdfcld = .false. Model%shcnvcw = .false. Model%ncnd = 5 + Model%nleffr = 1 + Model%nieffr = 2 + Model%nseffr = 3 if (Model%me == Model%master) print *,' Using wsm6 microphysics' - elseif (Model%imp_physics == 8) then !Thompson microphysics + elseif (Model%imp_physics == Model%imp_physics_thompson) then !Thompson microphysics Model%npdf3d = 0 Model%num_p3d = 3 Model%num_p2d = 1 Model%pdfcld = .false. Model%shcnvcw = .false. Model%ncnd = 5 -! if(Model%ltaerosol) then -! Model%ltaerosol=.false. -! if (Model%me == Model%master) print *, & -! 'ltaerosol does not currently work with Thompson MP. ltaerosol is set to false' -! endif - + Model%nleffr = 1 + Model%nieffr = 2 + Model%nseffr = 3 if (Model%me == Model%master) print *,' Using Thompson double moment', & ' microphysics',' ltaerosol = ',Model%ltaerosol, & + ' make_number_concentrations = ',Model%make_number_concentrations, & + ' ttendlim =',Model%ttendlim, & ' lradar =',Model%lradar,Model%num_p3d,Model%num_p2d - else if (Model%imp_physics == 10) then ! Morrison-Gettelman Microphysics + else if (Model%imp_physics == Model%imp_physics_mg) then ! Morrison-Gettelman Microphysics Model%npdf3d = 0 Model%num_p3d = 5 Model%num_p2d = 1 Model%pdfcld = .false. Model%shcnvcw = .false. Model%ncnd = 2 + Model%nleffr = 2 + Model%nieffr = 3 + Model%nreffr = 4 + Model%nseffr = 5 if (abs(Model%fprcp) == 1) then Model%ncnd = 4 elseif (Model%fprcp >= 2) then @@ -2858,6 +5088,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & Model%ncnd = 5 endif Model%num_p3d = 6 + Model%ngeffr = 6 endif if (Model%me == Model%master) & print *,' Using Morrison-Gettelman double moment microphysics', & @@ -2874,10 +5105,15 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & ' mg_alf=', Model%mg_alf, ' mg_qcmin=', Model%mg_qcmin, & ' mg_do_ice_gmao=', Model%mg_do_ice_gmao, ' mg_do_liq_liu=', Model%mg_do_liq_liu - elseif (Model%imp_physics == 11) then !GFDL microphysics + elseif (Model%imp_physics == Model%imp_physics_gfdl) then !GFDL microphysics Model%npdf3d = 0 Model%num_p3d = 1 if(Model%effr_in) Model%num_p3d = 5 + Model%nleffr = 1 + Model%nieffr = 2 + Model%nreffr = 3 + Model%nseffr = 4 + Model%ngeffr = 5 Model%num_p2d = 1 Model%pdfcld = .false. Model%shcnvcw = .false. @@ -2890,13 +5126,19 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & endif if(Model%ras .or. Model%cscnv) Model%cnvcld = .false. +#ifdef CCPP + if(Model%do_shoc .or. Model%pdfcld .or. Model%do_mynnedmf) Model%cnvcld = .false. +#else if(Model%do_shoc .or. Model%pdfcld) Model%cnvcld = .false. +#endif if(Model%cnvcld) Model%ncnvcld3d = 1 -!--- get cnvw index in phy_f3d +!--- get cnvw and cnvc indices in phy_f3d Model%ncnvw = -999 + Model%ncnvc = -999 if ((Model%npdf3d == 3) .and. (Model%num_p3d == 4)) then Model%ncnvw = Model%num_p3d + 2 + Model%ncnvc = Model%ncnvw + 1 elseif ((Model%npdf3d == 0) .and. (Model%ncnvcld3d == 1)) then Model%ncnvw = Model%num_p3d + 1 endif @@ -2909,7 +5151,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & Model%uni_cld = .false. Model%indcld = -1 ! if (Model%shoc_cld .or. Model%ncld == 2 .or. Model%ntclamt > 0) then - if (Model%imp_physics == 10) then + if (Model%imp_physics == Model%imp_physics_mg) then Model%uni_cld = .true. Model%indcld = 1 elseif (Model%shoc_cld) then @@ -2927,7 +5169,8 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & ' uni_cld=', Model%uni_cld, & ' ntot3d=', Model%ntot3d, ' ntot2d=', Model%ntot2d, & ' shocaftcnv=',Model%shocaftcnv,' indcld=', Model%indcld, & - ' shoc_parm=', Model%shoc_parm, ' ncnvw=', Model%ncnvw + ' shoc_parm=', Model%shoc_parm, & + ' ncnvw=', Model%ncnvw, ' ncnvc=', Model%ncnvc !--- END CODE FROM COMPNS_PHYSICS @@ -2936,7 +5179,11 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & !--- set up parameters for Xu & Randell's cloudiness computation (Radiation) Model%lmfshal = (Model%shal_cnv .and. Model%imfshalcnv > 0) +#ifdef CCPP + Model%lmfdeep2 = (Model%imfdeepcnv == 2 .or. Model%imfdeepcnv == 3 .or. Model%imfdeepcnv == 4) +#else Model%lmfdeep2 = (Model%imfdeepcnv == 2) +#endif !--- END CODE FROM GLOOPR !--- BEGIN CODE FROM GLOOPB @@ -2973,6 +5220,9 @@ subroutine control_print(Model) print *, 'basic control parameters' print *, ' me : ', Model%me print *, ' master : ', Model%master +#ifdef CCPP + print *, ' communicator : ', Model%communicator +#endif print *, ' nlunit : ', Model%nlunit print *, ' fn_nml : ', trim(Model%fn_nml) print *, ' fhzero : ', Model%fhzero @@ -2995,6 +5245,10 @@ subroutine control_print(Model) print *, ' cny : ', Model%cny print *, ' lonr : ', Model%lonr print *, ' latr : ', Model%latr +#ifdef CCPP + print *, ' blksz(1) : ', Model%blksz(1) + print *, ' blksz(nblks) : ', Model%blksz(size(Model%blksz)) +#endif print *, ' ' print *, 'coupling parameters' print *, ' cplflx : ', Model%cplflx @@ -3046,7 +5300,7 @@ subroutine control_print(Model) print *, ' imp_physics : ', Model%imp_physics print *, ' ' - if (Model%imp_physics == 99 .or. Model%imp_physics == 98) then + if (Model%imp_physics == Model%imp_physics_zhao_carr .or. Model%imp_physics == Model%imp_physics_zhao_carr_pdf) then print *, ' Z-C microphysical parameters' print *, ' psautco : ', Model%psautco print *, ' prautco : ', Model%prautco @@ -3054,13 +5308,15 @@ subroutine control_print(Model) print *, ' wminco : ', Model%wminco print *, ' ' endif - if (Model%imp_physics == 6 .or. Model%imp_physics == 8) then + if (Model%imp_physics == Model%imp_physics_wsm6 .or. Model%imp_physics == Model%imp_physics_thompson) then print *, ' Thompson microphysical parameters' + print *, ' make_number_concentrations : ', Model%make_number_concentrations print *, ' ltaerosol : ', Model%ltaerosol print *, ' lradar : ', Model%lradar + print *, ' ttendlim : ', Model%ttendlim print *, ' ' endif - if (Model%imp_physics == 10) then + if (Model%imp_physics == Model%imp_physics_mg) then print *, ' M-G microphysical parameters' print *, ' fprcp : ', Model%fprcp print *, ' mg_dcs : ', Model%mg_dcs @@ -3071,7 +5327,7 @@ subroutine control_print(Model) print *, ' pdfflag : ', Model%pdfflag print *, ' ' endif - if (Model%imp_physics == 11) then + if (Model%imp_physics == Model%imp_physics_gfdl) then print *, ' GFDL microphysical parameters' print *, ' GFDL MP radiation inter: ', Model%lgfdlmprad print *, ' ' @@ -3080,10 +5336,13 @@ subroutine control_print(Model) print *, 'land/surface model parameters' print *, ' lsm : ', Model%lsm print *, ' lsoil : ', Model%lsoil +#ifdef CCPP + print *, ' lsoil_lsm : ', Model%lsoil_lsm +#endif print *, ' ivegsrc : ', Model%ivegsrc print *, ' isot : ', Model%isot - if (Model%lsm == 2) then + if (Model%lsm == Model%lsm_noahmp) then print *, ' Noah MP LSM is used, the options are' print *, ' iopt_dveg : ', Model%iopt_dveg print *, ' iopt_crs : ', Model%iopt_crs @@ -3130,6 +5389,8 @@ subroutine control_print(Model) print *, ' redrag : ', Model%redrag print *, ' hybedmf : ', Model%hybedmf print *, ' satmedmf : ', Model%satmedmf + print *, ' shinhong : ', Model%shinhong + print *, ' do_ysu : ', Model%do_ysu print *, ' dspheat : ', Model%dspheat print *, ' lheatstrg : ', Model%lheatstrg print *, ' cnvcld : ', Model%cnvcld @@ -3151,6 +5412,10 @@ subroutine control_print(Model) print *, ' dlqf : ', Model%dlqf print *, ' seed0 : ', Model%seed0 print *, ' rbcr : ', Model%rbcr +#ifdef CCPP + print *, ' do_mynnedmf : ', Model%do_mynnedmf + print *, ' do_mynnsfclay : ', Model%do_mynnsfclay +#endif print *, ' ' print *, 'Rayleigh friction' print *, ' prslrd0 : ', Model%prslrd0 @@ -3214,6 +5479,9 @@ subroutine control_print(Model) print *, 'tracers' print *, ' tracer_names : ', Model%tracer_names print *, ' ntrac : ', Model%ntrac +#ifdef CCPP + print *, ' ntqv : ', Model%ntqv +#endif print *, ' ntoz : ', Model%ntoz print *, ' ntcw : ', Model%ntcw print *, ' ntiw : ', Model%ntiw @@ -3265,6 +5533,13 @@ subroutine control_print(Model) print *, ' zhour : ', Model%zhour print *, ' kdt : ', Model%kdt print *, ' jdat : ', Model%jdat +#ifdef CCPP + print *, ' sec : ', Model%sec + print *, ' si : ', Model%si + print *, ' first_time_step : ', Model%first_time_step + print *, ' restart : ', Model%restart + print *, ' hydrostatic : ', Model%hydrostatic +#endif endif end subroutine control_print @@ -3338,12 +5613,19 @@ end subroutine grid_create !-------------------- ! GFS_tbd_type%create !-------------------- +#ifndef CCPP + subroutine tbd_create (Tbd, IM, BLKNO, Model) +#else subroutine tbd_create (Tbd, IM, Model) +#endif implicit none class(GFS_tbd_type) :: Tbd integer, intent(in) :: IM +#ifndef CCPP + integer, intent(in) :: BLKNO +#endif type(GFS_control_type), intent(in) :: Model !--- In @@ -3369,6 +5651,16 @@ subroutine tbd_create (Tbd, IM, Model) allocate (Tbd%aer_nm (IM,Model%levs,ntrcaer)) Tbd%aer_nm = clear_val +#ifdef CCPP +! DH* TODO - MOVE THIS TO a block-vector dependent structure in GFS_control? +! e.g. GFS_Control%imap(blk), GFS_Control%jmap(blk), or ii instead if imap etc? *DH +!--- maps of local index ix to global indices i and j for this block + allocate (Tbd%imap (IM)) + allocate (Tbd%jmap (IM)) + Tbd%imap = 0 + Tbd%jmap = 0 +#endif + allocate (Tbd%rann (IM,Model%nrcm)) Tbd%rann = rann_init @@ -3405,6 +5697,73 @@ subroutine tbd_create (Tbd, IM, Model) ! if (Model%do_shoc) Tbd%phy_f3d(:,1,Model%ntot3d-1) = 3.0 ! if (Model%do_shoc) Tbd%phy_f3d(:,:,Model%ntot3d-1) = 1.0 +#ifndef CCPP + Tbd%blkno = BLKNO +#endif + +#ifdef CCPP + allocate (Tbd%htlwc (IM,Model%levr+LTP)) + allocate (Tbd%htlw0 (IM,Model%levr+LTP)) + allocate (Tbd%htswc (IM,Model%levr+LTP)) + allocate (Tbd%htsw0 (IM,Model%levr+LTP)) + + Tbd%htlwc = clear_val + Tbd%htlw0 = clear_val + Tbd%htswc = clear_val + Tbd%htsw0 = clear_val + + if (Model%imfdeepcnv == 3 .or. Model%imfdeepcnv == 4) then + allocate(Tbd%forcet(IM, Model%levs)) + allocate(Tbd%forceq(IM, Model%levs)) + allocate(Tbd%prevst(IM, Model%levs)) + allocate(Tbd%prevsq(IM, Model%levs)) + Tbd%forcet = clear_val + Tbd%forceq = clear_val + Tbd%prevst = clear_val + Tbd%prevsq = clear_val + end if + + if (Model%imfdeepcnv == 3) then + allocate(Tbd%cactiv(IM)) + Tbd%cactiv = zero + end if + + if (Model%lsm == Model%lsm_ruc) then + allocate(Tbd%raincprv (IM)) + allocate(Tbd%rainncprv (IM)) + allocate(Tbd%iceprv (IM)) + allocate(Tbd%snowprv (IM)) + allocate(Tbd%graupelprv(IM)) + Tbd%raincprv = clear_val + Tbd%rainncprv = clear_val + Tbd%iceprv = clear_val + Tbd%snowprv = clear_val + Tbd%graupelprv = clear_val + end if + + !--- MYNN variables: + if (Model%do_mynnedmf) then + !print*,"Allocating all MYNN-EDMF variables:" + allocate (Tbd%cldfra_bl (IM,Model%levs)) + allocate (Tbd%qc_bl (IM,Model%levs)) + allocate (Tbd%el_pbl (IM,Model%levs)) + allocate (Tbd%sh3d (IM,Model%levs)) + allocate (Tbd%qke (IM,Model%levs)) + allocate (Tbd%tsq (IM,Model%levs)) + allocate (Tbd%qsq (IM,Model%levs)) + allocate (Tbd%cov (IM,Model%levs)) + !print*,"Allocating all MYNN-EDMF variables:" + Tbd%cldfra_bl = clear_val + Tbd%qc_bl = clear_val + Tbd%el_pbl = clear_val + Tbd%sh3d = clear_val + Tbd%qke = zero + Tbd%tsq = clear_val + Tbd%qsq = clear_val + Tbd%cov = clear_val + end if +#endif + end subroutine tbd_create @@ -3565,6 +5924,9 @@ subroutine diag_create (Diag, IM, Model) allocate (Diag%dlwsfci (IM)) allocate (Diag%ulwsfci (IM)) allocate (Diag%dswsfci (IM)) +#ifdef CCPP + allocate (Diag%nswsfci (IM)) +#endif allocate (Diag%uswsfci (IM)) allocate (Diag%dusfci (IM)) allocate (Diag%dvsfci (IM)) @@ -3574,7 +5936,9 @@ subroutine diag_create (Diag, IM, Model) allocate (Diag%epi (IM)) allocate (Diag%smcwlt2 (IM)) allocate (Diag%smcref2 (IM)) - allocate (Diag%wet1 (IM)) + if (.not. Model%lsm == Model%lsm_ruc) then + allocate (Diag%wet1 (IM)) + end if allocate (Diag%sr (IM)) allocate (Diag%tdomr (IM)) allocate (Diag%tdomzr (IM)) @@ -3598,6 +5962,7 @@ subroutine diag_create (Diag, IM, Model) allocate (Diag%du3dt (IM,Model%levs,4)) allocate (Diag%dv3dt (IM,Model%levs,4)) allocate (Diag%dt3dt (IM,Model%levs,7)) + allocate (Diag%dq3dt (IM,Model%levs,9)) ! allocate (Diag%dq3dt (IM,Model%levs,oz_coeff+5)) !--- needed to allocate GoCart coupling fields ! allocate (Diag%upd_mf (IM,Model%levs)) @@ -3605,6 +5970,7 @@ subroutine diag_create (Diag, IM, Model) ! allocate (Diag%det_mf (IM,Model%levs)) ! allocate (Diag%cldcov (IM,Model%levs)) endif + !vay-2018 if (Model%ldiag_ugwp) then allocate (Diag%du3dt_dyn (IM,Model%levs) ) @@ -3676,7 +6042,7 @@ subroutine diag_create (Diag, IM, Model) endif - !--- 3D diagnostics for Thompson MP + !--- 3D diagnostics for Thompson MP / GFDL MP allocate (Diag%refl_10cm(IM,Model%levs)) !-- New max hourly diag. @@ -3687,6 +6053,36 @@ subroutine diag_create (Diag, IM, Model) allocate (Diag%rh02max(IM)) allocate (Diag%rh02min(IM)) +#ifdef CCPP + !--- MYNN variables: + if (Model%do_mynnedmf) then + !print*,"Allocating all MYNN-EDMF variables:" + allocate (Diag%edmf_a (IM,Model%levs)) + allocate (Diag%edmf_w (IM,Model%levs)) + allocate (Diag%edmf_qt (IM,Model%levs)) + allocate (Diag%edmf_thl (IM,Model%levs)) + allocate (Diag%edmf_ent (IM,Model%levs)) + allocate (Diag%edmf_qc (IM,Model%levs)) + allocate (Diag%nupdraft (IM)) + allocate (Diag%maxmf (IM)) + allocate (Diag%ktop_shallow(IM)) + allocate (Diag%exch_h (IM,Model%levs)) + allocate (Diag%exch_m (IM,Model%levs)) + !print*,"Initializing all MYNN-EDMF variables with ",clear_val + Diag%edmf_a = clear_val + Diag%edmf_w = clear_val + Diag%edmf_qt = clear_val + Diag%edmf_thl = clear_val + Diag%edmf_ent = clear_val + Diag%edmf_qc = clear_val + Diag%nupdraft = 0 + Diag%maxmf = clear_val + Diag%ktop_shallow = 0 + Diag%exch_h = clear_val + Diag%exch_m = clear_val + endif +#endif + !--- diagnostics for coupled chemistry if (Model%cplchm) call Diag%chem_init(IM,Model) @@ -3781,6 +6177,9 @@ subroutine diag_phys_zero (Diag, Model, linit) Diag%dlwsfci = zero Diag%ulwsfci = zero Diag%dswsfci = zero +#ifdef CCPP + Diag%nswsfci = zero +#endif Diag%uswsfci = zero Diag%dusfci = zero Diag%dvsfci = zero @@ -3790,7 +6189,9 @@ subroutine diag_phys_zero (Diag, Model, linit) Diag%epi = zero Diag%smcwlt2 = zero Diag%smcref2 = zero - Diag%wet1 = zero + if (.not. Model%lsm == Model%lsm_ruc) then + Diag%wet1 = zero + end if Diag%sr = zero Diag%tdomr = zero Diag%tdomzr = zero @@ -3800,6 +6201,7 @@ subroutine diag_phys_zero (Diag, Model, linit) Diag%skebv_wts = zero Diag%sppt_wts = zero Diag%shum_wts = zero + Diag%zmtnblck = zero Diag%totprcpb = zero Diag%cnvprcpb = zero Diag%toticeb = zero @@ -4008,21 +6410,1008 @@ end function get_number_bins end subroutine diag_chem_init #ifdef CCPP -! DH* for testing of CCPP integration -!-------------------- -! GFS_fastphys_type%create -!-------------------- - subroutine fastphys_create (Fastphys) - + !------------------------- + ! GFS_interstitial_type%create + !------------------------- + subroutine interstitial_create (Interstitial, IM, Model) + ! + implicit none + ! + class(GFS_interstitial_type) :: Interstitial + integer, intent(in) :: IM + type(GFS_control_type), intent(in) :: Model + ! + allocate (Interstitial%otspt (Model%ntracp1,2)) + ! Set up numbers of tracers for PBL, convection, etc: sets + ! Interstitial%{nncl,nvdiff,mg3_as_mg2,nn,tracers_total,ntiwx,ntk,ntkev,otspt,nsamftrac,ncstrac} + call interstitial_setup_tracers(Interstitial, Model) + ! Allocate arrays + allocate (Interstitial%adjnirbmd (IM)) + allocate (Interstitial%adjnirbmu (IM)) + allocate (Interstitial%adjnirdfd (IM)) + allocate (Interstitial%adjnirdfu (IM)) + allocate (Interstitial%adjvisbmd (IM)) + allocate (Interstitial%adjvisbmu (IM)) + allocate (Interstitial%adjvisdfu (IM)) + allocate (Interstitial%adjvisdfd (IM)) + allocate (Interstitial%aerodp (IM,NSPC1)) + allocate (Interstitial%alb1d (IM)) + allocate (Interstitial%bexp1d (IM)) + allocate (Interstitial%cd (IM)) + allocate (Interstitial%cd_ice (IM)) + allocate (Interstitial%cd_land (IM)) + allocate (Interstitial%cd_ocean (IM)) + allocate (Interstitial%cdq (IM)) + allocate (Interstitial%cdq_ice (IM)) + allocate (Interstitial%cdq_land (IM)) + allocate (Interstitial%cdq_ocean (IM)) + allocate (Interstitial%cf_upi (IM,Model%levs)) + allocate (Interstitial%chh_ice (IM)) + allocate (Interstitial%chh_land (IM)) + allocate (Interstitial%chh_ocean (IM)) + allocate (Interstitial%clcn (IM,Model%levs)) + allocate (Interstitial%cldf (IM)) + allocate (Interstitial%cldsa (IM,5)) + allocate (Interstitial%cldtaulw (IM,Model%levr+LTP)) + allocate (Interstitial%cldtausw (IM,Model%levr+LTP)) + allocate (Interstitial%cld1d (IM)) + allocate (Interstitial%clouds (IM,Model%levr+LTP,NF_CLDS)) + allocate (Interstitial%clw (IM,Model%levs,Interstitial%nn)) + allocate (Interstitial%clx (IM,4)) + allocate (Interstitial%cmm_ice (IM)) + allocate (Interstitial%cmm_land (IM)) + allocate (Interstitial%cmm_ocean (IM)) + allocate (Interstitial%cnv_dqldt (IM,Model%levs)) + allocate (Interstitial%cnv_fice (IM,Model%levs)) + allocate (Interstitial%cnv_mfd (IM,Model%levs)) + allocate (Interstitial%cnv_ndrop (IM,Model%levs)) + allocate (Interstitial%cnv_nice (IM,Model%levs)) + allocate (Interstitial%cnvc (IM,Model%levs)) + allocate (Interstitial%cnvw (IM,Model%levs)) + allocate (Interstitial%ctei_r (IM)) + allocate (Interstitial%ctei_rml (IM)) + allocate (Interstitial%cumabs (IM)) + allocate (Interstitial%dd_mf (IM,Model%levs)) + allocate (Interstitial%de_lgth (IM)) + allocate (Interstitial%del (IM,Model%levs)) + allocate (Interstitial%del_gz (IM,Model%levs+1)) + allocate (Interstitial%delr (IM,Model%levr+LTP)) + allocate (Interstitial%dkt (IM,Model%levs-1)) + allocate (Interstitial%dlength (IM)) + allocate (Interstitial%dqdt (IM,Model%levs,Model%ntrac)) + allocate (Interstitial%dqsfc1 (IM)) + allocate (Interstitial%drain (IM)) + allocate (Interstitial%dtdt (IM,Model%levs)) + allocate (Interstitial%dtdtc (IM,Model%levs)) + allocate (Interstitial%dtsfc1 (IM)) + allocate (Interstitial%dt_mf (IM,Model%levs)) + allocate (Interstitial%dtzm (IM)) + allocate (Interstitial%dudt (IM,Model%levs)) + allocate (Interstitial%dusfcg (IM)) + allocate (Interstitial%dusfc1 (IM)) + allocate (Interstitial%dvdt (IM,Model%levs)) + allocate (Interstitial%dvsfcg (IM)) + allocate (Interstitial%dvsfc1 (IM)) + allocate (Interstitial%dvdftra (IM,Model%levs,Interstitial%nvdiff)) + allocate (Interstitial%dzlyr (IM,Model%levr+LTP)) + allocate (Interstitial%elvmax (IM)) + allocate (Interstitial%ep1d (IM)) + allocate (Interstitial%ep1d_ice (IM)) + allocate (Interstitial%ep1d_land (IM)) + allocate (Interstitial%ep1d_ocean (IM)) + allocate (Interstitial%evap (IM)) + allocate (Interstitial%evap_ice (IM)) + allocate (Interstitial%evap_land (IM)) + allocate (Interstitial%evap_ocean (IM)) + allocate (Interstitial%evbs (IM)) + allocate (Interstitial%evcw (IM)) + allocate (Interstitial%faerlw (IM,Model%levr+LTP,NBDLW,NF_AELW)) + allocate (Interstitial%faersw (IM,Model%levr+LTP,NBDSW,NF_AESW)) + allocate (Interstitial%ffhh_ice (IM)) + allocate (Interstitial%ffhh_land (IM)) + allocate (Interstitial%ffhh_ocean (IM)) + allocate (Interstitial%fh2 (IM)) + allocate (Interstitial%fh2_ice (IM)) + allocate (Interstitial%fh2_land (IM)) + allocate (Interstitial%fh2_ocean (IM)) + allocate (Interstitial%flag_cice (IM)) + allocate (Interstitial%flag_guess (IM)) + allocate (Interstitial%flag_iter (IM)) + allocate (Interstitial%ffmm_ice (IM)) + allocate (Interstitial%ffmm_land (IM)) + allocate (Interstitial%ffmm_ocean (IM)) + allocate (Interstitial%fm10 (IM)) + allocate (Interstitial%fm10_ice (IM)) + allocate (Interstitial%fm10_land (IM)) + allocate (Interstitial%fm10_ocean (IM)) + allocate (Interstitial%frland (IM)) + allocate (Interstitial%fscav (Model%ntrac-Model%ncld+2)) + allocate (Interstitial%fswtr (Model%ntrac-Model%ncld+2)) + allocate (Interstitial%gabsbdlw (IM)) + allocate (Interstitial%gamma (IM)) + allocate (Interstitial%gamq (IM)) + allocate (Interstitial%gamt (IM)) + allocate (Interstitial%gasvmr (IM,Model%levr+LTP,NF_VGAS)) + allocate (Interstitial%gflx (IM)) + allocate (Interstitial%gflx_ice (IM)) + allocate (Interstitial%gflx_land (IM)) + allocate (Interstitial%gflx_ocean (IM)) + allocate (Interstitial%gwdcu (IM,Model%levs)) + allocate (Interstitial%gwdcv (IM,Model%levs)) + allocate (Interstitial%h2o_pres (levh2o)) + allocate (Interstitial%hflx (IM)) + allocate (Interstitial%hflx_ice (IM)) + allocate (Interstitial%hflx_land (IM)) + allocate (Interstitial%hflx_ocean (IM)) + allocate (Interstitial%hprime1 (IM)) + allocate (Interstitial%dry (IM)) + allocate (Interstitial%idxday (IM)) + allocate (Interstitial%icy (IM)) + allocate (Interstitial%lake (IM)) + allocate (Interstitial%ocean (IM)) + allocate (Interstitial%islmsk (IM)) + allocate (Interstitial%wet (IM)) + allocate (Interstitial%kbot (IM)) + allocate (Interstitial%kcnv (IM)) + allocate (Interstitial%kinver (IM)) + allocate (Interstitial%kpbl (IM)) + allocate (Interstitial%ktop (IM)) + allocate (Interstitial%mbota (IM,3)) + allocate (Interstitial%mtopa (IM,3)) + allocate (Interstitial%oa4 (IM,4)) + allocate (Interstitial%oc (IM)) + allocate (Interstitial%olyr (IM,Model%levr+LTP)) + allocate (Interstitial%oz_pres (levozp)) + allocate (Interstitial%plvl (IM,Model%levr+1+LTP)) + allocate (Interstitial%plyr (IM,Model%levr+LTP)) + allocate (Interstitial%prnum (IM,Model%levs)) + allocate (Interstitial%qicn (IM,Model%levs)) + allocate (Interstitial%qlcn (IM,Model%levs)) + allocate (Interstitial%qlyr (IM,Model%levr+LTP)) + allocate (Interstitial%prcpmp (IM)) + allocate (Interstitial%qss (IM)) + allocate (Interstitial%qss_ice (IM)) + allocate (Interstitial%qss_land (IM)) + allocate (Interstitial%qss_ocean (IM)) + allocate (Interstitial%raincd (IM)) + allocate (Interstitial%raincs (IM)) + allocate (Interstitial%rainmcadj (IM)) + allocate (Interstitial%rainp (IM,Model%levs)) + allocate (Interstitial%rb (IM)) + allocate (Interstitial%rb_ice (IM)) + allocate (Interstitial%rb_land (IM)) + allocate (Interstitial%rb_ocean (IM)) + allocate (Interstitial%rhc (IM,Model%levs)) + allocate (Interstitial%runoff (IM)) + allocate (Interstitial%save_q (IM,Model%levs,Model%ntrac)) + allocate (Interstitial%save_t (IM,Model%levs)) + allocate (Interstitial%save_u (IM,Model%levs)) + allocate (Interstitial%save_v (IM,Model%levs)) + allocate (Interstitial%sbsno (IM)) + allocate (Interstitial%scmpsw (IM)) + allocate (Interstitial%sfcalb (IM,NF_ALBD)) + allocate (Interstitial%sigma (IM)) + allocate (Interstitial%sigmaf (IM)) + allocate (Interstitial%sigmafrac (IM,Model%levs)) + allocate (Interstitial%sigmatot (IM,Model%levs)) + allocate (Interstitial%slopetype (IM)) + allocate (Interstitial%snowc (IM)) + allocate (Interstitial%snowd_ice (IM)) + allocate (Interstitial%snowd_land (IM)) + allocate (Interstitial%snowd_ocean(IM)) + allocate (Interstitial%snohf (IM)) + allocate (Interstitial%snowmt (IM)) + allocate (Interstitial%soiltype (IM)) + allocate (Interstitial%stress (IM)) + allocate (Interstitial%stress_ice (IM)) + allocate (Interstitial%stress_land(IM)) + allocate (Interstitial%stress_ocean(IM)) + allocate (Interstitial%theta (IM)) + allocate (Interstitial%tice (IM)) + allocate (Interstitial%tlvl (IM,Model%levr+1+LTP)) + allocate (Interstitial%tlyr (IM,Model%levr+LTP)) + allocate (Interstitial%tprcp_ice (IM)) + allocate (Interstitial%tprcp_land (IM)) + allocate (Interstitial%tprcp_ocean(IM)) + allocate (Interstitial%trans (IM)) + allocate (Interstitial%tseal (IM)) + allocate (Interstitial%tsfa (IM)) + allocate (Interstitial%tsfc_ice (IM)) + allocate (Interstitial%tsfc_land (IM)) + allocate (Interstitial%tsfc_ocean (IM)) + allocate (Interstitial%tsfg (IM)) + allocate (Interstitial%tsurf (IM)) + allocate (Interstitial%tsurf_ice (IM)) + allocate (Interstitial%tsurf_land (IM)) + allocate (Interstitial%tsurf_ocean(IM)) + allocate (Interstitial%ud_mf (IM,Model%levs)) + allocate (Interstitial%ulwsfc_cice(IM)) + allocate (Interstitial%uustar_ice (IM)) + allocate (Interstitial%uustar_land(IM)) + allocate (Interstitial%uustar_ocean(IM)) + allocate (Interstitial%vdftra (IM,Model%levs,Interstitial%nvdiff)) !GJF first dimension was set as 'IX' in GFS_physics_driver + allocate (Interstitial%vegf1d (IM)) + allocate (Interstitial%vegtype (IM)) + allocate (Interstitial%w_upi (IM,Model%levs)) + allocate (Interstitial%wcbmax (IM)) + allocate (Interstitial%weasd_ice (IM)) + allocate (Interstitial%weasd_land (IM)) + allocate (Interstitial%weasd_ocean(IM)) + allocate (Interstitial%wind (IM)) + allocate (Interstitial%work1 (IM)) + allocate (Interstitial%work2 (IM)) + allocate (Interstitial%work3 (IM)) + allocate (Interstitial%xcosz (IM)) + allocate (Interstitial%xlai1d (IM)) + allocate (Interstitial%xmu (IM)) + allocate (Interstitial%z01d (IM)) + allocate (Interstitial%zorl_ice (IM)) + allocate (Interstitial%zorl_land (IM)) + allocate (Interstitial%zorl_ocean (IM)) + allocate (Interstitial%zt1d (IM)) + ! Allocate arrays that are conditional on physics choices + if (Model%imp_physics == Model%imp_physics_gfdl .or. Model%imp_physics == Model%imp_physics_thompson) then + allocate (Interstitial%graupelmp (IM)) + allocate (Interstitial%icemp (IM)) + allocate (Interstitial%rainmp (IM)) + allocate (Interstitial%snowmp (IM)) + else if (Model%imp_physics == Model%imp_physics_mg) then + allocate (Interstitial%ncgl (IM,Model%levs)) + allocate (Interstitial%ncpr (IM,Model%levs)) + allocate (Interstitial%ncps (IM,Model%levs)) + allocate (Interstitial%qgl (IM,Model%levs)) + allocate (Interstitial%qrn (IM,Model%levs)) + allocate (Interstitial%qsnw (IM,Model%levs)) + end if + if (Model%do_shoc) then + if (.not. associated(Interstitial%qrn)) allocate (Interstitial%qrn (IM,Model%levs)) + if (.not. associated(Interstitial%qsnw)) allocate (Interstitial%qsnw (IM,Model%levs)) + ! DH* updated version of shoc from May 22 2019 (not yet in CCPP) doesn't use qgl? remove? + if (.not. associated(Interstitial%qgl)) allocate (Interstitial%qgl (IM,Model%levs)) + ! *DH + allocate (Interstitial%ncpi (IM,Model%levs)) + allocate (Interstitial%ncpl (IM,Model%levs)) + end if + ! + ! Set components that do not change + Interstitial%im = IM + Interstitial%ipr = min(IM,10) + Interstitial%ix = IM + Interstitial%latidxprnt = 1 + Interstitial%levi = Model%levs+1 + Interstitial%levh2o = levh2o + Interstitial%levozp = levozp + Interstitial%lm = Model%levr + Interstitial%lmk = Model%levr+LTP + Interstitial%lmp = Model%levr+1+LTP + Interstitial%h2o_coeff = h2o_coeff + Interstitial%oz_coeff = oz_coeff + ! h2o_pres and oz_pres do not change during the run, but + ! need to be set later in GFS_phys_time_vary_init (after + ! h2o_pres/oz_pres are read in read_h2odata/read_o3data) + Interstitial%h2o_pres = clear_val + Interstitial%oz_pres = clear_val + ! + Interstitial%skip_macro = .false. + ! The value phys_hydrostatic from dynamics does not match the + ! hardcoded value for calling GFDL MP in GFS_physics_driver.F90, + ! which is set to .true. + Interstitial%phys_hydrostatic = .true. + ! + ! Reset all other variables + call Interstitial%rad_reset () + call Interstitial%phys_reset (Model) + ! + end subroutine interstitial_create + + subroutine interstitial_setup_tracers(Interstitial, Model) + ! implicit none + ! + class(GFS_interstitial_type) :: Interstitial + type(GFS_control_type), intent(in) :: Model + integer :: n, tracers + + !first, initialize the values (in case the values don't get initialized within if statements below) + Interstitial%nncl = Model%ncld + Interstitial%nvdiff = Model%ntrac + Interstitial%mg3_as_mg2 = .false. + Interstitial%nn = Model%ntrac + 1 + Interstitial%ntk = 0 + Interstitial%ntkev = 0 + Interstitial%tracers_total = 0 + Interstitial%otspt(:,:) = .true. + Interstitial%nsamftrac = 0 + Interstitial%ncstrac = 0 + + if (Model%imp_physics == Model%imp_physics_thompson) then + if (Model%ltaerosol) then + Interstitial%nvdiff = 8 + else + Interstitial%nvdiff = 5 + endif + if (Model%satmedmf) Interstitial%nvdiff = Interstitial%nvdiff + 1 + Interstitial%nncl = 5 + elseif (Model%imp_physics == Model%imp_physics_wsm6) then + Interstitial%nvdiff = Model%ntrac -3 + if (Model%satmedmf) Interstitial%nvdiff = Interstitial%nvdiff + 1 + Interstitial%nncl = 5 + elseif (Model%ntclamt > 0) then ! for GFDL MP don't diffuse cloud amount + Interstitial%nvdiff = Model%ntrac - 1 + endif - class(GFS_fastphys_type) :: Fastphys + if (Model%imp_physics == Model%imp_physics_gfdl) then + Interstitial%nncl = 5 + endif + + if (Model%imp_physics == Model%imp_physics_mg) then + if (abs(Model%fprcp) == 1) then + Interstitial%nncl = 4 ! MG2 with rain and snow + Interstitial%mg3_as_mg2 = .false. + elseif (Model%fprcp >= 2) then + if(Model%ntgl > 0 .and. (Model%mg_do_graupel .or. Model%mg_do_hail)) then + Interstitial%nncl = 5 ! MG3 with rain and snow and grapuel/hail + Interstitial%mg3_as_mg2 = .false. + else ! MG3 code run without graupel/hail i.e. as MG2 + Interstitial%nncl = 4 + Interstitial%mg3_as_mg2 = .true. + endif + endif + endif + + ! DH* STILL VALID GIVEN THE CHANGES BELOW FOR CPLCHM? + if (Interstitial%nvdiff == Model%ntrac) then + Interstitial%ntiwx = Model%ntiw + else + if (Model%imp_physics == Model%imp_physics_wsm6) then + Interstitial%ntiwx = 3 + elseif (Model%imp_physics == Model%imp_physics_thompson) then + if(Model%ltaerosol) then + Interstitial%ntiwx = 3 + else + Interstitial%ntiwx = 3 + endif + elseif (Model%imp_physics == Model%imp_physics_gfdl) then + Interstitial%ntiwx = 3 + elseif (Model%imp_physics == Model%imp_physics_mg) then + Interstitial%ntiwx = 3 + else + Interstitial%ntiwx = 0 + endif + endif + ! *DH + + if (Model%cplchm) then + if (Model%imp_physics == Model%imp_physics_zhao_carr) then + Interstitial%nvdiff = 3 + elseif (Model%imp_physics == Model%imp_physics_mg) then + if (Model%ntgl > 0) then + Interstitial%nvdiff = 12 + else + Interstitial%nvdiff = 10 + endif + elseif (Model%imp_physics == Model%imp_physics_gfdl) then + Interstitial%nvdiff = 7 + ! DH* WHAT ABOUT THOMPSON? *DH + endif + if (Model%ntke > 0) Interstitial%nvdiff = Interstitial%nvdiff + 1 ! adding tke to the list + endif - Fastphys%dummy = 0 - Fastphys%errmsg = '' - Fastphys%errflg = 0 + Interstitial%ntkev = Interstitial%nvdiff - end subroutine fastphys_create + if (Model%ntiw > 0) then + if (Model%ntclamt > 0) then + Interstitial%nn = Model%ntrac - 2 + else + Interstitial%nn = Model%ntrac - 1 + endif + elseif (Model%ntcw > 0) then + Interstitial%nn = Model%ntrac + else + Interstitial%nn = Model%ntrac + 1 + endif + + if (Model%cscnv .or. Model%satmedmf .or. Model%trans_trac ) then + Interstitial%otspt(:,:) = .true. ! otspt is used only for cscnv + Interstitial%otspt(1:3,:) = .false. ! this is for sp.hum, ice and liquid water + tracers = 2 + do n=2,Model%ntrac + if ( n /= Model%ntcw .and. n /= Model%ntiw .and. n /= Model%ntclamt .and. & + n /= Model%ntrw .and. n /= Model%ntsw .and. n /= Model%ntrnc .and. & + n /= Model%ntsnc .and. n /= Model%ntgl .and. n /= Model%ntgnc) then + tracers = tracers + 1 + if (Model%ntke == n ) then + Interstitial%otspt(tracers+1,1) = .false. + Interstitial%ntk = tracers + endif + if (Model%ntlnc == n .or. Model%ntinc == n .or. Model%ntrnc == n .or. Model%ntsnc == n .or. Model%ntgnc == n) & +! if (ntlnc == n .or. ntinc == n .or. ntrnc == n .or. ntsnc == n .or.& +! ntrw == n .or. ntsw == n .or. ntgl == n) & + Interstitial%otspt(tracers+1,1) = .false. + endif + enddo + Interstitial%tracers_total = tracers - 2 + endif ! end if_ras or cfscnv or samf + if(.not. Model%satmedmf .and. .not. Model%trans_trac) then + Interstitial%nsamftrac = 0 + else + Interstitial%nsamftrac = Interstitial%tracers_total + endif + Interstitial%ncstrac = Interstitial%tracers_total + 3 + + end subroutine interstitial_setup_tracers + + subroutine interstitial_rad_reset (Interstitial) + ! + implicit none + ! + class(GFS_interstitial_type) :: Interstitial + ! + Interstitial%aerodp = clear_val + Interstitial%alb1d = clear_val + Interstitial%cldsa = clear_val + Interstitial%cldtaulw = clear_val + Interstitial%cldtausw = clear_val + Interstitial%clouds = clear_val + Interstitial%de_lgth = clear_val + Interstitial%delr = clear_val + Interstitial%dzlyr = clear_val + Interstitial%faerlw = clear_val + Interstitial%faersw = clear_val + Interstitial%gasvmr = clear_val + Interstitial%idxday = 0 + Interstitial%kb = 0 + Interstitial%kd = 0 + Interstitial%kt = 0 + Interstitial%mbota = 0 + Interstitial%mtopa = 0 + Interstitial%nday = 0 + Interstitial%olyr = clear_val + Interstitial%plvl = clear_val + Interstitial%plyr = clear_val + Interstitial%qlyr = clear_val + Interstitial%raddt = clear_val + Interstitial%scmpsw%uvbfc = clear_val + Interstitial%scmpsw%uvbf0 = clear_val + Interstitial%scmpsw%nirbm = clear_val + Interstitial%scmpsw%nirdf = clear_val + Interstitial%scmpsw%visbm = clear_val + Interstitial%scmpsw%visdf = clear_val + Interstitial%sfcalb = clear_val + Interstitial%tlvl = clear_val + Interstitial%tlyr = clear_val + Interstitial%tsfa = clear_val + Interstitial%tsfg = clear_val + ! + end subroutine interstitial_rad_reset + + subroutine interstitial_phys_reset (Interstitial, Model) + ! + implicit none + ! + class(GFS_interstitial_type) :: Interstitial + type(GFS_control_type), intent(in) :: Model + ! + Interstitial%adjnirbmd = clear_val + Interstitial%adjnirbmu = clear_val + Interstitial%adjnirdfd = clear_val + Interstitial%adjnirdfu = clear_val + Interstitial%adjvisbmd = clear_val + Interstitial%adjvisbmu = clear_val + Interstitial%adjvisdfu = clear_val + Interstitial%adjvisdfd = clear_val + Interstitial%bexp1d = clear_val + Interstitial%cd = clear_val + Interstitial%cd_ice = huge + Interstitial%cd_land = huge + Interstitial%cd_ocean = huge + Interstitial%cdq = clear_val + Interstitial%cdq_ice = huge + Interstitial%cdq_land = huge + Interstitial%cdq_ocean = huge + Interstitial%cf_upi = clear_val + Interstitial%chh_ice = huge + Interstitial%chh_land = huge + Interstitial%chh_ocean = huge + Interstitial%clcn = clear_val + Interstitial%cld1d = clear_val + Interstitial%cldf = clear_val + Interstitial%clw = clear_val + Interstitial%clw(:,:,2) = -999.9 + Interstitial%clx = clear_val + Interstitial%cmm_ice = huge + Interstitial%cmm_land = huge + Interstitial%cmm_ocean = huge + Interstitial%cnv_dqldt = clear_val + Interstitial%cnv_fice = clear_val + Interstitial%cnv_mfd = clear_val + Interstitial%cnv_ndrop = clear_val + Interstitial%cnv_nice = clear_val + Interstitial%cnvc = clear_val + Interstitial%cnvw = clear_val + Interstitial%ctei_r = clear_val + Interstitial%ctei_rml = clear_val + Interstitial%cumabs = clear_val + Interstitial%dd_mf = clear_val + Interstitial%del = clear_val + Interstitial%del_gz = clear_val + Interstitial%dkt = clear_val + Interstitial%dlength = clear_val + Interstitial%dqdt = clear_val + Interstitial%dqsfc1 = clear_val + Interstitial%drain = clear_val + Interstitial%dt_mf = clear_val + Interstitial%dtdt = clear_val + Interstitial%dtdtc = clear_val + Interstitial%dtsfc1 = clear_val + Interstitial%dtzm = clear_val + Interstitial%dudt = clear_val + Interstitial%dusfcg = clear_val + Interstitial%dusfc1 = clear_val + Interstitial%dvdftra = clear_val + Interstitial%dvdt = clear_val + Interstitial%dvsfcg = clear_val + Interstitial%dvsfc1 = clear_val + Interstitial%elvmax = clear_val + Interstitial%ep1d = clear_val + Interstitial%ep1d_ice = huge + Interstitial%ep1d_land = huge + Interstitial%ep1d_ocean = huge + Interstitial%evap = clear_val + Interstitial%evap_ice = huge + Interstitial%evap_land = huge + Interstitial%evap_ocean = huge + Interstitial%evbs = clear_val + Interstitial%evcw = clear_val + Interstitial%ffhh_ice = huge + Interstitial%ffhh_land = huge + Interstitial%ffhh_ocean = huge + Interstitial%fh2 = clear_val + Interstitial%fh2_ice = huge + Interstitial%fh2_land = huge + Interstitial%fh2_ocean = huge + Interstitial%flag_cice = .false. + Interstitial%flag_guess = .false. + Interstitial%flag_iter = .true. + Interstitial%ffmm_ice = huge + Interstitial%ffmm_land = huge + Interstitial%ffmm_ocean = huge + Interstitial%fm10 = clear_val + Interstitial%fm10_ice = huge + Interstitial%fm10_land = huge + Interstitial%fm10_ocean = huge + Interstitial%frain = clear_val + Interstitial%frland = clear_val + Interstitial%fscav = clear_val + Interstitial%fswtr = clear_val + Interstitial%gabsbdlw = clear_val + Interstitial%gamma = clear_val + Interstitial%gamq = clear_val + Interstitial%gamt = clear_val + Interstitial%gflx = clear_val + Interstitial%gflx_ice = huge + Interstitial%gflx_land = huge + Interstitial%gflx_ocean = huge + Interstitial%gwdcu = clear_val + Interstitial%gwdcv = clear_val + Interstitial%hflx = clear_val + Interstitial%hflx_ice = huge + Interstitial%hflx_land = huge + Interstitial%hflx_ocean = huge + Interstitial%hprime1 = clear_val + Interstitial%dry = .false. + Interstitial%icy = .false. + Interstitial%lake = .false. + Interstitial%ocean = .false. + Interstitial%islmsk = 0 + Interstitial%wet = .false. + Interstitial%kbot = Model%levs + Interstitial%kcnv = 0 + Interstitial%kinver = Model%levs + Interstitial%kpbl = 0 + Interstitial%ktop = 1 + Interstitial%oa4 = clear_val + Interstitial%oc = clear_val + Interstitial%prcpmp = clear_val + Interstitial%prnum = clear_val + Interstitial%qicn = clear_val + Interstitial%qlcn = clear_val + Interstitial%qss = clear_val + Interstitial%qss_ice = huge + Interstitial%qss_land = huge + Interstitial%qss_ocean = huge + Interstitial%raincd = clear_val + Interstitial%raincs = clear_val + Interstitial%rainmcadj = clear_val + Interstitial%rainp = clear_val + Interstitial%rb = clear_val + Interstitial%rb_ice = huge + Interstitial%rb_land = huge + Interstitial%rb_ocean = huge + Interstitial%rhc = clear_val + Interstitial%runoff = clear_val + Interstitial%save_q = clear_val + Interstitial%save_t = clear_val + Interstitial%save_u = clear_val + Interstitial%save_v = clear_val + Interstitial%sbsno = clear_val + Interstitial%sigma = clear_val + Interstitial%sigmaf = clear_val + Interstitial%sigmafrac = clear_val + Interstitial%sigmatot = clear_val + Interstitial%slopetype = 0 + Interstitial%snowc = clear_val + Interstitial%snowd_ice = huge + Interstitial%snowd_land = huge + Interstitial%snowd_ocean = huge + Interstitial%snohf = clear_val + Interstitial%snowmt = clear_val + Interstitial%soiltype = 0 + Interstitial%stress = clear_val + Interstitial%stress_ice = huge + Interstitial%stress_land = huge + Interstitial%stress_ocean = huge + Interstitial%theta = clear_val + Interstitial%tice = clear_val + Interstitial%tprcp_ice = huge + Interstitial%tprcp_land = huge + Interstitial%tprcp_ocean = huge + Interstitial%trans = clear_val + Interstitial%tseal = clear_val + Interstitial%tsfc_ice = huge + Interstitial%tsfc_land = huge + Interstitial%tsfc_ocean = huge + Interstitial%tsurf = clear_val + Interstitial%tsurf_ice = huge + Interstitial%tsurf_land = huge + Interstitial%tsurf_ocean = huge + Interstitial%ud_mf = clear_val + Interstitial%ulwsfc_cice = clear_val + Interstitial%uustar_ice = huge + Interstitial%uustar_land = huge + Interstitial%uustar_ocean = huge + Interstitial%vdftra = clear_val + Interstitial%vegf1d = clear_val + Interstitial%vegtype = 0 + Interstitial%w_upi = clear_val + Interstitial%wcbmax = clear_val + Interstitial%weasd_ice = huge + Interstitial%weasd_land = huge + Interstitial%weasd_ocean = huge + Interstitial%wind = huge + Interstitial%work1 = clear_val + Interstitial%work2 = clear_val + Interstitial%work3 = clear_val + Interstitial%xcosz = clear_val + Interstitial%xlai1d = clear_val + Interstitial%xmu = clear_val + Interstitial%z01d = clear_val + Interstitial%zorl_ice = huge + Interstitial%zorl_land = huge + Interstitial%zorl_ocean = huge + Interstitial%zt1d = clear_val + ! Reset fields that are conditional on physics choices + if (Model%imp_physics == Model%imp_physics_gfdl .or. Model%imp_physics == Model%imp_physics_thompson) then + Interstitial%graupelmp = clear_val + Interstitial%icemp = clear_val + Interstitial%rainmp = clear_val + Interstitial%snowmp = clear_val + else if (Model%imp_physics == Model%imp_physics_mg) then + Interstitial%ncgl = clear_val + Interstitial%ncpr = clear_val + Interstitial%ncps = clear_val + Interstitial%qgl = clear_val + Interstitial%qrn = clear_val + Interstitial%qsnw = clear_val + end if + if (Model%do_shoc) then + Interstitial%qrn = clear_val + Interstitial%qsnw = clear_val + ! DH* updated version of shoc from May 22 2019 doesn't use qgl? remove? + Interstitial%qgl = clear_val + ! *DH + Interstitial%ncpi = clear_val + Interstitial%ncpl = clear_val + end if + ! + ! Set flag for resetting maximum hourly output fields + Interstitial%reset = mod(Model%kdt-1, nint(Model%avg_max_length/Model%dtp)) == 0 + ! + end subroutine interstitial_phys_reset + + subroutine interstitial_print(Interstitial, Model, mpirank, omprank, blkno) + ! + implicit none + ! + class(GFS_interstitial_type) :: Interstitial + type(GFS_control_type), intent(in) :: Model + integer, intent(in) :: mpirank, omprank, blkno + ! + ! Print static variables + write (0,'(a,3i6)') 'Interstitial_print for mpirank, omprank, blkno: ', mpirank, omprank, blkno + write (0,*) 'Interstitial_print: values that do not change' + write (0,*) 'Interstitial%h2o_coeff = ', Interstitial%h2o_coeff + write (0,*) 'sum(Interstitial%h2o_pres) = ', sum(Interstitial%h2o_pres) + write (0,*) 'Interstitial%im = ', Interstitial%im + write (0,*) 'Interstitial%ipr = ', Interstitial%ipr + write (0,*) 'Interstitial%ix = ', Interstitial%ix + write (0,*) 'Interstitial%latidxprnt = ', Interstitial%latidxprnt + write (0,*) 'Interstitial%levi = ', Interstitial%levi + write (0,*) 'Interstitial%levh2o = ', Interstitial%levh2o + write (0,*) 'Interstitial%levozp = ', Interstitial%levozp + write (0,*) 'Interstitial%lm = ', Interstitial%lm + write (0,*) 'Interstitial%lmk = ', Interstitial%lmk + write (0,*) 'Interstitial%lmp = ', Interstitial%lmp + write (0,*) 'Interstitial%nsamftrac = ', Interstitial%nsamftrac + write (0,*) 'Interstitial%ntiwx = ', Interstitial%ntiwx + write (0,*) 'Interstitial%nvdiff = ', Interstitial%nvdiff + write (0,*) 'Interstitial%oz_coeff = ', Interstitial%oz_coeff + write (0,*) 'sum(Interstitial%oz_pres) = ', sum(Interstitial%oz_pres) + write (0,*) 'Interstitial%phys_hydrostatic = ', Interstitial%phys_hydrostatic + write (0,*) 'Interstitial%skip_macro = ', Interstitial%skip_macro + ! Print all other variables + write (0,*) 'Interstitial_print: values that change' + write (0,*) 'sum(Interstitial%adjnirbmd ) = ', sum(Interstitial%adjnirbmd ) + write (0,*) 'sum(Interstitial%adjnirbmu ) = ', sum(Interstitial%adjnirbmu ) + write (0,*) 'sum(Interstitial%adjnirdfd ) = ', sum(Interstitial%adjnirdfd ) + write (0,*) 'sum(Interstitial%adjnirdfu ) = ', sum(Interstitial%adjnirdfu ) + write (0,*) 'sum(Interstitial%adjvisbmd ) = ', sum(Interstitial%adjvisbmd ) + write (0,*) 'sum(Interstitial%adjvisbmu ) = ', sum(Interstitial%adjvisbmu ) + write (0,*) 'sum(Interstitial%adjvisdfu ) = ', sum(Interstitial%adjvisdfu ) + write (0,*) 'sum(Interstitial%adjvisdfd ) = ', sum(Interstitial%adjvisdfd ) + write (0,*) 'sum(Interstitial%aerodp ) = ', sum(Interstitial%aerodp ) + write (0,*) 'sum(Interstitial%alb1d ) = ', sum(Interstitial%alb1d ) + write (0,*) 'sum(Interstitial%bexp1d ) = ', sum(Interstitial%bexp1d ) + write (0,*) 'sum(Interstitial%cd ) = ', sum(Interstitial%cd ) + write (0,*) 'sum(Interstitial%cd_ice ) = ', sum(Interstitial%cd_ice ) + write (0,*) 'sum(Interstitial%cd_land ) = ', sum(Interstitial%cd_land ) + write (0,*) 'sum(Interstitial%cd_ocean ) = ', sum(Interstitial%cd_ocean ) + write (0,*) 'sum(Interstitial%cdq ) = ', sum(Interstitial%cdq ) + write (0,*) 'sum(Interstitial%cdq_ice ) = ', sum(Interstitial%cdq_ice ) + write (0,*) 'sum(Interstitial%cdq_land ) = ', sum(Interstitial%cdq_land ) + write (0,*) 'sum(Interstitial%cdq_ocean ) = ', sum(Interstitial%cdq_ocean ) + write (0,*) 'sum(Interstitial%cf_upi ) = ', sum(Interstitial%cf_upi ) + write (0,*) 'sum(Interstitial%chh_ice ) = ', sum(Interstitial%chh_ice ) + write (0,*) 'sum(Interstitial%chh_land ) = ', sum(Interstitial%chh_land ) + write (0,*) 'sum(Interstitial%chh_ocean ) = ', sum(Interstitial%chh_ocean ) + write (0,*) 'sum(Interstitial%clcn ) = ', sum(Interstitial%clcn ) + write (0,*) 'sum(Interstitial%cldf ) = ', sum(Interstitial%cldf ) + write (0,*) 'sum(Interstitial%cldsa ) = ', sum(Interstitial%cldsa ) + write (0,*) 'sum(Interstitial%cldtaulw ) = ', sum(Interstitial%cldtaulw ) + write (0,*) 'sum(Interstitial%cldtausw ) = ', sum(Interstitial%cldtausw ) + write (0,*) 'sum(Interstitial%cld1d ) = ', sum(Interstitial%cld1d ) + write (0,*) 'sum(Interstitial%clw ) = ', sum(Interstitial%clw ) + write (0,*) 'sum(Interstitial%clx ) = ', sum(Interstitial%clx ) + write (0,*) 'sum(Interstitial%clouds ) = ', sum(Interstitial%clouds ) + write (0,*) 'sum(Interstitial%cmm_ice ) = ', sum(Interstitial%cmm_ice ) + write (0,*) 'sum(Interstitial%cmm_land ) = ', sum(Interstitial%cmm_land ) + write (0,*) 'sum(Interstitial%cmm_ocean ) = ', sum(Interstitial%cmm_ocean ) + write (0,*) 'sum(Interstitial%cnv_dqldt ) = ', sum(Interstitial%cnv_dqldt ) + write (0,*) 'sum(Interstitial%cnv_fice ) = ', sum(Interstitial%cnv_fice ) + write (0,*) 'sum(Interstitial%cnv_mfd ) = ', sum(Interstitial%cnv_mfd ) + write (0,*) 'sum(Interstitial%cnv_ndrop ) = ', sum(Interstitial%cnv_ndrop ) + write (0,*) 'sum(Interstitial%cnv_nice ) = ', sum(Interstitial%cnv_nice ) + write (0,*) 'sum(Interstitial%cnvc ) = ', sum(Interstitial%cnvc ) + write (0,*) 'sum(Interstitial%cnvw ) = ', sum(Interstitial%cnvw ) + write (0,*) 'sum(Interstitial%ctei_r ) = ', sum(Interstitial%ctei_r ) + write (0,*) 'sum(Interstitial%ctei_rml ) = ', sum(Interstitial%ctei_rml ) + write (0,*) 'sum(Interstitial%cumabs ) = ', sum(Interstitial%cumabs ) + write (0,*) 'sum(Interstitial%dd_mf ) = ', sum(Interstitial%dd_mf ) + write (0,*) 'sum(Interstitial%de_lgth ) = ', sum(Interstitial%de_lgth ) + write (0,*) 'sum(Interstitial%del ) = ', sum(Interstitial%del ) + write (0,*) 'sum(Interstitial%del_gz ) = ', sum(Interstitial%del_gz ) + write (0,*) 'sum(Interstitial%delr ) = ', sum(Interstitial%delr ) + write (0,*) 'sum(Interstitial%dkt ) = ', sum(Interstitial%dkt ) + write (0,*) 'sum(Interstitial%dlength ) = ', sum(Interstitial%dlength ) + write (0,*) 'sum(Interstitial%dqdt ) = ', sum(Interstitial%dqdt ) + write (0,*) 'sum(Interstitial%dqsfc1 ) = ', sum(Interstitial%dqsfc1 ) + write (0,*) 'sum(Interstitial%drain ) = ', sum(Interstitial%drain ) + write (0,*) 'sum(Interstitial%dtdt ) = ', sum(Interstitial%dtdt ) + write (0,*) 'sum(Interstitial%dtdtc ) = ', sum(Interstitial%dtdtc ) + write (0,*) 'sum(Interstitial%dtsfc1 ) = ', sum(Interstitial%dtsfc1 ) + write (0,*) 'sum(Interstitial%dtzm ) = ', sum(Interstitial%dtzm ) + write (0,*) 'sum(Interstitial%dt_mf ) = ', sum(Interstitial%dt_mf ) + write (0,*) 'sum(Interstitial%dudt ) = ', sum(Interstitial%dudt ) + write (0,*) 'sum(Interstitial%dusfcg ) = ', sum(Interstitial%dusfcg ) + write (0,*) 'sum(Interstitial%dusfc1 ) = ', sum(Interstitial%dusfc1 ) + write (0,*) 'sum(Interstitial%dvdftra ) = ', sum(Interstitial%dvdftra ) + write (0,*) 'sum(Interstitial%dvdt ) = ', sum(Interstitial%dvdt ) + write (0,*) 'sum(Interstitial%dvsfcg ) = ', sum(Interstitial%dvsfcg ) + write (0,*) 'sum(Interstitial%dvsfc1 ) = ', sum(Interstitial%dvsfc1 ) + write (0,*) 'sum(Interstitial%dzlyr ) = ', sum(Interstitial%dzlyr ) + write (0,*) 'sum(Interstitial%elvmax ) = ', sum(Interstitial%elvmax ) + write (0,*) 'sum(Interstitial%ep1d ) = ', sum(Interstitial%ep1d ) + write (0,*) 'sum(Interstitial%ep1d_ice ) = ', sum(Interstitial%ep1d_ice ) + write (0,*) 'sum(Interstitial%ep1d_land ) = ', sum(Interstitial%ep1d_land ) + write (0,*) 'sum(Interstitial%ep1d_ocean ) = ', sum(Interstitial%ep1d_ocean ) + write (0,*) 'sum(Interstitial%evap ) = ', sum(Interstitial%evap ) + write (0,*) 'sum(Interstitial%evap_ice ) = ', sum(Interstitial%evap_ice ) + write (0,*) 'sum(Interstitial%evap_land ) = ', sum(Interstitial%evap_land ) + write (0,*) 'sum(Interstitial%evap_ocean ) = ', sum(Interstitial%evap_ocean ) + write (0,*) 'sum(Interstitial%evbs ) = ', sum(Interstitial%evbs ) + write (0,*) 'sum(Interstitial%evcw ) = ', sum(Interstitial%evcw ) + write (0,*) 'sum(Interstitial%faerlw ) = ', sum(Interstitial%faerlw ) + write (0,*) 'sum(Interstitial%faersw ) = ', sum(Interstitial%faersw ) + write (0,*) 'sum(Interstitial%ffhh_ice ) = ', sum(Interstitial%ffhh_ice ) + write (0,*) 'sum(Interstitial%ffhh_land ) = ', sum(Interstitial%ffhh_land ) + write (0,*) 'sum(Interstitial%ffhh_ocean ) = ', sum(Interstitial%ffhh_ocean ) + write (0,*) 'sum(Interstitial%fh2 ) = ', sum(Interstitial%fh2 ) + write (0,*) 'sum(Interstitial%fh2_ice ) = ', sum(Interstitial%fh2_ice ) + write (0,*) 'sum(Interstitial%fh2_land ) = ', sum(Interstitial%fh2_land ) + write (0,*) 'sum(Interstitial%fh2_ocean ) = ', sum(Interstitial%fh2_ocean ) + write (0,*) 'Interstitial%flag_cice(1) = ', Interstitial%flag_cice(1) + write (0,*) 'Interstitial%flag_guess(1) = ', Interstitial%flag_guess(1) + write (0,*) 'Interstitial%flag_iter(1) = ', Interstitial%flag_iter(1) + write (0,*) 'sum(Interstitial%ffmm_ice ) = ', sum(Interstitial%ffmm_ice ) + write (0,*) 'sum(Interstitial%ffmm_land ) = ', sum(Interstitial%ffmm_land ) + write (0,*) 'sum(Interstitial%ffmm_ocean ) = ', sum(Interstitial%ffmm_ocean ) + write (0,*) 'sum(Interstitial%fm10 ) = ', sum(Interstitial%fm10 ) + write (0,*) 'sum(Interstitial%fm10_ice ) = ', sum(Interstitial%fm10_ice ) + write (0,*) 'sum(Interstitial%fm10_land ) = ', sum(Interstitial%fm10_land ) + write (0,*) 'sum(Interstitial%fm10_ocean ) = ', sum(Interstitial%fm10_ocean ) + write (0,*) 'Interstitial%frain = ', Interstitial%frain + write (0,*) 'sum(Interstitial%frland ) = ', sum(Interstitial%frland ) + write (0,*) 'sum(Interstitial%fscav ) = ', sum(Interstitial%fscav ) + write (0,*) 'sum(Interstitial%fswtr ) = ', sum(Interstitial%fswtr ) + write (0,*) 'sum(Interstitial%gabsbdlw ) = ', sum(Interstitial%gabsbdlw ) + write (0,*) 'sum(Interstitial%gamma ) = ', sum(Interstitial%gamma ) + write (0,*) 'sum(Interstitial%gamq ) = ', sum(Interstitial%gamq ) + write (0,*) 'sum(Interstitial%gamt ) = ', sum(Interstitial%gamt ) + write (0,*) 'sum(Interstitial%gasvmr ) = ', sum(Interstitial%gasvmr ) + write (0,*) 'sum(Interstitial%gflx ) = ', sum(Interstitial%gflx ) + write (0,*) 'sum(Interstitial%gflx_ice ) = ', sum(Interstitial%gflx_ice ) + write (0,*) 'sum(Interstitial%gflx_land ) = ', sum(Interstitial%gflx_land ) + write (0,*) 'sum(Interstitial%gflx_ocean ) = ', sum(Interstitial%gflx_ocean ) + write (0,*) 'sum(Interstitial%gwdcu ) = ', sum(Interstitial%gwdcu ) + write (0,*) 'sum(Interstitial%gwdcv ) = ', sum(Interstitial%gwdcv ) + write (0,*) 'sum(Interstitial%hflx ) = ', sum(Interstitial%hflx ) + write (0,*) 'sum(Interstitial%hflx_ice ) = ', sum(Interstitial%hflx_ice ) + write (0,*) 'sum(Interstitial%hflx_land ) = ', sum(Interstitial%hflx_land ) + write (0,*) 'sum(Interstitial%hflx_ocean ) = ', sum(Interstitial%hflx_ocean ) + write (0,*) 'sum(Interstitial%hprime1 ) = ', sum(Interstitial%hprime1 ) + write (0,*) 'Interstitial%dry(:)==.true. = ', count(Interstitial%dry(:)) + write (0,*) 'sum(Interstitial%idxday ) = ', sum(Interstitial%idxday ) + write (0,*) 'Interstitial%icy(:)==.true. = ', count(Interstitial%icy(:)) + write (0,*) 'Interstitial%lake(:)==.true. = ', count(Interstitial%lake(:)) + write (0,*) 'Interstitial%ocean(:)==.true. = ', count(Interstitial%ocean(:)) + write (0,*) 'sum(Interstitial%islmsk ) = ', sum(Interstitial%islmsk ) + write (0,*) 'Interstitial%wet(:)==.true. = ', count(Interstitial%wet(:)) + write (0,*) 'Interstitial%kb = ', Interstitial%kb + write (0,*) 'sum(Interstitial%kbot ) = ', sum(Interstitial%kbot ) + write (0,*) 'sum(Interstitial%kcnv ) = ', sum(Interstitial%kcnv ) + write (0,*) 'Interstitial%kd = ', Interstitial%kd + write (0,*) 'sum(Interstitial%kinver ) = ', sum(Interstitial%kinver ) + write (0,*) 'sum(Interstitial%kpbl ) = ', sum(Interstitial%kpbl ) + write (0,*) 'Interstitial%kt = ', Interstitial%kt + write (0,*) 'sum(Interstitial%ktop ) = ', sum(Interstitial%ktop ) + write (0,*) 'sum(Interstitial%mbota ) = ', sum(Interstitial%mbota ) + write (0,*) 'sum(Interstitial%mtopa ) = ', sum(Interstitial%mtopa ) + write (0,*) 'Interstitial%nday = ', Interstitial%nday + write (0,*) 'sum(Interstitial%oa4 ) = ', sum(Interstitial%oa4 ) + write (0,*) 'sum(Interstitial%oc ) = ', sum(Interstitial%oc ) + write (0,*) 'sum(Interstitial%olyr ) = ', sum(Interstitial%olyr ) + write (0,*) 'sum(Interstitial%plvl ) = ', sum(Interstitial%plvl ) + write (0,*) 'sum(Interstitial%plyr ) = ', sum(Interstitial%plyr ) + write (0,*) 'sum(Interstitial%prcpmp ) = ', sum(Interstitial%prcpmp ) + write (0,*) 'sum(Interstitial%prnum ) = ', sum(Interstitial%prnum ) + write (0,*) 'sum(Interstitial%qicn ) = ', sum(Interstitial%qicn ) + write (0,*) 'sum(Interstitial%qlcn ) = ', sum(Interstitial%qlcn ) + write (0,*) 'sum(Interstitial%qlyr ) = ', sum(Interstitial%qlyr ) + write (0,*) 'sum(Interstitial%qss ) = ', sum(Interstitial%qss ) + write (0,*) 'sum(Interstitial%qss_ice ) = ', sum(Interstitial%qss_ice ) + write (0,*) 'sum(Interstitial%qss_land ) = ', sum(Interstitial%qss_land ) + write (0,*) 'sum(Interstitial%qss_ocean ) = ', sum(Interstitial%qss_ocean ) + write (0,*) 'Interstitial%raddt = ', Interstitial%raddt + write (0,*) 'sum(Interstitial%raincd ) = ', sum(Interstitial%raincd ) + write (0,*) 'sum(Interstitial%raincs ) = ', sum(Interstitial%raincs ) + write (0,*) 'sum(Interstitial%rainmcadj ) = ', sum(Interstitial%rainmcadj ) + write (0,*) 'sum(Interstitial%rainp ) = ', sum(Interstitial%rainp ) + write (0,*) 'sum(Interstitial%rb ) = ', sum(Interstitial%rb ) + write (0,*) 'sum(Interstitial%rb_ice ) = ', sum(Interstitial%rb_ice ) + write (0,*) 'sum(Interstitial%rb_land ) = ', sum(Interstitial%rb_land ) + write (0,*) 'sum(Interstitial%rb_ocean ) = ', sum(Interstitial%rb_ocean ) + write (0,*) 'Interstitial%reset = ', Interstitial%reset + write (0,*) 'sum(Interstitial%rhc ) = ', sum(Interstitial%rhc ) + write (0,*) 'sum(Interstitial%runoff ) = ', sum(Interstitial%runoff ) + write (0,*) 'sum(Interstitial%save_q ) = ', sum(Interstitial%save_q ) + write (0,*) 'sum(Interstitial%save_t ) = ', sum(Interstitial%save_t ) + write (0,*) 'sum(Interstitial%save_u ) = ', sum(Interstitial%save_u ) + write (0,*) 'sum(Interstitial%save_v ) = ', sum(Interstitial%save_v ) + write (0,*) 'sum(Interstitial%sbsno ) = ', sum(Interstitial%sbsno ) + write (0,*) 'sum(Interstitial%scmpsw%uvbfc) = ', sum(Interstitial%scmpsw%uvbfc) + write (0,*) 'sum(Interstitial%scmpsw%uvbf0) = ', sum(Interstitial%scmpsw%uvbf0) + write (0,*) 'sum(Interstitial%scmpsw%nirbm) = ', sum(Interstitial%scmpsw%nirbm) + write (0,*) 'sum(Interstitial%scmpsw%nirdf) = ', sum(Interstitial%scmpsw%nirdf) + write (0,*) 'sum(Interstitial%scmpsw%visbm) = ', sum(Interstitial%scmpsw%visbm) + write (0,*) 'sum(Interstitial%scmpsw%visdf) = ', sum(Interstitial%scmpsw%visdf) + write (0,*) 'sum(Interstitial%sfcalb ) = ', sum(Interstitial%sfcalb ) + write (0,*) 'sum(Interstitial%sigma ) = ', sum(Interstitial%sigma ) + write (0,*) 'sum(Interstitial%sigmaf ) = ', sum(Interstitial%sigmaf ) + write (0,*) 'sum(Interstitial%sigmafrac ) = ', sum(Interstitial%sigmafrac ) + write (0,*) 'sum(Interstitial%sigmatot ) = ', sum(Interstitial%sigmatot ) + write (0,*) 'sum(Interstitial%slopetype ) = ', sum(Interstitial%slopetype ) + write (0,*) 'sum(Interstitial%snowc ) = ', sum(Interstitial%snowc ) + write (0,*) 'sum(Interstitial%snowd_ice ) = ', sum(Interstitial%snowd_ice ) + write (0,*) 'sum(Interstitial%snowd_land ) = ', sum(Interstitial%snowd_land ) + write (0,*) 'sum(Interstitial%snowd_ocean ) = ', sum(Interstitial%snowd_ocean ) + write (0,*) 'sum(Interstitial%snohf ) = ', sum(Interstitial%snohf ) + write (0,*) 'sum(Interstitial%snowmt ) = ', sum(Interstitial%snowmt ) + write (0,*) 'sum(Interstitial%soiltype ) = ', sum(Interstitial%soiltype ) + write (0,*) 'sum(Interstitial%stress ) = ', sum(Interstitial%stress ) + write (0,*) 'sum(Interstitial%stress_ice ) = ', sum(Interstitial%stress_ice ) + write (0,*) 'sum(Interstitial%stress_land ) = ', sum(Interstitial%stress_land ) + write (0,*) 'sum(Interstitial%stress_ocean) = ', sum(Interstitial%stress_ocean) + write (0,*) 'sum(Interstitial%theta ) = ', sum(Interstitial%theta ) + write (0,*) 'sum(Interstitial%tice ) = ', sum(Interstitial%tice ) + write (0,*) 'sum(Interstitial%tlvl ) = ', sum(Interstitial%tlvl ) + write (0,*) 'sum(Interstitial%tlyr ) = ', sum(Interstitial%tlyr ) + write (0,*) 'sum(Interstitial%tprcp_ice ) = ', sum(Interstitial%tprcp_ice ) + write (0,*) 'sum(Interstitial%tprcp_land ) = ', sum(Interstitial%tprcp_land ) + write (0,*) 'sum(Interstitial%tprcp_ocean ) = ', sum(Interstitial%tprcp_ocean ) + write (0,*) 'sum(Interstitial%trans ) = ', sum(Interstitial%trans ) + write (0,*) 'sum(Interstitial%tseal ) = ', sum(Interstitial%tseal ) + write (0,*) 'sum(Interstitial%tsfa ) = ', sum(Interstitial%tsfa ) + write (0,*) 'sum(Interstitial%tsfc_ice ) = ', sum(Interstitial%tsfc_ice ) + write (0,*) 'sum(Interstitial%tsfc_land ) = ', sum(Interstitial%tsfc_land ) + write (0,*) 'sum(Interstitial%tsfc_ocean ) = ', sum(Interstitial%tsfc_ocean ) + write (0,*) 'sum(Interstitial%tsfg ) = ', sum(Interstitial%tsfg ) + write (0,*) 'sum(Interstitial%tsurf ) = ', sum(Interstitial%tsurf ) + write (0,*) 'sum(Interstitial%tsurf_ice ) = ', sum(Interstitial%tsurf_ice ) + write (0,*) 'sum(Interstitial%tsurf_land ) = ', sum(Interstitial%tsurf_land ) + write (0,*) 'sum(Interstitial%tsurf_ocean ) = ', sum(Interstitial%tsurf_ocean ) + write (0,*) 'sum(Interstitial%ud_mf ) = ', sum(Interstitial%ud_mf ) + write (0,*) 'sum(Interstitial%ulwsfc_cice ) = ', sum(Interstitial%ulwsfc_cice ) + write (0,*) 'sum(Interstitial%uustar_ice ) = ', sum(Interstitial%uustar_ice ) + write (0,*) 'sum(Interstitial%uustar_land ) = ', sum(Interstitial%uustar_land ) + write (0,*) 'sum(Interstitial%uustar_ocean) = ', sum(Interstitial%uustar_ocean) + write (0,*) 'sum(Interstitial%vdftra ) = ', sum(Interstitial%vdftra ) + write (0,*) 'sum(Interstitial%vegf1d ) = ', sum(Interstitial%vegf1d ) + write (0,*) 'sum(Interstitial%vegtype ) = ', sum(Interstitial%vegtype ) + write (0,*) 'sum(Interstitial%w_upi ) = ', sum(Interstitial%w_upi ) + write (0,*) 'sum(Interstitial%wcbmax ) = ', sum(Interstitial%wcbmax ) + write (0,*) 'sum(Interstitial%weasd_ice ) = ', sum(Interstitial%weasd_ice ) + write (0,*) 'sum(Interstitial%weasd_land ) = ', sum(Interstitial%weasd_land ) + write (0,*) 'sum(Interstitial%weasd_ocean ) = ', sum(Interstitial%weasd_ocean ) + write (0,*) 'sum(Interstitial%wind ) = ', sum(Interstitial%wind ) + write (0,*) 'sum(Interstitial%work1 ) = ', sum(Interstitial%work1 ) + write (0,*) 'sum(Interstitial%work2 ) = ', sum(Interstitial%work2 ) + write (0,*) 'sum(Interstitial%work3 ) = ', sum(Interstitial%work3 ) + write (0,*) 'sum(Interstitial%xcosz ) = ', sum(Interstitial%xcosz ) + write (0,*) 'sum(Interstitial%xlai1d ) = ', sum(Interstitial%xlai1d ) + write (0,*) 'sum(Interstitial%xmu ) = ', sum(Interstitial%xmu ) + write (0,*) 'sum(Interstitial%z01d ) = ', sum(Interstitial%z01d ) + write (0,*) 'sum(Interstitial%zorl_ice ) = ', sum(Interstitial%zorl_ice ) + write (0,*) 'sum(Interstitial%zorl_land ) = ', sum(Interstitial%zorl_land ) + write (0,*) 'sum(Interstitial%zorl_ocean ) = ', sum(Interstitial%zorl_ocean ) + write (0,*) 'sum(Interstitial%zt1d ) = ', sum(Interstitial%zt1d ) + ! Print arrays that are conditional on physics choices + if (Model%imp_physics == Model%imp_physics_gfdl .or. Model%imp_physics == Model%imp_physics_thompson) then + write (0,*) 'Interstitial_print: values specific to GFDL/Thompson microphysics' + write (0,*) 'sum(Interstitial%graupelmp) = ', sum(Interstitial%graupelmp ) + write (0,*) 'sum(Interstitial%icemp ) = ', sum(Interstitial%icemp ) + write (0,*) 'sum(Interstitial%rainmp ) = ', sum(Interstitial%rainmp ) + write (0,*) 'sum(Interstitial%snowmp ) = ', sum(Interstitial%snowmp ) + else if (Model%imp_physics == Model%imp_physics_mg) then + write (0,*) 'Interstitial_print: values specific to MG microphysics' + write (0,*) 'sum(Interstitial%ncgl ) = ', sum(Interstitial%ncgl ) + write (0,*) 'sum(Interstitial%ncpr ) = ', sum(Interstitial%ncpr ) + write (0,*) 'sum(Interstitial%ncps ) = ', sum(Interstitial%ncps ) + write (0,*) 'sum(Interstitial%qgl ) = ', sum(Interstitial%qgl ) + write (0,*) 'sum(Interstitial%qrn ) = ', sum(Interstitial%qrn ) + write (0,*) 'sum(Interstitial%qsnw ) = ', sum(Interstitial%qsnw ) + end if + if (Model%do_shoc) then + write (0,*) 'Interstitial_print: values specific to SHOC' + write (0,*) 'sum(Interstitial%ncgl ) = ', sum(Interstitial%ncgl ) + write (0,*) 'sum(Interstitial%qrn ) = ', sum(Interstitial%qrn ) + write (0,*) 'sum(Interstitial%qsnw ) = ', sum(Interstitial%qsnw ) + write (0,*) 'sum(Interstitial%qgl ) = ', sum(Interstitial%qgl ) + write (0,*) 'sum(Interstitial%ncpi ) = ', sum(Interstitial%ncpi ) + write (0,*) 'sum(Interstitial%ncpl ) = ', sum(Interstitial%ncpl ) + end if + write (0,*) 'Interstitial_print: end' + ! + end subroutine interstitial_print #endif end module GFS_typedefs diff --git a/gfsphysics/makefile b/gfsphysics/makefile index e5489b888..5043da6cc 100644 --- a/gfsphysics/makefile +++ b/gfsphysics/makefile @@ -21,7 +21,43 @@ FFLAGS += -I$(FMS_DIR) -I../cpl CPPDEFS += -DNEW_TAUCTMAX -DSMALL_PE -DNEMS_GSM -DINTERNAL_FILE_NML -SRCS_f = \ +# CCPP dynamic and static builds +ifneq (,$(findstring CCPP,$(CPPDEFS))) +# Set flags for 32-bit dynamics build +ifeq ($(DYN32),Y) +CPPDEFS += -DOVERLOAD_R4 +endif +# Set CCPP static api for static build +ifneq (,$(findstring STATIC,$(CPPDEFS))) + CCPP_STATIC_API = ./CCPP_layer/ccpp_static_api.F90 +else + CCPP_STATIC_API = +endif +# Set physics source files +SRCS_f = \ + ./physics/mersenne_twister.f \ + ./physics/namelist_soilveg.f \ + ./physics/physparam.f \ + ./physics/radlw_param.f \ + ./physics/radsw_param.f \ + ./physics/set_soilveg.f +SRCS_f90 = +SRCS_F = \ + ./physics/machine.F +SRCS_F90 = \ + ./physics/GFDL_parse_tracers.F90 \ + ./physics/physcons.F90 \ + ./CCPP_layer/CCPP_typedefs.F90 \ + ./CCPP_layer/CCPP_data.F90 \ + $(CCPP_STATIC_API) \ + ./GFS_layer/GFS_abstraction_layer.F90 \ + ./GFS_layer/GFS_diagnostics.F90 \ + ./GFS_layer/GFS_driver.F90 \ + ./GFS_layer/GFS_restart.F90 \ + ./GFS_layer/GFS_typedefs.F90 +# non-CCPP build +else +SRCS_f = \ ./physics/cnvc90.f \ ./physics/co2hc.f \ ./physics/date_def.f \ @@ -29,7 +65,6 @@ SRCS_f = \ ./physics/dcyc2.pre.rad.f \ ./physics/efield.f \ ./physics/get_prs.f \ - ./physics/gfs_phy_tracer_config.f \ ./physics/gocart_tracer_config_stub.f \ ./physics/gscond.f \ ./physics/gscondp.f \ @@ -70,8 +105,8 @@ SRCS_f = \ ./physics/mstcnv.f \ ./physics/namelist_soilveg.f \ ./physics/ozne_def.f \ - ./physics/iccn_def.f \ - ./physics/aerclm_def.f \ + ./physics/iccn_def.f \ + ./physics/aerclm_def.f \ ./physics/ozphys.f \ ./physics/ozphys_2015.f \ ./physics/physparam.f \ @@ -122,12 +157,10 @@ SRCS_f = \ SRCS_f90 = \ ./physics/calpreciptype.f90 \ - ./physics/cs_conv.f90 \ ./physics/funcphys.f90 \ ./physics/gcm_shoc.f90 \ ./physics/get_prs_fv3.f90 \ ./physics/h2ointerp.f90 \ - ./physics/m_micro_driver.f90 \ ./physics/module_nst_model.f90 \ ./physics/module_nst_parameters.f90 \ ./physics/module_nst_water_prop.f90 \ @@ -136,21 +169,22 @@ SRCS_f90 = \ ./physics/noahmp_tables.f90 \ ./physics/module_sf_noahmplsm.f90 \ ./physics/module_sf_noahmp_glacier.f90 \ - ./physics/iccninterp.f90 \ - ./physics/aerinterp.f90 \ - ./physics/physcons.f90 \ + ./physics/iccninterp.f90 \ + ./physics/aerinterp.f90 \ ./physics/wam_f107_kp_mod.f90 -SRCS_F = ./physics/aer_cloud.F \ - ./physics/cldmacro.F \ +SRCS_F = \ + ./physics/aer_cloud.F \ + ./physics/cldmacro.F \ ./physics/cldwat2m_micro.F \ + ./physics/gfs_phy_tracer_config.F \ ./physics/machine.F \ - ./physics/num_parthds.F \ + ./physics/num_parthds.F \ ./physics/sfcsub.F \ ./physics/wv_saturation.F SRCS_F90 = \ - ./physics/GFDL_parse_tracers.F90 \ + ./physics/GFDL_parse_tracers.F90 \ ./physics/gcycle.F90 \ ./physics/cires_ugwp_initialize.F90 \ ./physics/cires_ugwp_module.F90 \ @@ -160,20 +194,26 @@ SRCS_F90 = \ ./physics/cires_vert_lsatdis.F90 \ ./physics/cires_vert_orodis.F90 \ ./physics/cires_vert_wmsdis.F90 \ - ./physics/gfdl_cloud_microphys.F90 \ + ./physics/gfdl_cloud_microphys.F90 \ ./physics/micro_mg_utils.F90 \ ./physics/micro_mg2_0.F90 \ ./physics/micro_mg3_0.F90 \ - ./physics/module_mp_radar.F90 \ + ./physics/m_micro_driver.F90 \ + ./physics/cs_conv.F90 \ + ./physics/GFS_debug.F90 \ + ./physics/module_mp_radar.F90 \ ./physics/module_mp_thompson_gfs.F90 \ ./physics/module_mp_wsm6_fv3.F90 \ - ./GFS_layer/GFS_abstraction_layer.F90 \ - ./GFS_layer/GFS_diagnostics.F90 \ - ./GFS_layer/GFS_driver.F90 \ - ./GFS_layer/GFS_physics_driver.F90 \ - ./GFS_layer/GFS_radiation_driver.F90 \ - ./GFS_layer/GFS_restart.F90 \ + ./physics/physcons.F90 \ + ./physics/surface_perturbation.F90 \ + ./GFS_layer/GFS_abstraction_layer.F90 \ + ./GFS_layer/GFS_diagnostics.F90 \ + ./GFS_layer/GFS_driver.F90 \ + ./GFS_layer/GFS_physics_driver.F90 \ + ./GFS_layer/GFS_radiation_driver.F90 \ + ./GFS_layer/GFS_restart.F90 \ ./GFS_layer/GFS_typedefs.F90 +endif SRCS_c = @@ -195,27 +235,62 @@ $(LIBRARY): $(OBJS) # this is the place to override default (implicit) compilation rules # and create specific (explicit) rules -ifneq (,$(findstring xCORE-AVX2,$(FFLAGS))) -./physics/radiation_aerosols.o : ./physics/radiation_aerosols.f - $(FC) $(FFLAGS) $(OTHER_FFLAGS) -xCORE-AVX-I -c $< -o $@ -else ifneq (,$(findstring axSSE4.2,AVX,CORE-AVX2,$(FFLAGS))) -./physics/radiation_aerosols.o : ./physics/radiation_aerosols.f - $(FC) $(FFLAGS) $(OTHER_FFLAGS) -axSSE4.2,AVX,CORE-AVX-I -c $< -o $@ -else ifneq (,$(findstring xHOST,$(FFLAGS))) -./physics/radiation_aerosols.o : ./physics/radiation_aerosols.f - $(FC) $(FFLAGS) $(OTHER_FFLAGS) -xCORE-AVX-I -c $< -o $@ -else +# Reduce optimization (substitute (x)CORE-AVX2, (x)CORE-AVX512 or xHOST with (x)CORE-AVX-I) for radiation_aerosols.f +FFLAGS_LOPT1=$(subst CORE-AVX512,CORE-AVX-I,\ + $(subst CORE-AVX2,CORE-AVX-I,\ + $(subst xHOST,xCORE-AVX-I,$(FFLAGS)))) ./physics/radiation_aerosols.o : ./physics/radiation_aerosols.f - $(FC) $(FFLAGS) $(OTHER_FFLAGS) -c $< -o $@ -endif + $(FC) $(CPPDEFS) $(FFLAGS_LOPT1) $(OTHER_FFLAGS) -c $< -o $@ + +# Reduce optimization (add -O0) for GFS_diagnsostics.F90 ./GFS_layer/GFS_diagnostics.o : ./GFS_layer/GFS_diagnostics.F90 - $(FC) $(FFLAGS) $(OTHER_FFLAGS) -O0 -c $< -o $@ + $(FC) $(CPPDEFS) $(FFLAGS) $(OTHER_FFLAGS) -O0 -c $< -o $@ + +# Force consistent results of math calculations for MG microphysics +# in DEBUG or REPRO mode; without this flag, the results of the intrinsic +# gamma function differ for the non-CCPP and CCPP version (Theia/Intel 18). +# This is only required for the dynamic CCPP build, not for the static build. +ifneq (,$(findstring TRANSITION,$(CPPDEFS))) +FFLAGS_LOPT2=$(subst CORE-AVX2,CORE-AVX-I,\ + $(subst no-prec-sqrt,prec-sqrt,\ + $(subst no-prec-div,prec-div,$(FFLAGS)))) +./physics/micro_mg2_0.o : ./physics/micro_mg2_0.F90 + $(FC) $(CPPDEFS) $(FFLAGS_LOPT2) $(OTHER_FFLAGS) -c $< -o $@ +./physics/micro_mg3_0.o : ./physics/micro_mg3_0.F90 + $(FC) $(CPPDEFS) $(FFLAGS_LOPT2) $(OTHER_FFLAGS) -c $< -o $@ +./physics/aer_cloud.o : ./physics/aer_cloud.F + $(FC) $(CPPDEFS) $(FFLAGS_LOPT2) $(OTHER_FFLAGS) -c $< -o $@ +./physics/cldmacro.o : ./physics/cldmacro.F + $(FC) $(CPPDEFS) $(FFLAGS_LOPT2) $(OTHER_FFLAGS) -c $< -o $@ +./physics/sflx.o : ./physics/sflx.f + $(FC) $(CPPDEFS) $(FFLAGS_LOPT2) $(OTHER_FFLAGS) -c $< -o $@ +./physics/gfdl_cloud_microphys.o: ./physics/gfdl_cloud_microphys.F90 + $(FC) $(CPPDEFS) $(FFLAGS_LOPT2) $(OTHER_FFLAGS) -c $< -o $@ +./physics/satmedmfvdif.o : ./physics/satmedmfvdif.f + $(FC) $(CPPDEFS) $(FFLAGS_LOPT2) $(OTHER_FFLAGS) -c $< -o $@ +./physics/cs_conv.o : ./physics/cs_conv.F90 + $(FC) $(CPPDEFS) $(FFLAGS_LOPT2) $(OTHER_FFLAGS) -c $< -o $@ +./physics/gcm_shoc.o : ./physics/gcm_shoc.f90 + $(FC) $(CPPDEFS) $(FFLAGS_LOPT2) $(OTHER_FFLAGS) -c $< -o $@ +endif + +# Do preprocessing of the GFS drivers in two steps to be able +# to look at the actual .f90 file that is compiled +./GFS_layer/GFS_driver.o: ./GFS_layer/GFS_driver.F90 + $(CPP) $(CPPDEFS) $(CPPFLAGS) $< > $*.tmp.f90 + $(FC) $(FFLAGS) $(OTHER_FFLAGS) -c $*.tmp.f90 -o $@ +./GFS_layer/GFS_physics_driver.o: ./GFS_layer/GFS_physics_driver.F90 + $(CPP) $(CPPDEFS) $(CPPFLAGS) $< > $*.tmp.f90 + $(FC) $(FFLAGS) $(OTHER_FFLAGS) -c $*.tmp.f90 -o $@ +./GFS_layer/GFS_radiation_driver.o: ./GFS_layer/GFS_radiation_driver.F90 + $(CPP) $(CPPDEFS) $(CPPFLAGS) $< > $*.tmp.f90 + $(FC) $(FFLAGS) $(OTHER_FFLAGS) -c $*.tmp.f90 -o $@ .PHONY: clean clean: @echo "Cleaning gfsphysics ... " @echo - $(RM) -f $(LIBRARY) *__genmod.f90 *.o */*.o *.mod *.i90 *.lst *.i depend + $(RM) -f $(LIBRARY) *__genmod.f90 *.o */*.o *.mod *.i90 *.lst *.i depend */*.tmp.f90 MKDEPENDS = ../mkDepends.pl include ../conf/make.rules diff --git a/gfsphysics/physics/GFS_debug.F90 b/gfsphysics/physics/GFS_debug.F90 new file mode 100644 index 000000000..250d1631c --- /dev/null +++ b/gfsphysics/physics/GFS_debug.F90 @@ -0,0 +1,764 @@ +#define MPI +#define OPENMP +!> \file GFS_debug.F90 + + module GFS_diagtoscreen + + private + + public GFS_diagtoscreen_init, GFS_diagtoscreen_run, GFS_diagtoscreen_finalize + + public print_my_stuff, chksum_int, chksum_real + +! Calculating the checksum leads to segmentation faults with gfortran (bug in malloc?), +! thus print the sum of the array instead of the checksum. +#ifdef __GFORTRAN__ +#define PRINT_SUM +#else +#define PRINT_CHKSUM +#endif + + interface print_var + module procedure print_logic_0d + module procedure print_int_0d + module procedure print_int_1d + module procedure print_real_0d + module procedure print_real_1d + module procedure print_real_2d + module procedure print_real_3d + end interface + + integer, parameter :: ISTART = 1 + integer, parameter :: IEND = 9999999 + + integer, parameter :: KSTART = 1 + integer, parameter :: KEND = 9999999 + + contains + + subroutine GFS_diagtoscreen_init () + end subroutine GFS_diagtoscreen_init + + subroutine GFS_diagtoscreen_finalize () + end subroutine GFS_diagtoscreen_finalize + + subroutine GFS_diagtoscreen_run (Model, Statein, Stateout, Sfcprop, Coupling, & + Grid, Tbd, Cldprop, Radtend, Diag, blkno) + +#ifdef MPI + use mpi +#endif +#ifdef OPENMP + use omp_lib +#endif + use machine, only: kind_phys + use GFS_typedefs, only: GFS_control_type, GFS_statein_type, & + GFS_stateout_type, GFS_sfcprop_type, & + GFS_coupling_type, GFS_grid_type, & + GFS_tbd_type, GFS_cldprop_type, & + GFS_radtend_type, GFS_diag_type + + implicit none + + !--- interface variables + type(GFS_control_type), intent(in ) :: Model + type(GFS_statein_type), intent(in ) :: Statein + type(GFS_stateout_type), intent(in ) :: Stateout + type(GFS_sfcprop_type), intent(in ) :: Sfcprop + type(GFS_coupling_type), intent(in ) :: Coupling + type(GFS_grid_type), intent(in ) :: Grid + type(GFS_tbd_type), intent(in ) :: Tbd + type(GFS_cldprop_type), intent(in ) :: Cldprop + type(GFS_radtend_type), intent(in ) :: Radtend + type(GFS_diag_type), intent(in ) :: Diag + integer, intent(in ) :: blkno + + !--- local variables + integer :: impi, iomp, ierr, n + integer :: mpirank, mpisize, mpicomm + integer :: omprank, ompsize + + +#ifdef MPI + mpicomm = MPI_COMM_WORLD + mpirank = Model%me + call MPI_COMM_SIZE(mpicomm, mpisize, ierr) +#else + mpirank = 0 + mpisize = 1 + mpicomm = 0 +#endif +#ifdef OPENMP + omprank = OMP_GET_THREAD_NUM() + ompsize = OMP_GET_NUM_THREADS() +#else + omprank = 0 + ompsize = 1 +#endif + +#ifdef OPENMP +!$OMP BARRIER +#endif +#ifdef MPI +! call MPI_BARRIER(mpicomm,ierr) +#endif + + do impi=0,mpisize-1 + do iomp=0,ompsize-1 + if (mpirank==impi .and. omprank==iomp) then + ! Sfcprop + call print_var(mpirank,omprank, blkno, 'Sfcprop%slmsk' , Sfcprop%slmsk) + call print_var(mpirank,omprank, blkno, 'Sfcprop%oceanfrac', Sfcprop%oceanfrac) + call print_var(mpirank,omprank, blkno, 'Sfcprop%landfrac' , Sfcprop%landfrac) + call print_var(mpirank,omprank, blkno, 'Sfcprop%lakefrac' , Sfcprop%lakefrac) + call print_var(mpirank,omprank, blkno, 'Sfcprop%tsfc' , Sfcprop%tsfc) + call print_var(mpirank,omprank, blkno, 'Sfcprop%tsfco' , Sfcprop%tsfco) + call print_var(mpirank,omprank, blkno, 'Sfcprop%tsfcl' , Sfcprop%tsfcl) + call print_var(mpirank,omprank, blkno, 'Sfcprop%tisfc' , Sfcprop%tisfc) + call print_var(mpirank,omprank, blkno, 'Sfcprop%snowd' , Sfcprop%snowd) + call print_var(mpirank,omprank, blkno, 'Sfcprop%zorl' , Sfcprop%zorl) + call print_var(mpirank,omprank, blkno, 'Sfcprop%zorlo' , Sfcprop%zorlo) + call print_var(mpirank,omprank, blkno, 'Sfcprop%zorll' , Sfcprop%zorll) + call print_var(mpirank,omprank, blkno, 'Sfcprop%fice' , Sfcprop%fice) + call print_var(mpirank,omprank, blkno, 'Sfcprop%hprim' , Sfcprop%hprim) + call print_var(mpirank,omprank, blkno, 'Sfcprop%hprime' , Sfcprop%hprime) + call print_var(mpirank,omprank, blkno, 'Sfcprop%sncovr' , Sfcprop%sncovr) + call print_var(mpirank,omprank, blkno, 'Sfcprop%snoalb' , Sfcprop%snoalb) + call print_var(mpirank,omprank, blkno, 'Sfcprop%alvsf' , Sfcprop%alvsf) + call print_var(mpirank,omprank, blkno, 'Sfcprop%alnsf' , Sfcprop%alnsf) + call print_var(mpirank,omprank, blkno, 'Sfcprop%alvwf' , Sfcprop%alvwf) + call print_var(mpirank,omprank, blkno, 'Sfcprop%alnwf' , Sfcprop%alnwf) + call print_var(mpirank,omprank, blkno, 'Sfcprop%facsf' , Sfcprop%facsf) + call print_var(mpirank,omprank, blkno, 'Sfcprop%facwf' , Sfcprop%facwf) + call print_var(mpirank,omprank, blkno, 'Sfcprop%slope' , Sfcprop%slope) + call print_var(mpirank,omprank, blkno, 'Sfcprop%shdmin' , Sfcprop%shdmin) + call print_var(mpirank,omprank, blkno, 'Sfcprop%shdmax' , Sfcprop%shdmax) + call print_var(mpirank,omprank, blkno, 'Sfcprop%tg3' , Sfcprop%tg3) + call print_var(mpirank,omprank, blkno, 'Sfcprop%vfrac' , Sfcprop%vfrac) + call print_var(mpirank,omprank, blkno, 'Sfcprop%vtype' , Sfcprop%vtype) + call print_var(mpirank,omprank, blkno, 'Sfcprop%stype' , Sfcprop%stype) + call print_var(mpirank,omprank, blkno, 'Sfcprop%uustar' , Sfcprop%uustar) + call print_var(mpirank,omprank, blkno, 'Sfcprop%oro' , Sfcprop%oro) + call print_var(mpirank,omprank, blkno, 'Sfcprop%oro_uf' , Sfcprop%oro_uf) + call print_var(mpirank,omprank, blkno, 'Sfcprop%hice' , Sfcprop%hice) + call print_var(mpirank,omprank, blkno, 'Sfcprop%weasd' , Sfcprop%weasd) + call print_var(mpirank,omprank, blkno, 'Sfcprop%canopy' , Sfcprop%canopy) + call print_var(mpirank,omprank, blkno, 'Sfcprop%ffmm' , Sfcprop%ffmm) + call print_var(mpirank,omprank, blkno, 'Sfcprop%ffhh' , Sfcprop%ffhh) + call print_var(mpirank,omprank, blkno, 'Sfcprop%f10m' , Sfcprop%f10m) + call print_var(mpirank,omprank, blkno, 'Sfcprop%tprcp' , Sfcprop%tprcp) + call print_var(mpirank,omprank, blkno, 'Sfcprop%srflag' , Sfcprop%srflag) + call print_var(mpirank,omprank, blkno, 'Sfcprop%slc' , Sfcprop%slc) + call print_var(mpirank,omprank, blkno, 'Sfcprop%smc' , Sfcprop%smc) + call print_var(mpirank,omprank, blkno, 'Sfcprop%stc' , Sfcprop%stc) + call print_var(mpirank,omprank, blkno, 'Sfcprop%t2m' , Sfcprop%t2m) + call print_var(mpirank,omprank, blkno, 'Sfcprop%q2m' , Sfcprop%q2m) + if (Model%nstf_name(1)>0) then + call print_var(mpirank,omprank, blkno, 'Sfcprop%tref ', Sfcprop%tref) + call print_var(mpirank,omprank, blkno, 'Sfcprop%z_c ', Sfcprop%z_c) + call print_var(mpirank,omprank, blkno, 'Sfcprop%c_0 ', Sfcprop%c_0) + call print_var(mpirank,omprank, blkno, 'Sfcprop%c_d ', Sfcprop%c_d) + call print_var(mpirank,omprank, blkno, 'Sfcprop%w_0 ', Sfcprop%w_0) + call print_var(mpirank,omprank, blkno, 'Sfcprop%w_d ', Sfcprop%w_d) + call print_var(mpirank,omprank, blkno, 'Sfcprop%xt ', Sfcprop%xt) + call print_var(mpirank,omprank, blkno, 'Sfcprop%xs ', Sfcprop%xs) + call print_var(mpirank,omprank, blkno, 'Sfcprop%xu ', Sfcprop%xu) + call print_var(mpirank,omprank, blkno, 'Sfcprop%xv ', Sfcprop%xv) + call print_var(mpirank,omprank, blkno, 'Sfcprop%xz ', Sfcprop%xz) + call print_var(mpirank,omprank, blkno, 'Sfcprop%zm ', Sfcprop%zm) + call print_var(mpirank,omprank, blkno, 'Sfcprop%xtts ', Sfcprop%xtts) + call print_var(mpirank,omprank, blkno, 'Sfcprop%xzts ', Sfcprop%xzts) + call print_var(mpirank,omprank, blkno, 'Sfcprop%d_conv ', Sfcprop%d_conv) + call print_var(mpirank,omprank, blkno, 'Sfcprop%ifd ', Sfcprop%ifd) + call print_var(mpirank,omprank, blkno, 'Sfcprop%dt_cool ', Sfcprop%dt_cool) + call print_var(mpirank,omprank, blkno, 'Sfcprop%qrain ', Sfcprop%qrain) + end if + ! CCPP only + !if (Model%lsm == Model%lsm_ruc) then + ! call print_var(mpirank,omprank, blkno, 'Sfcprop%sh2o', Sfcprop%sh2o) + ! call print_var(mpirank,omprank, blkno, 'Sfcprop%smois', Sfcprop%smois) + ! call print_var(mpirank,omprank, blkno, 'Sfcprop%tslb', Sfcprop%tslb) + ! call print_var(mpirank,omprank, blkno, 'Sfcprop%zs', Sfcprop%zs) + ! call print_var(mpirank,omprank, blkno, 'Sfcprop%clw_surf', Sfcprop%clw_surf) + ! call print_var(mpirank,omprank, blkno, 'Sfcprop%qwv_surf', Sfcprop%qwv_surf) + ! call print_var(mpirank,omprank, blkno, 'Sfcprop%cndm_surf', Sfcprop%cndm_surf) + ! call print_var(mpirank,omprank, blkno, 'Sfcprop%flag_frsoil', Sfcprop%flag_frsoil) + ! call print_var(mpirank,omprank, blkno, 'Sfcprop%rhofr', Sfcprop%rhofr) + ! call print_var(mpirank,omprank, blkno, 'Sfcprop%tsnow', Sfcprop%tsnow) + !end if + ! Radtend + call print_var(mpirank,omprank, blkno, 'Radtend%sfcfsw%upfxc', Radtend%sfcfsw(:)%upfxc) + call print_var(mpirank,omprank, blkno, 'Radtend%sfcfsw%dnfxc', Radtend%sfcfsw(:)%dnfxc) + call print_var(mpirank,omprank, blkno, 'Radtend%sfcfsw%upfx0', Radtend%sfcfsw(:)%upfx0) + call print_var(mpirank,omprank, blkno, 'Radtend%sfcfsw%dnfx0', Radtend%sfcfsw(:)%dnfx0) + call print_var(mpirank,omprank, blkno, 'Radtend%sfcflw%upfxc', Radtend%sfcflw(:)%upfxc) + call print_var(mpirank,omprank, blkno, 'Radtend%sfcflw%upfx0', Radtend%sfcflw(:)%upfx0) + call print_var(mpirank,omprank, blkno, 'Radtend%sfcflw%dnfxc', Radtend%sfcflw(:)%dnfxc) + call print_var(mpirank,omprank, blkno, 'Radtend%sfcflw%dnfx0', Radtend%sfcflw(:)%dnfx0) + call print_var(mpirank,omprank, blkno, 'Radtend%htrsw', Radtend%htrsw) + call print_var(mpirank,omprank, blkno, 'Radtend%htrlw', Radtend%htrlw) + call print_var(mpirank,omprank, blkno, 'Radtend%sfalb', Radtend%sfalb) + call print_var(mpirank,omprank, blkno, 'Radtend%coszen', Radtend%coszen) + call print_var(mpirank,omprank, blkno, 'Radtend%tsflw', Radtend%tsflw) + call print_var(mpirank,omprank, blkno, 'Radtend%semis', Radtend%semis) + call print_var(mpirank,omprank, blkno, 'Radtend%coszdg', Radtend%coszdg) + call print_var(mpirank,omprank, blkno, 'Radtend%swhc', Radtend%swhc) + call print_var(mpirank,omprank, blkno, 'Radtend%lwhc', Radtend%lwhc) + call print_var(mpirank,omprank, blkno, 'Radtend%lwhd', Radtend%lwhd) + ! Tbd + call print_var(mpirank,omprank, blkno, 'Tbd%icsdsw' , Tbd%icsdsw) + call print_var(mpirank,omprank, blkno, 'Tbd%icsdlw' , Tbd%icsdlw) + call print_var(mpirank,omprank, blkno, 'Tbd%ozpl' , Tbd%ozpl) + call print_var(mpirank,omprank, blkno, 'Tbd%h2opl' , Tbd%h2opl) + call print_var(mpirank,omprank, blkno, 'Tbd%rann' , Tbd%rann) + call print_var(mpirank,omprank, blkno, 'Tbd%acv' , Tbd%acv) + call print_var(mpirank,omprank, blkno, 'Tbd%acvb' , Tbd%acvb) + call print_var(mpirank,omprank, blkno, 'Tbd%acvt' , Tbd%acvt) + if (Model%do_sppt) then + call print_var(mpirank,omprank, blkno, 'Tbd%dtdtr' , Tbd%dtdtr) + call print_var(mpirank,omprank, blkno, 'Tbd%dtotprcp' , Tbd%dtotprcp) + call print_var(mpirank,omprank, blkno, 'Tbd%dcnvprcp' , Tbd%dcnvprcp) + call print_var(mpirank,omprank, blkno, 'Tbd%drain_cpl' , Tbd%drain_cpl) + call print_var(mpirank,omprank, blkno, 'Tbd%dsnow_cpl' , Tbd%dsnow_cpl) + end if + call print_var(mpirank,omprank, blkno, 'Tbd%phy_fctd' , Tbd%phy_fctd) + call print_var(mpirank,omprank, blkno, 'Tbd%phy_f2d' , Tbd%phy_f2d) + call print_var(mpirank,omprank, blkno, 'Tbd%phy_f3d' , Tbd%phy_f3d) + do n=1,size(Tbd%phy_f3d(1,1,:)) + call print_var(mpirank,omprank, blkno, 'Tbd%phy_f3d_n' , Tbd%phy_f3d(:,:,n)) + end do + call print_var(mpirank,omprank, blkno, 'Tbd%in_nm' , Tbd%in_nm) + call print_var(mpirank,omprank, blkno, 'Tbd%ccn_nm' , Tbd%ccn_nm) + call print_var(mpirank,omprank, blkno, 'Tbd%aer_nm' , Tbd%aer_nm) + ! Diag + !call print_var(mpirank,omprank, blkno, 'Diag%fluxr ', Diag%fluxr) + !do n=1,size(Diag%fluxr(1,:)) + ! call print_var(mpirank,omprank, blkno, 'Diag%fluxr_n ', Diag%fluxr(:,n)) + !end do + call print_var(mpirank,omprank, blkno, 'Diag%srunoff ', Diag%srunoff) + call print_var(mpirank,omprank, blkno, 'Diag%evbsa ', Diag%evbsa) + call print_var(mpirank,omprank, blkno, 'Diag%evcwa ', Diag%evcwa) + call print_var(mpirank,omprank, blkno, 'Diag%snohfa ', Diag%snohfa) + call print_var(mpirank,omprank, blkno, 'Diag%transa ', Diag%transa) + call print_var(mpirank,omprank, blkno, 'Diag%sbsnoa ', Diag%sbsnoa) + call print_var(mpirank,omprank, blkno, 'Diag%snowca ', Diag%snowca) + call print_var(mpirank,omprank, blkno, 'Diag%soilm ', Diag%soilm) + call print_var(mpirank,omprank, blkno, 'Diag%tmpmin ', Diag%tmpmin) + call print_var(mpirank,omprank, blkno, 'Diag%tmpmax ', Diag%tmpmax) + call print_var(mpirank,omprank, blkno, 'Diag%dusfc ', Diag%dusfc) + call print_var(mpirank,omprank, blkno, 'Diag%dvsfc ', Diag%dvsfc) + call print_var(mpirank,omprank, blkno, 'Diag%dtsfc ', Diag%dtsfc) + call print_var(mpirank,omprank, blkno, 'Diag%dqsfc ', Diag%dqsfc) + call print_var(mpirank,omprank, blkno, 'Diag%totprcp ', Diag%totprcp) + call print_var(mpirank,omprank, blkno, 'Diag%totice ', Diag%totice) + call print_var(mpirank,omprank, blkno, 'Diag%totsnw ', Diag%totsnw) + call print_var(mpirank,omprank, blkno, 'Diag%totgrp ', Diag%totgrp) + call print_var(mpirank,omprank, blkno, 'Diag%totprcpb ', Diag%totprcpb) + call print_var(mpirank,omprank, blkno, 'Diag%toticeb ', Diag%toticeb) + call print_var(mpirank,omprank, blkno, 'Diag%totsnwb ', Diag%totsnwb) + call print_var(mpirank,omprank, blkno, 'Diag%totgrpb ', Diag%totgrpb) + call print_var(mpirank,omprank, blkno, 'Diag%suntim ', Diag%suntim) + call print_var(mpirank,omprank, blkno, 'Diag%runoff ', Diag%runoff) + call print_var(mpirank,omprank, blkno, 'Diag%ep ', Diag%ep) + call print_var(mpirank,omprank, blkno, 'Diag%cldwrk ', Diag%cldwrk) + call print_var(mpirank,omprank, blkno, 'Diag%dugwd ', Diag%dugwd) + call print_var(mpirank,omprank, blkno, 'Diag%dvgwd ', Diag%dvgwd) + call print_var(mpirank,omprank, blkno, 'Diag%psmean ', Diag%psmean) + call print_var(mpirank,omprank, blkno, 'Diag%cnvprcp ', Diag%cnvprcp) + call print_var(mpirank,omprank, blkno, 'Diag%cnvprcpb ', Diag%cnvprcpb) + call print_var(mpirank,omprank, blkno, 'Diag%spfhmin ', Diag%spfhmin) + call print_var(mpirank,omprank, blkno, 'Diag%spfhmax ', Diag%spfhmax) + call print_var(mpirank,omprank, blkno, 'Diag%u10mmax ', Diag%u10mmax) + call print_var(mpirank,omprank, blkno, 'Diag%v10mmax ', Diag%v10mmax) + call print_var(mpirank,omprank, blkno, 'Diag%wind10mmax ', Diag%wind10mmax) + call print_var(mpirank,omprank, blkno, 'Diag%rain ', Diag%rain) + call print_var(mpirank,omprank, blkno, 'Diag%rainc ', Diag%rainc) + call print_var(mpirank,omprank, blkno, 'Diag%ice ', Diag%ice) + call print_var(mpirank,omprank, blkno, 'Diag%snow ', Diag%snow) + call print_var(mpirank,omprank, blkno, 'Diag%graupel ', Diag%graupel) + call print_var(mpirank,omprank, blkno, 'Diag%u10m ', Diag%u10m) + call print_var(mpirank,omprank, blkno, 'Diag%v10m ', Diag%v10m) + call print_var(mpirank,omprank, blkno, 'Diag%dpt2m ', Diag%dpt2m) + call print_var(mpirank,omprank, blkno, 'Diag%zlvl ', Diag%zlvl) + call print_var(mpirank,omprank, blkno, 'Diag%psurf ', Diag%psurf) + call print_var(mpirank,omprank, blkno, 'Diag%hpbl ', Diag%hpbl) + call print_var(mpirank,omprank, blkno, 'Diag%pwat ', Diag%pwat) + call print_var(mpirank,omprank, blkno, 'Diag%t1 ', Diag%t1) + call print_var(mpirank,omprank, blkno, 'Diag%q1 ', Diag%q1) + call print_var(mpirank,omprank, blkno, 'Diag%u1 ', Diag%u1) + call print_var(mpirank,omprank, blkno, 'Diag%v1 ', Diag%v1) + call print_var(mpirank,omprank, blkno, 'Diag%chh ', Diag%chh) + call print_var(mpirank,omprank, blkno, 'Diag%cmm ', Diag%cmm) + call print_var(mpirank,omprank, blkno, 'Diag%epi ', Diag%epi) + call print_var(mpirank,omprank, blkno, 'Diag%smcwlt2 ', Diag%smcwlt2) + call print_var(mpirank,omprank, blkno, 'Diag%smcref2 ', Diag%smcref2) + call print_var(mpirank,omprank, blkno, 'Diag%sr ', Diag%sr) + call print_var(mpirank,omprank, blkno, 'Diag%tdomr ', Diag%tdomr) + call print_var(mpirank,omprank, blkno, 'Diag%tdomzr ', Diag%tdomzr) + call print_var(mpirank,omprank, blkno, 'Diag%tdomip ', Diag%tdomip) + call print_var(mpirank,omprank, blkno, 'Diag%tdoms ', Diag%tdoms) + call print_var(mpirank,omprank, blkno, 'Diag%wet1 ', Diag%wet1) + ! CCPP only + !call print_var(mpirank,omprank, blkno, 'Diag%snowfallac ', Diag%snowfallac) + !call print_var(mpirank,omprank, blkno, 'Diag%acsnow ', Diag%acsnow) + call print_var(mpirank,omprank, blkno, 'Diag%skebu_wts ', Diag%skebu_wts) + call print_var(mpirank,omprank, blkno, 'Diag%skebv_wts ', Diag%skebv_wts) + call print_var(mpirank,omprank, blkno, 'Diag%sppt_wts ', Diag%sppt_wts) + call print_var(mpirank,omprank, blkno, 'Diag%shum_wts ', Diag%shum_wts) + call print_var(mpirank,omprank, blkno, 'Diag%zmtnblck ', Diag%zmtnblck) + if (Model%ldiag3d) then + call print_var(mpirank,omprank, blkno, 'Diag%du3dt ', Diag%du3dt) + do n=1,size(Diag%du3dt(1,1,:)) + call print_var(mpirank,omprank, blkno, 'Diag%du3dt_n ', Diag%du3dt(:,:,n)) + end do + call print_var(mpirank,omprank, blkno, 'Diag%dv3dt ', Diag%dv3dt) + do n=1,size(Diag%dv3dt(1,1,:)) + call print_var(mpirank,omprank, blkno, 'Diag%dv3dt_n ', Diag%dv3dt(:,:,n)) + end do + call print_var(mpirank,omprank, blkno, 'Diag%dt3dt ', Diag%dt3dt) + do n=1,size(Diag%dt3dt(1,1,:)) + call print_var(mpirank,omprank, blkno, 'Diag%dt3dt_n ', Diag%dt3dt(:,:,n)) + end do + call print_var(mpirank,omprank, blkno, 'Diag%dq3dt ', Diag%dq3dt) + do n=1,size(Diag%dq3dt(1,1,:)) + call print_var(mpirank,omprank, blkno, 'Diag%dq3dt_n ', Diag%dq3dt(:,:,n)) + end do + call print_var(mpirank,omprank, blkno, 'Diag%upd_mf ', Diag%upd_mf) + call print_var(mpirank,omprank, blkno, 'Diag%dwn_mf ', Diag%dwn_mf) + call print_var(mpirank,omprank, blkno, 'Diag%det_mf ', Diag%det_mf) + call print_var(mpirank,omprank, blkno, 'Diag%cldcov ', Diag%cldcov) + end if + if(Model%lradar) then + call print_var(mpirank,omprank, blkno, 'Diag%refl_10cm ', Diag%refl_10cm) + end if + ! CCPP only + !if (Model%do_mynnedmf) then + ! call print_var(mpirank,omprank, blkno, 'Diag%edmf_a ', Diag%edmf_a) + ! call print_var(mpirank,omprank, blkno, 'Diag%edmf_w ', Diag%edmf_w) + ! call print_var(mpirank,omprank, blkno, 'Diag%edmf_qt ', Diag%edmf_qt) + ! call print_var(mpirank,omprank, blkno, 'Diag%edmf_thl ', Diag%edmf_thl) + ! call print_var(mpirank,omprank, blkno, 'Diag%edmf_ent ', Diag%edmf_ent) + ! call print_var(mpirank,omprank, blkno, 'Diag%edmf_qc ', Diag%edmf_qc) + ! call print_var(mpirank,omprank, blkno, 'Diag%nupdraft ', Diag%nupdraft) + ! call print_var(mpirank,omprank, blkno, 'Diag%maxMF ', Diag%maxMF) + ! call print_var(mpirank,omprank, blkno, 'Diag%ktop_shallow', Diag%ktop_shallow) + ! call print_var(mpirank,omprank, blkno, 'Diag%exch_h ', Diag%exch_h) + ! call print_var(mpirank,omprank, blkno, 'Diag%exch_m ', Diag%exch_m) + !end if + ! Statein + call print_var(mpirank,omprank, blkno, 'Statein%phii' , Statein%phii) + call print_var(mpirank,omprank, blkno, 'Statein%prsi' , Statein%prsi) + call print_var(mpirank,omprank, blkno, 'Statein%prsik' , Statein%prsik) + call print_var(mpirank,omprank, blkno, 'Statein%phil' , Statein%phil) + call print_var(mpirank,omprank, blkno, 'Statein%prsl' , Statein%prsl) + call print_var(mpirank,omprank, blkno, 'Statein%prslk' , Statein%prslk) + call print_var(mpirank,omprank, blkno, 'Statein%pgr' , Statein%pgr) + call print_var(mpirank,omprank, blkno, 'Statein%ugrs' , Statein%ugrs) + call print_var(mpirank,omprank, blkno, 'Statein%vgrs' , Statein%vgrs) + call print_var(mpirank,omprank, blkno, 'Statein%vvl' , Statein%vvl) + call print_var(mpirank,omprank, blkno, 'Statein%tgrs' , Statein%tgrs) + call print_var(mpirank,omprank, blkno, 'Statein%qgrs' , Statein%qgrs) + do n=1,size(Statein%qgrs(1,1,:)) + call print_var(mpirank,omprank, blkno, 'Statein%qgrs_n', Statein%qgrs(:,:,n)) + end do + call print_var(mpirank,omprank, blkno, 'Statein%diss_est', Statein%diss_est) + call print_var(mpirank,omprank, blkno, 'Statein%smc' , Statein%smc) + call print_var(mpirank,omprank, blkno, 'Statein%stc' , Statein%stc) + call print_var(mpirank,omprank, blkno, 'Statein%slc' , Statein%slc) + ! Stateout + call print_var(mpirank,omprank, blkno, 'Stateout%gu0', Stateout%gu0) + call print_var(mpirank,omprank, blkno, 'Stateout%gv0', Stateout%gv0) + call print_var(mpirank,omprank, blkno, 'Stateout%gt0', Stateout%gt0) + call print_var(mpirank,omprank, blkno, 'Stateout%gq0', Stateout%gq0) + do n=1,size(Stateout%gq0(1,1,:)) + call print_var(mpirank,omprank, blkno, 'Stateout%gq0_n', Stateout%gq0(:,:,n)) + end do + ! Coupling + call print_var(mpirank,omprank, blkno, 'Coupling%nirbmdi', Coupling%nirbmdi) + call print_var(mpirank,omprank, blkno, 'Coupling%nirdfdi', Coupling%nirdfdi) + call print_var(mpirank,omprank, blkno, 'Coupling%visbmdi', Coupling%visbmdi) + call print_var(mpirank,omprank, blkno, 'Coupling%visdfdi', Coupling%visdfdi) + call print_var(mpirank,omprank, blkno, 'Coupling%nirbmui', Coupling%nirbmui) + call print_var(mpirank,omprank, blkno, 'Coupling%nirdfui', Coupling%nirdfui) + call print_var(mpirank,omprank, blkno, 'Coupling%visbmui', Coupling%visbmui) + call print_var(mpirank,omprank, blkno, 'Coupling%visdfui', Coupling%visdfui) + call print_var(mpirank,omprank, blkno, 'Coupling%sfcdsw ', Coupling%sfcdsw ) + call print_var(mpirank,omprank, blkno, 'Coupling%sfcnsw ', Coupling%sfcnsw ) + call print_var(mpirank,omprank, blkno, 'Coupling%sfcdlw ', Coupling%sfcdlw ) + if (Model%cplflx .or. Model%do_sppt) then + call print_var(mpirank,omprank, blkno, 'Coupling%rain_cpl', Coupling%rain_cpl) + call print_var(mpirank,omprank, blkno, 'Coupling%snow_cpl', Coupling%snow_cpl) + end if + if (Model%cplflx) then + call print_var(mpirank,omprank, blkno, 'Coupling%slimskin_cpl', Coupling%slimskin_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%dusfcin_cpl ', Coupling%dusfcin_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%dvsfcin_cpl ', Coupling%dvsfcin_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%dtsfcin_cpl ', Coupling%dtsfcin_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%dqsfcin_cpl ', Coupling%dqsfcin_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%ulwsfcin_cpl', Coupling%ulwsfcin_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%tseain_cpl ', Coupling%tseain_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%tisfcin_cpl ', Coupling%tisfcin_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%ficein_cpl ', Coupling%ficein_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%hicein_cpl ', Coupling%hicein_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%hsnoin_cpl ', Coupling%hsnoin_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%dusfc_cpl ', Coupling%dusfc_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%dvsfc_cpl ', Coupling%dvsfc_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%dtsfc_cpl ', Coupling%dtsfc_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%dqsfc_cpl ', Coupling%dqsfc_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%dlwsfc_cpl ', Coupling%dlwsfc_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%dswsfc_cpl ', Coupling%dswsfc_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%dnirbm_cpl ', Coupling%dnirbm_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%dnirdf_cpl ', Coupling%dnirdf_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%dvisbm_cpl ', Coupling%dvisbm_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%dvisdf_cpl ', Coupling%dvisdf_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%nlwsfc_cpl ', Coupling%nlwsfc_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%nswsfc_cpl ', Coupling%nswsfc_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%nnirbm_cpl ', Coupling%nnirbm_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%nnirdf_cpl ', Coupling%nnirdf_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%nvisbm_cpl ', Coupling%nvisbm_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%nvisdf_cpl ', Coupling%nvisdf_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%dusfci_cpl ', Coupling%dusfci_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%dvsfci_cpl ', Coupling%dvsfci_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%dtsfci_cpl ', Coupling%dtsfci_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%dqsfci_cpl ', Coupling%dqsfci_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%dlwsfci_cpl ', Coupling%dlwsfci_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%dswsfci_cpl ', Coupling%dswsfci_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%dnirbmi_cpl ', Coupling%dnirbmi_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%dnirdfi_cpl ', Coupling%dnirdfi_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%dvisbmi_cpl ', Coupling%dvisbmi_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%dvisdfi_cpl ', Coupling%dvisdfi_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%nlwsfci_cpl ', Coupling%nlwsfci_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%nswsfci_cpl ', Coupling%nswsfci_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%nnirbmi_cpl ', Coupling%nnirbmi_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%nnirdfi_cpl ', Coupling%nnirdfi_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%nvisbmi_cpl ', Coupling%nvisbmi_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%nvisdfi_cpl ', Coupling%nvisdfi_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%t2mi_cpl ', Coupling%t2mi_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%q2mi_cpl ', Coupling%q2mi_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%u10mi_cpl ', Coupling%u10mi_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%v10mi_cpl ', Coupling%v10mi_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%tsfci_cpl ', Coupling%tsfci_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%psurfi_cpl ', Coupling%psurfi_cpl ) + end if + if (Model%cplchm) then + call print_var(mpirank,omprank, blkno, 'Coupling%rain_cpl ', Coupling%rain_cpl ) + call print_var(mpirank,omprank, blkno, 'Coupling%rainc_cpl', Coupling%rainc_cpl) + call print_var(mpirank,omprank, blkno, 'Coupling%ushfsfci ', Coupling%ushfsfci ) + call print_var(mpirank,omprank, blkno, 'Coupling%dkt ', Coupling%dkt ) + end if + if (Model%do_sppt) then + call print_var(mpirank,omprank, blkno, 'Coupling%sppt_wts', Coupling%sppt_wts) + end if + if (Model%do_shum) then + call print_var(mpirank,omprank, blkno, 'Coupling%shum_wts', Coupling%shum_wts) + end if + if (Model%do_skeb) then + call print_var(mpirank,omprank, blkno, 'Coupling%skebu_wts', Coupling%skebu_wts) + call print_var(mpirank,omprank, blkno, 'Coupling%skebv_wts', Coupling%skebv_wts) + end if + if (Model%do_sfcperts) then + call print_var(mpirank,omprank, blkno, 'Coupling%sfc_wts', Coupling%sfc_wts) + end if + if (Model%lgocart .or. Model%ldiag3d) then + call print_var(mpirank,omprank, blkno, 'Coupling%dqdti ', Coupling%dqdti ) + call print_var(mpirank,omprank, blkno, 'Coupling%cnvqci ', Coupling%cnvqci ) + call print_var(mpirank,omprank, blkno, 'Coupling%upd_mfi', Coupling%upd_mfi) + call print_var(mpirank,omprank, blkno, 'Coupling%dwn_mfi', Coupling%dwn_mfi) + call print_var(mpirank,omprank, blkno, 'Coupling%det_mfi', Coupling%det_mfi) + call print_var(mpirank,omprank, blkno, 'Coupling%cldcovi', Coupling%cldcovi) + end if + if(Model%imp_physics == Model%imp_physics_thompson .and. Model%ltaerosol) then + call print_var(mpirank,omprank, blkno, 'Coupling%nwfa2d', Coupling%nwfa2d) + call print_var(mpirank,omprank, blkno, 'Coupling%nifa2d', Coupling%nifa2d) + end if + ! Grid + call print_var(mpirank,omprank, blkno, 'Grid%xlon ', Grid%xlon ) + call print_var(mpirank,omprank, blkno, 'Grid%xlat ', Grid%xlat ) + call print_var(mpirank,omprank, blkno, 'Grid%xlat_d', Grid%xlat_d) + call print_var(mpirank,omprank, blkno, 'Grid%sinlat', Grid%sinlat) + call print_var(mpirank,omprank, blkno, 'Grid%coslat', Grid%coslat) + call print_var(mpirank,omprank, blkno, 'Grid%area ', Grid%area ) + call print_var(mpirank,omprank, blkno, 'Grid%dx ', Grid%dx ) + if (Model%ntoz > 0) then + call print_var(mpirank,omprank, blkno, 'Grid%ddy_o3 ', Grid%ddy_o3 ) + call print_var(mpirank,omprank, blkno, 'Grid%jindx1_o3', Grid%jindx1_o3) + call print_var(mpirank,omprank, blkno, 'Grid%jindx2_o3', Grid%jindx2_o3) + endif + if (Model%h2o_phys) then + call print_var(mpirank,omprank, blkno, 'Grid%ddy_h ', Grid%ddy_h ) + call print_var(mpirank,omprank, blkno, 'Grid%jindx1_h', Grid%jindx1_h) + call print_var(mpirank,omprank, blkno, 'Grid%jindx2_h', Grid%jindx2_h) + endif + ! Model/Control + ! not yet + end if +#ifdef OPENMP +!$OMP BARRIER +#endif + end do +#ifdef MPI +! call MPI_BARRIER(mpicomm,ierr) +#endif + end do + +#ifdef OPENMP +!$OMP BARRIER +#endif +#ifdef MPI +! call MPI_BARRIER(mpicomm,ierr) +#endif + + end subroutine GFS_diagtoscreen_run + + subroutine print_logic_0d(mpirank,omprank,blkno,name,var) + + implicit none + + integer, intent(in) :: mpirank, omprank, blkno + character(len=*), intent(in) :: name + logical, intent(in) :: var + + write(0,'(2a,3i6,1x,l)') 'XXX: ', trim(name), mpirank, omprank, blkno, var + + end subroutine print_logic_0d + + subroutine print_int_0d(mpirank,omprank,blkno,name,var) + + implicit none + + integer, intent(in) :: mpirank, omprank, blkno + character(len=*), intent(in) :: name + integer, intent(in) :: var + + write(0,'(2a,3i6,i15)') 'XXX: ', trim(name), mpirank, omprank, blkno, var + + end subroutine print_int_0d + + subroutine print_int_1d(mpirank,omprank,blkno,name,var) + + use machine, only: kind_phys + + implicit none + + integer, intent(in) :: mpirank, omprank, blkno + character(len=*), intent(in) :: name + integer, intent(in) :: var(:) + + integer :: i + +#ifdef PRINT_SUM + write(0,'(2a,3i6,3i15)') 'XXX: ', trim(name), mpirank, omprank, blkno, sum(var), minval(var), maxval(var) +#elif defined(PRINT_CHKSUM) + write(0,'(2a,3i6,i20,2i15)') 'XXX: ', trim(name), mpirank, omprank, blkno, chksum_int(size(var),var), minval(var), maxval(var) +#else + do i=ISTART,min(IEND,size(var(:))) + write(0,'(2a,3i6,i6,i15)') 'XXX: ', trim(name), mpirank, omprank, blkno, i, var(i) + end do +#endif + + end subroutine print_int_1d + + subroutine print_real_0d(mpirank,omprank,blkno,name,var) + + use machine, only: kind_phys + + implicit none + + integer, intent(in) :: mpirank, omprank, blkno + character(len=*), intent(in) :: name + real(kind_phys), intent(in) :: var + + write(0,'(2a,3i6,e35.25)') 'XXX: ', trim(name), mpirank, omprank, blkno, var + + end subroutine print_real_0d + + subroutine print_real_1d(mpirank,omprank,blkno,name,var) + + use machine, only: kind_phys + + implicit none + + integer, intent(in) :: mpirank, omprank, blkno + character(len=*), intent(in) :: name + real(kind_phys), intent(in) :: var(:) + + integer :: i + +#ifdef PRINT_SUM + write(0,'(2a,3i6,3e35.25)') 'XXX: ', trim(name), mpirank, omprank, blkno, sum(var), minval(var), maxval(var) +#elif defined(PRINT_CHKSUM) + write(0,'(2a,3i6,i20,2e35.25)') 'XXX: ', trim(name), mpirank, omprank, blkno, chksum_real(size(var),var), minval(var), maxval(var) +#else + do i=ISTART,min(IEND,size(var(:))) + write(0,'(2a,3i6,i6,e35.25)') 'XXX: ', trim(name), mpirank, omprank, blkno, i, var(i) + end do +#endif + + end subroutine print_real_1d + + subroutine print_real_2d(mpirank,omprank,blkno,name,var) + + use machine, only: kind_phys + + implicit none + + integer, intent(in) :: mpirank, omprank, blkno + character(len=*), intent(in) :: name + real(kind_phys), intent(in) :: var(:,:) + + integer :: k, i + +#ifdef PRINT_SUM + write(0,'(2a,3i6,3e35.25)') 'XXX: ', trim(name), mpirank, omprank, blkno, sum(var), minval(var), maxval(var) +#elif defined(PRINT_CHKSUM) + write(0,'(2a,3i6,i20,2e35.25)') 'XXX: ', trim(name), mpirank, omprank, blkno, chksum_real(size(var),reshape(var,(/size(var)/))), minval(var), maxval(var) +#else + do i=ISTART,min(IEND,size(var(:,1))) + do k=KSTART,min(KEND,size(var(1,:))) + write(0,'(2a,3i6,2i6,e35.25)') 'XXX: ', trim(name), mpirank, omprank, blkno, i, k, var(i,k) + end do + end do +#endif + + end subroutine print_real_2d + + subroutine print_real_3d(mpirank,omprank,blkno,name,var) + + use machine, only: kind_phys + + implicit none + + integer, intent(in) :: mpirank, omprank, blkno + character(len=*), intent(in) :: name + real(kind_phys), intent(in) :: var(:,:,:) + + integer :: k, i, l + +#ifdef PRINT_SUM + write(0,'(2a,3i6,3e35.25)') 'XXX: ', trim(name), mpirank, omprank, blkno, sum(var), minval(var), maxval(var) +#elif defined(PRINT_CHKSUM) + write(0,'(2a,3i6,i20,2e35.25)') 'XXX: ', trim(name), mpirank, omprank, blkno, chksum_real(size(var),reshape(var,(/size(var)/))), minval(var), maxval(var) +#else + do i=ISTART,min(IEND,size(var(:,1,1))) + do k=KSTART,min(KEND,size(var(1,:,1))) + do l=1,size(var(1,1,:)) + write(0,'(2a,3i6,3i6,e35.25)') 'XXX: ', trim(name), mpirank, omprank, blkno, i, k, l, var(i,k,l) + end do + end do + end do +#endif + + end subroutine print_real_3d + + function chksum_int(N, var) result(hash) + implicit none + integer, intent(in) :: N + integer, dimension(1:N), intent(in) :: var + integer*8, dimension(1:N) :: int_var + integer*8 :: a, b, i, hash + integer*8, parameter :: mod_adler=65521 + + a=1 + b=0 + i=1 + hash = 0 + int_var = TRANSFER(var, a, N) + + do i= 1, N + a = MOD(a + int_var(i), mod_adler) + b = MOD(b+a, mod_adler) + end do + + hash = ior(b * 65536, a) + + end function chksum_int + + function chksum_real(N, var) result(hash) + use machine, only: kind_phys + implicit none + integer, intent(in) :: N + real(kind_phys), dimension(1:N), intent(in) :: var + integer*8, dimension(1:N) :: int_var + integer*8 :: a, b, i, hash + integer*8, parameter :: mod_adler=65521 + + a=1 + b=0 + i=1 + hash = 0 + int_var = TRANSFER(var, a, N) + + do i= 1, N + a = MOD(a + int_var(i), mod_adler) + b = MOD(b+a, mod_adler) + end do + + hash = ior(b * 65536, a) + + end function chksum_real + + function print_my_stuff(mpitoprint,omptoprint) result(flag) +#ifdef MPI + use mpi +#endif +#ifdef OPENMP + use omp_lib +#endif + implicit none + integer, intent(in) :: mpitoprint, omptoprint + logical :: flag + integer :: ompthread, mpirank, ierr +#ifdef MPI + call MPI_COMM_RANK(MPI_COMM_WORLD, mpirank, ierr) +#else + mpirank = 0 +#endif +#ifdef OPENMP + ompthread = OMP_GET_THREAD_NUM() +#else + ompthread = 0 +#endif + + if (mpitoprint==mpirank .and. omptoprint==ompthread) then + flag = .true. + else + flag = .false. + end if + end function print_my_stuff + + end module GFS_diagtoscreen + + module GFS_abort + + private + + public GFS_abort_init, GFS_abort_run, GFS_abort_finalize + + contains + + subroutine GFS_abort_init () + end subroutine GFS_abort_init + + subroutine GFS_abort_finalize () + end subroutine GFS_abort_finalize + + subroutine GFS_abort_run (Model, blkno) + + use machine, only: kind_phys + use GFS_typedefs, only: GFS_control_type + + implicit none + + !--- interface variables + type(GFS_control_type), intent(in ) :: Model + integer, intent(in ) :: blkno + + if (Model%kdt==1 .and. blkno==4) then + if (Model%me==0) write(0,*) "GFS_abort_run: ABORTING MODEL" + call sleep(10) + stop + end if + + end subroutine GFS_abort_run + + end module GFS_abort diff --git a/gfsphysics/physics/aer_cloud.F b/gfsphysics/physics/aer_cloud.F index 680ce8438..364b2782f 100644 --- a/gfsphysics/physics/aer_cloud.F +++ b/gfsphysics/physics/aer_cloud.F @@ -460,7 +460,9 @@ subroutine aerosol_activate(tparc_in, pparc_in, sigwparc_in, ! allocate(sigdust_ice(nbindust_ice)) ! allocate(ddust_ice(nbindust_ice)) - + ddust_ice = zero_par + ndust_ice = zero_par + sigdust_ice = zero_par do n=1,nbindust_ice ddust_ice(n) = DBLE(Aeraux%dpg(n)) ndust_ice(n) = DBLE(Aeraux%num(n))*air_den @@ -3076,7 +3078,8 @@ subroutine INSPEC_ice(six, N, Dsh,np_ice,norg_ice, sigorg_ice, & dNglassy, SIW, D_grid_bio, n_grid_bio,vpresw_ice,vpresi_ice real*8, dimension(3) :: sig_array, the_array, frac_array - real*8, dimension(:) :: ndust_ice, sigdust_ice,ddust_ice + real*8, dimension(1:nbindust_ice) :: ndust_ice, sigdust_ice, + & ddust_ice real :: n_iw, DSh_s , nbc_s, dbc_s, Asolo real, dimension (nbindust_ice) :: ndust_s, ddust_s diff --git a/gfsphysics/physics/cires_ugwp_module.F90 b/gfsphysics/physics/cires_ugwp_module.F90 index 45a4df54b..45b71f3ee 100644 --- a/gfsphysics/physics/cires_ugwp_module.F90 +++ b/gfsphysics/physics/cires_ugwp_module.F90 @@ -149,7 +149,7 @@ subroutine cires_ugwp_init (me, master, nlunit, logunit, fn_nml2, & if (me == master) & write (6, *) 'separate ugwp :: namelist file: ', trim (fn_nml), ' does not exist' else - open (unit = nlunit, file = trim(fn_nml), readonly, status = 'old', iostat = ios) + open (unit = nlunit, file = trim(fn_nml), action = 'read', status = 'old', iostat = ios) endif rewind (nlunit) read (nlunit, nml = cires_ugwp_nml) diff --git a/gfsphysics/physics/co2hc.f b/gfsphysics/physics/co2hc.f index 4616f82a8..073b999ff 100644 --- a/gfsphysics/physics/co2hc.f +++ b/gfsphysics/physics/co2hc.f @@ -834,9 +834,9 @@ subroutine co2cc(im,jm,xtemp,temp,ltemp,xhr,hrate,lhr,mu,ro1, & ! Calculate composition on Victor grid above x=12.5 (index 50) for ! recurrent formula ! - call splin2(xhr,mu,xvic0(51),vicmu,lhr,itm50,im,jm) - call splin2(xhr,rn2,xvic0(51),vicn2,lhr,itm50,im,jm) - call splin2(xhr,ro2,xvic0(51),vico2,lhr,itm50,im,jm) + call splin2(xhr,mu,xvic0(51:),vicmu,lhr,itm50,im,jm) + call splin2(xhr,rn2,xvic0(51:),vicn2,lhr,itm50,im,jm) + call splin2(xhr,ro2,xvic0(51:),vico2,lhr,itm50,im,jm) ! ! Feb 28, 2008 ! idea change: the following portion of the code commented out and @@ -864,7 +864,7 @@ subroutine co2cc(im,jm,xtemp,temp,ltemp,xhr,hrate,lhr,mu,ro1, & ! call splin2(xhr(iwork),ro1(1:im,iwork:),xvic0(51),vico1, & ! & lhr-iwork+1,itm50,im,jm) ! - call splin2(xhr,ro1,xvic0(51),vico1,lhr,itm50,im,jm) + call splin2(xhr,ro1,xvic0(51:),vico1,lhr,itm50,im,jm) ! ! idea add: make sure O is non-negative ! @@ -1200,8 +1200,8 @@ subroutine co2cin(xmod,pmod,mu,gr,lmod,me,mpi_ior,mpi_comm) endif enddo j=i-1 - call splin1(xmod,mu,xvic0(i),vmu(i),lmod,ivict-j) - call splin1(xmod,gr,xvic0(i),vgrav(i),lmod,ivict-j) + call splin1(xmod,mu,xvic0(i:),vmu(i:),lmod,ivict-j) + call splin1(xmod,gr,xvic0(i:),vgrav(i:),lmod,ivict-j) ! ! Below x(i) assume constant mu and g ! @@ -1386,7 +1386,7 @@ subroutine co2cin(xmod,pmod,mu,gr,lmod,me,mpi_ior,mpi_comm) if(uco2(i+50).lt.uco2ro(1)) then war1(1)=0. else - call splin1(uco2ro,alo,uco2(i+50),war1,51,1) + call splin1(uco2ro,alo,uco2(i+50:),war1,51,1) endif co2int(1)=cor150(i) co2int(2)=cor360(i) @@ -1396,7 +1396,7 @@ subroutine co2cin(xmod,pmod,mu,gr,lmod,me,mpi_ior,mpi_comm) uref(2) =uco2o(i+50) uref(3) =uco2o(i+50)*540./360. uref(4) =uco2o(i+50)*720./360. - call splin1(uref,co2int,uco2(i+50),war2,4,1) + call splin1(uref,co2int,uco2(i+50:),war2,4,1) alvic(i)=exp(war1(1)+war2(1)) enddo ! @@ -1406,7 +1406,7 @@ subroutine co2cin(xmod,pmod,mu,gr,lmod,me,mpi_ior,mpi_comm) if(uco2(i+50).lt.uco2ro(1)) then war1(1)=0. else - call splin1(uco2ro,alo,uco2(i+50),war1,51,1) + call splin1(uco2ro,alo,uco2(i+50:),war1,51,1) endif alvic(i)=exp(war1(1)) enddo diff --git a/gfsphysics/physics/cs_conv.f90 b/gfsphysics/physics/cs_conv.F90 similarity index 99% rename from gfsphysics/physics/cs_conv.f90 rename to gfsphysics/physics/cs_conv.F90 index c2921d1f8..f60cfc5d8 100644 --- a/gfsphysics/physics/cs_conv.f90 +++ b/gfsphysics/physics/cs_conv.F90 @@ -966,6 +966,10 @@ SUBROUTINE CS_CUMLUS (im , IJSDIM, KMAX , NTR , & !DD dimensions !! CUMUP computes In-cloud Properties +! DH* GNU crashes - check all arguments to CUMUP for their dimensions +! before and after CUMUP (i.e. here), and inside the routine, in +! particular: gctm, gcqm, gcwm, gchm, gcwt, gclm, gcim,gctrm +! also, inside, check that no reads/writes out of bounds occur *DH CALL CUMUP(IJSDIM, KMAX, NTR, ntrq, & !DD dimensions ACWF , & ! output GCLZ , GCIZ , GPRCIZ , GSNWIZ, & ! output @@ -1980,15 +1984,10 @@ SUBROUTINE CUMUP & !! in-cloud properties REAL(r8) :: esat, tem ! REAL(r8) :: esat, tem, rhs_h, rhs_q ! -! [INTERNAL FUNC] - REAL(r8) FPREC ! precipitation ratio in condensate - REAL(r8) FRICE ! ice ratio in cloud water REAL(r8) Z ! altitude REAL(r8) ZH ! scale height REAL(r8) T ! temperature ! - FPREC(Z,ZH) = MIN(MAX(one-EXP(-(Z-PRECZ0)/ZH), zero), one) - FRICE(T) = MIN(MAX((TSICE-T)/(TSICE-TWICE), zero), one) ! ! Note: iteration is not made to diagnose cloud ice for simplicity ! @@ -2455,6 +2454,24 @@ SUBROUTINE CUMUP & !! in-cloud properties ! ! WRITE( CTNUM, '(I2.2)' ) CTP ! + +contains + + pure function FPREC(Z,ZH) + implicit none + real(r8), intent(in) :: Z + real(r8), intent(in) :: ZH + real(r8) :: FPREC + FPREC = MIN(MAX(one-EXP(-(Z-PRECZ0)/ZH), zero), one) + end function FPREC + + pure function FRICE(T) + implicit none + real(r8), intent(in) :: T + real(r8) :: FRICE + FRICE = MIN(MAX((TSICE-T)/(TSICE-TWICE), zero), one) + end function FRICE + END SUBROUTINE CUMUP !*********************************************************************** SUBROUTINE CUMBMX & !! cloud base mass flux @@ -3853,8 +3870,8 @@ SUBROUTINE CUMCHK & ! check range of output va REAL(r8) :: CLWMAX = 1.e-3_r8 REAL(r8) :: TPRPMAX = 1.e-2_r8 REAL(r8) :: GTQIMAX = 1.e-5_r8 - REAL(r8) :: GTM2MAX = 1._r8 - REAL(r8) :: GTM3MAX = 1._r8 + !REAL(r8) :: GTM2MAX = 1._r8 + !REAL(r8) :: GTM3MAX = 1._r8 ! DO K=1,KMAX DO I=ISTS, IENS diff --git a/gfsphysics/physics/gcm_shoc.f90 b/gfsphysics/physics/gcm_shoc.f90 index 6b768946c..69092d3d4 100644 --- a/gfsphysics/physics/gcm_shoc.f90 +++ b/gfsphysics/physics/gcm_shoc.f90 @@ -1567,7 +1567,7 @@ subroutine assumed_pdf() cld_sgs(i,k) = diag_frac ! Update ncpl and ncpi Moorthi 12/12/2018 - if (imp_phys) then + if (imp_phys>0) then if (ncpl(i,k) > nmin) then ncpl(i,k) = diag_ql/max(qc(i,k),1.e-10)*ncpl(i,k) else diff --git a/gfsphysics/physics/gfs_phy_tracer_config.f b/gfsphysics/physics/gfs_phy_tracer_config.F similarity index 100% rename from gfsphysics/physics/gfs_phy_tracer_config.f rename to gfsphysics/physics/gfs_phy_tracer_config.F diff --git a/gfsphysics/physics/h2oc.f b/gfsphysics/physics/h2oc.f index 99e306fd2..5fb507431 100644 --- a/gfsphysics/physics/h2oc.f +++ b/gfsphysics/physics/h2oc.f @@ -837,9 +837,9 @@ subroutine wvrefm(pmy,wvmy,tmy,coeff,lmy,lh2o,llin) wvmy(:)=0. tmy(:)=0. call splin1(x0(kz0:1:-1),mmr0(kz0:1:-1), - $ xmy(lh2o),wvmy(lh2o),kz0,lmy+1-lh2o) + $ xmy(lh2o:),wvmy(lh2o:),kz0,lmy+1-lh2o) call splin1(x0(kz0:1:-1),tem0(kz0:1:-1), - $ xmy(lh2o),tmy(lh2o),kz0,lmy+1-lh2o) + $ xmy(lh2o:),tmy(lh2o:),kz0,lmy+1-lh2o) c For linear extrapolation of cooling rates upward of xmy(lh2o), count c how many model layers are between xmy(lh2o) and xmu(lh2o)+1 and diff --git a/gfsphysics/physics/iccninterp.f90 b/gfsphysics/physics/iccninterp.f90 index d0183d8c9..66dd344db 100644 --- a/gfsphysics/physics/iccninterp.f90 +++ b/gfsphysics/physics/iccninterp.f90 @@ -209,6 +209,17 @@ SUBROUTINE ciinterpol(me,npts,IDATE,FHOUR,jindx1,jindx2,ddy, & ccnout(j,l)=ccnpm(j,1) else DO k=kcipl-1,1,-1 + ! DH* There is no backstop if this condition isn't met, + ! i.e. i1 and i2 will have values determined by the + ! previous code (line 178) - this leads to crashes in + ! debug mode (out of bounds), for example for regression + ! test fv3_stretched_nest_debug. For the time being, + ! this is 'solved' by simply switching off ICCN + ! if MG2/3 are not used (these are the only microphysics + ! schemes that use the ICCN data); however, this doesn't + ! mean that the code is correct for MG2/3, it just doesn't + ! abort if the below condition isn't met, because the code + ! is not tested in DEBUG mode. *DH IF(prsl(j,l)>cipres(j,k)) then i1=k i2=min(k+1,kcipl) diff --git a/gfsphysics/physics/m_micro_driver.f90 b/gfsphysics/physics/m_micro_driver.F90 similarity index 100% rename from gfsphysics/physics/m_micro_driver.f90 rename to gfsphysics/physics/m_micro_driver.F90 diff --git a/gfsphysics/physics/machine.F b/gfsphysics/physics/machine.F index d39159bee..bd896dac9 100644 --- a/gfsphysics/physics/machine.F +++ b/gfsphysics/physics/machine.F @@ -32,6 +32,12 @@ MODULE MACHINE #endif +#ifdef OVERLOAD_R4 + integer, parameter :: kind_dyn = 4 +#else + integer, parameter :: kind_dyn = 8 +#endif + ! real(kind=kind_evod), parameter :: mprec = 1.e-12 ! machine precision to restrict dep real(kind=kind_evod), parameter :: grib_undef = 9.99e20 ! grib undefine value diff --git a/gfsphysics/physics/physcons.f90 b/gfsphysics/physics/physcons.F90 similarity index 98% rename from gfsphysics/physics/physcons.f90 rename to gfsphysics/physics/physcons.F90 index f079f57f7..5702b65de 100644 --- a/gfsphysics/physics/physcons.f90 +++ b/gfsphysics/physics/physcons.F90 @@ -153,6 +153,11 @@ module physcons ! !> temperature the H.G.Nuc. ice starts real(kind=kind_phys), parameter:: con_thgni =-38.15_kind_phys +#ifdef CCPP +!> minimum ice concentration + real(kind=kind_phys),parameter:: cimin =0.15 +#endif + !> \name Miscellaneous physics related constants (Moorthi - Jul 2014) ! integer, parameter :: max_lon=16000, max_lat=8000, min_lon=192, min_lat=94 @@ -170,6 +175,7 @@ module physcons ! real(kind=kind_phys),parameter:: rhosnow = 100._kind_phys ! density of snow (kg/m^3) real(kind=kind_phys),parameter:: rhoair = 1.28_kind_phys ! density of air near surface (kg/m^3) +#ifndef CCPP real(kind=kind_phys) :: dxmax, dxmin, dxinv, rhc_max ! For min/max hourly rh02m and t02m real(kind=kind_phys),parameter :: PQ0 = 379.90516E0_kind_phys @@ -177,6 +183,8 @@ module physcons ! real(kind=kind_phys),parameter :: A3 = 273.16_kind_phys real(kind=kind_phys),parameter :: A4 = 35.86_kind_phys real(kind=kind_phys),parameter :: RHmin = 1.0E-6_kind_phys +#endif + !........................................! end module physcons ! !========================================! diff --git a/gfsphysics/physics/physparam.f b/gfsphysics/physics/physparam.f index f3742c9cc..f78191278 100644 --- a/gfsphysics/physics/physparam.f +++ b/gfsphysics/physics/physparam.f @@ -209,7 +209,7 @@ module physparam ! !> ozone data source control flag !!\n =0:use seasonal climatology ozone data !!\n >0:use prognostic ozone scheme (also depend on other model control -!! variable at initial time +!! variable at initial time) integer, save :: ioznflg = 1 !> external co2 2d monthly obsv data table: co2historicaldata_2004.txt diff --git a/gfsphysics/physics/radiation_aerosols.f b/gfsphysics/physics/radiation_aerosols.f index 732556c6d..37364b8be 100644 --- a/gfsphysics/physics/radiation_aerosols.f +++ b/gfsphysics/physics/radiation_aerosols.f @@ -46,7 +46,7 @@ ! ! ! aerolw(IMAX,NLAY,NBDLW,1) - aerosols optical depth for lw ! ! aerolw(IMAX,NLAY,NBDLW,2) - aerosols single scattering albedo ! -! aerolw(IMAX,NLAY,NBDLW,3) - aerosols asymetry parameter ! +! aerolw(IMAX,NLAY,NBDLW,3) - aerosols asymmetry parameter ! ! ! ! ! ! program history: ! diff --git a/gfsphysics/physics/radiation_clouds.f b/gfsphysics/physics/radiation_clouds.f index f2ad5e1d0..99d58b677 100644 --- a/gfsphysics/physics/radiation_clouds.f +++ b/gfsphysics/physics/radiation_clouds.f @@ -2595,8 +2595,8 @@ subroutine progcld5 & clouds(i,k,5) = rei(i,k) clouds(i,k,6) = crp(i,k) ! added for Thompson clouds(i,k,7) = rer(i,k) - clouds(i,k,8) = csp(i,k) ! added for Thompson - clouds(i,k,9) = rei(i,k) + clouds(i,k,8) = csp(i,k) ! added for Thompson + clouds(i,k,9) = res(i,k) enddo enddo diff --git a/gfsphysics/physics/radiation_surface.f b/gfsphysics/physics/radiation_surface.f index 3ec50ed30..e02ea32b9 100644 --- a/gfsphysics/physics/radiation_surface.f +++ b/gfsphysics/physics/radiation_surface.f @@ -90,6 +90,7 @@ module module_radiation_surface ! & kind_phys use physcons, only : con_t0c, con_ttp, con_pi, con_tice use module_iounitdef, only : NIRADSF + use surface_perturbation, only : ppfbet ! implicit none ! @@ -119,7 +120,7 @@ module module_radiation_surface ! !> global surface emissivity contrl flag set up in 'sfc_init' integer :: iemslw = 0 ! - public sfc_init, setalb, setemis, gmln, cdfbet, ppfbet + public sfc_init, setalb, setemis ! ================= contains @@ -830,264 +831,6 @@ subroutine setemis & end subroutine setemis !----------------------------------- -! mg, sfc perts **** -! --- subroutines for computing the beta distribution value that --- -! --- matches the percentile from the random pattern --- - - - subroutine ppfbet(pr,p,q,iflag,x) - use machine - implicit none - real(kind=kind_phys), intent(in) :: pr, p, q - real(kind=kind_phys), intent(out) :: x - ! local variables - integer iflag, iter, itmax - real(kind=kind_phys) tol, a, b, fa, fb, fc, cdf, tol1 - real(kind=kind_phys) c, d, e, xm, s, u, v, r, eps - data itmax, eps / 50, 1.0E-12 / - - ! Compute beta distribution value corresponding to the - ! probability and distribution parameters a,b. - ! - ! pr - a probability value in the interval [0,1] - ! p - the first parameter of the beta(p,q) distribution - ! q - the second parameter of the beta(p,q) distribution - ! iflag - erro indicator in output, 0-no errors, 1,2-error flags - ! from subroutine cdfbet, 3- pr<0 or pr>1, 4-p<=0 or - ! q<=0, 5-tol<1.E-8, 6-the cdfs at the endpoints have - ! the same sign and no value of x is defined, 7-maximum - ! iterations exceeded and current value of x returned - - tol = 1.0E-5 - - - iflag = 0 - if (pr.lt.0.0.or.pr.gt.1.) then - iflag = 3 - return - endif - if(min(p,q).le.0.) then - iflag =4 - return - endif - if (tol.lt.1.0E-8) then - iflag = 5 - return - endif - a = 0. - b = 1. - fa = -pr - fb = 1.-pr - if (fb*fa.gt.0.0) then - iflag = 6 - return - endif - - fc = fb - do iter =1,itmax - if (fb*fc.gt.0.) then - c=a - fc=fa - d = b-a - e=d - endif - if (abs(fc).lt.abs(fb)) then - a=b - b=c - c=a - fa=fb - fb=fc - fc=fa - endif - - tol1 = 2.*eps*abs(b)+0.5*tol - xm = 0.5*(c-b) - if (abs(xm).le.tol1.or.fb.eq.0.0) then - x=b - return - endif - if (abs(e).ge.tol1.and.abs(fa).gt.abs(fb)) then - s = fb/fa - if (a.eq.c) then - u = 2.0*xm*s - v = 1.0-s - else - v = fa/fc - r = fb/fc - u = s*(2.0*xm*v*(v-r)-(b-a)*(r-1.0)) - v = (v-1.0)*(r-1.0)*(s-1.0) - endif - if (u.gt.0.0) v = -v - u = abs(u) - if (2.0*u.lt.min(3.0*xm*v-ABS(tol1*v),ABS(e*v))) then - e = d - d = u/v - else - d = xm - e = d - endif - - else - - d=xm - e=d - endif - - a = b - fa = fb - if (abs(d).gt.tol1) then - b = b+d - else - b = b+sign(tol1,xm) - endif - call cdfbet(b,p,q,eps,iflag,cdf) - if (iflag.ne.0) return - fb = cdf-pr - enddo - x = b - - return - end subroutine ppfbet - - subroutine cdfbet(x,p,q,eps,iflag,cdfx) - use machine - - ! Computes the value of the cumulative beta distribution at a - ! single point x, given the distribution parameters p,q. - ! - ! x - value at which the CDF is to be computed - ! p - first parameter of the beta function - ! q - second parameter of the beta function - ! eps - desired absolute accuracy - - implicit none - real(kind=kind_phys), intent(in) :: x, p, q, eps - real(kind=kind_phys), intent(out) :: cdfx - ! local vars - integer iflag, jmax, j - logical LL - real(kind=kind_phys) dp, dq, gamln, yxeps, w, uflo - real(kind=kind_phys) xy, yx, pq, qp, pdfl, u, r, v - real(kind=kind_phys) tmp - data jmax, w, uflo / 5000, 20.0, 1.0E-30 / - - cdfx = 0.0 - - if (p.le.uflo.or.q.le.uflo.or.eps.le.uflo) then - iflag = 1 - endif - iflag = 0 - - if (x.le.0.0) return - if (x.ge.1.0) then - cdfx=1.0 - else - LL = (p+w).ge.(p+q+2.0*w)*x - if (LL) then - xy = x - yx = 1.-xy - pq = p - qp = q - else - yx = x - xy = 1.-yx - qp = p - pq = q - endif - - call gmln(pq,tmp) - dp = (pq-1.)*log(xy)-tmp - call gmln(qp,tmp) - dq = (qp-1.)*log(yx)-tmp - call gmln(pq+qp,tmp) - pdfl = tmp+dp+dq - - if (pdfl.ge.log(uflo)) then - u = exp(pdfl)*xy/pq - r = xy/yx - do while (qp.gt.1.) - if (u.le.eps*(1.-(pq+qp)*xy/(pq+1.))) then - if (.not.LL) cdfx = 1.-cdfx - return - endif - cdfx = cdfx+u - pq = pq+1. - qp = qp-1. - u = qp*r*u/pq - enddo - v = yx*u - yxeps = yx*eps - do j = 0, jmax - if (v.le.yxeps) then - if (.not.LL) cdfx = 1.-cdfx - return - endif - cdfx = cdfx + v - pq = pq+1. - v = (pq+qp-1.)*xy*v/pq - enddo - iflag = 2 - endif - if (.not.LL) cdfx = 1.-cdfx - endif - - end subroutine cdfbet - - subroutine gmln(x,y) - use machine - ! Computes the natural logarithm of the gamma distribution. Users - ! can set the absolute accuracy and corresponding xmin. - - implicit none - real(kind=kind_phys), intent(in) :: x - real(kind=kind_phys), intent(out) :: y -! local vars - integer i, n - real(kind=kind_phys) absacc, b1, b2, b3, b4, b5, b6, b7, b8 - real(kind=kind_phys) c, dx, q, r, xmin, xn -! data xmin, absacc / 6.894d0, 1.0E-15 / - data xmin, absacc / 1.357d0, 1.0E-3 / - data c / 0.918938533204672741780329736d0 / - data b1 / 0.833333333333333333333333333d-1 / - data b2 / - 0.277777777777777777777777778d-2 / - data b3 / 0.793650793650793650793650794d-3 / - data b4 / - 0.595238095238095238095238095d-3 / - data b5 / 0.841750841750841750841750842d-3 / - data b6 / - 0.191752691752691752691752692d-2 / - data b7 / 0.641025641025641025641025641d-2 / - data b8 / - 0.295506535947712418300653595d-1 / - - if (x.le.0.0) stop '*** x<=0.0 in function gamln ***' - dx = x - n = max(0,int(xmin - dx + 1.0d0) ) - xn = dx + n - r = 1.0d0/xn - q = r*r - y = r*( b1+q*( b2+q*( b3+q*( b4+q*( b5+q*( b6+q*( b7+q*b8 ) & - & )) ) ) ) ) +c + (xn-0.5d0)*log(xn)-xn - - if (n.gt.0) then - q = 1.0d0 - do i=0, n-1 - q = q*(dx+i) - enddo - y = y-log(q) - endif - - if (y + absacc.eq.y) then - print *,' ********* WARNING FROM FUNCTION GAMLN *********' - print *,' REQUIRED ABSOLUTE ACCURACY NOT ATTAINED FOR X = ',x - endif - return - end subroutine gmln - -! *** mg, sfc perts - - - - - - !> @} ! !.........................................! diff --git a/gfsphysics/physics/radsw_main.f b/gfsphysics/physics/radsw_main.f index a22b3b372..cf2640d78 100644 --- a/gfsphysics/physics/radsw_main.f +++ b/gfsphysics/physics/radsw_main.f @@ -592,7 +592,7 @@ module module_radsw_main ! subroutine swrad & & ( plyr,plvl,tlyr,tlvl,qlyr,olyr,gasvmr, & ! --- inputs & clouds,icseed,aerosols,sfcalb, & - $ dzlyr,delpin,de_lgth, & + & dzlyr,delpin,de_lgth, & & cosz,solcon,NDAY,idxday, & & npts, nlay, nlp1, lprnt, & & hswc,topflx,sfcflx,cldtau, & ! --- outputs diff --git a/gfsphysics/physics/samfdeepcnv.f b/gfsphysics/physics/samfdeepcnv.f index e85c7a1e7..f96464ec6 100644 --- a/gfsphysics/physics/samfdeepcnv.f +++ b/gfsphysics/physics/samfdeepcnv.f @@ -93,7 +93,7 @@ subroutine samfdeepcnv(im,ix,km,delt,ntk,ntr,delp, use physcons, grav => con_g, cp => con_cp, hvap => con_hvap &, rv => con_rv, fv => con_fvirt, t0c => con_t0c &, rd => con_rd, cvap => con_cvap, cliq => con_cliq - &, eps => con_eps,epsm1 => con_epsm1, rgas => con_rd + &, eps => con_eps,epsm1 => con_epsm1 implicit none ! integer, intent(in) :: im, ix, km, ntk, ntr, ncloud @@ -2391,7 +2391,7 @@ subroutine samfdeepcnv(im,ix,km,delt,ntk,ntr,delp, !If stochastic physics using cellular automata is .true. then perturb the mass-flux here: - if(do_ca == .true.)then + if(do_ca)then do i=1,im xmb(i) = xmb(i)*(1.0 + ca_deep(i)*5.) enddo @@ -2752,7 +2752,7 @@ subroutine samfdeepcnv(im,ix,km,delt,ntk,ntr,delp, QLCN(i,k) = qtr(i,k,2) - qlcn(i,k) QICN(i,k) = qtr(i,k,1) - qicn(i,k) cf_upi(i,k) = cnvc(i,k) - w_upi(i,k) = ud_mf(i,k)*t1(i,k)*rgas / + w_upi(i,k) = ud_mf(i,k)*t1(i,k)*rd / & (dt2*max(sigmagfm(i),1.e-12)*prslp(i,k)) CNV_MFD(i,k) = ud_mf(i,k)/dt2 CLCN(i,k) = cnvc(i,k) diff --git a/gfsphysics/physics/satmedmfvdif.f b/gfsphysics/physics/satmedmfvdif.f index fa85d2c5d..f96ef20f1 100644 --- a/gfsphysics/physics/satmedmfvdif.f +++ b/gfsphysics/physics/satmedmfvdif.f @@ -1356,7 +1356,7 @@ subroutine satmedmfvdif(ix,im,km,ntrac,ntcw,ntiw,ntke, ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! return - end + end subroutine satmedmfvdif ! !----------------------------------------------------------------------- !----------------------------------------------------------------------- diff --git a/gfsphysics/physics/sfc_drv.f b/gfsphysics/physics/sfc_drv.f index 520e8d5b7..91741dc06 100644 --- a/gfsphysics/physics/sfc_drv.f +++ b/gfsphysics/physics/sfc_drv.f @@ -162,7 +162,7 @@ subroutine sfc_drv & & eps => con_eps, epsm1 => con_epsm1, & & rvrdm1 => con_fvirt - use module_radiation_surface, only : ppfbet + use surface_perturbation, only : ppfbet implicit none diff --git a/gfsphysics/physics/sfcsub.F b/gfsphysics/physics/sfcsub.F index b14271cd0..916ff4e48 100644 --- a/gfsphysics/physics/sfcsub.F +++ b/gfsphysics/physics/sfcsub.F @@ -2697,12 +2697,13 @@ subroutine fixrdg(lugb,idim,jdim,fngrib, real (kind=kind_io8), allocatable :: data8(:) real (kind=kind_io4), allocatable :: data4(:) ! - logical*1 lbms(mdata) + logical, allocatable :: lbms(:) ! integer kpds(200),kgds(200) integer jpds(200),jgds(200), kpds0(200) ! allocate(data8(1:idim*jdim)) + allocate(lbms(1:mdata)) kpds = 0 kgds = 0 jpds = 0 @@ -2792,6 +2793,7 @@ subroutine fixrdg(lugb,idim,jdim,fngrib, endif ! deallocate(data8) + deallocate(lbms) return end subroutine getarea(kgds,dlat,dlon,rslat,rnlat,wlon,elon,ijordr @@ -8148,7 +8150,7 @@ subroutine fixrdc(lugb,fngrib,kpds5,kpds7,mon,slmask, real (kind=kind_io8), allocatable :: rlngrb(:), rltgrb(:) ! logical lmask, yr2kc, gaus, ijordr - logical*1 lbms(mdata) + logical, allocatable :: lbms(:) ! integer, intent(in) :: kpds7 integer kpds(1000),kgds(1000) @@ -8156,6 +8158,7 @@ subroutine fixrdc(lugb,fngrib,kpds5,kpds7,mon,slmask, real (kind=kind_io8) outlat(len), outlon(len) ! allocate(data8(1:mdata)) + allocate(lbms(mdata)) ! ! integer imax_sv, jmax_sv, wlon_sv, rnlat_sv, kpds1_sv ! date imax_sv/0/, jmax_sv/0/, wlon_sv/999.0/, rnlat_sv/999.0/ @@ -8291,6 +8294,7 @@ subroutine fixrdc(lugb,fngrib,kpds5,kpds7,mon,slmask, call baclose(lugb,iret) ! deallocate(data8) + deallocate(lbms) return end subroutine fixrdc subroutine fixrda(lugb,fngrib,kpds5,slmask, diff --git a/gfsphysics/physics/surface_perturbation.F90 b/gfsphysics/physics/surface_perturbation.F90 new file mode 100644 index 000000000..0c6535718 --- /dev/null +++ b/gfsphysics/physics/surface_perturbation.F90 @@ -0,0 +1,419 @@ +module surface_perturbation + + implicit none + + private + + public cdfnor, ppfbet + + contains + +! mg, sfc-perts *** + +! the routines below are used in the percentile matching algorithm for the +! albedo and vegetation fraction perturbations + subroutine cdfnor(z,cdfz) + use machine + + implicit none + real(kind=kind_phys), intent(out) :: cdfz + real(kind=kind_phys),intent(in) :: z +! local vars + integer iflag + real(kind=kind_phys) del,x,cdfx,eps + + eps = 1.0E-5 + + + ! definition of passed parameters ! + ! z = value for which the normal CDF is to be computed + ! eps = the absolute accuracy requirment for the CDF + ! iflag = error indicator on output 0->no errors, 1->errorflag from + ! cdfgam, 2->errorflag from cdfgam + ! cdfz = the CDF of the standard normal distribution evaluated at z + + del = 2.0*eps + if (z.eq.0.0) then + cdfz = 0.5 + else + x = 0.5*z*z + call cdfgam(x,0.5,del,iflag, cdfx) + if (iflag.ne.0) return + if (z.gt.0.0) then + cdfz = 0.5+0.5*cdfx + else + cdfz = 0.5-0.5*cdfx + endif + endif + + return + end + + subroutine cdfgam(x,alpha,eps,iflag,cdfx) + use machine + + implicit none + real(kind=kind_phys), intent(out) :: cdfx + real(kind=kind_phys),intent(in) :: x, alpha, eps +! local vars + integer iflag,i,j,k, imax + logical LL + real(kind=kind_phys) dx, dgln, p,u,epsx,pdfl, eta, bl, uflo + data imax, uflo / 5000, 1.0E-37 / + + + ! definition of passed parameters ! + ! x = value for which the CDF is to be computed + ! alpha = parameter of gamma function (>0) + ! eps = the absolute accuracy requirment for the CDF + ! iflag = error indicator on output 0->no errors, 1->either alpha or eps + ! is <= oflo, 2->number of terms evaluated in the infinite series exceeds + ! imax. + ! cdf = the CDF evaluated at x + + cdfx = 0.0 + + if (alpha.le.uflo.or.eps.le.uflo) then + iflag=1 + return + endif + iflag=0 + + ! check for special case of x + if (x.le.0) return + + dx = x + call dgamln(alpha,dgln) + pdfl = (alpha-1.0)*log(dx)-dx-dgln + if (pdfl.lt.log(uflo)) then + if (x.ge.alpha) cdfx = 1.0 + else + p = alpha + u = exp(pdfl) + LL = .true. + if (x.ge.p) then + k = int(p) + if (p.le.real(k)) k = k-1 + eta = p - real(k) + call dgamln(eta,dgln) + bl = (eta-1)*log(dx)-dx-dgln + LL = bl.gt.log(eps) + endif + epsx = eps/x + if (LL) then + do i=0,imax + if (u.le.epsx*(p-x)) return + u = x*u/p + cdfx = cdfx+u + p = p+1.0 + enddo + iflag = 2 + else + do j=1,k + p=p-1.0 + if (u.le.epsx*(x-p)) continue + cdfx = cdfx+u + u = p*u/x + enddo + cdfx = 1.0-cdfx + endif + endif + return + end subroutine cdfgam + + subroutine dgamln(x,dgamlnout) + + use machine + implicit none + real(kind=kind_phys), intent(in) :: x + real(kind=kind_phys), intent(out) :: dgamlnout +! local vars + integer i, n + real(kind=kind_phys) absacc, b1, b2, b3, b4, b5, b6, b7, b8 + real(kind=kind_phys) c, dx, q, r, xmin, xn + data xmin, absacc / 6.894d0, 1.0E-15 / + data c / 0.918938533204672741780329736d0 / + data b1 / 0.833333333333333333333333333d-1 / + data b2 / - 0.277777777777777777777777778d-2 / + data b3 / 0.793650793650793650793650794d-3 / + data b4 / - 0.595238095238095238095238095d-3 / + data b5 / 0.841750841750841750841750842d-3 / + data b6 / - 0.191752691752691752691752692d-2 / + data b7 / 0.641025641025641025641025641d-2 / + data b8 / - 0.295506535947712418300653595d-1 / + + if (x.le.0.0) stop '*** x<=0.0 in function dgamln ***' + dx = x + n = max(0,int(xmin - dx + 1.0d0) ) + xn = dx + n + r = 1.0d0/xn + q = r*r + dgamlnout = r*( b1+q*( b2+q*( b3+q*( b4+q*( b5+q*( b6+q*( b7+q*b8 ) ) ) ) ) ) ) +c + (xn-0.5d0)*log(xn)-xn + + if (n.gt.0) then + q = 1.0d0 + do i=0, n-1 + q = q*(dx+i) + enddo + dgamlnout = dgamlnout-log(q) + endif + + if (dgamlnout + absacc.eq.dgamlnout) then + print *,' ********* WARNING FROM FUNCTION DGAMLN *********' + print *,' REQUIRED ABSOLUTE ACCURACY NOT ATTAINED FOR X = ',x + endif + return + end subroutine dgamln + +! --- subroutines for computing the beta distribution value that --- +! --- matches the percentile from the random pattern --- + + subroutine ppfbet(pr,p,q,iflag,x) + use machine + implicit none + real(kind=kind_phys), intent(in) :: pr, p, q + real(kind=kind_phys), intent(out) :: x + ! local variables + integer iflag, iter, itmax + real(kind=kind_phys) tol, a, b, fa, fb, fc, cdf, tol1 + real(kind=kind_phys) c, d, e, xm, s, u, v, r, eps + data itmax, eps / 50, 1.0E-12 / + + ! Compute beta distribution value corresponding to the + ! probability and distribution parameters a,b. + ! + ! pr - a probability value in the interval [0,1] + ! p - the first parameter of the beta(p,q) distribution + ! q - the second parameter of the beta(p,q) distribution + ! iflag - erro indicator in output, 0-no errors, 1,2-error flags + ! from subroutine cdfbet, 3- pr<0 or pr>1, 4-p<=0 or + ! q<=0, 5-tol<1.E-8, 6-the cdfs at the endpoints have + ! the same sign and no value of x is defined, 7-maximum + ! iterations exceeded and current value of x returned + + tol = 1.0E-5 + + + iflag = 0 + if (pr.lt.0.0.or.pr.gt.1.) then + iflag = 3 + return + endif + if(min(p,q).le.0.) then + iflag =4 + return + endif + if (tol.lt.1.0E-8) then + iflag = 5 + return + endif + a = 0. + b = 1. + fa = -pr + fb = 1.-pr + if (fb*fa.gt.0.0) then + iflag = 6 + return + endif + + fc = fb + do iter =1,itmax + if (fb*fc.gt.0.) then + c=a + fc=fa + d = b-a + e=d + endif + if (abs(fc).lt.abs(fb)) then + a=b + b=c + c=a + fa=fb + fb=fc + fc=fa + endif + + tol1 = 2.*eps*abs(b)+0.5*tol + xm = 0.5*(c-b) + if (abs(xm).le.tol1.or.fb.eq.0.0) then + x=b + return + endif + if (abs(e).ge.tol1.and.abs(fa).gt.abs(fb)) then + s = fb/fa + if (a.eq.c) then + u = 2.0*xm*s + v = 1.0-s + else + v = fa/fc + r = fb/fc + u = s*(2.0*xm*v*(v-r)-(b-a)*(r-1.0)) + v = (v-1.0)*(r-1.0)*(s-1.0) + endif + if (u.gt.0.0) v = -v + u = abs(u) + if (2.0*u.lt.min(3.0*xm*v-ABS(tol1*v),ABS(e*v))) then + e = d + d = u/v + else + d = xm + e = d + endif + + else + + d=xm + e=d + endif + + a = b + fa = fb + if (abs(d).gt.tol1) then + b = b+d + else + b = b+sign(tol1,xm) + endif + call cdfbet(b,p,q,eps,iflag,cdf) + if (iflag.ne.0) return + fb = cdf-pr + enddo + x = b + + return + end subroutine ppfbet + + subroutine cdfbet(x,p,q,eps,iflag,cdfx) + use machine + + ! Computes the value of the cumulative beta distribution at a + ! single point x, given the distribution parameters p,q. + ! + ! x - value at which the CDF is to be computed + ! p - first parameter of the beta function + ! q - second parameter of the beta function + ! eps - desired absolute accuracy + + implicit none + real(kind=kind_phys), intent(in) :: x, p, q, eps + real(kind=kind_phys), intent(out) :: cdfx + ! local vars + integer iflag, jmax, j + logical LL + real(kind=kind_phys) dp, dq, gamln, yxeps, w, uflo + real(kind=kind_phys) xy, yx, pq, qp, pdfl, u, r, v + real(kind=kind_phys) tmp + data jmax, w, uflo / 5000, 20.0, 1.0E-30 / + + cdfx = 0.0 + + if (p.le.uflo.or.q.le.uflo.or.eps.le.uflo) then + iflag = 1 + endif + iflag = 0 + + if (x.le.0.0) return + if (x.ge.1.0) then + cdfx=1.0 + else + LL = (p+w).ge.(p+q+2.0*w)*x + if (LL) then + xy = x + yx = 1.-xy + pq = p + qp = q + else + yx = x + xy = 1.-yx + qp = p + pq = q + endif + + call gmln(pq,tmp) + dp = (pq-1.)*log(xy)-tmp + call gmln(qp,tmp) + dq = (qp-1.)*log(yx)-tmp + call gmln(pq+qp,tmp) + pdfl = tmp+dp+dq + + if (pdfl.ge.log(uflo)) then + u = exp(pdfl)*xy/pq + r = xy/yx + do while (qp.gt.1.) + if (u.le.eps*(1.-(pq+qp)*xy/(pq+1.))) then + if (.not.LL) cdfx = 1.-cdfx + return + endif + cdfx = cdfx+u + pq = pq+1. + qp = qp-1. + u = qp*r*u/pq + enddo + v = yx*u + yxeps = yx*eps + do j = 0, jmax + if (v.le.yxeps) then + if (.not.LL) cdfx = 1.-cdfx + return + endif + cdfx = cdfx + v + pq = pq+1. + v = (pq+qp-1.)*xy*v/pq + enddo + iflag = 2 + endif + if (.not.LL) cdfx = 1.-cdfx + endif + + end subroutine cdfbet + + subroutine gmln(x,y) + use machine + ! Computes the natural logarithm of the gamma distribution. Users + ! can set the absolute accuracy and corresponding xmin. + + implicit none + real(kind=kind_phys), intent(in) :: x + real(kind=kind_phys), intent(out) :: y +! local vars + integer i, n + real(kind=kind_phys) absacc, b1, b2, b3, b4, b5, b6, b7, b8 + real(kind=kind_phys) c, dx, q, r, xmin, xn +! data xmin, absacc / 6.894d0, 1.0E-15 / + data xmin, absacc / 1.357d0, 1.0E-3 / + data c / 0.918938533204672741780329736d0 / + data b1 / 0.833333333333333333333333333d-1 / + data b2 / - 0.277777777777777777777777778d-2 / + data b3 / 0.793650793650793650793650794d-3 / + data b4 / - 0.595238095238095238095238095d-3 / + data b5 / 0.841750841750841750841750842d-3 / + data b6 / - 0.191752691752691752691752692d-2 / + data b7 / 0.641025641025641025641025641d-2 / + data b8 / - 0.295506535947712418300653595d-1 / + + if (x.le.0.0) stop '*** x<=0.0 in function gamln ***' + dx = x + n = max(0,int(xmin - dx + 1.0d0) ) + xn = dx + n + r = 1.0d0/xn + q = r*r + y = r*( b1+q*( b2+q*( b3+q*( b4+q*( b5+q*( b6+q*( b7+q*b8 ) & + & )) ) ) ) ) +c + (xn-0.5d0)*log(xn)-xn + + if (n.gt.0) then + q = 1.0d0 + do i=0, n-1 + q = q*(dx+i) + enddo + y = y-log(q) + endif + + if (y + absacc.eq.y) then + print *,' ********* WARNING FROM FUNCTION GAMLN *********' + print *,' REQUIRED ABSOLUTE ACCURACY NOT ATTAINED FOR X = ',x + endif + return + end subroutine gmln + +! *** mg, sfc perts + +end module surface_perturbation diff --git a/io/FV3GFS_io.F90 b/io/FV3GFS_io.F90 index 0d1e6e852..a2a2ca249 100644 --- a/io/FV3GFS_io.F90 +++ b/io/FV3GFS_io.F90 @@ -33,6 +33,7 @@ module FV3GFS_io_mod !--- GFS physics modules !--- variables needed for calculating 'sncovr' use namelist_soilveg, only: salp_data, snupx +#ifndef CCPP ! ! --- variables needed for Noah MP init ! @@ -41,6 +42,7 @@ module FV3GFS_io_mod dwsat_table,dksat_table,psisat_table, & isurban_table,isbarren_table, & isice_table,iswater_table +#endif ! !--- GFS_typedefs !rab use GFS_typedefs, only: GFS_sfcprop_type, GFS_diag_type, & @@ -122,16 +124,27 @@ module FV3GFS_io_mod !-------------------- ! FV3GFS_restart_read !-------------------- +#ifdef CCPP + subroutine FV3GFS_restart_read (IPD_Data, IPD_Restart, Atm_block, Model, fv_domain, warm_start) +#else subroutine FV3GFS_restart_read (IPD_Data, IPD_Restart, Atm_block, Model, fv_domain) +#endif type(IPD_data_type), intent(inout) :: IPD_Data(:) type(IPD_restart_type), intent(inout) :: IPD_Restart type(block_control_type), intent(in) :: Atm_block type(IPD_control_type), intent(inout) :: Model type(domain2d), intent(in) :: fv_domain +#ifdef CCPP + logical, intent(in) :: warm_start +#endif !--- read in surface data from chgres +#ifdef CCPP + call sfc_prop_restart_read (IPD_Data%Sfcprop, Atm_block, Model, fv_domain, warm_start) +#else call sfc_prop_restart_read (IPD_Data%Sfcprop, Atm_block, Model, fv_domain) - +#endif + !--- read in physics restart data call phys_restart_read (IPD_Restart, Atm_block, Model, fv_domain) @@ -180,7 +193,7 @@ subroutine FV3GFS_IPD_checksum (Model, IPD_Data, Atm_block) ntr = size(IPD_Data(1)%Statein%qgrs,3) - if(Model%lsm == 2) then + if(Model%lsm == Model%lsm_noahmp) then nsfcprop2d = 149 else nsfcprop2d = 100 @@ -231,6 +244,9 @@ subroutine FV3GFS_IPD_checksum (Model, IPD_Data, Atm_block) temp2d(i,j,32) = IPD_Data(nb)%Sfcprop%f10m(ix) temp2d(i,j,33) = IPD_Data(nb)%Sfcprop%tprcp(ix) temp2d(i,j,34) = IPD_Data(nb)%Sfcprop%srflag(ix) +#ifdef CCPP + if (Model%lsm == Model%lsm_noah .or. Model%lsm == Model%lsm_noahmp) then +#endif temp2d(i,j,35) = IPD_Data(nb)%Sfcprop%slc(ix,1) temp2d(i,j,36) = IPD_Data(nb)%Sfcprop%slc(ix,2) temp2d(i,j,37) = IPD_Data(nb)%Sfcprop%slc(ix,3) @@ -243,6 +259,25 @@ subroutine FV3GFS_IPD_checksum (Model, IPD_Data, Atm_block) temp2d(i,j,44) = IPD_Data(nb)%Sfcprop%stc(ix,2) temp2d(i,j,45) = IPD_Data(nb)%Sfcprop%stc(ix,3) temp2d(i,j,46) = IPD_Data(nb)%Sfcprop%stc(ix,4) +#ifdef CCPP + elseif (Model%lsm == Model%lsm_ruc) then + temp2d(i,j,35) = IPD_Data(nb)%Sfcprop%sh2o(ix,1) + temp2d(i,j,36) = IPD_Data(nb)%Sfcprop%sh2o(ix,2) + temp2d(i,j,37) = IPD_Data(nb)%Sfcprop%sh2o(ix,3) + ! Combine levels 4 to lsoil_lsm (9 for RUC) into one + temp2d(i,j,38) = sum(IPD_Data(nb)%Sfcprop%sh2o(ix,4:Model%lsoil_lsm)) + temp2d(i,j,39) = IPD_Data(nb)%Sfcprop%smois(ix,1) + temp2d(i,j,40) = IPD_Data(nb)%Sfcprop%smois(ix,2) + temp2d(i,j,41) = IPD_Data(nb)%Sfcprop%smois(ix,3) + ! Combine levels 4 to lsoil_lsm (9 for RUC) into one + temp2d(i,j,42) = sum(IPD_Data(nb)%Sfcprop%smois(ix,4:Model%lsoil_lsm)) + temp2d(i,j,43) = IPD_Data(nb)%Sfcprop%tslb(ix,1) + temp2d(i,j,44) = IPD_Data(nb)%Sfcprop%tslb(ix,2) + temp2d(i,j,45) = IPD_Data(nb)%Sfcprop%tslb(ix,3) + ! Combine levels 4 to lsoil_lsm (9 for RUC) into one + temp2d(i,j,46) = sum(IPD_Data(nb)%Sfcprop%tslb(ix,4:Model%lsoil_lsm)) + endif ! LSM choice +#endif temp2d(i,j,47) = IPD_Data(nb)%Sfcprop%t2m(ix) temp2d(i,j,48) = IPD_Data(nb)%Sfcprop%q2m(ix) temp2d(i,j,49) = IPD_Data(nb)%Coupling%nirbmdi(ix) @@ -287,7 +322,7 @@ subroutine FV3GFS_IPD_checksum (Model, IPD_Data, Atm_block) temp2d(i,j,84) = IPD_Data(nb)%Radtend%sfcflw(ix)%dnfx0 idx_opt = 85 - if (Model%lsm == 2 ) then + if (Model%lsm == Model%lsm_noahmp) then temp2d(i,j,idx_opt) = IPD_Data(nb)%Sfcprop%snowxy(ix) temp2d(i,j,idx_opt+1) = IPD_Data(nb)%Sfcprop%tvxy(ix) temp2d(i,j,idx_opt+2) = IPD_Data(nb)%Sfcprop%tgxy(ix) @@ -427,18 +462,28 @@ end subroutine FV3GFS_IPD_checksum ! opens: oro_data.tile?.nc, sfc_data.tile?.nc ! !---------------------------------------------------------------------- +#ifdef CCPP + subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain, warm_start) +#else subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain) +#endif !--- interface variable definitions type(GFS_sfcprop_type), intent(inout) :: Sfcprop(:) type (block_control_type), intent(in) :: Atm_block type(IPD_control_type), intent(inout) :: Model type (domain2d), intent(in) :: fv_domain +#ifdef CCPP + logical, intent(in) :: warm_start +#endif !--- local variables integer :: i, j, k, ix, lsoil, num, nb integer :: isc, iec, jsc, jec, npz, nx, ny integer :: id_restart integer :: nvar_o2, nvar_s2m, nvar_s2o, nvar_s3 integer :: nvar_s2mp, nvar_s3mp,isnow +#ifdef CCPP + integer :: nvar_s2r +#endif real(kind=kind_phys), pointer, dimension(:,:) :: var2_p => NULL() real(kind=kind_phys), pointer, dimension(:,:,:) :: var3_p => NULL() real(kind=kind_phys), pointer, dimension(:,:,:) :: var3_p1 => NULL() @@ -469,9 +514,19 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain) endif nvar_o2 = 20 nvar_s2o = 18 +#ifdef CCPP + if (Model%lsm == Model%lsm_ruc .and. warm_start) then + nvar_s2r = 6 + nvar_s3 = 5 + else + nvar_s2r = 0 + nvar_s3 = 3 + endif +#else nvar_s3 = 3 +#endif - if( Model%lsm == 2) then + if (Model%lsm == Model%lsm_noahmp) then nvar_s2mp =29 !mp 2D nvar_s3mp =5 !mp 3D else @@ -585,22 +640,45 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain) !--- SURFACE FILE if (.not. allocated(sfc_name2)) then !--- allocate the various containers needed for restarts +#ifdef CCPP + allocate(sfc_name2(nvar_s2m+nvar_s2o+nvar_s2mp+nvar_s2r)) + allocate(sfc_name3(nvar_s3+nvar_s3mp)) + + allocate(sfc_var2(nx,ny,nvar_s2m+nvar_s2o+nvar_s2mp+nvar_s2r)) + if (Model%lsm == Model%lsm_noah .or. Model%lsm == Model%lsm_noahmp .or. (.not.warm_start)) then + allocate(sfc_var3(nx,ny,Model%lsoil,nvar_s3)) + else if (Model%lsm == Model%lsm_ruc) then + allocate(sfc_var3(nx,ny,Model%lsoil_lsm,nvar_s3)) + end if +#else allocate(sfc_name2(nvar_s2m+nvar_s2o+nvar_s2mp)) allocate(sfc_name3(nvar_s3+nvar_s3mp)) allocate(sfc_var2(nx,ny,nvar_s2m+nvar_s2o+nvar_s2mp)) allocate(sfc_var3(nx,ny,1:4,1:3)) - +#endif +#ifdef CCPP + if (Model%lsm == Model%lsm_noahmp) then +#endif allocate(sfc_var3sn(nx,ny,-2:0,4:6)) allocate(sfc_var3eq(nx,ny,1:4,7:7)) allocate(sfc_var3zn(nx,ny,-2:4,8:8)) +#ifdef CCPP + end if +#endif sfc_var2 = -9999._kind_phys sfc_var3 = -9999._kind_phys +#ifdef CCPP + if (Model%lsm == Model%lsm_noahmp) then +#endif sfc_var3sn = -9999._kind_phys sfc_var3eq = -9999._kind_phys sfc_var3zn = -9999._kind_phys - +#ifdef CCPP + end if +#endif + !--- names of the 2D variables to save sfc_name2(1) = 'slmsk' sfc_name2(2) = 'tsea' !tsfc @@ -662,7 +740,7 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain) ! ! Only needed when Noah MP LSM is used - 29 2D ! - if( Model%lsm == 2) then + if (Model%lsm == Model%lsm_noahmp) then sfc_name2(nvar_s2m+19) = 'snowxy' sfc_name2(nvar_s2m+20) = 'tvxy' sfc_name2(nvar_s2m+21) = 'tgxy' @@ -692,8 +770,17 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain) sfc_name2(nvar_s2m+45) = 'smcwtdxy' sfc_name2(nvar_s2m+46) = 'deeprechxy' sfc_name2(nvar_s2m+47) = 'rechxy' +#ifdef CCPP + else if (Model%lsm == Model%lsm_ruc .and. warm_start) then + sfc_name2(nvar_s2m+19) = 'wetness' + sfc_name2(nvar_s2m+20) = 'clw_surf' + sfc_name2(nvar_s2m+21) = 'qwv_surf' + sfc_name2(nvar_s2m+22) = 'tsnow' + sfc_name2(nvar_s2m+23) = 'snowfall_acc' + sfc_name2(nvar_s2m+24) = 'swe_snowfall_acc' +#endif endif - + !--- register the 2D fields do num = 1,nvar_s2m var2_p => sfc_var2(:,:,num) @@ -711,39 +798,68 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain) id_restart = register_restart_field(Sfc_restart, fn_srf, sfc_name2(num), var2_p, domain=fv_domain, mandatory=mand) enddo endif - +#ifdef CCPP + if (Model%lsm == Model%lsm_ruc) then ! nvar_s2mp = 0 + do num = nvar_s2m+nvar_s2o+1, nvar_s2m+nvar_s2o+nvar_s2r + var2_p => sfc_var2(:,:,num) + id_restart = register_restart_field(Sfc_restart, fn_srf, sfc_name2(num), var2_p, domain=fv_domain) + enddo + else if (Model%lsm == Model%lsm_noahmp) then +#else ! Noah MP register only necessary only lsm = 2, not necessary has values - - if (Model%lsm == 2) then + if (Model%lsm == Model%lsm_noahmp) then +#endif mand = .false. do num = nvar_s2m+nvar_s2o+1,nvar_s2m+nvar_s2o+nvar_s2mp var2_p => sfc_var2(:,:,num) id_restart = register_restart_field(Sfc_restart, fn_srf, sfc_name2(num), var2_p, domain=fv_domain, mandatory=mand) enddo - endif ! mp + endif ! mp/ruc endif ! if not allocated nullify(var2_p) +#ifdef CCPP + if (Model%lsm == Model%lsm_noah .or. Model%lsm == Model%lsm_noahmp .or. (.not.warm_start)) then + !--- names of the 3D variables to save + sfc_name3(1) = 'stc' + sfc_name3(2) = 'smc' + sfc_name3(3) = 'slc' + if (Model%lsm == Model%lsm_noahmp) then + sfc_name3(4) = 'snicexy' + sfc_name3(5) = 'snliqxy' + sfc_name3(6) = 'tsnoxy' + sfc_name3(7) = 'smoiseq' + sfc_name3(8) = 'zsnsoxy' + endif + else if (Model%lsm == Model%lsm_ruc) then + !--- names of the 2D variables to save + sfc_name3(1) = 'tslb' + sfc_name3(2) = 'smois' + sfc_name3(3) = 'sh2o' + sfc_name3(4) = 'smfr' + sfc_name3(5) = 'flfr' + endif +#else !--- names of the 3D variables to save sfc_name3(1) = 'stc' sfc_name3(2) = 'smc' sfc_name3(3) = 'slc' !--- Noah MP - if (Model%lsm == 2) then + if (Model%lsm == Model%lsm_noahmp) then sfc_name3(4) = 'snicexy' sfc_name3(5) = 'snliqxy' sfc_name3(6) = 'tsnoxy' sfc_name3(7) = 'smoiseq' sfc_name3(8) = 'zsnsoxy' endif - +#endif !--- register the 3D fields do num = 1,nvar_s3 var3_p => sfc_var3(:,:,:,num) id_restart = register_restart_field(Sfc_restart, fn_srf, sfc_name3(num), var3_p, domain=fv_domain) enddo - if (Model%lsm == 2) then + if (Model%lsm == Model%lsm_noahmp) then mand = .false. do num = nvar_s3+1,nvar_s3+3 var3_p1 => sfc_var3sn(:,:,:,num) @@ -763,11 +879,11 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain) endif !mp nullify(var3_p) - + !--- read the surface restart/data call mpp_error(NOTE,'reading surface properties data from INPUT/sfc_data.tile*.nc') call restore_state(Sfc_restart) - + ! write(0,*)' sfc_var2=',sfc_var2(:,:,12) !--- place the data into the block GFS containers do nb = 1, Atm_block%nblks @@ -840,9 +956,21 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain) Sfcprop(nb)%dt_cool(ix) = sfc_var2(i,j,nvar_s2m+17) !--- nsstm dt_cool Sfcprop(nb)%qrain(ix) = sfc_var2(i,j,nvar_s2m+18) !--- nsstm qrain endif +#ifdef CCPP + if (Model%lsm == Model%lsm_ruc .and. warm_start) then + !--- Extra RUC variables + Sfcprop(nb)%wetness(ix) = sfc_var2(i,j,nvar_s2m+19) + Sfcprop(nb)%clw_surf(ix) = sfc_var2(i,j,nvar_s2m+20) + Sfcprop(nb)%qwv_surf(ix) = sfc_var2(i,j,nvar_s2m+21) + Sfcprop(nb)%tsnow(ix) = sfc_var2(i,j,nvar_s2m+22) + Sfcprop(nb)%snowfallac(ix) = sfc_var2(i,j,nvar_s2m+23) + Sfcprop(nb)%acsnow(ix) = sfc_var2(i,j,nvar_s2m+24) + elseif (Model%lsm == Model%lsm_noahmp) then + !--- Extra Noah MP variables +#else ! Noah MP ! ------- - if (Model%lsm == 2 ) then + if (Model%lsm == Model%lsm_noahmp) then Sfcprop(nb)%snowxy(ix) = sfc_var2(i,j,nvar_s2m+19) Sfcprop(nb)%tvxy(ix) = sfc_var2(i,j,nvar_s2m+20) @@ -873,18 +1001,53 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain) Sfcprop(nb)%smcwtdxy(ix) = sfc_var2(i,j,nvar_s2m+45) Sfcprop(nb)%deeprechxy(ix) = sfc_var2(i,j,nvar_s2m+46) Sfcprop(nb)%rechxy(ix) = sfc_var2(i,j,nvar_s2m+47) +#endif endif +#ifdef CCPP + if (Model%lsm == Model%lsm_noah .or. Model%lsm == Model%lsm_noahmp .or. (.not.warm_start)) then + !--- 3D variables + do lsoil = 1,Model%lsoil + Sfcprop(nb)%stc(ix,lsoil) = sfc_var3(i,j,lsoil,1) !--- stc + Sfcprop(nb)%smc(ix,lsoil) = sfc_var3(i,j,lsoil,2) !--- smc + Sfcprop(nb)%slc(ix,lsoil) = sfc_var3(i,j,lsoil,3) !--- slc + enddo -!--- 3D variables -! ------------ + if (Model%lsm == Model%lsm_noahmp) then + do lsoil = -2, 0 + Sfcprop(nb)%snicexy(ix,lsoil) = sfc_var3sn(i,j,lsoil,4) + Sfcprop(nb)%snliqxy(ix,lsoil) = sfc_var3sn(i,j,lsoil,5) + Sfcprop(nb)%tsnoxy(ix,lsoil) = sfc_var3sn(i,j,lsoil,6) + enddo + + do lsoil = 1, 4 + Sfcprop(nb)%smoiseq(ix,lsoil) = sfc_var3eq(i,j,lsoil,7) + enddo + + do lsoil = -2, 4 + Sfcprop(nb)%zsnsoxy(ix,lsoil) = sfc_var3zn(i,j,lsoil,8) + enddo + endif + + else if (Model%lsm == Model%lsm_ruc) then + !--- 3D variables + do lsoil = 1,Model%lsoil_lsm + Sfcprop(nb)%tslb(ix,lsoil) = sfc_var3(i,j,lsoil,1) !--- tslb + Sfcprop(nb)%smois(ix,lsoil) = sfc_var3(i,j,lsoil,2) !--- smois + Sfcprop(nb)%sh2o(ix,lsoil) = sfc_var3(i,j,lsoil,3) !--- sh2o + Sfcprop(nb)%keepsmfr(ix,lsoil) = sfc_var3(i,j,lsoil,4) !--- keepsmfr + Sfcprop(nb)%flag_frsoil(ix,lsoil) = sfc_var3(i,j,lsoil,5) !--- flag_frsoil + enddo + end if +#else + !--- 3D variables do lsoil = 1,Model%lsoil Sfcprop(nb)%stc(ix,lsoil) = sfc_var3(i,j,lsoil,1) !--- stc Sfcprop(nb)%smc(ix,lsoil) = sfc_var3(i,j,lsoil,2) !--- smc Sfcprop(nb)%slc(ix,lsoil) = sfc_var3(i,j,lsoil,3) !--- slc enddo - if (Model%lsm == 2) then + if (Model%lsm == Model%lsm_noahmp) then do lsoil = -2, 0 Sfcprop(nb)%snicexy(ix,lsoil) = sfc_var3sn(i,j,lsoil,4) Sfcprop(nb)%snliqxy(ix,lsoil) = sfc_var3sn(i,j,lsoil,5) @@ -899,6 +1062,7 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain) Sfcprop(nb)%zsnsoxy(ix,lsoil) = sfc_var3zn(i,j,lsoil,8) enddo endif +#endif enddo !ix enddo !nb @@ -915,6 +1079,11 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain) ! It has to be done after the weasd is available ! sfc_var2(1,1,32) is the first; we need this to allocate snow related fields +#ifdef CCPP + ! Calculating sncovr does NOT belong into an I/O routine! + ! TODO: move to physics and stop building namelist_soilveg/set_soilveg + ! in the FV3/non-CCPP physics when the CCPP-enabled executable is built. +#endif !--- if sncovr does not exist in the restart, need to create it if (nint(sfc_var2(1,1,32)) == -9999) then if (Model%me == Model%master ) call mpp_error(NOTE, 'gfs_driver::surface_props_input - computing sncovr') @@ -985,7 +1154,8 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain) enddo enddo - if ( Model%lsm == 2 ) then +#ifndef CCPP + if (Model%lsm == Model%lsm_noahmp) then if (nint(sfc_var2(1,1,nvar_s2m+19)) == -9999) then if (Model%me == Model%master ) call mpp_error(NOTE, 'gfs_driver:: - Cold start Noah MP ') @@ -1241,6 +1411,7 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain) enddo ! nb endif endif !if Noah MP cold start ends +#endif end subroutine sfc_prop_restart_read @@ -1268,6 +1439,9 @@ subroutine sfc_prop_restart_write (Sfcprop, Atm_block, Model, fv_domain, timesta integer :: id_restart integer :: nvar2m, nvar2o, nvar3 integer :: nvar2mp, nvar3mp +#ifdef CCPP + integer :: nvar2r +#endif logical :: mand character(len=32) :: fn_srf = 'sfc_data.nc' real(kind=kind_phys), pointer, dimension(:,:) :: var2_p => NULL() @@ -1282,7 +1456,17 @@ subroutine sfc_prop_restart_write (Sfcprop, Atm_block, Model, fv_domain, timesta nvar2m = 32 end if nvar2o = 18 +#ifdef CCPP + if (Model%lsm == Model%lsm_ruc) then + nvar2r = 6 + nvar3 = 5 + else + nvar2r = 0 + nvar3 = 3 + endif +#else nvar3 = 3 +#endif nvar2mp = 29 nvar3mp = 5 @@ -1294,21 +1478,59 @@ subroutine sfc_prop_restart_write (Sfcprop, Atm_block, Model, fv_domain, timesta nx = (iec - isc + 1) ny = (jec - jsc + 1) +#ifdef CCPP + if (Model%lsm == Model%lsm_ruc) then + if (allocated(sfc_name2)) then + if (size(sfc_var3,dim=3).ne.Model%lsoil_lsm) then + !--- deallocate containers and free restart container + deallocate(sfc_name2) + deallocate(sfc_name3) + deallocate(sfc_var2) + deallocate(sfc_var3) + call free_restart_type(Sfc_restart) + end if + end if + end if +#endif + if (.not. allocated(sfc_name2)) then !--- allocate the various containers needed for restarts +#ifdef CCPP + allocate(sfc_name2(nvar2m+nvar2o+nvar2mp+nvar2r)) + allocate(sfc_name3(nvar3+nvar3mp)) + allocate(sfc_var2(nx,ny,nvar2m+nvar2o+nvar2mp+nvar2r)) + if (Model%lsm == Model%lsm_noah) then + allocate(sfc_var3(nx,ny,Model%lsoil,nvar3)) + else if (Model%lsm == Model%lsm_ruc) then + allocate(sfc_var3(nx,ny,Model%lsoil_lsm,nvar3)) + end if +#else allocate(sfc_name2(nvar2m+nvar2o+nvar2mp)) allocate(sfc_name3(nvar3+nvar3mp)) allocate(sfc_var2(nx,ny,nvar2m+nvar2o+nvar2mp)) allocate(sfc_var3(nx,ny,Model%lsoil,nvar3)) +#endif +#ifdef CCPP + if (Model%lsm == Model%lsm_noahmp) then +#endif allocate(sfc_var3sn(nx,ny,-2:0,4:6)) allocate(sfc_var3eq(nx,ny,1:4,7:7)) allocate(sfc_var3zn(nx,ny,-2:4,8:8)) +#ifdef CCPP + end if +#endif sfc_var2 = -9999._kind_phys sfc_var3 = -9999._kind_phys +#ifdef CCPP + if (Model%lsm == Model%lsm_noahmp) then +#endif sfc_var3sn = -9999._kind_phys sfc_var3eq = -9999._kind_phys sfc_var3zn = -9999._kind_phys +#ifdef CCPP + end if +#endif !--- names of the 2D variables to save @@ -1368,8 +1590,18 @@ subroutine sfc_prop_restart_write (Sfcprop, Atm_block, Model, fv_domain, timesta sfc_name2(nvar2m+16) = 'ifd' sfc_name2(nvar2m+17) = 'dt_cool' sfc_name2(nvar2m+18) = 'qrain' +#ifdef CCPP + if (Model%lsm == Model%lsm_ruc) then + sfc_name2(nvar2m+19) = 'wetness' + sfc_name2(nvar2m+20) = 'clw_surf' + sfc_name2(nvar2m+21) = 'qwv_surf' + sfc_name2(nvar2m+22) = 'tsnow' + sfc_name2(nvar2m+23) = 'snowfall_acc' + sfc_name2(nvar2m+24) = 'swe_snowfall_acc' + else if(Model%lsm == Model%lsm_noahmp) then +#else ! Only needed when Noah MP LSM is used - 29 2D - if( Model%lsm == 2 ) then + if(Model%lsm == Model%lsm_noahmp) then sfc_name2(nvar2m+19) = 'snowxy' sfc_name2(nvar2m+20) = 'tvxy' sfc_name2(nvar2m+21) = 'tgxy' @@ -1399,6 +1631,7 @@ subroutine sfc_prop_restart_write (Sfcprop, Atm_block, Model, fv_domain, timesta sfc_name2(nvar2m+45) = 'smcwtdxy' sfc_name2(nvar2m+46) = 'deeprechxy' sfc_name2(nvar2m+47) = 'rechxy' +#endif endif !--- register the 2D fields @@ -1418,7 +1651,16 @@ subroutine sfc_prop_restart_write (Sfcprop, Atm_block, Model, fv_domain, timesta id_restart = register_restart_field(Sfc_restart, fn_srf, sfc_name2(num), var2_p, domain=fv_domain, mandatory=mand) enddo endif - if (Model%lsm == 2) then +#ifdef CCPP + if (Model%lsm == Model%lsm_ruc) then ! nvar2mp =0 + do num = nvar2m+nvar2o+1, nvar2m+nvar2o+nvar2r + var2_p => sfc_var2(:,:,num) + id_restart = register_restart_field(Sfc_restart, fn_srf, sfc_name2(num), var2_p, domain=fv_domain) + enddo + else if (Model%lsm == Model%lsm_noahmp) then ! nvar2r =0 +#else + if (Model%lsm == Model%lsm_noahmp) then +#endif mand = .true. ! actually should be true since it is after cold start do num = nvar2m+nvar2o+1,nvar2m+nvar2o+nvar2mp var2_p => sfc_var2(:,:,num) @@ -1426,7 +1668,27 @@ subroutine sfc_prop_restart_write (Sfcprop, Atm_block, Model, fv_domain, timesta enddo endif nullify(var2_p) - + +#ifdef CCPP + if (Model%lsm == Model%lsm_noah .or. Model%lsm == Model%lsm_noahmp) then + !--- names of the 2D variables to save + sfc_name3(1) = 'stc' + sfc_name3(2) = 'smc' + sfc_name3(3) = 'slc' + sfc_name3(4) = 'snicexy' + sfc_name3(5) = 'snliqxy' + sfc_name3(6) = 'tsnoxy' + sfc_name3(7) = 'smoiseq' + sfc_name3(8) = 'zsnsoxy' + else if (Model%lsm == Model%lsm_ruc) then + !--- names of the 2D variables to save + sfc_name3(1) = 'tslb' + sfc_name3(2) = 'smois' + sfc_name3(3) = 'sh2o' + sfc_name3(4) = 'smfr' + sfc_name3(5) = 'flfr' + end if +#else !--- names of the 3D variables to save sfc_name3(1) = 'stc' sfc_name3(2) = 'smc' @@ -1436,29 +1698,30 @@ subroutine sfc_prop_restart_write (Sfcprop, Atm_block, Model, fv_domain, timesta sfc_name3(6) = 'tsnoxy' sfc_name3(7) = 'smoiseq' sfc_name3(8) = 'zsnsoxy' - +#endif + !--- register the 3D fields do num = 1,nvar3 var3_p => sfc_var3(:,:,:,num) id_restart = register_restart_field(Sfc_restart, fn_srf, sfc_name3(num), var3_p, domain=fv_domain) enddo - if (Model%lsm == 2) then + if (Model%lsm == Model%lsm_noahmp) then mand = .true. - do num = nvar3+1,nvar3+3 - var3_p1 => sfc_var3sn(:,:,:,num) - id_restart = register_restart_field(Sfc_restart, fn_srf, sfc_name3(num), var3_p1, domain=fv_domain,mandatory=mand) - enddo + do num = nvar3+1,nvar3+3 + var3_p1 => sfc_var3sn(:,:,:,num) + id_restart = register_restart_field(Sfc_restart, fn_srf, sfc_name3(num), var3_p1, domain=fv_domain,mandatory=mand) + enddo - var3_p2 => sfc_var3eq(:,:,:,7) - id_restart = register_restart_field(Sfc_restart, fn_srf, sfc_name3(7), var3_p2, domain=fv_domain,mandatory=mand) + var3_p2 => sfc_var3eq(:,:,:,7) + id_restart = register_restart_field(Sfc_restart, fn_srf, sfc_name3(7), var3_p2, domain=fv_domain,mandatory=mand) var3_p3 => sfc_var3zn(:,:,:,8) - id_restart = register_restart_fIeld(Sfc_restart, fn_srf, sfc_name3(8), var3_p3, domain=fv_domain,mandatory=mand) + id_restart = register_restart_fIeld(Sfc_restart, fn_srf, sfc_name3(8), var3_p3, domain=fv_domain,mandatory=mand) - nullify(var3_p1) - nullify(var3_p2) - nullify(var3_p3) - endif ! lsm =2 + nullify(var3_p1) + nullify(var3_p2) + nullify(var3_p3) + endif ! lsm = lsm_noahmp nullify(var3_p) endif @@ -1525,10 +1788,21 @@ subroutine sfc_prop_restart_write (Sfcprop, Atm_block, Model, fv_domain, timesta sfc_var2(i,j,nvar2m+17) = Sfcprop(nb)%dt_cool(ix)!--- nsstm dt_cool sfc_var2(i,j,nvar2m+18) = Sfcprop(nb)%qrain(ix) !--- nsstm qrain endif - +#ifdef CCPP + if (Model%lsm == Model%lsm_ruc) then + !--- Extra RUC variables + sfc_var2(i,j,nvar2m+19) = Sfcprop(nb)%wetness(ix) + sfc_var2(i,j,nvar2m+20) = Sfcprop(nb)%clw_surf(ix) + sfc_var2(i,j,nvar2m+21) = Sfcprop(nb)%qwv_surf(ix) + sfc_var2(i,j,nvar2m+22) = Sfcprop(nb)%tsnow(ix) + sfc_var2(i,j,nvar2m+23) = Sfcprop(nb)%snowfallac(ix) + sfc_var2(i,j,nvar2m+24) = Sfcprop(nb)%acsnow(ix) + else if (Model%lsm == Model%lsm_noahmp) then + +#else ! Noah MP - - if (Model%lsm == 2) then + if (Model%lsm == Model%lsm_noahmp) then +#endif sfc_var2(i,j,nvar2m+19) = Sfcprop(nb)%snowxy(ix) sfc_var2(i,j,nvar2m+20) = Sfcprop(nb)%tvxy(ix) @@ -1561,7 +1835,43 @@ subroutine sfc_prop_restart_write (Sfcprop, Atm_block, Model, fv_domain, timesta sfc_var2(i,j,nvar2m+47) = Sfcprop(nb)%rechxy(ix) endif - +#ifdef CCPP + if (Model%lsm == Model%lsm_noah) then + !--- 3D variables + do lsoil = 1,Model%lsoil + sfc_var3(i,j,lsoil,1) = Sfcprop(nb)%stc(ix,lsoil) !--- stc + sfc_var3(i,j,lsoil,2) = Sfcprop(nb)%smc(ix,lsoil) !--- smc + sfc_var3(i,j,lsoil,3) = Sfcprop(nb)%slc(ix,lsoil) !--- slc + enddo +! 5 Noah MP 3D + if (Model%lsm == Model%lsm_noahmp) then + + do lsoil = -2,0 + sfc_var3sn(i,j,lsoil,4) = Sfcprop(nb)%snicexy(ix,lsoil) + sfc_var3sn(i,j,lsoil,5) = Sfcprop(nb)%snliqxy(ix,lsoil) + sfc_var3sn(i,j,lsoil,6) = Sfcprop(nb)%tsnoxy(ix,lsoil) + enddo + + do lsoil = 1,Model%lsoil + sfc_var3eq(i,j,lsoil,7) = Sfcprop(nb)%smoiseq(ix,lsoil) + enddo + + do lsoil = -2,4 + sfc_var3zn(i,j,lsoil,8) = Sfcprop(nb)%zsnsoxy(ix,lsoil) + enddo + + endif ! Noah MP + else if (Model%lsm == Model%lsm_ruc) then + !--- 3D variables + do lsoil = 1,Model%lsoil_lsm + sfc_var3(i,j,lsoil,1) = Sfcprop(nb)%tslb(ix,lsoil) !--- tslb = stc + sfc_var3(i,j,lsoil,2) = Sfcprop(nb)%smois(ix,lsoil) !--- smois = smc + sfc_var3(i,j,lsoil,3) = Sfcprop(nb)%sh2o(ix,lsoil) !--- sh2o = slc + sfc_var3(i,j,lsoil,4) = Sfcprop(nb)%keepsmfr(ix,lsoil) !--- keepsmfr + sfc_var3(i,j,lsoil,5) = Sfcprop(nb)%flag_frsoil(ix,lsoil) !--- flag_frsoil + enddo + end if +#else !--- 3D variables do lsoil = 1,Model%lsoil sfc_var3(i,j,lsoil,1) = Sfcprop(nb)%stc(ix,lsoil) !--- stc @@ -1569,7 +1879,7 @@ subroutine sfc_prop_restart_write (Sfcprop, Atm_block, Model, fv_domain, timesta sfc_var3(i,j,lsoil,3) = Sfcprop(nb)%slc(ix,lsoil) !--- slc enddo ! 5 Noah MP 3D - if (Model%lsm == 2) then + if (Model%lsm == Model%lsm_noahmp) then do lsoil = -2,0 sfc_var3sn(i,j,lsoil,4) = Sfcprop(nb)%snicexy(ix,lsoil) @@ -1586,6 +1896,7 @@ subroutine sfc_prop_restart_write (Sfcprop, Atm_block, Model, fv_domain, timesta enddo endif ! Noah MP +#endif enddo enddo @@ -1617,7 +1928,7 @@ subroutine phys_restart_read (IPD_Restart, Atm_block, Model, fv_domain) integer :: i, j, k, nb, ix, num integer :: isc, iec, jsc, jec, npz, nx, ny integer :: id_restart - integer :: nvar2d, nvar3d, ndiag + integer :: nvar2d, nvar3d, fdiag, ldiag character(len=64) :: fname real(kind=kind_phys), pointer, dimension(:,:) :: var2_p => NULL() real(kind=kind_phys), pointer, dimension(:,:,:) :: var3_p => NULL() @@ -1632,7 +1943,8 @@ subroutine phys_restart_read (IPD_Restart, Atm_block, Model, fv_domain) ny = (jec - jsc + 1) nvar2d = IPD_Restart%num2d nvar3d = IPD_Restart%num3d - ndiag = IPD_Restart%ndiag + fdiag = IPD_Restart%fdiag + ldiag = IPD_Restart%ldiag !--- register the restart fields if (.not. allocated(phy_var2)) then @@ -1678,7 +1990,7 @@ subroutine phys_restart_read (IPD_Restart, Atm_block, Model, fv_domain) enddo !-- if restart from init time, reset accumulated diag fields if( Model%phour < 1.e-7) then - do num = nvar2d-ndiag+1,nvar2d + do num = fdiag,ldiag do nb = 1,Atm_block%nblks do ix = 1, Atm_block%blksz(nb) i = Atm_block%index(nb)%ii(ix) - isc + 1 @@ -2406,7 +2718,7 @@ subroutine fv_phys_bundle_setup(Diag, axes, phys_bundle, fcst_grid, quilting, nb ! 'bdl_intplmethod=',trim(bdl_intplmethod(ibdl)) call ESMF_AttributeAdd(phys_bundle(ibdl), convention="NetCDF", purpose="FV3", & - attrList=(/"fhzero", "ncld", "nsoil", "imp_physics", "dtp"/), rc=rc) + attrList=(/"fhzero ", "ncld ", "nsoil ", "imp_physics", "dtp "/), rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=__FILE__)) return ! bail out @@ -2579,7 +2891,7 @@ subroutine fv_phys_bundle_setup(Diag, axes, phys_bundle, fcst_grid, quilting, nb call add_field_to_phybundle(trim(output_name),trim(Diag(idx)%desc),trim(Diag(idx)%unit), "time: point", & axes(1:Diag(idx)%axes), fcst_grid, nstt(idx),phys_bundle(ibdl), outputfile(ibdl), & bdl_intplmethod(ibdl), rcd=rc) -! if( mpp_root_pe()==0) print *,'phys, add field,',trim(Diag(idx)%name),'idx=',idx,'ibdl=',ibdl +! if( mpp_pe() == mpp_root_pe()) print *,'phys, add field,',trim(Diag(idx)%name),'idx=',idx,'ibdl=',ibdl ! if( index(trim(Diag(idx)%intpl_method), "vector") > 0) then l2dvector = .true. @@ -2589,7 +2901,7 @@ subroutine fv_phys_bundle_setup(Diag, axes, phys_bundle, fcst_grid, quilting, nb call add_field_to_phybundle(trim(output_name),trim(Diag(idx)%desc),trim(Diag(idx)%unit), "time: point", & axes(1:Diag(idx)%axes), fcst_grid, nstt_vctbl(idx),phys_bundle(ibdl), outputfile1, & bdl_intplmethod(ibdl),l2dvector=l2dvector, rcd=rc) -! if( mpp_root_pe()==0) print *,'in phys, add vector field,',trim(Diag(idx)%name),' idx=',idx,' ibdl=',ibdl +! if( mpp_pe() == mpp_root_pe()) print *,'in phys, add vector field,',trim(Diag(idx)%name),' idx=',idx,' ibdl=',ibdl endif endif @@ -2597,7 +2909,7 @@ subroutine fv_phys_bundle_setup(Diag, axes, phys_bundle, fcst_grid, quilting, nb endif enddo if( .not. lput2physbdl ) then - if( mpp_root_pe()==0) print *,'WARNING: not matching interpolation method, field ',trim(Diag(idx)%name), & + if( mpp_pe() == mpp_root_pe()) print *,'WARNING: not matching interpolation method, field ',trim(Diag(idx)%name), & ' is not added to phys bundle ' endif @@ -2691,7 +3003,7 @@ subroutine add_field_to_phybundle(var_name,long_name,units,cell_methods, axes,ph if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=__FILE__)) call ESMF_Finalize(endflag=ESMF_END_ABORT) - if( mpp_root_pe() == 0) print *,'add 3D field to after nearest_stod, fld=', trim(var_name) + if( mpp_pe() == mpp_root_pe()) print *,'add 3D field to after nearest_stod, fld=', trim(var_name) endif else if( trim(intpl_method) == 'bilinear' ) then if(size(axes) == 2) then @@ -2706,7 +3018,7 @@ subroutine add_field_to_phybundle(var_name,long_name,units,cell_methods, axes,ph name=var_name, indexFlag=ESMF_INDEX_DELOCAL, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=__FILE__)) call ESMF_Finalize(endflag=ESMF_END_ABORT) - if( mpp_root_pe() == 0) print *,'add field to after bilinear, fld=', trim(var_name) + if( mpp_pe() == mpp_root_pe()) print *,'add field to after bilinear, fld=', trim(var_name) endif endif ! diff --git a/io/module_wrt_grid_comp.F90 b/io/module_wrt_grid_comp.F90 index 268786fe3..1c8c04934 100644 --- a/io/module_wrt_grid_comp.F90 +++ b/io/module_wrt_grid_comp.F90 @@ -622,7 +622,7 @@ subroutine wrt_initialize(wrt_comp, imp_state_write, exp_state_write, clock, rc) if ( .not. (trim(output_grid) == 'cubed_sphere_grid' .or. trim(output_grid) == 'gaussian_grid') ) then !!!!!!! call ESMF_AttributeAdd(wrt_int_state%wrtFB(i), convention="NetCDF", purpose="FV3", & - attrList=(/"source","grid"/), rc=rc) + attrList=(/"source","grid "/), rc=rc) call ESMF_AttributeSet(wrt_int_state%wrtFB(i), convention="NetCDF", purpose="FV3", & name="source", value="FV3GFS", rc=rc) @@ -666,7 +666,14 @@ subroutine wrt_initialize(wrt_comp, imp_state_write, exp_state_write, clock, rc) call ESMF_AttributeSet(wrt_int_state%wrtFB(i), convention="NetCDF", purpose="FV3", & name="grid", value="rotated_latlon", rc=rc) call ESMF_AttributeAdd(wrt_int_state%wrtFB(i), convention="NetCDF", purpose="FV3", & - attrList=(/"cen_lon","cen_lat","lon1","lat1","lon2","lat2","dlon","dlat"/), rc=rc) + attrList=(/"cen_lon",& + "cen_lat",& + "lon1 ",& + "lat1 ",& + "lon2 ",& + "lat2 ",& + "dlon ",& + "dlat "/), rc=rc) call ESMF_AttributeSet(wrt_int_state%wrtFB(i), convention="NetCDF", purpose="FV3", & name="cen_lon", value=cen_lon, rc=rc) call ESMF_AttributeSet(wrt_int_state%wrtFB(i), convention="NetCDF", purpose="FV3", & @@ -689,7 +696,16 @@ subroutine wrt_initialize(wrt_comp, imp_state_write, exp_state_write, clock, rc) call ESMF_AttributeSet(wrt_int_state%wrtFB(i), convention="NetCDF", purpose="FV3", & name="grid", value="lambert_conformal", rc=rc) call ESMF_AttributeAdd(wrt_int_state%wrtFB(i), convention="NetCDF", purpose="FV3", & - attrList=(/"cen_lon","cen_lat","stdlat1","stdlat2","nx","ny","lon1","lat1","dx","dy"/), rc=rc) + attrList=(/"cen_lon",& + "cen_lat",& + "stdlat1",& + "stdlat2",& + "nx ",& + "ny ",& + "lon1 ",& + "lat1 ",& + "dx ",& + "dy "/), rc=rc) call ESMF_AttributeSet(wrt_int_state%wrtFB(i), convention="NetCDF", purpose="FV3", & name="cen_lon", value=cen_lon, rc=rc) call ESMF_AttributeSet(wrt_int_state%wrtFB(i), convention="NetCDF", purpose="FV3", & diff --git a/ipd/IPD_CCPP_driver.F90 b/ipd/IPD_CCPP_driver.F90 deleted file mode 100644 index 42fcc8491..000000000 --- a/ipd/IPD_CCPP_driver.F90 +++ /dev/null @@ -1,126 +0,0 @@ -module IPD_CCPP_driver - - use IPD_typedefs, only: IPD_control_type, IPD_fastphys_type - - use ccpp_api, only: ccpp_t, & - ccpp_init, & - ccpp_finalize, & - ccpp_physics_init, & - ccpp_physics_run, & - ccpp_physics_finalize, & - ccpp_field_add - -! Begin include auto-generated list of modules for ccpp -#include "ccpp_modules.inc" -! End include auto-generated list of modules for ccpp - - use iso_c_binding, only: c_loc - - implicit none - -!------------------------------------------------------! -! CCPP container ! -!------------------------------------------------------! - type(ccpp_t), save, target :: cdata - -!---------------- -! Public Entities -!---------------- -! functions - public IPD_CCPP_step - - CONTAINS -!******************************************************************************************* - -!------------------------------- -! IPD step generalized for CCPP -!------------------------------- - subroutine IPD_CCPP_step (step, IPD_Control, IPD_Fastphys, ccpp_suite, ierr) - -#ifdef OPENMP - use omp_lib -#endif - - implicit none - - character(len=*), intent(in) :: step - type(IPD_control_type), target, intent(inout), optional :: IPD_Control - type(IPD_fastphys_type), target, intent(inout), optional :: IPD_Fastphys - character(len=*), intent(in), optional :: ccpp_suite - integer, intent(out) :: ierr - - ierr = 0 - - if (trim(step)=="init") then - - if (.not.present(IPD_Control)) then - write(0,*) 'Optional argument IPD_Control required for IPD-CCPP init step' - ierr = 1 - return - end if - - if (.not.present(IPD_Fastphys)) then - write(0,*) 'Optional argument IPD_Fastphys required for IPD-CCPP init step' - ierr = 1 - return - end if - - if (.not.present(ccpp_suite)) then - write(0,*) 'Optional argument ccpp_suite required for IPD-CCPP init step' - ierr = 1 - return - end if - - !--- Initialize CCPP framework - call ccpp_init(trim(ccpp_suite), cdata, ierr) - if (ierr/=0) then - write(0,*) 'An error occurred in ccpp_init' - return - end if - -! Begin include auto-generated list of calls to ccpp_field_add -#include "ccpp_fields.inc" -! End include auto-generated list of calls to ccpp_field_add - - !--- Initialize CCPP physics - call ccpp_physics_init(cdata, ierr) - if (ierr/=0) then - write(0,*) 'An error occurred in ccpp_physics_init' - return - end if - - else if (trim(step)=="fast_physics") then - - call ccpp_physics_run(cdata, group_name='fast_physics', ierr=ierr) - if (ierr/=0) then - write(0,'(a)') "An error occurred in ccpp_physics_run for group fast_physics" - return - end if - - ! Finalize - else if (trim(step)=="finalize") then - - !--- Finalize CCPP physics - call ccpp_physics_finalize(cdata, ierr) - if (ierr/=0) then - write(0,'(a)') "An error occurred in ccpp_physics_finalize" - return - end if - !--- Finalize CCPP framework - call ccpp_finalize(cdata, ierr) - if (ierr/=0) then - write(0,'(a)') "An error occurred in ccpp_finalize" - return - end if - - else - - write(0,'(2a)') 'Error, undefined IPD step ', trim(step) - ierr = 1 - return - - end if - - end subroutine IPD_CCPP_step - -end module IPD_CCPP_driver diff --git a/ipd/IPD_driver.F90 b/ipd/IPD_driver.F90 index ecccc6afc..93a61055d 100644 --- a/ipd/IPD_driver.F90 +++ b/ipd/IPD_driver.F90 @@ -7,6 +7,9 @@ module IPD_driver initialize, & diagnostic_populate, & restart_populate +#ifdef CCPP + use IPD_typedefs, only: IPD_interstitial_type +#endif implicit none @@ -33,18 +36,33 @@ module IPD_driver !---------------- ! IPD Initialize !---------------- +#ifdef CCPP + subroutine IPD_initialize (IPD_Control, IPD_Data, IPD_Diag, IPD_Restart, & + IPD_Interstitial, communicator, ntasks, IPD_init_parm) +#else subroutine IPD_initialize (IPD_Control, IPD_Data, IPD_Diag, IPD_Restart, IPD_init_parm) +#endif type(IPD_control_type), intent(inout) :: IPD_Control type(IPD_data_type), intent(inout) :: IPD_Data(:) type(IPD_diag_type), intent(inout) :: IPD_Diag(:) type(IPD_restart_type), intent(inout) :: IPD_Restart +#ifdef CCPP + type(IPD_interstitial_type), intent(inout) :: IPD_Interstitial(:) + integer, intent(in) :: communicator + integer, intent(in) :: ntasks +#endif type(IPD_init_type), intent(in) :: IPD_init_parm !--- initialize the physics suite call initialize (IPD_Control, IPD_Data(:)%Statein, IPD_Data(:)%Stateout, & IPD_Data(:)%Sfcprop, IPD_Data(:)%Coupling, IPD_Data(:)%Grid, & IPD_Data(:)%Tbd, IPD_Data(:)%Cldprop, IPD_Data(:)%Radtend, & +#ifdef CCPP + IPD_Data(:)%Intdiag, IPD_Interstitial(:), communicator, & + ntasks, IPD_init_parm) +#else IPD_Data(:)%Intdiag, IPD_init_parm) +#endif !--- populate/associate the Diag container elements diff --git a/ipd/IPD_typedefs.F90 b/ipd/IPD_typedefs.F90 index 6669de995..9a0bbbb77 100644 --- a/ipd/IPD_typedefs.F90 +++ b/ipd/IPD_typedefs.F90 @@ -8,6 +8,9 @@ module IPD_typedefs IPD_restart_type => restart_type, & IPD_diag_type => diagnostic_type, & IPD_kind_phys => kind_phys +#ifdef CCPP + use physics_abstraction_layer, only: IPD_interstitial_type => interstitial_type +#endif !--------------------------------------------------------- ! Physics/Radiation types used to create the IPD_data_type @@ -16,11 +19,9 @@ module IPD_typedefs sfcprop_type, coupling_type, & grid_type, tbd_type, & cldprop_type, radtend_type, & -#ifdef CCPP - intdiag_type, & - IPD_fastphys_type => fastphys_type -#else intdiag_type +#ifdef CCPP + use physics_abstraction_layer, only: IPD_data_type => data_type #endif !------------------------------------------------- @@ -30,7 +31,7 @@ module IPD_typedefs diagnostic_populate, & restart_populate - +#ifndef CCPP !------------------------------------------------------- ! IPD_data_type ! container of physics data types that can be blocked @@ -46,6 +47,7 @@ module IPD_typedefs type(radtend_type) :: Radtend type(intdiag_type) :: Intdiag end type IPD_data_type +#endif !------------------------------------------------------ @@ -146,7 +148,7 @@ end subroutine IPD_func1d_proc public IPD_diag_type public IPD_init_type #ifdef CCPP - public IPD_fastphys_type + public IPD_interstitial_type #endif @@ -157,7 +159,6 @@ end subroutine IPD_func1d_proc public diagnostic_populate public restart_populate - CONTAINS !******************************************************************************************* diff --git a/ipd/makefile b/ipd/makefile index e4232a7f5..f7a358ce5 100644 --- a/ipd/makefile +++ b/ipd/makefile @@ -15,12 +15,6 @@ else $(info ) endif -ifneq (,$(findstring CCPP,$(CPPDEFS))) - IPD_CCPP_DRIVER = IPD_CCPP_driver.F90 -else - IPD_CCPP_DRIVER = -endif - LIBRARY = libipd.a FFLAGS += -I$(FMS_DIR) -I../gfsphysics -I../namphysics @@ -29,7 +23,6 @@ CPPDEFS += -DNEW_TAUCTMAX -DSMALL_PE -DNEMS_GSM -DINTERNAL_FILE_NML SRCS_F90 = \ ./IPD_driver.F90 \ - $(IPD_CCPP_DRIVER) \ ./IPD_typedefs.F90 SRCS_c = diff --git a/makefile b/makefile index c34e25cec..7f153150e 100644 --- a/makefile +++ b/makefile @@ -17,9 +17,16 @@ else PHYSP = gfs endif -FFLAGS += -I$(FMS_DIR) -I$(PHYSP)physics -Iipd -Icpl -Iio -Iatmos_cubed_sphere +FFLAGS += -I$(FMS_DIR) -I$(PHYSP)physics -Iipd -Icpl -Iio -Iatmos_cubed_sphere -ICCPP_layer CPPDEFS += -DESMF_VERSION_MAJOR=$(ESMF_VERSION_MAJOR) +# Flag to CCPP build for 32bit dynamics +ifeq ($(32BIT),Y) + DYN32 = Y +else + DYN32 = N +endif + FV3_EXE = fv3.exe FV3CAP_LIB = libfv3cap.a @@ -30,6 +37,21 @@ nems: libs $(MAKE) $(FV3CAP_LIB) $(MAKE_OPTS) FMS_DIR=$(FMS_DIR) $(MAKE) esmf_make_fragment FMS_DIR=$(FMS_DIR) +# Remove stochastic_physics from CCPP build +ifneq (,$(findstring CCPP,$(CPPDEFS))) +libs: + $(MAKE) -C cpl $(MAKE_OPTS) FMS_DIR=$(FMS_DIR) + $(MAKE) -C $(PHYSP)physics $(MAKE_OPTS) FMS_DIR=$(FMS_DIR) 32BIT=N DYN32=$(DYN32) # force gfs physics to 64bit, flag to CCPP build for 32bit dynamics + $(MAKE) -C CCPP_layer $(MAKE_OPTS) FMS_DIR=$(FMS_DIR) 32BIT=N DYN32=$(DYN32) # force gfs physics to 64bit, flag to CCPP build for 32bit dynamics + $(MAKE) -C ipd $(MAKE_OPTS) FMS_DIR=$(FMS_DIR) 32BIT=N # force gfs physics to 64bit + $(MAKE) -C io $(MAKE_OPTS) FMS_DIR=$(FMS_DIR) + $(MAKE) -C atmos_cubed_sphere $(MAKE_OPTS) FMS_DIR=$(FMS_DIR) + #$(MAKE) -C stochastic_physics $(MAKE_OPTS) FMS_DIR=$(FMS_DIR) 32BIT=N # force gfs physics to 64bit + +$(FV3_EXE): atmos_model.o coupler_main.o CCPP_layer/libccppdriver.a atmos_cubed_sphere/libfv3core.a io/libfv3io.a ipd/libipd.a $(PHYSP)physics/lib$(PHYSP)phys.a cpl/libfv3cpl.a fms/libfms.a + $(LD) -o $@ $^ $(NCEPLIBS) $(LDFLAGS) + +else libs: $(MAKE) -C cpl $(MAKE_OPTS) FMS_DIR=$(FMS_DIR) $(MAKE) -C $(PHYSP)physics $(MAKE_OPTS) FMS_DIR=$(FMS_DIR) 32BIT=N # force gfs physics to 64bit @@ -40,6 +62,7 @@ libs: $(FV3_EXE): atmos_model.o coupler_main.o atmos_cubed_sphere/libfv3core.a io/libfv3io.a ipd/libipd.a $(PHYSP)physics/lib$(PHYSP)phys.a stochastic_physics/libstochastic_physics.a cpl/libfv3cpl.a fms/libfms.a $(LD) -o $@ $^ $(NCEPLIBS) $(LDFLAGS) +endif $(FV3CAP_LIB): atmos_model.o module_fv3_config.o module_fcst_grid_comp.o time_utils.o fv3_cap.o ar rv $(FV3CAP_LIB) $? @@ -58,6 +81,36 @@ fv3_cap.o: fv3_cap.F90 DEPEND_FILES = time_utils.F90 module_fv3_config.F90 atmos_model.F90 module_fcst_grid_comp.F90 fv3_cap.F90 coupler_main.F90 +# For CCPP, check if SIONlib is used and set linker flags accordingly +ifneq (,$(findstring CCPP,$(CPPDEFS))) +ifneq (,$(findstring SION,$(CPPDEFS))) + SIONLIB_LINK_FLAGS = $(SIONLIB_LIB) +else + SIONLIB_LINK_FLAGS = +endif +endif + +# Remove stochastic_physics from CCPP build +ifneq (,$(findstring CCPP,$(CPPDEFS))) +esmf_make_fragment: + @rm -rf nems_dir; mkdir nems_dir + @cp $(FV3CAP_LIB) CCPP_layer/libccppdriver.a atmos_cubed_sphere/libfv3core.a io/libfv3io.a ipd/libipd.a $(PHYSP)physics/lib$(PHYSP)phys.a cpl/libfv3cpl.a nems_dir + @cp fv3gfs_cap_mod.mod nems_dir + @echo "# ESMF self-describing build dependency makefile fragment" > fv3.mk + @echo "# src location $(PWD)" >> fv3.mk + @echo >> fv3.mk + @echo "ESMF_DEP_FRONT = fv3gfs_cap_mod" >> fv3.mk + # additional include files needed for PGI + #@echo "ESMF_DEP_INCPATH = $(PWD)/nems_dir" >> fv3.mk + @echo "ESMF_DEP_INCPATH = $(PWD) $(addprefix $(PWD)/, nems_dir CCPP_layer atmos_cubed_sphere io fms gfsphysics cpl ipd)" >> fv3.mk + @echo "ESMF_DEP_CMPL_OBJS =" >> fv3.mk + @echo "ESMF_DEP_LINK_OBJS = $(addprefix $(PWD)/nems_dir/, libfv3cap.a libccppdriver.a libfv3core.a libfv3io.a libipd.a lib$(PHYSP)phys.a libfv3cpl.a) $(SIONLIB_LINK_FLAGS)" >> fv3.mk + @echo "ESMF_DEP_SHRD_PATH =" >> fv3.mk + @echo "ESMF_DEP_SHRD_LIBS =" >> fv3.mk + @echo + @echo "Finished generating ESMF self-describing build dependency makefile fragment:" fv3.mk + @echo +else esmf_make_fragment: @rm -rf nems_dir; mkdir nems_dir @cp $(FV3CAP_LIB) atmos_cubed_sphere/libfv3core.a io/libfv3io.a ipd/libipd.a $(PHYSP)physics/lib$(PHYSP)phys.a cpl/libfv3cpl.a stochastic_physics/libstochastic_physics.a nems_dir @@ -70,12 +123,13 @@ esmf_make_fragment: #@echo "ESMF_DEP_INCPATH = $(PWD)/nems_dir" >> fv3.mk @echo "ESMF_DEP_INCPATH = $(PWD) $(addprefix $(PWD)/, nems_dir atmos_cubed_sphere io fms gfsphysics cpl ipd)" >> fv3.mk @echo "ESMF_DEP_CMPL_OBJS =" >> fv3.mk - @echo "ESMF_DEP_LINK_OBJS = $(addprefix $(PWD)/nems_dir/, libfv3cap.a libfv3core.a libfv3io.a libipd.a lib$(PHYSP)phys.a libfv3cpl.a libstochastic_physics.a)" >> fv3.mk + @echo "ESMF_DEP_LINK_OBJS = $(addprefix $(PWD)/nems_dir/, libfv3cap.a libfv3core.a libfv3io.a libipd.a lib$(PHYSP)phys.a libfv3cpl.a libstochastic_physics.a)" >> fv3.mk @echo "ESMF_DEP_SHRD_PATH =" >> fv3.mk @echo "ESMF_DEP_SHRD_LIBS =" >> fv3.mk @echo @echo "Finished generating ESMF self-describing build dependency makefile fragment:" fv3.mk @echo +endif # fv3 library installation defaults (for NEMS): DESTDIR := $(PWD) @@ -93,6 +147,7 @@ clean: @echo "Cleaning ... " @echo (cd $(PHYSP)physics && make clean) + (cd CCPP_layer && make clean) (cd ipd && make clean) (cd stochastic_physics && make clean) (cd io && make clean) diff --git a/module_fcst_grid_comp.F90 b/module_fcst_grid_comp.F90 index 6cf3354db..96a2df09a 100644 --- a/module_fcst_grid_comp.F90 +++ b/module_fcst_grid_comp.F90 @@ -1,5 +1,11 @@ +#ifdef __PGI +#define ESMF_ERR_ABORT(rc) \ +if (rc /= ESMF_SUCCESS) write(0,*) 'rc=',rc,__FILE__,__LINE__; call ESMF_Finalize(endflag=ESMF_END_ABORT) +#else #define ESMF_ERR_ABORT(rc) \ if (rc /= ESMF_SUCCESS) write(0,*) 'rc=',rc,__FILE__,__LINE__; if(ESMF_LogFoundError(rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) call ESMF_Finalize(endflag=ESMF_END_ABORT) +#endif + !----------------------------------------------------------------------- ! module module_fcst_grid_comp diff --git a/namphysics/NAM_layer/NAM_restart.F90 b/namphysics/NAM_layer/NAM_restart.F90 index 35871cf9e..771bfb60e 100644 --- a/namphysics/NAM_layer/NAM_restart.F90 +++ b/namphysics/NAM_layer/NAM_restart.F90 @@ -17,7 +17,8 @@ module GFS_restart type GFS_restart_type integer :: num2d !< current number of registered 2D restart variables integer :: num3d !< current number of registered 3D restart variables - integer :: ndiag !< current number of diagnostic fields in restart file + integer :: fdiag !< index of first diagnostic field in restart file + integer :: ldiag !< index of last diagnostic field in restart file character(len=32), allocatable :: name2d(:) !< variable name as it will appear in the restart file character(len=32), allocatable :: name3d(:) !< variable name as it will appear in the restart file @@ -91,7 +92,9 @@ subroutine GFS_restart_populate (Restart, Model, Statein, Stateout, Sfcprop, & endif enddo - Restart%ndiag = ndiag_rst + ! Store first and last index of diagnostic fields: + Restart%fdiag = 3 + Model%ntot2d + Model%nctp + 1 + Restart%ldiag = 3 + Model%ntot2d + Model%nctp + ndiag_rst Restart%num2d = 3 + Model%ntot2d + Model%nctp + ndiag_rst Restart%num3d = Model%ntot3d diff --git a/namphysics/NAM_layer/NAM_typedefs.F90 b/namphysics/NAM_layer/NAM_typedefs.F90 index 85898311b..328ad7954 100644 --- a/namphysics/NAM_layer/NAM_typedefs.F90 +++ b/namphysics/NAM_layer/NAM_typedefs.F90 @@ -544,6 +544,8 @@ module GFS_typedefs !--- land/surface model parameters integer :: lsm !< flag for land surface model lsm=1 for noah lsm + integer :: lsm_noah=1 !< flag for NOAH land surface model + integer :: lsm_noahmp=2 !< flag for NOAH land surface model integer :: lsoil !< number of soil layers integer :: ivegsrc !< ivegsrc = 0 => USGS, !< ivegsrc = 1 => IGBP (20 category) @@ -1526,7 +1528,7 @@ subroutine sfcprop_create (Sfcprop, IM, Model) ! Noah MP allocate and init when used ! - if (Model%lsm > 1 ) then + if (Model%lsm == Model%lsm_noahmp ) then allocate (Sfcprop%snowxy (IM)) allocate (Sfcprop%tvxy (IM)) @@ -2953,7 +2955,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & !--- output information about the run if (Model%me == Model%master) then - if (Model%lsm == 1) then + if (Model%lsm == Model%lsm_noah) then print *,' NOAH Land Surface Model used' elseif (Model%lsm == 0) then print *,' OSU no longer supported - job aborted' diff --git a/stochastic_physics/cellular_automata.f90 b/stochastic_physics/cellular_automata.f90 index b1d98323a..20ef90bf3 100644 --- a/stochastic_physics/cellular_automata.f90 +++ b/stochastic_physics/cellular_automata.f90 @@ -96,12 +96,12 @@ subroutine cellular_automata(kstep,Statein,Coupling,Diag,nblks,nlev, & stop endif - if(ca_global == .true. .and. ca_sgs == .true.)then + if(ca_global .and. ca_sgs)then write(0,*)'Namelist options ca_global and ca_sgs cannot both be true - exiting' stop endif - if(ca_sgs == .true. .and. ca_smooth == .true.)then + if(ca_sgs .and. ca_smooth)then write(0,*)'Currently ca_smooth does not work with ca_sgs - exiting' stop endif @@ -275,7 +275,7 @@ subroutine cellular_automata(kstep,Statein,Coupling,Diag,nblks,nlev, & do nf=1,nca !update each ca - if(ca_sgs == .true.)then + if(ca_sgs)then if(nf==1)then inci=ncells @@ -427,9 +427,9 @@ subroutine cellular_automata(kstep,Statein,Coupling,Diag,nblks,nlev, & nlives, ncells, nfracseed, nseed,nthresh, ca_global, & ca_sgs,nspinup, condition, vertvelhigh,nf,nca_plumes) - if(ca_global == .true.)then + if(ca_global)then CAstore(:,:) = CAstore(:,:) + CA(:,:) - elseif(ca_sgs == .true.)then + elseif(ca_sgs)then if(nf==1)then CA_DEEP(:,:)=CA(:,:) elseif(nf==2)then @@ -447,13 +447,13 @@ subroutine cellular_automata(kstep,Statein,Coupling,Diag,nblks,nlev, & enddo !nf (nca) - if(ca_global == .true.)then + if(ca_global)then CAavg = CAstore / real(nca) endif !smooth CA field -if (ca_smooth ==.true. .and. ca_global ==.true.) then +if (ca_smooth .and. ca_global) then field_in=0. !get halo @@ -527,7 +527,7 @@ subroutine cellular_automata(kstep,Statein,Coupling,Diag,nblks,nlev, & !endif !Set the range for the nca individual ca_sgs patterns: -if(ca_sgs ==.true.)then +if(ca_sgs)then Detmax(1)=maxval(CA_DEEP(:,:)) call mp_reduce_max(Detmax(1)) diff --git a/stochastic_physics/stochastic_physics.F90 b/stochastic_physics/stochastic_physics.F90 index a025a19a6..80831ba77 100644 --- a/stochastic_physics/stochastic_physics.F90 +++ b/stochastic_physics/stochastic_physics.F90 @@ -1,5 +1,5 @@ -subroutine init_stochastic_physics(Model,Init_parm,nblks,Grid) +subroutine init_stochastic_physics(Model,Init_parm,nblks) use fv_mp_mod, only : is_master use stochy_internal_state_mod use stochy_data_mod, only : nshum,rpattern_shum,init_stochdata,rpattern_sppt,nsppt,rpattern_skeb,nskeb,gg_lats,gg_lons,& @@ -13,13 +13,12 @@ subroutine init_stochastic_physics(Model,Init_parm,nblks,Grid) use spectral_layout,only:me use mpp_mod use MPI -use GFS_typedefs, only: GFS_control_type, GFS_init_type, GFS_coupling_type, GFS_grid_type +use GFS_typedefs, only: GFS_control_type, GFS_init_type, GFS_coupling_type implicit none type(GFS_control_type), intent(inout) :: Model type(GFS_init_type), intent(in) :: Init_parm integer,intent(in) :: nblks -type(GFS_grid_type), intent(in) :: Grid(nblks) real*8 :: PRSI(Model%levs),PRSL(Model%levs),dx real, allocatable :: skeb_vloc(:) integer :: k,kflip,latghf,nodes,blk,k2 diff --git a/stochastic_physics/stochy_patterngenerator.F90 b/stochastic_physics/stochy_patterngenerator.F90 index 2ade7b902..e2abcc0dd 100644 --- a/stochastic_physics/stochy_patterngenerator.F90 +++ b/stochastic_physics/stochy_patterngenerator.F90 @@ -249,6 +249,11 @@ subroutine getnoise(rpattern,noise_e,noise_o) end subroutine getnoise subroutine patterngenerator_advance(rpattern,k,skeb_first_call) + +#ifdef TRANSITION +!DIR$ OPTIMIZE:1 +#endif + ! advance 1st-order autoregressive process with ! specified autocorrelation (phi) and variance spectrum (spectrum) real(kind_dbl_prec) :: noise_e(len_trie_ls,2) diff --git a/stochastic_physics/update_ca.f90 b/stochastic_physics/update_ca.f90 index 9bc38eae8..f45e6974a 100644 --- a/stochastic_physics/update_ca.f90 +++ b/stochastic_physics/update_ca.f90 @@ -84,7 +84,7 @@ subroutine update_cells(kstep,nca,nxc,nyc,nxch,nych,nlon,nlat,CA,ca_plumes,iini, allocate(Cpert_halo(nxch,nych,1)) endif - if(ca_sgs == .true.)then + if(ca_sgs)then if(kstep <= 1)then @@ -163,7 +163,7 @@ subroutine update_cells(kstep,nca,nxc,nyc,nxch,nych,nlon,nlat,CA,ca_plumes,iini, !Step 1 - Solve the stochastic gaussian skewed SGS equation in order to generate !perturbations to the grid mean model fields. -if (ca_sgs == .true.) then +if (ca_sgs) then !Compute the SGS and perturb the vertical velocity field: !Read these values in from namelist, guided from LES data: @@ -194,7 +194,7 @@ subroutine update_cells(kstep,nca,nxc,nyc,nxch,nych,nlon,nlat,CA,ca_plumes,iini, do it=1,spinup -if (ca_sgs == .true.) then +if (ca_sgs) then !Random seed for SGS noise1D1 = 0.0 @@ -288,7 +288,7 @@ subroutine update_cells(kstep,nca,nxc,nyc,nxch,nych,nlon,nlat,CA,ca_plumes,iini, !take the updated board fields and extract the halo ! in order to have updated values in the halo region. - if(ca_global ==.true.)then + if(ca_global)then do j=1,nyc do i=1,nxc field_in(i+(j-1)*nxc,1)=board(i,j,nf) @@ -299,7 +299,7 @@ subroutine update_cells(kstep,nca,nxc,nyc,nxch,nych,nlon,nlat,CA,ca_plumes,iini, endif - if(ca_sgs==.true.)then + if(ca_sgs)then field_in=0 do j=1,nyc do i=1,nxc @@ -323,7 +323,7 @@ subroutine update_cells(kstep,nca,nxc,nyc,nxch,nych,nlon,nlat,CA,ca_plumes,iini, !Step 4 - Compute the neighbourhood -if(ca_sgs == .true.)then !SGSmethod +if(ca_sgs)then !SGSmethod !Count the number of neighbours where perturbed massflux is larger than !a threshold @@ -403,7 +403,7 @@ subroutine update_cells(kstep,nca,nxc,nyc,nxch,nych,nlon,nlat,CA,ca_plumes,iini, endif !sgs/global ! Step 5 - Check rules; the birth condition differs between SGS and GOL method -if(ca_sgs == .true.)then !SGS +if(ca_sgs)then !SGS if(nf==1)then do j=1,nyc @@ -483,7 +483,7 @@ subroutine update_cells(kstep,nca,nxc,nyc,nxch,nych,nlon,nlat,CA,ca_plumes,iini, enddo enddo - if(ca_sgs == .true.)then + if(ca_sgs)then do j=1,nyc do i=1,nxc lives(i,j,nf)=lives(i,j,nf)+newcell(i,j)*ilives(i,j) @@ -526,14 +526,14 @@ subroutine update_cells(kstep,nca,nxc,nyc,nxch,nych,nlon,nlat,CA,ca_plumes,iini, lives_max=maxval(ilives) call mp_reduce_max(lives_max) - if(ca_sgs == .true.)then + if(ca_sgs)then CA(:,:) = (frac(:,:)/lives_max) else !global CA(:,:) = (frac(:,:)/real(nlives)) endif -if(nca_plumes == .true.) then +if(nca_plumes) then !COMPUTE NUMBER OF CLUSTERS (CONVECTIVE PLUMES) IN EACH CA-CELL !Note, at the moment we only use the count of the plumes found in a grid-cell !In the future the routine "plumes" can also be used to give the size of