From eab5725d79821de9b35e89fddf83f092ba2dd6d0 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Thu, 19 Dec 2024 14:43:55 -0700 Subject: [PATCH] Update physics/Interstitials/UFS_SCM_NEPTUNE/GFS_phys_time_vary.fv3.*: support multiple instances by making is_initialized a host-model variable --- .../GFS_phys_time_vary.fv3.F90 | 39 ++++++------------- .../GFS_phys_time_vary.fv3.meta | 39 ++++++++++--------- 2 files changed, 31 insertions(+), 47 deletions(-) diff --git a/physics/Interstitials/UFS_SCM_NEPTUNE/GFS_phys_time_vary.fv3.F90 b/physics/Interstitials/UFS_SCM_NEPTUNE/GFS_phys_time_vary.fv3.F90 index b556af06f..0c90478be 100644 --- a/physics/Interstitials/UFS_SCM_NEPTUNE/GFS_phys_time_vary.fv3.F90 +++ b/physics/Interstitials/UFS_SCM_NEPTUNE/GFS_phys_time_vary.fv3.F90 @@ -44,9 +44,7 @@ module GFS_phys_time_vary private - public GFS_phys_time_vary_init, GFS_phys_time_vary_timestep_init, GFS_phys_time_vary_timestep_finalize, GFS_phys_time_vary_finalize - - logical :: is_initialized = .false. + public GFS_phys_time_vary_init, GFS_phys_time_vary_timestep_init, GFS_phys_time_vary_finalize real(kind=kind_phys), parameter :: con_hr = 3600.0_kind_phys real(kind=kind_phys), parameter :: con_99 = 99.0_kind_phys @@ -95,7 +93,8 @@ subroutine GFS_phys_time_vary_init ( smcwtdxy, deeprechxy, rechxy, snowxy, snicexy, snliqxy, tsnoxy , smoiseq, zsnsoxy, & slc, smc, stc, tsfcl, snowd, canopy, tg3, stype, con_t0c, lsm_cold_start, nthrds, & lkm, use_lake_model, lakefrac, lakedepth, iopt_lake, iopt_lake_clm, iopt_lake_flake, & - lakefrac_threshold, lakedepth_threshold, ozphys, h2ophys, errmsg, errflg) + lakefrac_threshold, lakedepth_threshold, ozphys, h2ophys, is_initialized, errmsg, & + errflg) implicit none @@ -193,6 +192,7 @@ subroutine GFS_phys_time_vary_init ( real(kind_phys), intent(in) :: con_t0c integer, intent(in) :: nthrds + logical, intent(inout) :: is_initialized character(len=*), intent(out) :: errmsg integer, intent(out) :: errflg @@ -713,7 +713,8 @@ subroutine GFS_phys_time_vary_timestep_init ( tsfc, tsfco, tisfc, hice, fice, facsf, facwf, alvsf, alvwf, alnsf, alnwf, zorli, zorll, & zorlo, weasd, slope, snoalb, canopy, vfrac, vtype, stype,scolor, shdmin, shdmax, snowd, & cv, cvb, cvt, oro, oro_uf, xlat_d, xlon_d, slmsk, landfrac, ozphys, h2ophys, & - do_ugwp_v1, jindx1_tau, jindx2_tau, ddy_j1tau, ddy_j2tau, tau_amf, errmsg, errflg) + do_ugwp_v1, jindx1_tau, jindx2_tau, ddy_j1tau, ddy_j2tau, tau_amf, is_initialized, & + errmsg, errflg) implicit none @@ -762,6 +763,7 @@ subroutine GFS_phys_time_vary_timestep_init ( real(kind_phys), intent(inout), optional :: smois(:,:), sh2o(:,:), tslb(:,:), tref(:) integer, intent(inout) :: vtype(:), stype(:),scolor(:), slope(:) + logical, intent(in) :: is_initialized character(len=*), intent(out) :: errmsg integer, intent(out) :: errflg @@ -931,36 +933,17 @@ subroutine GFS_phys_time_vary_timestep_init ( end subroutine GFS_phys_time_vary_timestep_init !> @} -!> \section arg_table_GFS_phys_time_vary_timestep_finalize Argument Table -!! \htmlinclude GFS_phys_time_vary_timestep_finalize.html -!! -!>\section gen_GFS_phys_time_vary_timestep_finalize GFS_phys_time_vary_timestep_finalize General Algorithm -!> @{ - subroutine GFS_phys_time_vary_timestep_finalize (errmsg, errflg) - - implicit none - - ! Interface variables - character(len=*), intent(out) :: errmsg - integer, intent(out) :: errflg - - ! Initialize CCPP error handling variables - errmsg = '' - errflg = 0 - - end subroutine GFS_phys_time_vary_timestep_finalize -!> @} - !> \section arg_table_GFS_phys_time_vary_finalize Argument Table !! \htmlinclude GFS_phys_time_vary_finalize.html !! - subroutine GFS_phys_time_vary_finalize(errmsg, errflg) + subroutine GFS_phys_time_vary_finalize(is_initialized, errmsg, errflg) implicit none ! Interface variables - character(len=*), intent(out) :: errmsg - integer, intent(out) :: errflg + logical, intent(inout) :: is_initialized + character(len=*), intent(out) :: errmsg + integer, intent(out) :: errflg ! Initialize CCPP error handling variables errmsg = '' diff --git a/physics/Interstitials/UFS_SCM_NEPTUNE/GFS_phys_time_vary.fv3.meta b/physics/Interstitials/UFS_SCM_NEPTUNE/GFS_phys_time_vary.fv3.meta index 44a5b92f9..d0c5e80ec 100644 --- a/physics/Interstitials/UFS_SCM_NEPTUNE/GFS_phys_time_vary.fv3.meta +++ b/physics/Interstitials/UFS_SCM_NEPTUNE/GFS_phys_time_vary.fv3.meta @@ -1042,6 +1042,13 @@ dimensions = () type = ty_h2ophys intent = in +[is_initialized] + standard_name = flag_for_gfs_phys_time_vary_interstitial_initialization + long_name = flag carrying interstitial initialization status + units = flag + dimensions = () + type = logical + intent = inout [errmsg] standard_name = ccpp_error_message long_name = error message for error handling in CCPP @@ -1062,6 +1069,13 @@ [ccpp-arg-table] name = GFS_phys_time_vary_finalize type = scheme +[is_initialized] + standard_name = flag_for_gfs_phys_time_vary_interstitial_initialization + long_name = flag carrying interstitial initialization status + units = flag + dimensions = () + type = logical + intent = inout [errmsg] standard_name = ccpp_error_message long_name = error message for error handling in CCPP @@ -2055,26 +2069,13 @@ dimensions = () type = ty_h2ophys intent = in -[errmsg] - standard_name = ccpp_error_message - long_name = error message for error handling in CCPP - units = none - dimensions = () - type = character - kind = len=* - intent = out -[errflg] - standard_name = ccpp_error_code - long_name = error code for error handling in CCPP - units = 1 +[is_initialized] + standard_name = flag_for_gfs_phys_time_vary_interstitial_initialization + long_name = flag carrying interstitial initialization status + units = flag dimensions = () - type = integer - intent = out - -######################################################################## -[ccpp-arg-table] - name = GFS_phys_time_vary_timestep_finalize - type = scheme + type = logical + intent = in [errmsg] standard_name = ccpp_error_message long_name = error message for error handling in CCPP