Skip to content

Commit

Permalink
Update physics/Interstitials/UFS_SCM_NEPTUNE/GFS_phys_time_vary.fv3.*…
Browse files Browse the repository at this point in the history
…: support multiple instances by making is_initialized a host-model variable
  • Loading branch information
climbfuji committed Dec 19, 2024
1 parent dab57fc commit eab5725
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 47 deletions.
39 changes: 11 additions & 28 deletions physics/Interstitials/UFS_SCM_NEPTUNE/GFS_phys_time_vary.fv3.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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 = ''
Expand Down
39 changes: 20 additions & 19 deletions physics/Interstitials/UFS_SCM_NEPTUNE/GFS_phys_time_vary.fv3.meta
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit eab5725

Please sign in to comment.