Skip to content

Commit

Permalink
Merge pull request mom-ocean#85 from gustavo-marques/misomip_pass_mel…
Browse files Browse the repository at this point in the history
…t_rate

Pass melt_rate via surface type
  • Loading branch information
alperaltuntas authored Nov 19, 2018
2 parents 41fd4fb + e869dbd commit 6ca7a40
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
11 changes: 7 additions & 4 deletions config_src/mct_driver/MOM_ocean_model.F90
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ subroutine ocean_model_init(Ocean_sfc, OS, Time_init, Time_in, gas_fields_ocn, i
!! The actual depth over which melt potential is computed will
!! min(HFrz, OBLD), where OBLD is the boundary layer depth.
!! If HFrz <= 0 (default), melt potential will not be computed.
logical :: use_melt_pot!< If true, allocate melt_potential array
logical :: use_melt_pot !< If true, allocate melt_potential array


#include "version_variable.h"
character(len=40) :: mdl = "ocean_model_init" !< This module's name.
Expand Down Expand Up @@ -358,14 +359,16 @@ subroutine ocean_model_init(Ocean_sfc, OS, Time_init, Time_in, gas_fields_ocn, i
"where OBLD is the boundary layer depth. If HFREEZE <= 0 (default), \n"//&
"melt potential will not be computed.", units="m", default=-1.0, do_not_log=.true.)


if (HFrz .gt. 0.0) then
use_melt_pot=.true.
else
use_melt_pot=.false.
endif

call allocate_surface_state(OS%sfc_state, OS%grid, use_temperature, do_integrals=.true., &
gas_fields_ocn=gas_fields_ocn, use_meltpot=use_melt_pot)
gas_fields_ocn=gas_fields_ocn, use_meltpot=use_melt_pot, &
use_ice_shelf=OS%use_ice_shelf)

call surface_forcing_init(Time_in, OS%grid, param_file, OS%diag, &
OS%forcing_CSp, OS%restore_salinity, OS%restore_temp)
Expand Down Expand Up @@ -824,8 +827,8 @@ subroutine convert_state_to_ocean_type(state, Ocean_sfc, G, patm, press_to_z)
if (allocated(state%melt_potential)) &
Ocean_sfc%melt_potential(i,j) = state%melt_potential(i+i0,j+j0)
!AA TODO: uncomment the following line and pass the melt rate here !!!!
!if (allocated(state%melt_rate)) &
! Ocean_sfc%melt_rate(i,j) = state%melt_rate(i+i0,j+j0)
if (allocated(state%melt_rate)) &
Ocean_sfc%melt_rate(i,j) = state%melt_rate(i+i0,j+j0)
if (allocated(state%Hml)) &
Ocean_sfc%OBLD(i,j) = state%Hml(i+i0,j+j0)
enddo ; enddo
Expand Down
14 changes: 11 additions & 3 deletions src/core/MOM_variables.F90
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ module MOM_variables
!! used, that is compensated for in sea_lev.
melt_potential, & !< instantaneous amount of heat that can be used to melt sea ice,
!! in J m-2. This is computed w.r.t. surface freezing temperature.
melt_rate, & !< Sub-ice-shelf melt rate, in kg m-2 s-1.
ocean_mass, & !< The total mass of the ocean in kg m-2.
ocean_heat, & !< The total heat content of the ocean in C kg m-2.
ocean_salt, & !< The total salt content of the ocean in kgSalt m-2.
Expand Down Expand Up @@ -292,7 +293,7 @@ module MOM_variables
!> Allocates the fields for the surface (return) properties of
!! the ocean model. Unused fields are unallocated.
subroutine allocate_surface_state(sfc_state, G, use_temperature, do_integrals, &
gas_fields_ocn, use_meltpot)
gas_fields_ocn, use_meltpot, use_ice_shelf)
type(ocean_grid_type), intent(in) :: G !< ocean grid structure
type(surface), intent(inout) :: sfc_state !< ocean surface state type to be allocated.
logical, optional, intent(in) :: use_temperature !< If true, allocate the space for thermodynamic variables.
Expand All @@ -304,10 +305,11 @@ subroutine allocate_surface_state(sfc_state, G, use_temperature, do_integrals, &
!! in the calculation of additional gas or other
!! tracer fluxes, and can be used to spawn related
!! internal variables in the ice model.
logical, optional, intent(in) :: use_meltpot !< If true, allocate the space for melt potential
logical, optional, intent(in) :: use_meltpot !< If true, allocate the space for melt potential
logical, optional, intent(in) :: use_ice_shelf !< If true, allocate the space for sub-ice-shelf melt rate

! local variables
logical :: use_temp, alloc_integ, use_melt_potential
logical :: use_temp, alloc_integ, use_melt_potential, ice_shelf
integer :: is, ie, js, je, isd, ied, jsd, jed
integer :: isdB, iedB, jsdB, jedB

Expand All @@ -318,6 +320,7 @@ subroutine allocate_surface_state(sfc_state, G, use_temperature, do_integrals, &
use_temp = .true. ; if (present(use_temperature)) use_temp = use_temperature
alloc_integ = .true. ; if (present(do_integrals)) alloc_integ = do_integrals
use_melt_potential = .false. ; if (present(use_meltpot)) use_melt_potential = use_meltpot
ice_shelf = .false. ; if (present(use_ice_shelf)) ice_shelf = use_ice_shelf

if (sfc_state%arrays_allocated) return

Expand All @@ -336,6 +339,10 @@ subroutine allocate_surface_state(sfc_state, G, use_temperature, do_integrals, &
allocate(sfc_state%melt_potential(isd:ied,jsd:jed)) ; sfc_state%melt_potential(:,:) = 0.0
endif

if (ice_shelf) then
allocate(sfc_state%melt_rate(isd:ied,jsd:jed)) ; sfc_state%melt_rate(:,:) = 0.0
endif

if (alloc_integ) then
! Allocate structures for the vertically integrated ocean_mass, ocean_heat, and ocean_salt.
allocate(sfc_state%ocean_mass(isd:ied,jsd:jed)) ; sfc_state%ocean_mass(:,:) = 0.0
Expand All @@ -360,6 +367,7 @@ subroutine deallocate_surface_state(sfc_state)

if (.not.sfc_state%arrays_allocated) return

if (allocated(sfc_state%melt_rate)) deallocate(sfc_state%melt_rate)
if (allocated(sfc_state%melt_potential)) deallocate(sfc_state%melt_potential)
if (allocated(sfc_state%SST)) deallocate(sfc_state%SST)
if (allocated(sfc_state%SSS)) deallocate(sfc_state%SSS)
Expand Down
4 changes: 4 additions & 0 deletions src/ice_shelf/MOM_ice_shelf.F90
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,10 @@ subroutine add_shelf_flux(G, CS, state, fluxes)
fluxes%evap(i,j) = frac_area*ISS%water_flux(i,j)*CS%flux_factor
endif
endif
! the following is used to pass melt rate (kg/(m^2 s)) to the MCT cap
! so that CISM can use it
if (allocated(state%melt_rate)) &
state%melt_rate(i,j) = frac_area*ISS%water_flux(i,j)*CS%flux_factor

if (associated(fluxes%sens)) &
fluxes%sens(i,j) = -frac_area*ISS%tflux_ocn(i,j)*CS%flux_factor
Expand Down

0 comments on commit 6ca7a40

Please sign in to comment.