Skip to content

Commit

Permalink
CCPP metadata bugfixes in GFS_typedefs.meta, update fv3 files with fm…
Browse files Browse the repository at this point in the history
…s.2021.03, IAU bug fix for restart files (#379)

* CCPP metadata bugfixes in ccpp/data/GFS_typedefs.meta
* fix the restart interval for iau

Co-authored-by: Jun.Wang <Jun.Wang@noaa.gov>
  • Loading branch information
climbfuji and junwang-noaa authored Sep 10, 2021
1 parent 967b84b commit e5dfdd5
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 44 deletions.
18 changes: 2 additions & 16 deletions atmos_model.F90
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,8 @@ module atmos_model_mod
use mpp_mod, only: FATAL, mpp_min, mpp_max, mpp_error, mpp_chksum
use mpp_domains_mod, only: domain2d
use mpp_mod, only: mpp_get_current_pelist_name
#ifdef INTERNAL_FILE_NML
use mpp_mod, only: input_nml_file
#else
use fms_mod, only: open_namelist_file
#endif
use fms_mod, only: file_exist, error_mesg
use fms2_io_mod, only: file_exists
use fms_mod, only: close_file, write_version_number, stdlog, stdout
use fms_mod, only: clock_flag_default
use fms_mod, only: check_nml_error
Expand Down Expand Up @@ -551,19 +547,9 @@ subroutine atmos_model_init (Atmos, Time_init, Time, Time_step)
!----------------------------------------------------------------------------------------------
! initialize atmospheric model - must happen AFTER atmosphere_init so that nests work correctly

IF ( file_exist('input.nml')) THEN
#ifdef INTERNAL_FILE_NML
IF ( file_exists('input.nml')) THEN
read(input_nml_file, nml=atmos_model_nml, iostat=io)
ierr = check_nml_error(io, 'atmos_model_nml')
#else
unit = open_namelist_file ( )
ierr=1
do while (ierr /= 0)
read (unit, nml=atmos_model_nml, iostat=io, end=10)
ierr = check_nml_error(io,'atmos_model_nml')
enddo
10 call close_file (unit)
#endif
endif

!-----------------------------------------------------------------------
Expand Down
8 changes: 4 additions & 4 deletions ccpp/data/GFS_typedefs.meta
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@
standard_name = surface_snow_area_fraction_over_ice
long_name = surface snow area fraction over ice
units = frac
dimensions = (horizontal_dimension)
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
active = (control_for_land_surface_scheme == identifier_for_ruc_land_surface_scheme)
Expand Down Expand Up @@ -1448,7 +1448,7 @@
standard_name = temperature_in_surface_snow_at_surface_adjacent_layer_over_land
long_name = snow temperature at the bottom of the first snow layer over land
units = K
dimensions = (horizontal_dimension)
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
active = (control_for_land_surface_scheme == identifier_for_ruc_land_surface_scheme)
Expand Down Expand Up @@ -10110,7 +10110,7 @@
standard_name = saturation_vapor_pressure
long_name = saturation vapor pressure
units = Pa
dimensions = (horizontal_dimension,vertical_layer_dimension)
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
optional = F
Expand All @@ -10119,7 +10119,7 @@
standard_name = water_vapor_mixing_ratio
long_name = water vaport mixing ratio
units = kg/kg
dimensions = (horizontal_dimension,vertical_layer_dimension)
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
optional = F
Expand Down
42 changes: 19 additions & 23 deletions module_fcst_grid_comp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module module_fcst_grid_comp
use esmf

use time_manager_mod, only: time_type, set_calendar_type, set_time, &
set_date, days_in_month, month_name, &
set_date, month_name, &
operator(+), operator(-), operator (<), &
operator (>), operator (/=), operator (/), &
operator (==), operator (*), &
Expand All @@ -43,22 +43,20 @@ module module_fcst_grid_comp
addLsmask2grid

use constants_mod, only: constants_init
use fms_mod, only: open_namelist_file, file_exist, check_nml_error, &
error_mesg, fms_init, fms_end, close_file, &
use fms_mod, only: error_mesg, fms_init, fms_end, &
write_version_number, uppercase

use mpp_mod, only: mpp_init, mpp_pe, mpp_root_pe, &
mpp_error, FATAL, WARNING
use mpp_mod, only: mpp_clock_id, mpp_clock_begin, mpp_clock_end
use mpp_mod, only: mpp_clock_id, mpp_clock_begin

use mpp_io_mod, only: mpp_open, mpp_close, MPP_NATIVE, MPP_RDONLY, MPP_DELETE
use mpp_io_mod, only: mpp_open, mpp_close, MPP_DELETE

use mpp_domains_mod, only: mpp_get_compute_domains, domain2D
use memutils_mod, only: print_memuse_stats
use sat_vapor_pres_mod, only: sat_vapor_pres_init

use diag_manager_mod, only: diag_manager_init, diag_manager_end, &
get_base_date, diag_manager_set_time_end
diag_manager_set_time_end

use data_override_mod, only: data_override_init
use fv_nggps_diags_mod, only: fv_dyn_bundle_setup
Expand Down Expand Up @@ -359,9 +357,7 @@ subroutine fcst_initialize(fcst_comp, importState, exportState, clock, rc)
if(restart_interval(2)== -1) freq_restart = .true.
endif
if(freq_restart) then
if(restart_interval(1) == 0) then
frestart(1) = total_inttime
else if(restart_interval(1) > 0) then
if(restart_interval(1) >= 0) then
tmpvar = restart_interval(1) * 3600
atm_int_state%Time_step_restart = set_time (tmpvar, 0)
if(iau_offset > 0 ) then
Expand All @@ -371,16 +367,18 @@ subroutine fcst_initialize(fcst_comp, importState, exportState, clock, rc)
atm_int_state%Time_restart = atm_int_state%Time_init + atm_int_state%Time_step_restart
frestart(1) = tmpvar
endif
i = 2
do while ( atm_int_state%Time_restart < atm_int_state%Time_end )
frestart(i) = frestart(i-1) + tmpvar
atm_int_state%Time_restart = atm_int_state%Time_restart + atm_int_state%Time_step_restart
i = i + 1
enddo
if(restart_interval(1) > 0) then
i = 2
do while ( atm_int_state%Time_restart < atm_int_state%Time_end )
frestart(i) = frestart(i-1) + tmpvar
atm_int_state%Time_restart = atm_int_state%Time_restart + atm_int_state%Time_step_restart
i = i + 1
enddo
endif
endif
! otherwise it is an array with forecast time at which the restart files will be written out
else if(num_restart_interval >= 1) then
if(restart_interval(1) == 0 ) then
if(num_restart_interval == 1 .and. restart_interval(1) == 0 ) then
frestart(1) = total_inttime
else
if(iau_offset > 0 ) then
Expand Down Expand Up @@ -861,20 +859,18 @@ subroutine fcst_run_phase_2(fcst_comp, importState, exportState,clock,rc)
!--- intermediate restart
if (atm_int_state%intrm_rst>0) then
if (na /= atm_int_state%num_atmos_calls-1) then
call get_time(atm_int_state%Time_atmos - atm_int_state%Time_atstart, seconds)
call get_time(atm_int_state%Time_atmos - atm_int_state%Time_init, seconds)
if (ANY(frestart(:) == seconds)) then
restart_inctime = set_time(seconds, 0)
atm_int_state%Time_restart = atm_int_state%Time_atstart + restart_inctime
timestamp = date_to_string (atm_int_state%Time_restart)
if (mype == 0) write(0,*)'write out restart at na=',na,' seconds=',seconds, &
'integration lenght=',na*dt_atmos/3600.
timestamp = date_to_string (atm_int_state%Time_atmos)
call atmos_model_restart(atm_int_state%Atm, timestamp)
call write_stoch_restart_atm('RESTART/'//trim(timestamp)//'.atm_stoch.res.nc')

call wrt_atmres_timestamp(atm_int_state,timestamp)
endif
endif
endif
!
call print_memuse_stats('after full step')
!
!-----------------------------------------------------------------------
!
Expand Down

0 comments on commit e5dfdd5

Please sign in to comment.