Skip to content

Commit

Permalink
Explicit coriolis in initial state
Browse files Browse the repository at this point in the history
  • Loading branch information
cbegeman committed Oct 23, 2023
1 parent 3ce419d commit 64ff904
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions compass/ocean/tests/drying_slope/drying_slope.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ background_temperature = 20.0
# Background salinity
background_salinity = 35.0

# Coriolis parameter
coriolis_parameter = 0.0

# time step in s per km of horizontal resolution
dt_per_km = 30

Expand Down
10 changes: 10 additions & 0 deletions compass/ocean/tests/drying_slope/initial_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def run(self):
plug_temperature = section.getfloat('plug_temperature')
background_temperature = section.getfloat('background_temperature')
background_salinity = section.getfloat('background_salinity')
coriolis_parameter = section.getfloat('coriolis_parameter')

# Check config options
if domain_length < drying_length:
Expand Down Expand Up @@ -113,6 +114,15 @@ def run(self):
plug_temperature, background_temperature)
ds['tracer1'] = xr.where(y_cell < y_plug_boundary, 1.0, 0.0)
ds['salinity'] = background_salinity * xr.ones_like(y_cell)
normalVelocity = xr.zeros_like(ds_mesh.xEdge)
normalVelocity, _ = xr.broadcast(normalVelocity, ds.refBottomDepth)
normalVelocity = normalVelocity.transpose('nEdges', 'nVertLevels')
normalVelocity = normalVelocity.expand_dims(dim='Time', axis=0)
ds['normalVelocity'] = normalVelocity
ds['fCell'] = coriolis_parameter * xr.ones_like(ds.xCell)
ds['fEdge'] = coriolis_parameter * xr.ones_like(ds.xEdge)
ds['fVertex'] = coriolis_parameter * xr.ones_like(ds.xVertex)

write_netcdf(ds, 'initial_state.nc')

# Define the tidal boundary condition over 1-cell width
Expand Down
3 changes: 3 additions & 0 deletions docs/users_guide/ocean/test_groups/drying_slope.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ The config options for this test case are:
# Background salinity
background_salinity = 35.0
# Coriolis parameter
coriolis_parameter = 0.0
# time step in s per km of horizontal resolution
dt_per_km = 30
Expand Down

0 comments on commit 64ff904

Please sign in to comment.