Skip to content

Commit

Permalink
Merge pull request NOAA-GFDL#58 from GEOS-ESM/feature/sdrabenh/merge_…
Browse files Browse the repository at this point in the history
…v10.25.1_MSTRF

Merging refactored physics code into develop
  • Loading branch information
mathomp4 authored Mar 10, 2023
2 parents 1581fa0 + 965aef5 commit dc279c4
Show file tree
Hide file tree
Showing 17 changed files with 1,537 additions and 1,285 deletions.
13 changes: 4 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ elseif (FV_PRECISION STREQUAL R8)
endforeach()
endif ()

set (CMAKE_Fortran_FLAGS_RELEASE "${GEOS_Fortran_FLAGS_VECT}")
#set (CMAKE_Fortran_FLAGS_RELEASE "${GEOS_Fortran_FLAGS_VECT}")

if (CRAY_POINTER)
set_target_properties (${this} PROPERTIES COMPILE_FLAGS ${CRAY_POINTER})
Expand All @@ -83,14 +83,9 @@ target_compile_definitions (${this} PRIVATE MAPL_MODE SPMD TIMING)
# Enable OpenMP
target_link_libraries(${this} PRIVATE OpenMP::OpenMP_Fortran)

option(HYDROSTATIC "Build FV dynamics as hydrostatic" ON)
if (HYDROSTATIC)
ecbuild_info("Building FV dynamics as hydrostatic")
else()
ecbuild_info("Building FV dynamics as non-hydrostatic")
ecbuild_info("This sets MOIST_CAPPA and USE_COND preprocessor variables")
target_compile_definitions (${this} PRIVATE MOIST_CAPPA USE_COND)
endif ()
ecbuild_info("Building FV dynamics dual hydrostatic/non-hydrostatic")
ecbuild_info("This sets MOIST_CAPPA and USE_COND preprocessor variables")
target_compile_definitions (${this} PRIVATE MOIST_CAPPA USE_COND)

esma_add_subdirectories(
model/mapz-driver
Expand Down
220 changes: 160 additions & 60 deletions model/dyn_core.F90

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions model/fv_arrays.F90
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,12 @@ module fv_arrays_mod
!< heat added) is reduced. The default is .false., which applies the Rayleigh
!< drag every physics timestep.

logical :: Beljaars_TOFD = .false. !< Option controlling whether to apply Beljaars turbulent-orographic-form-drag
!< on the dynamic/acoustic timestep rather than on the physics timestep.
!< This can help stabilize the model by applying the damping more weakly
!< more frequently, so the instantaneous amount of damping (and thereby
!< heat added) is reduced.

logical :: consv_am = .false. !< Whether to enable Angular momentum fixer. The default is .false.


Expand Down Expand Up @@ -866,6 +872,12 @@ module fv_arrays_mod
!< kord_tm no longer needs to be negative.
!< WMP-NASA-GMAO UPDATE

integer :: gmao_remap = 0 !< Whether the vertical remapping uses GFDl or GMAO remap schemes
!< 0: GFDL schemes
!< 1: GMAO linear
!< 2: GMAO quadratic
!< 3: GMAO cubic

logical :: z_tracer = .false. !< Whether to transport sub-cycled tracers layer-by-layer,
!< each with its own computed sub-cycling time step (if q_split = 0).
!< This may improve efficiency for very large numbers of tracers.
Expand Down Expand Up @@ -1223,6 +1235,7 @@ module fv_arrays_mod
! Others:
!-----------------------------------------------------------------------
real, _ALLOCATABLE :: phis(:,:) _NULL !< Surface geopotential (g*Z_surf)
real, _ALLOCATABLE :: varflt(:,:) _NULL !< variance of the filtered topography (m^2)
real, _ALLOCATABLE :: omga(:,:,:) _NULL !< Vertical pressure velocity (pa/s)
real, _ALLOCATABLE :: ua(:,:,:) _NULL !< (ua, va) are mostly used as the A grid winds
real, _ALLOCATABLE :: va(:,:,:) _NULL
Expand Down Expand Up @@ -1460,6 +1473,7 @@ subroutine allocate_fv_atmos_type(Atm, isd_in, ied_in, jsd_in, jed_in, is_in, ie
allocate ( Atm%diss_est(isd:ied ,jsd:jed ,npz) )
allocate ( Atm%ts(is:ie,js:je) )
allocate ( Atm%phis(isd:ied ,jsd:jed ) )
allocate ( Atm%varflt(is:ie ,js:je ) )
allocate ( Atm%omga(isd:ied ,jsd:jed ,npz) ); Atm%omga=0.
allocate ( Atm%ua(isd:ied ,jsd:jed ,npz) )
allocate ( Atm%va(isd:ied ,jsd:jed ,npz) )
Expand Down Expand Up @@ -1781,6 +1795,7 @@ subroutine deallocate_fv_atmos_type(Atm)
deallocate ( Atm%peln )
deallocate ( Atm%pkz )
deallocate ( Atm%phis )
deallocate ( Atm%varflt )
deallocate ( Atm%omga )
deallocate ( Atm%ua )
deallocate ( Atm%va )
Expand Down
362 changes: 184 additions & 178 deletions model/fv_cmp.F90

Large diffs are not rendered by default.

26 changes: 18 additions & 8 deletions model/fv_control.F90
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ module fv_control_mod
logical , pointer :: full_zs_filter

logical , pointer :: RF_fast
logical , pointer :: Beljaars_TOFD
logical , pointer :: consv_am
logical , pointer :: do_sat_adj
logical , pointer :: do_f3d
Expand Down Expand Up @@ -277,6 +278,7 @@ module fv_control_mod
logical , pointer :: srf_init
logical , pointer :: mountain
integer , pointer :: remap_option
integer , pointer :: gmao_remap
logical , pointer :: z_tracer

logical , pointer :: old_divg_damp
Expand Down Expand Up @@ -662,11 +664,11 @@ subroutine run_setup(Atm, dt_atmos, grids_on_this_pe, p_split)
dddmp, d2_bg, d4_bg, vtdm4, trdm2, d_ext, delt_max, beta, non_ortho, n_sponge, n_zfilter, &
warm_start, adjust_dry_mass, mountain, d_con, ke_bg, nord, nord_tr, convert_ke, use_old_omega, &
dry_mass, grid_type, do_Held_Suarez, do_reed_physics, reed_cond_only, &
consv_te, fill, filter_phys, fill_dp, fill_wz, consv_am, RF_fast, &
consv_te, fill, filter_phys, fill_dp, fill_wz, consv_am, RF_fast, Beljaars_TOFD, &
range_warn, dwind_2d, inline_q, z_tracer, reproduce_sum, adiabatic, do_vort_damp, no_dycore, &
tau, tau_h2o, rf_cutoff, nf_omega, hydrostatic, fv_sg_adj, breed_vortex_inline, &
na_init, nudge_dz, hybrid_z, Make_NH, n_zs_filter, nord_zs_filter, full_zs_filter, reset_eta, &
pnats, dnats, a2b_ord, remap_option, p_ref, d2_bg_k1, d2_bg_k2, &
pnats, dnats, a2b_ord, remap_option, gmao_remap, p_ref, d2_bg_k1, d2_bg_k2, &
c2l_ord, dx_const, dy_const, umax, deglat, &
deglon_start, deglon_stop, deglat_start, deglat_stop, &
phys_hydrostatic, use_hydro_pressure, make_hybrid_z, old_divg_damp, add_noise, &
Expand Down Expand Up @@ -764,14 +766,16 @@ subroutine run_setup(Atm, dt_atmos, grids_on_this_pe, p_split)

! Define n_split if not in namelist
if (ntiles==6) then
dimx = 4.0*(npx-1)
#ifdef MAPL_MODE
! WMP if ( hydrostatic ) then
ns0 = 5
! WMP else
! WMP ns0 = 6
! WMP endif
dimx = ceiling(stretch_fac)*4.0*(npx-1)
if (.not. hydrostatic ) then
ns0 = 6
if ( dimx >= 360 ) ns0 = 7
if ( dimx >= 1440 ) ns0 = 8
if ( stretch_fac > 1.0 ) ns0=ns0+1
endif
#else
dimx = 4.0*(npx-1)
if ( hydrostatic ) then
if ( npx >= 120 ) ns0 = 6
else
Expand Down Expand Up @@ -807,7 +811,11 @@ subroutine run_setup(Atm, dt_atmos, grids_on_this_pe, p_split)
n0split = max ( 1, n0split )

if ( n_split == 0 ) then
#ifdef MAPL_MODE
n_split = ceiling( real(n0split)/real(k_split*abs(p_split)) + 0.5 )
#else
n_split = nint( real(n0split)/real(k_split*abs(p_split)) * stretch_fac + 0.5 )
#endif
if(is_master()) write(*,*) 'For k_split (remapping)=', k_split
if(is_master()) write(*,198) 'n_split is set to ', n_split, ' for resolution-dt=',npx,npy,ntiles,dt_atmos
else
Expand Down Expand Up @@ -1188,6 +1196,7 @@ subroutine setup_pointers(Atm)
nord_zs_filter => Atm%flagstruct%nord_zs_filter
full_zs_filter => Atm%flagstruct%full_zs_filter
RF_fast => Atm%flagstruct%RF_fast
Beljaars_TOFD => Atm%flagstruct%Beljaars_TOFD
consv_am => Atm%flagstruct%consv_am
do_sat_adj => Atm%flagstruct%do_sat_adj
do_f3d => Atm%flagstruct%do_f3d
Expand Down Expand Up @@ -1261,6 +1270,7 @@ subroutine setup_pointers(Atm)
srf_init => Atm%flagstruct%srf_init
mountain => Atm%flagstruct%mountain
remap_option => Atm%flagstruct%remap_option
gmao_remap => Atm%flagstruct%gmao_remap
z_tracer => Atm%flagstruct%z_tracer
old_divg_damp => Atm%flagstruct%old_divg_damp
fv_land => Atm%flagstruct%fv_land
Expand Down
Loading

0 comments on commit dc279c4

Please sign in to comment.