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

New floating land ice variables #512

Merged
merged 17 commits into from
Apr 17, 2023
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
52 changes: 26 additions & 26 deletions compass/ocean/cached_files.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
"ocean/global_ocean/QUwISC240/mesh/mesh/culled_mesh.nc": "global_ocean/QUwISC240/mesh/mesh/culled_mesh.210809.nc",
"ocean/global_ocean/QUwISC240/mesh/mesh/culled_graph.info": "global_ocean/QUwISC240/mesh/mesh/culled_graph.210809.info",
"ocean/global_ocean/QUwISC240/mesh/mesh/critical_passages_mask_final.nc": "global_ocean/QUwISC240/mesh/mesh/critical_passages_mask_final.210809.nc",
"ocean/global_ocean/QUwISC240/PHC/init/initial_state/initial_state.nc": "global_ocean/QUwISC240/PHC/init/initial_state/initial_state.230327.nc",
"ocean/global_ocean/QUwISC240/PHC/init/initial_state/init_mode_forcing_data.nc": "global_ocean/QUwISC240/PHC/init/initial_state/init_mode_forcing_data.230327.nc",
"ocean/global_ocean/QUwISC240/PHC/init/initial_state/graph.info": "global_ocean/QUwISC240/PHC/init/initial_state/graph.230327.info",
"ocean/global_ocean/QUwISC240/PHC/init/ssh_adjustment/adjusted_init.nc": "global_ocean/QUwISC240/PHC/init/ssh_adjustment/adjusted_init.230327.nc",
"ocean/global_ocean/QUwISC240/PHC/init/initial_state/initial_state.nc": "global_ocean/QUwISC240/PHC/init/initial_state/initial_state.230414.nc",
"ocean/global_ocean/QUwISC240/PHC/init/initial_state/init_mode_forcing_data.nc": "global_ocean/QUwISC240/PHC/init/initial_state/init_mode_forcing_data.230414.nc",
"ocean/global_ocean/QUwISC240/PHC/init/initial_state/graph.info": "global_ocean/QUwISC240/PHC/init/initial_state/graph.230414.info",
"ocean/global_ocean/QUwISC240/PHC/init/ssh_adjustment/adjusted_init.nc": "global_ocean/QUwISC240/PHC/init/ssh_adjustment/adjusted_init.230414.nc",
"ocean/global_ocean/EC30to60/mesh/mesh/culled_mesh.nc": "global_ocean/EC30to60/mesh/mesh/culled_mesh.210809.nc",
"ocean/global_ocean/EC30to60/mesh/mesh/culled_graph.info": "global_ocean/EC30to60/mesh/mesh/culled_graph.210809.info",
"ocean/global_ocean/EC30to60/mesh/mesh/critical_passages_mask_final.nc": "global_ocean/EC30to60/mesh/mesh/critical_passages_mask_final.210809.nc",
Expand All @@ -27,10 +27,10 @@
"ocean/global_ocean/ECwISC30to60/mesh/mesh/culled_mesh.nc": "global_ocean/ECwISC30to60/mesh/mesh/culled_mesh.210809.nc",
"ocean/global_ocean/ECwISC30to60/mesh/mesh/culled_graph.info": "global_ocean/ECwISC30to60/mesh/mesh/culled_graph.210809.info",
"ocean/global_ocean/ECwISC30to60/mesh/mesh/critical_passages_mask_final.nc": "global_ocean/ECwISC30to60/mesh/mesh/critical_passages_mask_final.210809.nc",
"ocean/global_ocean/ECwISC30to60/PHC/init/initial_state/initial_state.nc": "global_ocean/ECwISC30to60/PHC/init/initial_state/initial_state.230411.nc",
"ocean/global_ocean/ECwISC30to60/PHC/init/initial_state/init_mode_forcing_data.nc": "global_ocean/ECwISC30to60/PHC/init/initial_state/init_mode_forcing_data.230411.nc",
"ocean/global_ocean/ECwISC30to60/PHC/init/ssh_adjustment/adjusted_init.nc": "global_ocean/ECwISC30to60/PHC/init/ssh_adjustment/adjusted_init.230411.nc",
"ocean/global_ocean/ECwISC30to60/PHC/init/initial_state/graph.info": "global_ocean/ECwISC30to60/PHC/init/initial_state/graph.230411.info",
"ocean/global_ocean/ECwISC30to60/PHC/init/initial_state/initial_state.nc": "global_ocean/ECwISC30to60/PHC/init/initial_state/initial_state.230414.nc",
"ocean/global_ocean/ECwISC30to60/PHC/init/initial_state/init_mode_forcing_data.nc": "global_ocean/ECwISC30to60/PHC/init/initial_state/init_mode_forcing_data.230414.nc",
"ocean/global_ocean/ECwISC30to60/PHC/init/ssh_adjustment/adjusted_init.nc": "global_ocean/ECwISC30to60/PHC/init/ssh_adjustment/adjusted_init.230414.nc",
"ocean/global_ocean/ECwISC30to60/PHC/init/initial_state/graph.info": "global_ocean/ECwISC30to60/PHC/init/initial_state/graph.230414.info",
"ocean/global_ocean/SOwISC12to60/mesh/mesh/culled_mesh.nc": "global_ocean/SOwISC12to60/mesh/mesh/culled_mesh.210810.nc",
"ocean/global_ocean/SOwISC12to60/mesh/mesh/culled_graph.info": "global_ocean/SOwISC12to60/mesh/mesh/culled_graph.210810.info",
"ocean/global_ocean/SOwISC12to60/mesh/mesh/critical_passages_mask_final.nc": "global_ocean/SOwISC12to60/mesh/mesh/critical_passages_mask_final.210810.nc",
Expand Down Expand Up @@ -118,29 +118,29 @@
"ocean/global_ocean/QU240/mesh/cull_mesh/culled_mesh.nc": "global_ocean/QU240/mesh/cull_mesh/culled_mesh.220814.nc",
"ocean/global_ocean/QU240/mesh/cull_mesh/culled_graph.info": "global_ocean/QU240/mesh/cull_mesh/culled_graph.220814.info",
"ocean/global_ocean/QU240/mesh/cull_mesh/critical_passages_mask_final.nc": "global_ocean/QU240/mesh/cull_mesh/critical_passages_mask_final.220814.nc",
"ocean/global_ocean/QUwISC240/mesh/base_mesh/mesh.msh": "global_ocean/QUwISC240/mesh/base_mesh/mesh.230327.msh",
"ocean/global_ocean/QUwISC240/mesh/base_mesh/base_mesh.nc": "global_ocean/QUwISC240/mesh/base_mesh/base_mesh.230327.nc",
"ocean/global_ocean/QUwISC240/mesh/base_mesh/cellWidthVsLatLon.nc": "global_ocean/QUwISC240/mesh/base_mesh/cellWidthVsLatLon.230327.nc",
"ocean/global_ocean/QUwISC240/mesh/base_mesh/graph.info": "global_ocean/QUwISC240/mesh/base_mesh/graph.230327.info",
"ocean/global_ocean/QUwISC240/mesh/cull_mesh/culled_mesh.nc": "global_ocean/QUwISC240/mesh/cull_mesh/culled_mesh.230327.nc",
"ocean/global_ocean/QUwISC240/mesh/cull_mesh/culled_graph.info": "global_ocean/QUwISC240/mesh/cull_mesh/culled_graph.230327.info",
"ocean/global_ocean/QUwISC240/mesh/cull_mesh/critical_passages_mask_final.nc": "global_ocean/QUwISC240/mesh/cull_mesh/critical_passages_mask_final.230327.nc",
"ocean/global_ocean/QUwISC240/mesh/cull_mesh/land_ice_mask.nc": "global_ocean/QUwISC240/mesh/cull_mesh/land_ice_mask.230327.nc",
"ocean/global_ocean/QUwISC240/mesh/base_mesh/mesh.msh": "global_ocean/QUwISC240/mesh/base_mesh/mesh.230414.msh",
"ocean/global_ocean/QUwISC240/mesh/base_mesh/base_mesh.nc": "global_ocean/QUwISC240/mesh/base_mesh/base_mesh.230414.nc",
"ocean/global_ocean/QUwISC240/mesh/base_mesh/cellWidthVsLatLon.nc": "global_ocean/QUwISC240/mesh/base_mesh/cellWidthVsLatLon.230414.nc",
"ocean/global_ocean/QUwISC240/mesh/base_mesh/graph.info": "global_ocean/QUwISC240/mesh/base_mesh/graph.230414.info",
"ocean/global_ocean/QUwISC240/mesh/cull_mesh/culled_mesh.nc": "global_ocean/QUwISC240/mesh/cull_mesh/culled_mesh.230414.nc",
"ocean/global_ocean/QUwISC240/mesh/cull_mesh/culled_graph.info": "global_ocean/QUwISC240/mesh/cull_mesh/culled_graph.230414.info",
"ocean/global_ocean/QUwISC240/mesh/cull_mesh/critical_passages_mask_final.nc": "global_ocean/QUwISC240/mesh/cull_mesh/critical_passages_mask_final.230414.nc",
"ocean/global_ocean/QUwISC240/mesh/cull_mesh/land_ice_mask.nc": "global_ocean/QUwISC240/mesh/cull_mesh/land_ice_mask.230414.nc",
"ocean/global_ocean/EC30to60/mesh/base_mesh/mesh.msh": "global_ocean/EC30to60/mesh/base_mesh/mesh.230411.msh",
"ocean/global_ocean/EC30to60/mesh/base_mesh/base_mesh.nc": "global_ocean/EC30to60/mesh/base_mesh/base_mesh.230411.nc",
"ocean/global_ocean/EC30to60/mesh/base_mesh/cellWidthVsLatLon.nc": "global_ocean/EC30to60/mesh/base_mesh/cellWidthVsLatLon.230411.nc",
"ocean/global_ocean/EC30to60/mesh/base_mesh/graph.info": "global_ocean/EC30to60/mesh/base_mesh/graph.230411.info",
"ocean/global_ocean/EC30to60/mesh/cull_mesh/culled_mesh.nc": "global_ocean/EC30to60/mesh/cull_mesh/culled_mesh.230411.nc",
"ocean/global_ocean/EC30to60/mesh/cull_mesh/culled_graph.info": "global_ocean/EC30to60/mesh/cull_mesh/culled_graph.230411.info",
"ocean/global_ocean/EC30to60/mesh/cull_mesh/critical_passages_mask_final.nc": "global_ocean/EC30to60/mesh/cull_mesh/critical_passages_mask_final.230411.nc",
"ocean/global_ocean/ECwISC30to60/mesh/base_mesh/mesh.msh": "global_ocean/ECwISC30to60/mesh/base_mesh/mesh.230411.msh",
"ocean/global_ocean/ECwISC30to60/mesh/base_mesh/base_mesh.nc": "global_ocean/ECwISC30to60/mesh/base_mesh/base_mesh.230411.nc",
"ocean/global_ocean/ECwISC30to60/mesh/base_mesh/cellWidthVsLatLon.nc": "global_ocean/ECwISC30to60/mesh/base_mesh/cellWidthVsLatLon.230411.nc",
"ocean/global_ocean/ECwISC30to60/mesh/base_mesh/graph.info": "global_ocean/ECwISC30to60/mesh/base_mesh/graph.230411.info",
"ocean/global_ocean/ECwISC30to60/mesh/cull_mesh/culled_mesh.nc": "global_ocean/ECwISC30to60/mesh/cull_mesh/culled_mesh.230411.nc",
"ocean/global_ocean/ECwISC30to60/mesh/cull_mesh/culled_graph.info": "global_ocean/ECwISC30to60/mesh/cull_mesh/culled_graph.230411.info",
"ocean/global_ocean/ECwISC30to60/mesh/cull_mesh/critical_passages_mask_final.nc": "global_ocean/ECwISC30to60/mesh/cull_mesh/critical_passages_mask_final.230411.nc",
"ocean/global_ocean/ECwISC30to60/mesh/cull_mesh/land_ice_mask.nc": "global_ocean/ECwISC30to60/mesh/cull_mesh/land_ice_mask.230411.nc",
"ocean/global_ocean/ECwISC30to60/mesh/base_mesh/mesh.msh": "global_ocean/ECwISC30to60/mesh/base_mesh/mesh.230414.msh",
"ocean/global_ocean/ECwISC30to60/mesh/base_mesh/base_mesh.nc": "global_ocean/ECwISC30to60/mesh/base_mesh/base_mesh.230414.nc",
"ocean/global_ocean/ECwISC30to60/mesh/base_mesh/cellWidthVsLatLon.nc": "global_ocean/ECwISC30to60/mesh/base_mesh/cellWidthVsLatLon.230414.nc",
"ocean/global_ocean/ECwISC30to60/mesh/base_mesh/graph.info": "global_ocean/ECwISC30to60/mesh/base_mesh/graph.230414.info",
"ocean/global_ocean/ECwISC30to60/mesh/cull_mesh/culled_mesh.nc": "global_ocean/ECwISC30to60/mesh/cull_mesh/culled_mesh.230414.nc",
"ocean/global_ocean/ECwISC30to60/mesh/cull_mesh/culled_graph.info": "global_ocean/ECwISC30to60/mesh/cull_mesh/culled_graph.230414.info",
"ocean/global_ocean/ECwISC30to60/mesh/cull_mesh/critical_passages_mask_final.nc": "global_ocean/ECwISC30to60/mesh/cull_mesh/critical_passages_mask_final.230414.nc",
"ocean/global_ocean/ECwISC30to60/mesh/cull_mesh/land_ice_mask.nc": "global_ocean/ECwISC30to60/mesh/cull_mesh/land_ice_mask.230414.nc",
"ocean/global_ocean/SOwISC12to60/mesh/base_mesh/mesh.msh": "global_ocean/SOwISC12to60/mesh/base_mesh/mesh.230327.msh",
"ocean/global_ocean/SOwISC12to60/mesh/base_mesh/base_mesh.nc": "global_ocean/SOwISC12to60/mesh/base_mesh/base_mesh.230327.nc",
"ocean/global_ocean/SOwISC12to60/mesh/base_mesh/cellWidthVsLatLon.nc": "global_ocean/SOwISC12to60/mesh/base_mesh/cellWidthVsLatLon.230327.nc",
Expand All @@ -151,6 +151,6 @@
"ocean/global_ocean/SOwISC12to60/mesh/cull_mesh/land_ice_mask.nc": "global_ocean/SOwISC12to60/mesh/cull_mesh/land_ice_mask.230327.nc",
"ocean/global_ocean/EC30to60/mesh/remap_topography/topography_remapped.nc": "global_ocean/EC30to60/mesh/remap_topography/topography_remapped.230411.nc",
"ocean/global_ocean/EC30to60/mesh/cull_mesh/topography_culled.nc": "global_ocean/EC30to60/mesh/cull_mesh/topography_culled.230411.nc",
"ocean/global_ocean/ECwISC30to60/mesh/remap_topography/topography_remapped.nc": "global_ocean/ECwISC30to60/mesh/remap_topography/topography_remapped.230411.nc",
"ocean/global_ocean/ECwISC30to60/mesh/cull_mesh/topography_culled.nc": "global_ocean/ECwISC30to60/mesh/cull_mesh/topography_culled.230411.nc"
"ocean/global_ocean/ECwISC30to60/mesh/remap_topography/topography_remapped.nc": "global_ocean/ECwISC30to60/mesh/remap_topography/topography_remapped.230414.nc",
"ocean/global_ocean/ECwISC30to60/mesh/cull_mesh/topography_culled.nc": "global_ocean/ECwISC30to60/mesh/cull_mesh/topography_culled.230414.nc"
}
1 change: 1 addition & 0 deletions compass/ocean/mesh/cull.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ def _cull_mesh_with_logging(logger, with_cavities, with_critical_passages,
landIceMask = dsMask.regionCellMasks.isel(nRegions=0)
dsLandIceMask = xr.Dataset()
dsLandIceMask['landIceMask'] = landIceMask
dsLandIceMask['landIceFloatingMask'] = landIceMask

write_netcdf(dsLandIceMask, 'land_ice_mask.nc')

Expand Down
2 changes: 2 additions & 0 deletions compass/ocean/tests/global_ocean/init/streams.init
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
<var name="landIceFracObserved"/>
<var name="landIceGroundedFracObserved"/>
<var name="landIceFraction"/>
<var name="landIceFloatingFraction"/>
<var name="landIceMask"/>
<var name="landIceFloatingMask"/>
<var name="landIcePressure"/>
<var name="landIceDraft"/>
<var name="ssh"/>
Expand Down
1 change: 1 addition & 0 deletions compass/ocean/tests/global_ocean/init/streams.wisc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
type = "input">

<var name="landIceMask"/>
<var name="landIceFloatingMask"/>
</stream>

</streams>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
<var name="landIcePressure"/>
<var name="landIceDraft"/>
<var name="landIceFraction"/>
<var name="landIceFloatingFraction"/>
<var name="landIceMask"/>
<var name="landIceFloatingMask"/>
<var name="landIceFrictionVelocity"/>
<var name="topDrag"/>
<var name="topDragMagnitude"/>
Expand Down
4 changes: 4 additions & 0 deletions compass/ocean/tests/ice_shelf_2d/initial_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ def run(self):
dim='Time', axis=0)
landIceFraction = modify_mask.astype(float)
landIceMask = modify_mask.copy()
landIceFloatingFraction = landIceFraction.copy()
landIceFloatingMask = landIceMask.copy()

ref_density = constants['SHR_CONST_RHOSW']
landIcePressure, landIceDraft = compute_land_ice_pressure_and_draft(
Expand All @@ -121,7 +123,9 @@ def run(self):
ds['fVertex'] = xarray.zeros_like(ds.xVertex)
ds['modifyLandIcePressureMask'] = modify_mask
ds['landIceFraction'] = landIceFraction
ds['landIceFloatingFraction'] = landIceFloatingFraction
ds['landIceMask'] = landIceMask
ds['landIceFloatingMask'] = landIceFloatingMask
ds['landIcePressure'] = landIcePressure
ds['landIceDraft'] = landIceDraft

Expand Down
12 changes: 3 additions & 9 deletions compass/ocean/tests/isomip_plus/cull_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
from mpas_tools.io import write_netcdf
from mpas_tools.mesh.conversion import convert, cull

from compass.ocean.tests.isomip_plus.geom import (
define_thin_film_mask_step1,
interpolate_ocean_mask,
)
from compass.ocean.tests.isomip_plus.geom import interpolate_ocean_mask
from compass.ocean.tests.isomip_plus.spherical_mesh import add_isomip_plus_xy
from compass.step import Step

Expand Down Expand Up @@ -70,11 +67,8 @@ def run(self):
ds_mesh = xr.open_dataset('base_mesh.nc')
ds_geom = xr.open_dataset('input_geometry_processed.nc')

if thin_film_present:
ds_mask = define_thin_film_mask_step1(ds_mesh, ds_geom)
else:
ds_mask = \
interpolate_ocean_mask(ds_mesh, ds_geom, min_ocean_fraction)
ds_mask = interpolate_ocean_mask(ds_mesh, ds_geom, min_ocean_fraction,
thin_film_present)
ds_mesh = cull(ds_mesh, dsInverse=ds_mask, logger=logger)
ds_mesh.attrs['is_periodic'] = 'NO'

Expand Down
47 changes: 44 additions & 3 deletions compass/ocean/tests/isomip_plus/forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import shutil
import time

import numpy as np
import xarray

from compass.model import run_model
Expand Down Expand Up @@ -165,18 +166,58 @@ def run(self):
dsMesh=dsMesh, ds=ds, expt=self.experiment,
showProgress=show_progress)

plotter.plot_horiz_series(ds.ssh, 'ssh', 'ssh',
True, vmin=-700, vmax=0)
plotter.plot_3d_field_top_bot_section(
ds.temperature, nameInTitle='temperature', prefix='temp',
units='C', vmin=-2., vmax=1., cmap='cmo.thermal')

plotter.plot_3d_field_top_bot_section(
ds.salinity, nameInTitle='salinity', prefix='salin',
units='PSU', vmin=33.8, vmax=34.7, cmap='cmo.haline')
tol = 1e-10
dsIce = xarray.open_dataset(
os.path.join(self.work_dir,
'land_ice_fluxes.nc'))
plotter.plot_horiz_series(
dsIce.topDragMagnitude,
'topDragMagnitude', 'topDragMagnitude', True,
vmin=0 + tol, vmax=np.max(dsIce.topDragMagnitude.values),
cmap_set_under='k')
plotter.plot_horiz_series(
dsIce.landIceHeatFlux,
'landIceHeatFlux', 'landIceHeatFlux', True,
vmin=np.min(dsIce.landIceHeatFlux.values),
vmax=np.max(dsIce.landIceHeatFlux.values))
plotter.plot_horiz_series(
dsIce.landIceInterfaceTemperature,
'landIceInterfaceTemperature', 'landIceInterfaceTemperature',
True,
vmin=np.min(dsIce.landIceInterfaceTemperature.values),
vmax=np.max(dsIce.landIceInterfaceTemperature.values))
plotter.plot_horiz_series(
dsIce.landIceFreshwaterFlux,
'landIceFreshwaterFlux', 'landIceFreshwaterFlux', True,
vmin=0 + tol, vmax=1e-4,
cmap_set_under='k', cmap_scale='log')
plotter.plot_horiz_series(
dsIce.landIceFraction,
'landIceFraction', 'landIceFraction', True,
vmin=0 + tol, vmax=1 - tol,
cmap='cmo.balance',
cmap_set_under='k', cmap_set_over='r')
if 'landIceFloatingFraction' in dsIce.keys():
plotter.plot_horiz_series(
dsIce.landIceFloatingFraction,
'landIceFloatingFraction', 'landIceFloatingFraction',
True, vmin=0 + tol, vmax=1 - tol,
cmap='cmo.balance', cmap_set_under='k', cmap_set_over='r')

if self.name == 'simulation':
update_evaporation_flux(in_forcing_file='forcing_data_init.nc',
out_forcing_file='forcing_data_updated.nc',
out_forcing_link='forcing_data.nc')
update_evaporation_flux(
in_forcing_file='forcing_data_init.nc',
out_forcing_file='forcing_data_updated.nc',
out_forcing_link='forcing_data.nc')

replacements = {'config_do_restart': '.true.',
'config_start_time': "'file'"}
Expand Down
Loading