Skip to content

Commit

Permalink
Merge pull request #88 from grantfirl/ufs-dev-PR53
Browse files Browse the repository at this point in the history
UFS-dev PR#53
  • Loading branch information
grantfirl authored Apr 6, 2023
2 parents 1a7867f + a82ff9a commit 66c6ff1
Show file tree
Hide file tree
Showing 12 changed files with 68 additions and 49 deletions.
4 changes: 2 additions & 2 deletions atmos_model.F90
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ module atmos_model_mod
DIAG_SIZE
use fv_iau_mod, only: iau_external_data_type,getiauforcing,iau_initialize
use module_fv3_config, only: output_1st_tstep_rst, first_kdt, nsout, &
restart_endfcst, output_fh, fcst_mpi_comm, &
fcst_ntasks
output_fh, fcst_mpi_comm, fcst_ntasks
use module_block_data, only: block_atmos_copy, block_data_copy, &
block_data_copy_or_fill, &
block_data_combine_fractions
Expand Down Expand Up @@ -178,6 +177,7 @@ module atmos_model_mod
logical :: debug = .false.
!logical :: debug = .true.
logical :: sync = .false.
logical :: restart_endfcst = .false.
real :: avg_max_length=3600.
logical :: ignore_rst_cksum = .false.
namelist /atmos_model_nml/ blocksize, chksum_debug, dycore_only, debug, sync, ccpp_suite, avg_max_length, &
Expand Down
13 changes: 13 additions & 0 deletions ccpp/data/GFS_typedefs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,9 @@ module GFS_typedefs
real(kind=kind_phys) :: nssl_cccn !< CCN concentration (m-3)
real(kind=kind_phys) :: nssl_alphah !< graupel shape parameter
real(kind=kind_phys) :: nssl_alphahl !< hail shape parameter
real(kind=kind_phys) :: nssl_alphar ! shape parameter for rain (imurain=1 only)
real(kind=kind_phys) :: nssl_ehw0_in ! constant or max assumed graupel-droplet collection efficiency
real(kind=kind_phys) :: nssl_ehlw0_in! constant or max assumed hail-droplet collection efficiency
logical :: nssl_hail_on !< NSSL flag to activate the hail category
logical :: nssl_ccn_on !< NSSL flag to activate the CCN category
logical :: nssl_invertccn !< NSSL flag to treat CCN as activated (true) or unactivated (false)
Expand Down Expand Up @@ -3162,6 +3165,9 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
real(kind=kind_phys) :: nssl_cccn = 0.6e9 !< CCN concentration (m-3)
real(kind=kind_phys) :: nssl_alphah = 0.0 !< graupel shape parameter
real(kind=kind_phys) :: nssl_alphahl = 1.0 !< hail shape parameter
real(kind=kind_phys) :: nssl_alphar = 0.0 ! shape parameter for rain (imurain=1 only)
real(kind=kind_phys) :: nssl_ehw0_in = 0.9 ! constant or max assumed graupel-droplet collection efficiency
real(kind=kind_phys) :: nssl_ehlw0_in = 0.9 ! constant or max assumed hail-droplet collection efficiency
logical :: nssl_hail_on = .false. !< NSSL flag to activate the hail category
logical :: nssl_ccn_on = .true. !< NSSL flag to activate the CCN category
logical :: nssl_invertccn = .true. !< NSSL flag to treat CCN as activated (true) or unactivated (false)
Expand Down Expand Up @@ -3587,6 +3593,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
ext_diag_thompson, dt_inner, lgfdlmprad, &
sedi_semi, decfl, &
nssl_cccn, nssl_alphah, nssl_alphahl, &
nssl_alphar, nssl_ehw0_in, nssl_ehlw0_in, &
nssl_invertccn, nssl_hail_on, nssl_ccn_on, &
!--- max hourly
avg_max_length, &
Expand Down Expand Up @@ -4161,6 +4168,9 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
Model%nssl_cccn = nssl_cccn
Model%nssl_alphah = nssl_alphah
Model%nssl_alphahl = nssl_alphahl
Model%nssl_alphar = nssl_alphar
Model%nssl_ehw0_in = nssl_ehw0_in
Model%nssl_ehlw0_in = nssl_ehlw0_in
Model%nssl_hail_on = nssl_hail_on
Model%nssl_ccn_on = nssl_ccn_on
Model%nssl_invertccn = nssl_invertccn
Expand Down Expand Up @@ -6019,6 +6029,9 @@ subroutine control_print(Model)
print *, ' nssl_cccn - CCCN background CCN conc. : ', Model%nssl_cccn
print *, ' nssl_alphah - graupel shape parameter : ', Model%nssl_alphah
print *, ' nssl_alphahl - hail shape parameter : ', Model%nssl_alphahl
print *, ' nssl_alphar - rain shape parameter : ', Model%nssl_alphar
print *, ' nssl_ehw0_in - graupel-droplet collection effiency : ', Model%nssl_ehw0_in
print *, ' nssl_ehlw0_in - hail-droplet collection effiency : ', Model%nssl_ehlw0_in
print *, ' nssl_hail_on - hail activation flag : ', Model%nssl_hail_on
print *, ' lradar - radar refl. flag : ', Model%lradar
print *, ' lrefres : ', Model%lrefres
Expand Down
31 changes: 26 additions & 5 deletions ccpp/data/GFS_typedefs.meta
Original file line number Diff line number Diff line change
Expand Up @@ -3935,33 +3935,54 @@
kind = kind_phys
[nssl_alphah]
standard_name = nssl_alpha_graupel
long_name = graupel PSD shape parameter in NSSL micro
long_name = graupel particle size distribution(PSD) shape parameter in NSSL microphysics scheme
units = none
dimensions = ()
type = real
kind = kind_phys
[nssl_alphahl]
standard_name = nssl_alpha_hail
long_name = hail PSD shape parameter in NSSL micro
long_name = hail particle size distribution(PSD) shape parameter in NSSL microphysics scheme
units = none
dimensions = ()
type = real
kind = kind_phys
[nssl_alphar]
standard_name = nssl_alpha_rain
long_name = rain particle size distribution(PSD) shape parameter in NSSL microphysics scheme
units = none
dimensions = ()
type = real
kind = kind_phys
[nssl_ehw0_in]
standard_name = nssl_graupel_collection_efficiency
long_name = graupel droplet collection efficiency in NSSL microphysics scheme
units = none
dimensions = ()
type = real
kind = kind_phys
[nssl_ehlw0_in]
standard_name = nssl_hail_collection_efficiency
long_name = hail droplet collection efficiency in NSSL microphysics scheme
units = none
dimensions = ()
type = real
kind = kind_phys
[nssl_ccn_on]
standard_name = nssl_ccn_on
long_name = CCN activation flag in NSSL micro
long_name = CCN activation flag in NSSL microphysics scheme
units = flag
dimensions = ()
type = logical
[nssl_hail_on]
standard_name = nssl_hail_on
long_name = hail activation flag in NSSL micro
long_name = hail activation flag in NSSL microphysics scheme
units = flag
dimensions = ()
type = logical
[nssl_invertccn]
standard_name = nssl_invertccn
long_name = flag to invert CCN in NSSL micro
long_name = flag to invert CCN in NSSL microphysics scheme
units = flag
dimensions = ()
type = logical
Expand Down
2 changes: 1 addition & 1 deletion ccpp/framework
2 changes: 1 addition & 1 deletion ccpp/physics
44 changes: 5 additions & 39 deletions module_fcst_grid_comp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,14 @@ module module_fcst_grid_comp
nbdlphys, iau_offset
use module_fv3_config, only: dt_atmos, fcst_mpi_comm, fcst_ntasks, &
quilting, calendar, cpl_grid_id, &
cplprint_flag, restart_endfcst
cplprint_flag

use get_stochy_pattern_mod, only: write_stoch_restart_atm
use module_cplfields, only: nExportFields, exportFields, exportFieldsInfo, &
nImportFields, importFields, importFieldsInfo
use module_cplfields, only: realizeConnectedCplFields

use atmos_model_mod, only: setup_exportdata
use CCPP_data, only: GFS_control
!
!-----------------------------------------------------------------------
!
Expand All @@ -90,7 +89,7 @@ module module_fcst_grid_comp
type(ESMF_GridComp),dimension(:),allocatable :: fcstGridComp
integer :: ngrids, mygrid

integer :: intrm_rst, n_atmsteps
integer :: n_atmsteps

!----- coupled model data -----

Expand Down Expand Up @@ -744,20 +743,7 @@ subroutine fcst_initialize(fcst_comp, importState, exportState, clock, rc)
endif
endif
! if to write out restart at the end of forecast
restart_endfcst = .false.
if ( ANY(frestart(:) == total_inttime) ) restart_endfcst = .true.
! frestart only contains intermediate restart
do i=1,size(frestart)
if(frestart(i) == total_inttime) then
frestart(i) = 0
exit
endif
enddo
if (mype == 0) print *,'frestart=',frestart(1:10)/3600, 'restart_endfcst=',restart_endfcst, &
'total_inttime=',total_inttime
! if there is restart writing during integration
intrm_rst = 0
if (frestart(1)>0) intrm_rst = 1
if (mype == 0) print *,'frestart=',frestart(1:10)/3600, 'total_inttime=',total_inttime

!------ initialize component models ------

Expand Down Expand Up @@ -1255,9 +1241,8 @@ subroutine fcst_run_phase_2(fcst_comp, importState, exportState,clock,rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return

!--- intermediate restart
if (intrm_rst>0) then
call get_time(Atmos%Time - Atmos%Time_init, seconds)
if (ANY(frestart(:) == seconds)) then
call get_time(Atmos%Time - Atmos%Time_init, seconds)
if (ANY(frestart(:) == seconds)) then
if (mype == 0) write(*,*)'write out restart at n_atmsteps=',n_atmsteps,' seconds=',seconds, &
'integration length=',n_atmsteps*dt_atmos/3600.

Expand All @@ -1279,7 +1264,6 @@ subroutine fcst_run_phase_2(fcst_comp, importState, exportState,clock,rc)
'Current model time: year, month, day, hour, minute, second'
close( unit )
endif
endif
endif

if (mype == 0) write(*,'(A,I16,A,F16.6)')'PASS: fcstRUN phase 2, n_atmsteps = ', &
Expand Down Expand Up @@ -1323,24 +1307,6 @@ subroutine fcst_finalize(fcst_comp, importState, exportState,clock,rc)

call atmos_model_end (Atmos)

!*** write restart file
if( restart_endfcst ) then
call get_date (Atmos%Time, date(1), date(2), date(3), &
date(4), date(5), date(6))
call mpp_set_current_pelist()
if (mpp_pe() == mpp_root_pe())then
open( newunit=unit, file='RESTART/coupler.res' )
write( unit, '(i6,8x,a)' )calendar_type, &
'(Calendar: no_calendar=0, thirty_day_months=1, julian=2, gregorian=3, noleap=4)'

write( unit, '(6i6,8x,a)' )date_init, &
'Model start time: year, month, day, hour, minute, second'
write( unit, '(6i6,8x,a)' )date, &
'Current model time: year, month, day, hour, minute, second'
close( unit )
endif
endif

call diag_manager_end (Atmos%Time)

call fms_end
Expand Down
1 change: 0 additions & 1 deletion module_fv3_config.F90
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ module module_fv3_config
integer :: cpl_grid_id
logical :: cplprint_flag
logical :: quilting, output_1st_tstep_rst
logical :: restart_endfcst
!
real,dimension(:),allocatable :: output_fh
character(esmf_maxstr),dimension(:),allocatable :: filename_base
Expand Down
4 changes: 4 additions & 0 deletions moving_nest/fv_moving_nest.F90
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ module fv_moving_nest_mod

use boundary_mod, only: update_coarse_grid, update_coarse_grid_mpp
use bounding_box_mod, only: bbox, bbox_get_C2F_index, fill_bbox
#ifdef OVERLOAD_R4
use constantsR4_mod, only: cp_air, omega, rdgas, grav, rvgas, kappa, pstd_mks, hlv
#else
use constants_mod, only: cp_air, omega, rdgas, grav, rvgas, kappa, pstd_mks, hlv
#endif
use field_manager_mod, only: MODEL_ATMOS
use fv_arrays_mod, only: fv_atmos_type, fv_nest_type, fv_grid_type, R_GRID
use fv_arrays_mod, only: allocate_fv_nest_bc_type, deallocate_fv_nest_bc_type
Expand Down
4 changes: 4 additions & 0 deletions moving_nest/fv_moving_nest_main.F90
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ module fv_moving_nest_main_mod
! FMS modules:
!-----------------
use block_control_mod, only: block_control_type
#ifdef OVERLOAD_R4
use constantsR4_mod, only: cp_air, rdgas, grav, rvgas, kappa, pstd_mks
#else
use constants_mod, only: cp_air, rdgas, grav, rvgas, kappa, pstd_mks
#endif
use time_manager_mod, only: time_type, get_time, get_date, set_time, operator(+), &
operator(-), operator(/), time_type_to_real
use fms_mod, only: file_exist, open_namelist_file, &
Expand Down
4 changes: 4 additions & 0 deletions moving_nest/fv_moving_nest_physics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ module fv_moving_nest_physics_mod
use GFS_init, only: GFS_grid_populate

use boundary_mod, only: update_coarse_grid, update_coarse_grid_mpp
#ifdef OVERLOAD_R4
use constantsR4_mod, only: cp_air, rdgas, grav, rvgas, kappa, pstd_mks, hlv
#else
use constants_mod, only: cp_air, rdgas, grav, rvgas, kappa, pstd_mks, hlv
#endif
use field_manager_mod, only: MODEL_ATMOS
use fv_arrays_mod, only: fv_atmos_type, fv_nest_type, fv_grid_type, R_GRID
use fv_moving_nest_types_mod, only: fv_moving_nest_prog_type, fv_moving_nest_physics_type, mn_surface_grids, fv_moving_nest_type
Expand Down
4 changes: 4 additions & 0 deletions moving_nest/fv_moving_nest_utils.F90
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ module fv_moving_nest_utils_mod
use IPD_typedefs, only: kind_phys => IPD_kind_phys
#endif

#ifdef OVERLOAD_R4
use constantsR4_mod, only: grav
#else
use constants_mod, only: grav
#endif

use boundary_mod, only: update_coarse_grid, update_coarse_grid_mpp
use bounding_box_mod, only: bbox, bbox_get_C2F_index, fill_bbox
Expand Down
4 changes: 4 additions & 0 deletions moving_nest/fv_tracker.F90
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ module fv_tracker_mod

#include <fms_platform.h>

#ifdef OVERLOAD_R4
use constantsR4_mod, only: pi=>pi_8, rad_to_deg, deg_to_rad, RVGAS, RDGAS
#else
use constants_mod, only: pi=>pi_8, rad_to_deg, deg_to_rad, RVGAS, RDGAS
#endif
use fms_mod, only: mpp_clock_id, CLOCK_SUBCOMPONENT, clock_flag_default, &
mpp_clock_begin, mpp_clock_end
use time_manager_mod, only: time_type, get_time, set_time, operator(+), &
Expand Down

0 comments on commit 66c6ff1

Please sign in to comment.