Skip to content

Commit

Permalink
+Created SIS_restart module
Browse files Browse the repository at this point in the history
  Moved the SIS2 restart-related types and interfaces into the new module
SIS_restart.  The MOM_domain type arguments to only_read_from_restarts were also
made mandatory, reflecting what will need to be done when the SIS_restart is
modified to use new interfaces that work via the MOM6 infrastructure routines.
All answers are bitwise identical, but there are minor argument changes and a
number of module use statements needed to be modified.
  • Loading branch information
Hallberg-NOAA committed Apr 15, 2021
1 parent 242cab7 commit e06b0db
Show file tree
Hide file tree
Showing 11 changed files with 706 additions and 860 deletions.
3 changes: 2 additions & 1 deletion src/SIS_dyn_bgrid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ module SIS_dyn_bgrid
use SIS_diag_mediator, only : register_diag_field=>register_SIS_diag_field, time_type
use SIS_debugging, only : chksum, Bchksum, hchksum, check_redundant_B
use SIS_debugging, only : Bchksum_pair
use SIS_framework, only : register_restart_field, SIS_restart_CS, safe_alloc_ptr
use SIS_restart, only : register_restart_field, SIS_restart_CS
use SIS_framework, only : safe_alloc_ptr
use SIS_hor_grid, only : SIS_hor_grid_type
use ice_ridging_mod, only : ridge_rate

Expand Down
13 changes: 7 additions & 6 deletions src/SIS_dyn_cgrid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ module SIS_dyn_cgrid
use SIS_diag_mediator, only : register_diag_field=>register_SIS_diag_field
use SIS_debugging, only : chksum, Bchksum, hchksum, uvchksum
use SIS_debugging, only : check_redundant_B, check_redundant_C
use SIS_framework, only : register_restart_field, only_read_from_restarts, SIS_restart_CS
use SIS_framework, only : query_initialized=>query_inited, safe_alloc
use SIS_restart, only : register_restart_field, only_read_from_restarts, SIS_restart_CS
use SIS_restart, only : query_initialized=>query_inited
use SIS_framework, only : safe_alloc
use SIS_hor_grid, only : SIS_hor_grid_type

implicit none ; private
Expand Down Expand Up @@ -1781,8 +1782,8 @@ subroutine SIS_C_dyn_read_alt_restarts(CS, G, US, Ice_restart, restart_dir)
domain_name="ice temporary domain")
allocate(str_tmp(G%isd:G%ied, G%jsd:G%jed)) ; str_tmp(:,:) = 0.0

call only_read_from_restarts(Ice_restart, 'str_s', str_tmp, position=CORNER, &
directory=restart_dir, domain=domain_tmp, success=read_values)
call only_read_from_restarts(Ice_restart, 'str_s', str_tmp, domain_tmp, position=CORNER, &
directory=restart_dir, success=read_values)
if (read_values) then
! The non-symmetric variant of this variable has been successfully read.
call pass_var(str_tmp, domain_tmp, position=CORNER)
Expand All @@ -1797,8 +1798,8 @@ subroutine SIS_C_dyn_read_alt_restarts(CS, G, US, Ice_restart, restart_dir)
domain_name="ice temporary domain")
allocate(str_tmp(G%isd-1:G%ied, G%jsd-1:G%jed)) ; str_tmp(:,:) = 0.0

call only_read_from_restarts(Ice_restart, 'sym_str_s', str_tmp, position=CORNER, &
directory=restart_dir, domain=domain_tmp, success=read_values)
call only_read_from_restarts(Ice_restart, 'sym_str_s', str_tmp, domain_tmp, position=CORNER, &
directory=restart_dir, success=read_values)
if (read_values) then
! The symmetric variant of this variable has been successfully read.
do J=G%jsc-1,G%jec ; do I=G%isc-1,G%iec
Expand Down
4 changes: 2 additions & 2 deletions src/SIS_dyn_trans.F90
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ module SIS_dyn_trans
use SIS_dyn_cgrid, only : SIS_C_dyn_CS, SIS_C_dynamics, SIS_C_dyn_init
use SIS_dyn_cgrid, only : SIS_C_dyn_register_restarts, SIS_C_dyn_end
use SIS_dyn_cgrid, only : SIS_C_dyn_read_alt_restarts, basal_stress_coeff_C
use SIS_framework, only : SIS_restart_CS, safe_alloc
use SIS_framework, only : coupler_type_initialized, coupler_type_send_data
use SIS_restart, only : SIS_restart_CS
use SIS_framework, only : coupler_type_initialized, coupler_type_send_data, safe_alloc
use SIS_hor_grid, only : SIS_hor_grid_type
use SIS_ice_diags, only : ice_state_diags_type, register_ice_state_diagnostics
use SIS_ice_diags, only : post_ocean_sfc_diagnostics, post_ice_state_diagnostics
Expand Down
824 changes: 2 additions & 822 deletions src/SIS_framework.F90

Large diffs are not rendered by default.

664 changes: 664 additions & 0 deletions src/SIS_restart.F90

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions src/SIS_state_initialization.F90
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ module SIS_state_initialization
use MOM_io, only : file_exists, MOM_read_data, slasher
use MOM_time_manager, only : time_type, time_type_to_real, real_to_time
use MOM_unit_scaling, only : unit_scale_type
use SIS_framework, only : restore_SIS_state, query_initialized=>query_inited
use SIS_framework, only : register_restart_field, only_read_from_restarts
use SIS_restart, only : restore_SIS_state, query_initialized=>query_inited
use SIS_restart, only : register_restart_field, only_read_from_restarts
use SIS_get_input, only : directories
use SIS_types, only : ice_state_type
use SIS_hor_grid, only : SIS_hor_grid_type, set_hor_grid, SIS_hor_grid_end
Expand Down Expand Up @@ -962,7 +962,7 @@ subroutine read_archaic_thermo_restarts(Ice, IST, G, IG, US, PF, dirs, restart_f
do n=1,NkIce
write(nstr, '(I4)') n ; nstr = adjustl(nstr)
call only_read_from_restarts(Ice%Ice_restart, 'sal_ice'//trim(nstr), sal_ice_tmp(:,:,:), &
directory=dirs%restart_input_dir, success=read_values)
G%domain, directory=dirs%restart_input_dir, success=read_values)
if (read_values) then
do k=1,CatIce ; do j=jsc,jec ; do i=isc,iec
IST%sal_ice(i,j,k,n) = sal_ice_tmp(i,j,k)
Expand All @@ -985,7 +985,7 @@ subroutine read_archaic_thermo_restarts(Ice, IST, G, IG, US, PF, dirs, restart_f
do n=1,NkIce
write(nstr, '(I4)') n ; nstr = adjustl(nstr)
call only_read_from_restarts(Ice%Ice_restart, 't_ice'//trim(nstr), t_ice_tmp(:,:,:,n), &
directory=dirs%restart_input_dir, success=read_values)
G%domain, directory=dirs%restart_input_dir, success=read_values)
read_t_ice(n) = read_values
enddo
endif
Expand Down Expand Up @@ -1022,8 +1022,8 @@ subroutine read_archaic_thermo_restarts(Ice, IST, G, IG, US, PF, dirs, restart_f
! Try to initialize the snow enthalpy from separate temperature variables for each layer,
! perhaps from a SIS1 restart.
allocate(t_snow_tmp(SZI_(G), SZJ_(G), CatIce)) ; t_snow_tmp(:,:,:) = 0.0
call only_read_from_restarts(Ice%Ice_restart, 't_snow', t_snow_tmp, &
directory=dirs%restart_input_dir, success=read_values)
call only_read_from_restarts(Ice%Ice_restart, 't_snow', t_snow_tmp, G%domain, &
directory=dirs%restart_input_dir, success=read_values)
if (.not.read_values) then ! Try reading the ice temperature if snow is not available.
if (read_t_ice(1)) then
t_snow_tmp(:,:,:) = t_ice_tmp(:,:,:,1)
Expand Down
2 changes: 1 addition & 1 deletion src/SIS_tracer_flow_control.F90
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module SIS_tracer_flow_control
use MOM_error_handler, only : SIS_error=>MOM_error, FATAL, WARNING
use MOM_file_parser, only : get_param, log_version, param_file_type
use SIS_diag_mediator, only : time_type, SIS_diag_ctrl
use SIS_framework, only : SIS_restart_CS
use SIS_restart, only : SIS_restart_CS
use SIS_hor_grid, only : SIS_hor_grid_type
use SIS_tracer_registry, only : SIS_tracer_registry_type
use SIS_tracer_registry, only : register_SIS_tracer, register_SIS_tracer_pair
Expand Down
36 changes: 18 additions & 18 deletions src/SIS_types.F90
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ module SIS_types
use SIS_debugging, only : chksum, Bchksum, Bchksum_pair, hchksum, uvchksum
use SIS_debugging, only : check_redundant_B, check_redundant_C
use SIS_framework, only : domain2D, CORNER, EAST_FACE, NORTH_FACE, redistribute_data
use SIS_framework, only : register_restart_field, SIS_restart_CS, restore_SIS_state
use SIS_framework, only : query_initialized=>query_inited, only_read_from_restarts
use SIS_restart, only : register_restart_field, SIS_restart_CS, restore_SIS_state
use SIS_restart, only : query_initialized=>query_inited, only_read_from_restarts
use SIS_framework, only : safe_alloc, safe_alloc_ptr
use SIS_framework, only : coupler_1d_bc_type, coupler_2d_bc_type, coupler_3d_bc_type
use SIS_framework, only : coupler_type_spawn, coupler_type_initialized
Expand Down Expand Up @@ -604,10 +604,10 @@ subroutine ice_state_read_alt_restarts(IST, G, IG, Ice_restart, restart_dir)
if (IST%Cgrid_dyn .and. (.not.u_set)) then
call safe_alloc(u_tmp, G%isd, G%ied, G%jsd, G%jed)
call safe_alloc(v_tmp, G%isd, G%ied, G%jsd, G%jed)
call only_read_from_restarts(Ice_restart, 'u_ice_C', u_tmp, position=EAST_FACE, &
directory=restart_dir, domain=domain_tmp, success=read_u)
call only_read_from_restarts(Ice_restart, 'v_ice_C', v_tmp, position=NORTH_FACE, &
directory=restart_dir, domain=domain_tmp, success=read_v)
call only_read_from_restarts(Ice_restart, 'u_ice_C', u_tmp, domain_tmp, position=EAST_FACE, &
directory=restart_dir, success=read_u)
call only_read_from_restarts(Ice_restart, 'v_ice_C', v_tmp, domain_tmp, position=NORTH_FACE, &
directory=restart_dir, success=read_v)
if (read_u .and. read_v) then
! The non-symmetric variant of this vector has been successfully read.
call pass_vector(u_tmp, v_tmp, domain_tmp, stagger=CGRID_NE)
Expand All @@ -622,10 +622,10 @@ subroutine ice_state_read_alt_restarts(IST, G, IG, Ice_restart, restart_dir)
if ((.not.IST%Cgrid_dyn) .and. (.not.u_set)) then
call safe_alloc(u_tmp, G%isd, G%ied, G%jsd, G%jed)
call safe_alloc(v_tmp, G%isd, G%ied, G%jsd, G%jed)
call only_read_from_restarts(Ice_restart, 'u_ice', u_tmp, position=CORNER, &
directory=restart_dir, domain=domain_tmp, success=read_u)
call only_read_from_restarts(Ice_restart, 'v_ice', v_tmp, position=CORNER, &
directory=restart_dir, domain=domain_tmp, success=read_v)
call only_read_from_restarts(Ice_restart, 'u_ice', u_tmp, domain_tmp, position=CORNER, &
directory=restart_dir, success=read_u)
call only_read_from_restarts(Ice_restart, 'v_ice', v_tmp, domain_tmp, position=CORNER, &
directory=restart_dir, success=read_v)
if (read_u .and. read_v) then
! The non-symmetric variant of this variable has been successfully read.
call pass_vector(u_tmp, v_tmp, domain_tmp, stagger=BGRID_NE)
Expand Down Expand Up @@ -655,10 +655,10 @@ subroutine ice_state_read_alt_restarts(IST, G, IG, Ice_restart, restart_dir)
if (IST%Cgrid_dyn .and. (.not.u_set)) then
call safe_alloc(u_tmp, G%isd-1, G%ied, G%jsd, G%jed)
call safe_alloc(v_tmp, G%isd, G%ied, G%jsd-1, G%jed)
call only_read_from_restarts(Ice_restart, 'sym_u_ice_C', u_tmp, position=EAST_FACE, &
directory=restart_dir, domain=domain_tmp, success=read_u)
call only_read_from_restarts(Ice_restart, 'sym_v_ice_C', v_tmp, position=NORTH_FACE, &
directory=restart_dir, domain=domain_tmp, success=read_v)
call only_read_from_restarts(Ice_restart, 'sym_u_ice_C', u_tmp, domain_tmp, &
position=EAST_FACE, directory=restart_dir, success=read_u)
call only_read_from_restarts(Ice_restart, 'sym_v_ice_C', v_tmp, domain_tmp, &
position=NORTH_FACE, directory=restart_dir, success=read_v)
if (read_u .and. read_v) then
! The symmetric variant of this vector has been successfully read.
do j=G%jsc,G%jec ; do I=G%isc-1,G%iec
Expand All @@ -672,10 +672,10 @@ subroutine ice_state_read_alt_restarts(IST, G, IG, Ice_restart, restart_dir)
if ((.not.IST%Cgrid_dyn) .and. (.not.u_set)) then
call safe_alloc(u_tmp, G%isd-1, G%ied, G%jsd-1, G%jed)
call safe_alloc(v_tmp, G%isd-1, G%ied, G%jsd-1, G%jed)
call only_read_from_restarts(Ice_restart, 'sym_u_ice_B', u_tmp, position=CORNER, &
directory=restart_dir, domain=domain_tmp, success=read_u)
call only_read_from_restarts(Ice_restart, 'sym_v_ice_B', v_tmp, position=CORNER, &
directory=restart_dir, domain=domain_tmp, success=read_v)
call only_read_from_restarts(Ice_restart, 'sym_u_ice_B', u_tmp, domain_tmp, position=CORNER, &
directory=restart_dir, success=read_u)
call only_read_from_restarts(Ice_restart, 'sym_v_ice_B', v_tmp, domain_tmp, position=CORNER, &
directory=restart_dir, success=read_v)
if (read_u .and. read_v) then
! The symmetric variant of this variable has been successfully read.
do J=G%jsc-1,G%jec ; do I=G%isc-1,G%iec
Expand Down
2 changes: 1 addition & 1 deletion src/ice_age_tracer.F90
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module ice_age_tracer
use MOM_unit_scaling, only : unit_scale_type
use SIS_diag_mediator, only : register_SIS_diag_field, safe_alloc_ptr
use SIS_diag_mediator, only : SIS_diag_ctrl, post_data=>post_SIS_data
use SIS_framework, only : register_restart_field, SIS_restart_CS
use SIS_restart, only : register_restart_field, SIS_restart_CS
use SIS_hor_grid, only : SIS_hor_grid_type
use SIS_tracer_registry, only : register_SIS_tracer, SIS_tracer_registry_type
use SIS_utils, only : post_avg
Expand Down
4 changes: 2 additions & 2 deletions src/ice_model.F90
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ module ice_model_mod
use SIS_fast_thermo, only : redo_update_ice_model_fast, find_excess_fluxes
use SIS_fast_thermo, only : infill_array, SIS_fast_thermo_init, SIS_fast_thermo_end
use SIS_framework, only : set_domain, nullify_domain, broadcast_domain
use SIS_framework, only : restore_SIS_state, query_initialized=>query_inited, SIS_restart_init
use SIS_framework, only : determine_is_new_run, is_new_run
use SIS_restart, only : restore_SIS_state, query_initialized=>query_inited, SIS_restart_init
use SIS_restart, only : determine_is_new_run, is_new_run
use SIS_framework, only : coupler_1d_bc_type, coupler_2d_bc_type, coupler_3d_bc_type
use SIS_framework, only : coupler_type_spawn, coupler_type_initialized
use SIS_framework, only : coupler_type_rescale_data, coupler_type_copy_data
Expand Down
2 changes: 1 addition & 1 deletion src/ice_type.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module ice_type_mod
use SIS_debugging, only : chksum
use SIS_diag_mediator, only : SIS_diag_ctrl, post_data=>post_SIS_data, register_SIS_diag_field
use SIS_framework, only : domain2D, SIS_chksum, get_domain_extent, safe_alloc, safe_alloc_ptr
use SIS_framework, only : register_restart_field, save_restart, SIS_restart_CS, query_initialized
use SIS_restart, only : register_restart_field, save_restart, SIS_restart_CS, query_initialized
use SIS_framework, only : coupler_1d_bc_type, coupler_2d_bc_type, coupler_3d_bc_type
use SIS_framework, only : coupler_type_spawn, coupler_type_write_chksums
use SIS_hor_grid, only : SIS_hor_grid_type
Expand Down

0 comments on commit e06b0db

Please sign in to comment.