Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditional calls to data_override #9

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion config_src/drivers/solo_driver/MOM_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ program MOM_main
use MOM_ice_shelf, only : initialize_ice_shelf, ice_shelf_end, ice_shelf_CS
use MOM_ice_shelf, only : shelf_calc_flux, add_shelf_forces, ice_shelf_save_restart
use MOM_ice_shelf, only : initialize_ice_shelf_fluxes, initialize_ice_shelf_forces
use MOM_ice_shelf, only : ice_shelf_query
use MOM_interpolate, only : time_interp_external_init
use MOM_io, only : file_exists, open_ASCII_file, close_file
use MOM_io, only : check_nml_error, io_infra_init, io_infra_end
Expand Down Expand Up @@ -177,6 +178,8 @@ program MOM_main
type(surface_forcing_CS), pointer :: surface_forcing_CSp => NULL()
type(write_cputime_CS), pointer :: write_CPU_CSp => NULL()
type(ice_shelf_CS), pointer :: ice_shelf_CSp => NULL()
logical :: override_shelf_fluxes !< If true, and shelf dynamics are active,
!! the data_override feature is enabled (only for MOSAIC grid types)
type(wave_parameters_cs), pointer :: waves_CSp => NULL()
type(MOM_restart_CS), pointer :: &
restart_CSp => NULL() !< A pointer to the restart control structure
Expand Down Expand Up @@ -303,7 +306,8 @@ program MOM_main
! when using an ice shelf
call initialize_ice_shelf_fluxes(ice_shelf_CSp, grid, US, fluxes)
call initialize_ice_shelf_forces(ice_shelf_CSp, grid, US, forces)
call data_override_init(Ocean_Domain_in=grid%domain%mpp_domain)
call ice_shelf_query(ice_shelf_CSp, grid, data_override_shelf_fluxes=override_shelf_fluxes)
if (override_shelf_fluxes) call data_override_init(Ocean_Domain_in=grid%domain%mpp_domain)
endif


Expand Down
21 changes: 17 additions & 4 deletions src/ice_shelf/MOM_ice_shelf.F90
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ module MOM_ice_shelf
!! equation of state to use.
logical :: active_shelf_dynamics !< True if the ice shelf mass changes as a result
!! the dynamic ice-shelf model.
logical :: data_override_shelf_fluxes !< True if the ice shelf surface mass fluxes can be
!! written using the data_override feature (only for MOSAIC grids)
logical :: override_shelf_movement !< If true, user code specifies the shelf movement
!! instead of using the dynamic ice-shelf mode.
logical :: isthermo !< True if the ice shelf can exchange heat and
Expand Down Expand Up @@ -323,7 +325,7 @@ subroutine shelf_calc_flux(sfc_state_in, fluxes_in, Time, time_step, CS)
G => CS%grid ; US => CS%US
ISS => CS%ISS

if (CS%active_shelf_dynamics) then
if (CS%data_override_shelf_fluxes .and. CS%active_shelf_dynamics) then
call data_override(G%Domain, 'shelf_sfc_mass_flux', fluxes_in%shelf_sfc_mass_flux, CS%Time, &
scale=US%kg_m3_to_R*US%m_to_Z)
endif
Expand Down Expand Up @@ -1274,7 +1276,7 @@ subroutine initialize_ice_shelf(param_file, ocn_grid, Time, CS, diag, forces_in,
allocate(CS%Grid)
call MOM_domains_init(CS%Grid%domain, param_file, min_halo=wd_halos, symmetric=GRID_SYM_,&
domain_name='MOM_Ice_Shelf_in')
! allocate(CS%Grid_in%HI)
!allocate(CS%Grid_in%HI)
!call hor_index_init(CS%Grid%Domain, CS%Grid%HI, param_file, &
! local_indexing=.not.global_indexing)
call MOM_grid_init(CS%Grid, param_file, CS%US)
Expand Down Expand Up @@ -1363,6 +1365,11 @@ subroutine initialize_ice_shelf(param_file, ocn_grid, Time, CS, diag, forces_in,
"If true, user provided code specifies the ice-shelf "//&
"movement instead of the dynamic ice model.", default=.false.)
CS%active_shelf_dynamics = .not.CS%override_shelf_movement
call get_param(param_file, mdl, "DATA_OVERRIDE_SHELF_FLUXES", &
CS%data_override_shelf_fluxes, &
"If true, the data override feature is used to write "//&
"the surface mass flux deposition. This option is only "//&
"available for MOSAIC grid types.", default=.false.)
call get_param(param_file, mdl, "GROUNDING_LINE_INTERPOLATE", CS%GL_regularize, &
"If true, regularize the floatation condition at the "//&
"grounding line as in Goldberg Holland Schoof 2009.", default=.false.)
Expand Down Expand Up @@ -2043,12 +2050,13 @@ subroutine update_shelf_mass(G, US, CS, ISS, Time)
end subroutine update_shelf_mass

!> Save the ice shelf restart file
subroutine ice_shelf_query(CS, G, frac_shelf_h, mass_shelf)
subroutine ice_shelf_query(CS, G, frac_shelf_h, mass_shelf, data_override_shelf_fluxes)
type(ice_shelf_CS), pointer :: CS !< ice shelf control structure
type(ocean_grid_type), intent(in) :: G !< A pointer to an ocean grid control structure.
real, optional, dimension(SZI_(G),SZJ_(G)), intent(out) :: frac_shelf_h !< Ice shelf area fraction [nodim].
real, optional, dimension(SZI_(G),SZJ_(G)), intent(out) :: mass_shelf !<Ice shelf mass [R Z -> kg m-2]

logical, optional :: data_override_shelf_fluxes !< If true, shelf fluxes can be written using
!! the data_override capability (only for MOSAIC grids)

integer :: i, j

Expand All @@ -2066,6 +2074,11 @@ subroutine ice_shelf_query(CS, G, frac_shelf_h, mass_shelf)
enddo ; enddo
endif

if (present(data_override_shelf_fluxes)) then
data_override_shelf_fluxes=.false.
if (CS%active_shelf_dynamics) data_override_shelf_fluxes = CS%data_override_shelf_fluxes
endif

end subroutine ice_shelf_query

!> Save the ice shelf restart file
Expand Down