Skip to content

Commit d164d4b

Browse files
committed
Add time-varying forcing
1 parent d521159 commit d164d4b

File tree

4 files changed

+45
-12
lines changed

4 files changed

+45
-12
lines changed

polaris/ocean/tasks/isomip_plus/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def add_isomip_plus_tasks(component, mesh_type):
7373
)
7474

7575
basic_expts = ['ocean0', 'ocean1', 'ocean2', 'ocean3', 'ocean4']
76-
extra_expts = ['inception', 'wetting', 'drying']
76+
extra_expts = ['wetting', 'drying']
7777
vert_coords = ['z-star', 'sigma']
7878

7979
for experiment in basic_expts:
@@ -216,7 +216,7 @@ def _get_shared_steps(
216216
# ocean0 and ocean1 use the same topography
217217
shared_steps['ocean0'] = shared_steps['ocean1']
218218

219-
for experiment in ['inception', 'wetting', 'drying']:
219+
for experiment in ['wetting', 'drying']:
220220
shared_steps[experiment] = dict(shared_steps['ocean1'])
221221
subdir = f'{resdir}/topo/scale/{experiment}'
222222
topo_scale = TopoScale(

polaris/ocean/tasks/isomip_plus/init/forcing.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ def run(self):
9292
Create restoring and other forcing files
9393
"""
9494
self._compute_restoring()
95+
self._write_time_varying_forcing()
9596

9697
def _compute_restoring(self):
9798
config = self.config
@@ -182,3 +183,40 @@ def _compute_restoring(self):
182183
ds_forcing['tidalInputMask'] = xr.zeros_like(ds_mesh.xIsomipCell)
183184

184185
write_netcdf(ds_forcing, 'init_mode_forcing_data.nc')
186+
187+
@staticmethod
188+
def _write_time_varying_forcing():
189+
"""
190+
Write time-varying land-ice forcing and update the initial condition
191+
"""
192+
193+
ds_topo = xr.open_dataset('topo.nc')
194+
195+
if 'Time' not in ds_topo.dims:
196+
# no time-varying forcing needed
197+
return
198+
199+
ds_out = xr.Dataset()
200+
ds_out['xtime'] = ds_topo.xtime
201+
202+
ds_out['landIceDraftForcing'] = ds_topo.landIceDraft
203+
ds_out.landIceDraftForcing.attrs['units'] = 'm'
204+
ds_out.landIceDraftForcing.attrs['long_name'] = (
205+
'The approximate elevation of the land ice-ocean interface'
206+
)
207+
ds_out['landIcePressureForcing'] = ds_topo.landIcePressure
208+
ds_out.landIcePressureForcing.attrs['units'] = 'm'
209+
ds_out.landIcePressureForcing.attrs['long_name'] = (
210+
'Pressure from the weight of land ice at the ice-ocean interface'
211+
)
212+
ds_out['landIceFractionForcing'] = ds_topo.landIceFraction
213+
ds_out.landIceFractionForcing.attrs['long_name'] = (
214+
'The fraction of each cell covered by land ice'
215+
)
216+
ds_out['landIceFloatingFractionForcing'] = (
217+
ds_topo.landIceFloatingFraction
218+
)
219+
ds_out.landIceFloatingFractionForcing.attrs['long_name'] = (
220+
'The fraction of each cell covered by floating land ice'
221+
)
222+
write_netcdf(ds_out, 'land_ice_forcing.nc')

polaris/ocean/tasks/isomip_plus/isomip_plus_topo.cfg

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,12 @@ expand_factor = 2.0
2727
# simple thickening and thinning experiments that involve scaling the Ocean1
2828
# landIcePressure and landIceDraft over time
2929
#
30-
# "inception" reference dates
31-
inception_dates = 0001-01-01_00:00:00, 0002-01-01_00:00:00, 0003-01-01_00:00:00
32-
# scaling at each date
33-
inception_scales = 0.0, 1.0, 1.0
34-
3530
# "drying" reference dates
3631
drying_dates = 0001-01-01_00:00:00, 0002-01-01_00:00:00, 0003-01-01_00:00:00
3732
# scaling at each date
38-
drying_scales = 1.0, 2.0, 2.0
33+
drying_scales = 1.0, 1.05, 1.10
3934

4035
# "wetting" reference dates
4136
wetting_dates = 0001-01-01_00:00:00, 0002-01-01_00:00:00, 0003-01-01_00:00:00
4237
# scaling at each date
43-
wetting_scales = 1.0, 0.0, 0.0
38+
wetting_scales = 1.0, 0.95, 0.9

polaris/ocean/tasks/isomip_plus/topo/scale.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class TopoScale(Step):
1414
1515
Attributes
1616
----------
17-
experiment : {'inception', 'drying', 'wetting'}
17+
experiment : {'drying', 'wetting'}
1818
The scaling experiment
1919
"""
2020

@@ -36,10 +36,10 @@ def __init__(self, component, subdir, config, topo_remap, experiment):
3636
topo_remap : polaris.ocean.tasks.isomip_plus.topo_map.TopoRemap
3737
The step that produced the remapped topography to be scaled
3838
39-
experiment : {'inception', 'drying', 'wetting'}
39+
experiment : {'drying', 'wetting'}
4040
The scaling experiment
4141
"""
42-
if experiment not in ['inception', 'drying', 'wetting']:
42+
if experiment not in ['drying', 'wetting']:
4343
raise ValueError(f'Unexpected experiment {experiment}')
4444

4545
super().__init__(component=component, name='topo_scale', subdir=subdir)

0 commit comments

Comments
 (0)