Skip to content

Commit

Permalink
Remove ice density calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
cbegeman committed Oct 26, 2023
1 parent f38ec10 commit b977252
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 42 deletions.
34 changes: 0 additions & 34 deletions compass/ocean/iceshelf.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,40 +40,6 @@ def compute_land_ice_pressure_from_thickness(land_ice_thickness, modify_mask,
return land_ice_pressure


def compute_land_ice_density_from_draft(land_ice_draft, land_ice_thickness,
floating_mask, ref_density=None):
"""
Compute the spatially-averaged ice density needed to match the ice draft
Parameters
----------
land_ice_draft : xarray.DataArray
The ice draft (sea surface height)
land_ice_thickness: xarray.DataArray
The ice thickness
floating_mask : xarray.DataArray
A mask that is 1 where the ice is assumed in hydrostatic equilibrium
ref_density : float, optional
A reference density for seawater displaced by the ice shelf
Returns
-------
land_ice_density: float
The ice density
"""
if ref_density is None:
ref_density = constants['SHR_CONST_RHOSW']
land_ice_draft = numpy.where(floating_mask, land_ice_draft, numpy.nan)
land_ice_thickness = numpy.where(floating_mask, land_ice_thickness,
numpy.nan)
land_ice_density = \
numpy.nanmean(-ref_density * land_ice_draft / land_ice_thickness)
return land_ice_density


def compute_land_ice_pressure_from_draft(land_ice_draft, modify_mask,
ref_density=None):
"""
Expand Down
18 changes: 10 additions & 8 deletions compass/ocean/tests/isomip_plus/initial_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from mpas_tools.io import write_netcdf

from compass.ocean.iceshelf import (
compute_land_ice_density_from_draft,
compute_land_ice_draft_from_pressure,
compute_land_ice_pressure_from_draft,
compute_land_ice_pressure_from_thickness,
)
Expand Down Expand Up @@ -101,13 +101,16 @@ def _compute_initial_condition(self):
section = config['isomip_plus']
min_land_ice_fraction = section.getfloat('min_land_ice_fraction')
min_ocean_fraction = section.getfloat('min_ocean_fraction')
ice_density = section.getfloat('ice_density')

ds_geom = xr.open_dataset('input_geometry_processed.nc')
ds_mesh = xr.open_dataset('culled_mesh.nc')

ds = interpolate_geom(ds_mesh, ds_geom, min_ocean_fraction,
thin_film_present)

ds['bottomDepth'] = -ds.bottomDepthObserved

ds['landIceFraction'] = \
ds['landIceFraction'].expand_dims(dim='Time', axis=0)
ds['landIceFloatingFraction'] = \
Expand All @@ -129,16 +132,17 @@ def _compute_initial_condition(self):

ds['landIceFraction'] = xr.where(mask, ds.landIceFraction, 0.)

land_ice_draft = ds.ssh
if thin_film_present:
land_ice_thickness = ds.landIceThickness
land_ice_density = compute_land_ice_density_from_draft(
land_ice_draft, land_ice_thickness,
floating_mask=ds.landIceFloatingMask)
land_ice_pressure = compute_land_ice_pressure_from_thickness(
land_ice_thickness=land_ice_thickness, modify_mask=ds.ssh < 0.,
land_ice_density=land_ice_density)
land_ice_density=ice_density)
land_ice_draft = compute_land_ice_draft_from_pressure(
land_ice_pressure=land_ice_pressure,
modify_mask=ds.bottomDepth > 0.)
ds['ssh'] = np.maximum(land_ice_draft, -ds.bottomDepth)
else:
land_ice_draft = ds.ssh
land_ice_pressure = compute_land_ice_pressure_from_draft(
land_ice_draft=land_ice_draft, modify_mask=land_ice_draft < 0.)

Expand All @@ -147,8 +151,6 @@ def _compute_initial_condition(self):
if self.time_varying_forcing:
self._write_time_varying_forcing(ds_init=ds)

ds['bottomDepth'] = -ds.bottomDepthObserved

section = config['isomip_plus']

# Deepen the bottom depth to maintain the minimum water-column
Expand Down
3 changes: 3 additions & 0 deletions compass/ocean/tests/isomip_plus/isomip_plus.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ min_smoothed_draft_mask = 0.01
# considered a land-ice cell by MPAS-Ocean (landIceMask == 1).
min_land_ice_fraction = 0.5

# the density of ice prescribed in ISOMIP+
ice_density = 918

# the initial temperature at the sea surface
init_top_temp = -1.9
# the initial temperature at the sea floor
Expand Down

0 comments on commit b977252

Please sign in to comment.