Skip to content

Commit

Permalink
removed errant .true. in save_restart call
Browse files Browse the repository at this point in the history
removed use_fms2 optional arguments in save_restart, restore_state, and create_file
made use_fms2 a MOM_restart module variable

Update MOM_state_initialization.F90

Remove space.

Update MOM_ice_shelf.F90

Add space.

Update MOM_driver.F90

Add space

Update mom_surface_forcing_mct.F90

remove whitespace

Update ocean_model_MOM.F90

Add space

Update mom_ocean_model_nuopc.F90

Add space

Update MOM_surface_forcing.F90

Add space

Changes needed work ESM4 to run with new io
  • Loading branch information
wrongkindofdoctor authored and wrongkindofdoctor committed Aug 24, 2020
1 parent 809b3ac commit 2e46ea6
Show file tree
Hide file tree
Showing 14 changed files with 58 additions and 88 deletions.
6 changes: 2 additions & 4 deletions config_src/coupled_driver/MOM_surface_forcing_gfdl.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1224,8 +1224,7 @@ subroutine forcing_save_restart(CS, G, Time, directory, time_stamped, &

if (.not.associated(CS)) return
if (.not.associated(CS%restart_CSp)) return
! NOTE: use_fms2=.true. routes routine to fms2 IO interface; omit this argument to use the old interface
call save_restart(directory, Time, G, CS%restart_CSp, time_stamped, use_fms2=.true.)
call save_restart(directory, Time, G, CS%restart_CSp, time_stamped)

end subroutine forcing_save_restart

Expand Down Expand Up @@ -1590,9 +1589,8 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, wind_stagger)
if ((dirs%input_filename(1:1) == 'n') .and. &
(LEN_TRIM(dirs%input_filename) == 1)) new_sim = .true.
if (.not.new_sim) then
! NOTE: use_fms2=.true. routes routine to fms2 IO interface; omit this argument to use the old interface
call restore_state(dirs%input_filename, dirs%restart_input_dir, Time_frc, &
G, CS%restart_CSp, use_fms2=.true.)
G, CS%restart_CSp)
endif
endif

Expand Down
10 changes: 4 additions & 6 deletions config_src/coupled_driver/ocean_model_MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -684,19 +684,17 @@ subroutine ocean_model_restart(OS, timestamp)
"restart files can only be created after the buoyancy forcing is applied.")

if (BTEST(OS%Restart_control,1)) then
! NOTE: use_fms2=.true. routes routine to fms2 IO interface
call save_restart(OS%dirs%restart_output_dir, OS%Time, OS%grid, &
OS%restart_CSp, .true., GV=OS%GV, use_fms2=.true.)
OS%restart_CSp, .true., GV=OS%GV)
call forcing_save_restart(OS%forcing_CSp, OS%grid, OS%Time, &
OS%dirs%restart_output_dir, .true.)
if (OS%use_ice_shelf) then
call ice_shelf_save_restart(OS%Ice_shelf_CSp, OS%Time, OS%dirs%restart_output_dir, .true.)
endif
endif
if (BTEST(OS%Restart_control,0)) then
! NOTE: use_fms2=.true. routes routine to fms2 IO interface
call save_restart(OS%dirs%restart_output_dir, OS%Time, OS%grid, &
OS%restart_CSp, GV=OS%GV, use_fms2=.true.)
OS%restart_CSp, GV=OS%GV)
call forcing_save_restart(OS%forcing_CSp, OS%grid, OS%Time, &
OS%dirs%restart_output_dir)
if (OS%use_ice_shelf) then
Expand Down Expand Up @@ -748,8 +746,8 @@ subroutine ocean_model_save_restart(OS, Time, directory, filename_suffix)

if (present(directory)) then ; restart_dir = directory
else ; restart_dir = OS%dirs%restart_output_dir ; endif
! NOTE: use_fms2=.true. routes routine to fms2 IO interface
call save_restart(restart_dir, Time, OS%grid, OS%restart_CSp, GV=OS%GV, use_fms2=.true.)

call save_restart(restart_dir, Time, OS%grid, OS%restart_CSp, GV=OS%GV)

call forcing_save_restart(OS%forcing_CSp, OS%grid, Time, restart_dir)

Expand Down
11 changes: 4 additions & 7 deletions config_src/mct_driver/mom_ocean_model_mct.F90
Original file line number Diff line number Diff line change
Expand Up @@ -690,9 +690,8 @@ subroutine ocean_model_restart(OS, timestamp, restartname)
"restart files can only be created after the buoyancy forcing is applied.")

if (present(restartname)) then
! NOTE: use_fms2=.true. routes routine to fms2 IO interface
call save_restart(OS%dirs%restart_output_dir, OS%Time, OS%grid, &
OS%restart_CSp, GV=OS%GV, filename=restartname, use_fms2=.true.)
OS%restart_CSp, GV=OS%GV, filename=restartname)
call forcing_save_restart(OS%forcing_CSp, OS%grid, OS%Time, &
OS%dirs%restart_output_dir) ! Is this needed?
if (OS%use_ice_shelf) then
Expand All @@ -701,19 +700,17 @@ subroutine ocean_model_restart(OS, timestamp, restartname)
endif
else
if (BTEST(OS%Restart_control,1)) then
! NOTE:use_fms2=.true. routes routine to fms2 IO interface
call save_restart(OS%dirs%restart_output_dir, OS%Time, OS%grid, &
OS%restart_CSp, .true., GV=OS%GV, use_fms2=.true.)
OS%restart_CSp, .true., GV=OS%GV)
call forcing_save_restart(OS%forcing_CSp, OS%grid, OS%Time, &
OS%dirs%restart_output_dir, .true.)
if (OS%use_ice_shelf) then
call ice_shelf_save_restart(OS%Ice_shelf_CSp, OS%Time, OS%dirs%restart_output_dir, .true.)
endif
endif
if (BTEST(OS%Restart_control,0)) then
! NOTE: use_fms2=.true. routes routine to fms2 IO interface
call save_restart(OS%dirs%restart_output_dir, OS%Time, OS%grid, &
OS%restart_CSp, GV=OS%GV, use_fms2=.true.)
OS%restart_CSp, GV=OS%GV)
call forcing_save_restart(OS%forcing_CSp, OS%grid, OS%Time, &
OS%dirs%restart_output_dir)
if (OS%use_ice_shelf) then
Expand Down Expand Up @@ -769,7 +766,7 @@ subroutine ocean_model_save_restart(OS, Time, directory, filename_suffix)
if (present(directory)) then ; restart_dir = directory
else ; restart_dir = OS%dirs%restart_output_dir ; endif

call save_restart(restart_dir, Time, OS%grid, OS%restart_CSp, GV=OS%GV, use_fms2=.true.)
call save_restart(restart_dir, Time, OS%grid, OS%restart_CSp, GV=OS%GV)

call forcing_save_restart(OS%forcing_CSp, OS%grid, Time, restart_dir)

Expand Down
6 changes: 2 additions & 4 deletions config_src/mct_driver/mom_surface_forcing_mct.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1001,8 +1001,7 @@ subroutine forcing_save_restart(CS, G, Time, directory, time_stamped, &

if (.not.associated(CS)) return
if (.not.associated(CS%restart_CSp)) return
! NOTE: use_fms2=.true. routes routine to fms2 IO interface
call save_restart(.true., directory, Time, G, CS%restart_CSp, time_stamped, use_fms2=.true.)
call save_restart(directory, Time, G, CS%restart_CSp, time_stamped)

end subroutine forcing_save_restart

Expand Down Expand Up @@ -1326,9 +1325,8 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, restore_salt,
if ((dirs%input_filename(1:1) == 'n') .and. &
(LEN_TRIM(dirs%input_filename) == 1)) new_sim = .true.
if (.not.new_sim) then
! NOTE: use_fms2=.true. routes routine to fms2 IO interface
call restore_state(dirs%input_filename, dirs%restart_input_dir, Time_frc, &
G, CS%restart_CSp, use_fms2=.true.)
G, CS%restart_CSp)
endif
endif

Expand Down
2 changes: 1 addition & 1 deletion config_src/mct_driver/ocn_comp_mct.F90
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ subroutine ocn_run_mct( EClock, cdata_o, x2o_o, o2x_o)
write(restartname,'(A,".mom6.r.",I4.4,"-",I2.2,"-",I2.2,"-",I5.5)') trim(runid), year, month, day, seconds

call save_restart(glb%ocn_state%dirs%restart_output_dir, glb%ocn_state%Time, glb%grid, &
glb%ocn_state%restart_CSp, .false., filename=restartname, GV=glb%ocn_state%GV, use_fms2=.true.)
glb%ocn_state%restart_CSp, .false., filename=restartname, GV=glb%ocn_state%GV)

! write name of restart file in the rpointer file
nu = shr_file_getUnit()
Expand Down
13 changes: 5 additions & 8 deletions config_src/nuopc_driver/mom_ocean_model_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -686,9 +686,8 @@ subroutine ocean_model_restart(OS, timestamp, restartname)
"restart files can only be created after the buoyancy forcing is applied.")

if (present(restartname)) then
! NOTE: use_fms2=.true. routes routine to fms2 IO interface
call save_restart(OS%dirs%restart_output_dir, OS%Time, OS%grid, &
OS%restart_CSp, GV=OS%GV, filename=restartname, use_fms2=.true.)
OS%restart_CSp, GV=OS%GV, filename=restartname)
call forcing_save_restart(OS%forcing_CSp, OS%grid, OS%Time, &
OS%dirs%restart_output_dir) ! Is this needed?
if (OS%use_ice_shelf) then
Expand All @@ -697,19 +696,17 @@ subroutine ocean_model_restart(OS, timestamp, restartname)
endif
else
if (BTEST(OS%Restart_control,1)) then
! NOTE: use_fms2=.true. routes routine to fms2 IO interface
call save_restart(OS%dirs%restart_output_dir, OS%Time, OS%grid, &
OS%restart_CSp, .true., GV=OS%GV, use_fms2=.true.)
OS%restart_CSp, .true., GV=OS%GV)
call forcing_save_restart(OS%forcing_CSp, OS%grid, OS%Time, &
OS%dirs%restart_output_dir, .true.)
if (OS%use_ice_shelf) then
call ice_shelf_save_restart(OS%Ice_shelf_CSp, OS%Time, OS%dirs%restart_output_dir, .true.)
endif
endif
if (BTEST(OS%Restart_control,0)) then
! NOTE: use_fms2=.true. routes routine to fms2 IO interface
call save_restart(OS%dirs%restart_output_dir, OS%Time, OS%grid, &
OS%restart_CSp, GV=OS%GV, use_fms2=.true.)
OS%restart_CSp, GV=OS%GV)
call forcing_save_restart(OS%forcing_CSp, OS%grid, OS%Time, &
OS%dirs%restart_output_dir)
if (OS%use_ice_shelf) then
Expand Down Expand Up @@ -763,8 +760,8 @@ subroutine ocean_model_save_restart(OS, Time, directory, filename_suffix)

if (present(directory)) then ; restart_dir = directory
else ; restart_dir = OS%dirs%restart_output_dir ; endif
! NOTE: use_fms2=.true. routes routine to fms2 IO interface
call save_restart(restart_dir, Time, OS%grid, OS%restart_CSp, GV=OS%GV, use_fms2=.true.)

call save_restart(restart_dir, Time, OS%grid, OS%restart_CSp, GV=OS%GV)

call forcing_save_restart(OS%forcing_CSp, OS%grid, Time, restart_dir)

Expand Down
6 changes: 2 additions & 4 deletions config_src/nuopc_driver/mom_surface_forcing_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1000,8 +1000,7 @@ subroutine forcing_save_restart(CS, G, Time, directory, time_stamped, &

if (.not.associated(CS)) return
if (.not.associated(CS%restart_CSp)) return
! NOTE: use_fms2=.true. routes routine to fms2 IO interface
call save_restart(directory, Time, G, CS%restart_CSp, time_stamped, use_fms2=.true.)
call save_restart(directory, Time, G, CS%restart_CSp, time_stamped)

end subroutine forcing_save_restart

Expand Down Expand Up @@ -1331,9 +1330,8 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, restore_salt,
if ((dirs%input_filename(1:1) == 'n') .and. &
(LEN_TRIM(dirs%input_filename) == 1)) new_sim = .true.
if (.not.new_sim) then
! NOTE: use_fms2=.true. routes routine to fms2 IO interface
call restore_state(dirs%input_filename, dirs%restart_input_dir, Time_frc, &
G, CS%restart_CSp, use_fms2=.true.)
G, CS%restart_CSp)
endif
endif

Expand Down
10 changes: 4 additions & 6 deletions config_src/solo_driver/MOM_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -583,18 +583,16 @@ program MOM_main
if ((permit_incr_restart) .and. (fluxes%fluxes_used) .and. &
(Time + (Time_step_ocean/2) > restart_time)) then
if (BTEST(Restart_control,1)) then
! NOTE: use_fms2=.true. routes routine to fms2 IO interface
call save_restart(dirs%restart_output_dir, Time, grid, &
restart_CSp, .true., GV=GV, use_fms2=.true.)
restart_CSp, .true., GV=GV)
call forcing_save_restart(surface_forcing_CSp, grid, Time, &
dirs%restart_output_dir, .true.)
if (use_ice_shelf) call ice_shelf_save_restart(ice_shelf_CSp, Time, &
dirs%restart_output_dir, .true.)
endif
if (BTEST(Restart_control,0)) then
! NOTE: use_fms2=.true. routes routine to fms2 IO interface
call save_restart(dirs%restart_output_dir, Time, grid, &
restart_CSp, GV=GV, use_fms2=.true.)
restart_CSp, GV=GV)
call forcing_save_restart(surface_forcing_CSp, grid, Time, &
dirs%restart_output_dir)
if (use_ice_shelf) call ice_shelf_save_restart(ice_shelf_CSp, Time, &
Expand All @@ -618,8 +616,8 @@ program MOM_main
"End of MOM_main reached with unused buoyancy fluxes. "//&
"For conservation, the ocean restart files can only be "//&
"created after the buoyancy forcing is applied.")
! NOTE: use_fms2=.true. routes routine to fms2 IO interface
call save_restart(dirs%restart_output_dir, Time, grid, restart_CSp, GV=GV, use_fms2=.true.)

call save_restart(dirs%restart_output_dir, Time, grid, restart_CSp, GV=GV)
if (use_ice_shelf) call ice_shelf_save_restart(ice_shelf_CSp, Time, &
dirs%restart_output_dir)
! Write ocean solo restart file.
Expand Down
7 changes: 3 additions & 4 deletions config_src/solo_driver/MOM_surface_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1524,8 +1524,8 @@ subroutine forcing_save_restart(CS, G, Time, directory, time_stamped, &

if (.not.associated(CS)) return
if (.not.associated(CS%restart_CSp)) return
! NOTE: use_fms2=.true. routes routine to fms2 IO interface
call save_restart(directory, Time, G, CS%restart_CSp, time_stamped, use_fms2=.true.)

call save_restart(directory, Time, G, CS%restart_CSp, time_stamped)

end subroutine forcing_save_restart

Expand Down Expand Up @@ -1925,9 +1925,8 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, tracer_flow_C
if ((dirs%input_filename(1:1) == 'n') .and. &
(LEN_TRIM(dirs%input_filename) == 1)) new_sim = .true.
if (.not.new_sim) then
! NOTE: use_fms2=.true. routes routine to fms2 IO interface
call restore_state(dirs%input_filename, dirs%restart_input_dir, Time_frc, &
G, CS%restart_CSp, use_fms2=.true.)
G, CS%restart_CSp)
endif
endif

Expand Down
9 changes: 4 additions & 5 deletions src/framework/MOM_io.F90
Original file line number Diff line number Diff line change
Expand Up @@ -385,12 +385,11 @@ end subroutine create_file_old

!> This routine opens a netcdf file in "write" or "overwrite" mode, registers the global diagnostic axes, and writes
!! the axis data and metadata to the file
subroutine create_file_fms2_filename(filename, vars, numVariables, use_fms2, register_time, G, DG, GV, checksums, &
subroutine create_file_fms2_filename(filename, vars, numVariables, register_time, G, DG, GV, checksums, &
is_restart)
character(len=*), intent(in) :: filename !< full path to the netcdf file
type(vardesc), dimension(:), intent(in) :: vars !< structures describing the output
integer, intent(in) :: numVariables !< number of variables to write to the file
logical, intent(in) :: use_fms2 !< flag indicating whether to use this routine
logical, optional, intent(in) :: register_time !< if .true., register a time dimension to the file
type(ocean_grid_type), optional, intent(in) :: G !< ocean horizontal grid structure; G or dG
!! is required if the new file uses any
Expand Down Expand Up @@ -467,7 +466,7 @@ subroutine create_file_fms2_filename(filename, vars, numVariables, use_fms2, reg

if (.not. check_if_open(fileObjDD)) &
file_open_successDD=fms2_open_file(fileObjDD, filename_temp, trim(nc_mode), Domain%mpp_domain, &
is_restart=is_restart_file)
is_restart=is_restart_file, dont_add_res_to_filename=.true.)
else
! get the pes associated with the file.
!>\note this is required so that only pe(1) is identified as the root pe to create the file
Expand All @@ -480,7 +479,7 @@ subroutine create_file_fms2_filename(filename, vars, numVariables, use_fms2, reg

if (.not. check_if_open(fileObjNoDD)) &
file_open_successNoDD=fms2_open_file(fileObjNoDD, filename_temp, trim(nc_mode), &
is_restart=is_restart_file, pelist=pelist)
is_restart=is_restart_file, pelist=pelist, dont_add_res_to_filename=.true.)
endif
! allocate the output data variable dimension attributes
allocate(dim_names(numVariables,4))
Expand Down Expand Up @@ -745,7 +744,7 @@ subroutine create_file_fms2_fileobj(filename, fileObjDD, vars, numVariables, reg
if (.not. check_if_open(fileObjDD)) &
!write(output_unit, '(A)'), "Create_file: Opening file ", trim(filename_temp)
file_open_successDD=fms2_open_file(fileObjDD, filename_temp, trim(nc_mode), Domain%mpp_domain, &
is_restart=is_restart_file)
is_restart=is_restart_file, dont_add_res_to_filename=.true.)
! allocate the output data variable dimension attributes
allocate(dim_names(numVariables,4))
dim_names(:,:) = ""
Expand Down
Loading

0 comments on commit 2e46ea6

Please sign in to comment.