Skip to content

Commit

Permalink
Rename {u,v}_ssa_bc to {u,v}_bc and bc_mask to vel_bc_mask
Browse files Browse the repository at this point in the history
  • Loading branch information
ckhroulev committed Sep 29, 2021
1 parent d838cf3 commit 4c2498d
Show file tree
Hide file tree
Showing 35 changed files with 197 additions and 191 deletions.
2 changes: 1 addition & 1 deletion doc/pismpython/inverse/index.rst
Expand Up @@ -20,7 +20,7 @@ We use the following typesetting conventions for variable names:
* Command line flags setting PISM/PETSc options appear the same way,
but start with a hyphen: :cfg:`-ssa_dirichlet_bc`
* Variables in NC files corresponding to data defined on a grid appear
as: :ncvar:`vel_ssa_bc`.
as: :ncvar:`vel_bc`.

.. toctree::
refresher
Expand Down
4 changes: 2 additions & 2 deletions doc/pismpython/inverse/pism_ssa.rst
Expand Up @@ -88,8 +88,8 @@ regions as discussed in :ref:`SSADiscrete`.
Dirichlet boundary conditions (i.e. locations where :math:`\vU` is known)
can be turned on with the :cfg:`-ssa_dirichlet_bc` flag, in which case
the known velocities are taken from the NC variable
:ncvar:`vel_ssa_bc`. For regional models, the Dirichlet locations are specified
indirectly via the NC mask variable :ncvar:`no_model_mask`, otherwise the NC mask variable :ncvar:`bc_mask` determines these locations.
:ncvar:`vel_bc`. For regional models, the Dirichlet locations are specified
indirectly via the NC mask variable :ncvar:`no_model_mask`, otherwise the NC mask variable :ncvar:`vel_bc_mask` determines these locations.

PISM supports a calving front boundary condition :cite:`AlbrechtLevermann2012`
that modifies the stress balance at the ice/ocean interface (config variable
Expand Down
4 changes: 2 additions & 2 deletions doc/pismpython/inverse/pismi.rst
Expand Up @@ -191,8 +191,8 @@ The model state file must contain the following variables:
If Dirichlet boundary conditions are being used (:cfg:`-ssa_dirichlet_bc`),
the model state file must contain

4. SSA Dirichlet velocities :ncvar:`vel_ssa_bc`
5. Dirichlet mask :ncvar:`bc_mask` specifying where Dirichlet conditions
4. SSA Dirichlet velocities :ncvar:`vel_bc`
5. Dirichlet mask :ncvar:`vel_bc_mask` specifying where Dirichlet conditions
apply.

If PISM is being used in regional model mode (:cfg:`-regional`), this last variable is replaced with
Expand Down
39 changes: 22 additions & 17 deletions doc/sphinx/manual/diagnostics/diagnostics-list.txt
Expand Up @@ -451,23 +451,6 @@ Spatially-variable fields
:Units: m
:Description: snow cover depth (set to zero once a year)

#. ``ssa_bc_mask``

:Units: ---
:Description: Dirichlet boundary mask

#. ``ssa_bc_vel``

- ``u_ssa_bc``

:Units: m year-1
:Description: X-component of the SSA velocity boundary conditions

- ``v_ssa_bc``

:Units: m year-1
:Description: Y-component of the SSA velocity boundary conditions

#. ``steady_state_hydraulic_potential``

:Units: Pa
Expand Down Expand Up @@ -776,6 +759,11 @@ Spatially-variable fields
:Description: land ice thickness
:Standard name: ``land_ice_thickness``

#. ``thk_bc_mask``

:Units: ---
:Description: Mask specifying locations where ice thickness is held constant

#. ``thksmooth``

:Units: m
Expand Down Expand Up @@ -819,6 +807,23 @@ Spatially-variable fields
:Description: horizontal velocity of ice in the X direction
:Standard name: ``land_ice_x_velocity``

#. ``vel_bc_mask``

:Units: ---
:Description: Mask prescribing Dirichlet boundary locations for the sliding velocity

#. ``vel_bc_values``

- ``u_bc``

:Units: m year-1
:Description: X-component of the SSA velocity boundary conditions

- ``v_bc``

:Units: m year-1
:Description: Y-component of the SSA velocity boundary conditions

#. ``velbar``

- ``ubar``
Expand Down
6 changes: 3 additions & 3 deletions doc/sphinx/manual/jakobshavn/index.rst
Expand Up @@ -100,7 +100,7 @@ examined in the usual ways, for example:
The boundary condition file ``g5km_bc.nc`` contains thermodynamical spun-up variables
(``enthalpy,bmelt,bwat``) and boundary values for the sliding velocity
(``u_ssa_bc,v_ssa_bc``); these have been extracted from ``g5km_gridseq.nc``.
(``u_bc,v_bc``); these have been extracted from ``g5km_gridseq.nc``.

None of the above actions is specific to Jakobshavn, though all are specific to Greenland.
If your goal is to build a regional model of another outlet glacier in Greenland, then you
Expand Down Expand Up @@ -280,9 +280,9 @@ Some more comments on this run are appropriate:

.. code-block:: none
-regrid_file g5km_bc.nc -regrid_vars bmelt,tillwat,enthalpy,litho_temp,vel_ssa_bc
-regrid_file g5km_bc.nc -regrid_vars bmelt,tillwat,enthalpy,litho_temp,vel_bc
- Dirichlet boundary conditions ``u_ssa_bc,v_ssa_bc`` are also regridded from
- Dirichlet boundary conditions ``u_bc,v_bc`` are also regridded from
``g5km_bc.nc`` for the sliding SSA stress balance, and the option ``-ssa_dirichlet_bc``
then uses them during the run. The SSA equations are solved as usual except in the
``no_model_strip`` where these Dirichlet boundary conditions are used. Note that the
Expand Down
10 changes: 5 additions & 5 deletions doc/sphinx/manual/validation/ross.rst
Expand Up @@ -58,10 +58,10 @@ bed elevations, surface temperature, net accumulation, as well as latitude and l
values. All of these are typical of ice sheet modelling data, both in diagnostic runs and
as needed to initialize and provide boundary conditions for prognostic (evolutionary)
runs; see below for the prognostic case with these data. The ``_combined`` file also has
variables ``u_ssa_bc`` and ``v_ssa_bc`` for the boundary values used in the (diagnostic
variables ``u_bc`` and ``v_bc`` for the boundary values used in the (diagnostic
and prognostic) computation of velocity. They are used at all grounded locations and at
ice shelf cells that are immediate neighbors of grounded ice. The variable ``bc_mask``
specifies these locations. Finally the variables ``u_ssa_bc,v_ssa_bc``, which contain
ice shelf cells that are immediate neighbors of grounded ice. The variable ``vel_bc_mask``
specifies these locations. Finally the variables ``u_bc,v_bc``, which contain
observed values, are used after the run to compare to the computed interior velocities.

Diagnostic computation of ice shelf velocity
Expand Down Expand Up @@ -103,8 +103,8 @@ options,
ice, especially in McMurdo sound area, so that the SSA problem is well-posed for the
grounded-ice-sheet-connected ice shelf.

- Option :opt:`-ssa_dirichlet_bc` forces the use of fields ``u_ssa_bc, v_ssa_bc, bc_mask``
described above. The field ``bc_mask`` is `1` at boundary condition locations, and `0`
- Option :opt:`-ssa_dirichlet_bc` forces the use of fields ``u_bc, v_bc, vel_bc_mask``
described above. The field ``vel_bc_mask`` is `1` at boundary condition locations, and `0`
elsewhere. For the prognostic runs below, the ice thickness is also fixed at boundary
condition locations, so as to prescribe ice flux as an ice shelf input.

Expand Down
4 changes: 2 additions & 2 deletions examples/jako/century.sh
Expand Up @@ -76,7 +76,7 @@ echo
cmd="$PISM_MPIDO $NN $PISM_EXEC -i $BOOT -bootstrap \
-Mx $Mx -My $My -Lz 4000 -Lbz 1000 -Mz $Mz -Mbz $Mbz -z_spacing equal \
-no_model_strip 10 $PHYS \
-ssa_dirichlet_bc -regrid_file $PREFILE -regrid_vars thk,basal_melt_rate_grounded,tillwat,enthalpy,litho_temp,vel_ssa_bc \
-ssa_dirichlet_bc -regrid_file $PREFILE -regrid_vars thk,basal_melt_rate_grounded,tillwat,enthalpy,litho_temp,vel_bc \
$CLIMATE -y 0.01 -o jakofine_short.nc"
$PISM_DO $cmd

Expand All @@ -86,7 +86,7 @@ cmd="$PISM_MPIDO $NN $PISM_EXEC -i jakofine_short.nc \
-extra_file ex_jakofine.nc -extra_times 0:yearly:$LENGTH \
-extra_vars mask,thk,velbase_mag,tillwat,tauc,dhdt,hardav,velsurf_mag,temppabase,diffusivity,bmelt,tempicethk_basal \
-ts_file ts_jakofine.nc -ts_times 0:monthly:$LENGTH \
-ssa_dirichlet_bc -regrid_file $BCFILE -regrid_vars vel_ssa_bc \
-ssa_dirichlet_bc -regrid_file $BCFILE -regrid_vars vel_bc \
$CLIMATE -ys 0 -ye $LENGTH -skip -skip_max $SKIP -o jakofine.nc"
$PISM_DO $cmd

4 changes: 2 additions & 2 deletions examples/jako/preprocess.sh
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright (C) 2011-2014, 2017, 2019 the PISM authors
# Copyright (C) 2011-2014, 2017, 2019, 2021 the PISM authors

# downloads SeaRISE "1km Greenland data set" NetCDF file,
# adjusts metadata, saves under new name with fields needed
Expand Down Expand Up @@ -85,6 +85,6 @@ BCFILE=g5km_bc.nc
echo "creating PISM-readable boundary conditions file $BCFILE from whole ice sheet result ..."
ncks -O -v u_ssa,v_ssa,bmelt,tillwat,enthalpy,litho_temp $WHOLE $BCFILE
# rename bmelt and u_ssa and v_ssa so that they are used as b.c.
ncrename -O -v bmelt,basal_melt_rate_grounded -v u_ssa,u_ssa_bc -v v_ssa,v_ssa_bc $BCFILE
ncrename -O -v bmelt,basal_melt_rate_grounded -v u_ssa,u_bc -v v_ssa,v_bc $BCFILE
echo "... done"
echo
2 changes: 1 addition & 1 deletion examples/jako/spinup.sh
Expand Up @@ -72,7 +72,7 @@ cmd="$PISM_MPIDO $NN $PISM -i $BOOT -bootstrap -no_model_strip 10 \
-extra_file ex_spunjako_0.nc -extra_times -$LENGTH:$EXDT:0 \
-extra_vars thk,velbase_mag,tillwat,tauc,dHdt,hardav,velsurf_mag,temppabase,diffusivity,bmelt,tempicethk_basal \
-ts_file ts_spunjako_0.nc -ts_times -$LENGTH:yearly:0 \
-ssa_dirichlet_bc -regrid_file $BCFILE -regrid_vars basal_melt_rate_grounded,tillwat,enthalpy,litho_temp,vel_ssa_bc \
-ssa_dirichlet_bc -regrid_file $BCFILE -regrid_vars basal_melt_rate_grounded,tillwat,enthalpy,litho_temp,vel_bc \
$CLIMATE -ys -$LENGTH -ye 0 -skip -skip_max $SKIP -o spunjako_0.nc"
$PISM_DO $cmd

Expand Down
20 changes: 10 additions & 10 deletions examples/marine/circular/circular_dirichlet.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

# Copyright (C) 2012, 2013, 2014, 2015, 2017, 2020 Ricarda Winkelmann, Torsten Albrecht,
# Copyright (C) 2012, 2013, 2014, 2015, 2017, 2020, 2021 Ricarda Winkelmann, Torsten Albrecht,
# Ed Bueler, and Constantine Khroulev

import numpy as np
Expand Down Expand Up @@ -50,17 +50,17 @@
Ts = np.zeros_like(thk) + p.air_temperature

# Dirichlet B.C locations
bc_mask = np.zeros_like(thk)
bc_mask[radius <= p.r_gl] = 1
vel_bc_mask = np.zeros_like(thk)
vel_bc_mask[radius <= p.r_gl] = 1

# SSA velocity Dirichlet B.C.
ubar = np.zeros_like(thk)
ubar[bc_mask == 1] = p.vel_bc * (xx[radius <= p.r_gl] / radius[radius <= p.r_gl])
ubar[bc_mask == 0] = 0
ubar[vel_bc_mask == 1] = p.vel_bc * (xx[radius <= p.r_gl] / radius[radius <= p.r_gl])
ubar[vel_bc_mask == 0] = 0

vbar = np.zeros_like(thk)
vbar[bc_mask == 1] = p.vel_bc * (yy[radius <= p.r_gl] / radius[radius <= p.r_gl])
vbar[bc_mask == 0] = 0
vbar[vel_bc_mask == 1] = p.vel_bc * (yy[radius <= p.r_gl] / radius[radius <= p.r_gl])
vbar[vel_bc_mask == 0] = 0

ncfile = PISMNC.PISMDataset(options.output_filename, 'w', format='NETCDF3_CLASSIC')
piktests_utils.prepare_output_file(ncfile, x, y)
Expand All @@ -69,9 +69,9 @@
"topg": bed,
"ice_surface_temp": Ts,
"climatic_mass_balance": accum,
"bc_mask": bc_mask,
"u_ssa_bc": ubar,
"v_ssa_bc": vbar,
"vel_bc_mask": vel_bc_mask,
"u_bc": ubar,
"v_bc": vbar,
"thickness_calving_threshold": thk_threshold}

piktests_utils.write_data(ncfile, variables)
Expand Down
6 changes: 3 additions & 3 deletions examples/marine/circular/piktests_utils.py
Expand Up @@ -87,15 +87,15 @@ def prepare_output_file(nc, x, y, include_vel_bc=True):
attrs = {'long_name': "Dirichlet boundary condition locations",
"units": "1",
"_FillValue": 0}
nc.define_2d_field("bc_mask", attrs=attrs)
nc.define_2d_field("vel_bc_mask", attrs=attrs)

attrs = {'long_name': "X-component of the SSA velocity boundary conditions",
"units": "m/year",
"_FillValue": 0.0}
nc.define_2d_field("u_ssa_bc", attrs=attrs)
nc.define_2d_field("u_bc", attrs=attrs)

attrs['long_name'] = "Y-component of the SSA velocity boundary conditions"
nc.define_2d_field("v_ssa_bc", attrs=attrs)
nc.define_2d_field("v_bc", attrs=attrs)


def write_data(nc, variables):
Expand Down
16 changes: 8 additions & 8 deletions examples/marine/circular/test_iceberg_removal.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

# Copyright (C) 2012, 2013, 2014, 2015 Ricarda Winkelmann, Torsten Albrecht,
# Copyright (C) 2012, 2013, 2014, 2015, 2021 Ricarda Winkelmann, Torsten Albrecht,
# Ed Bueler, and Constantine Khroulev

import numpy as np
Expand All @@ -18,7 +18,7 @@
accum = np.zeros_like(thk) # accumulation/ ablation
Ts = np.zeros_like(thk) + p.air_temperature

bc_mask = np.zeros_like(thk)
vel_bc_mask = np.zeros_like(thk)
ubar = np.zeros_like(thk)
vbar = np.zeros_like(thk)

Expand Down Expand Up @@ -67,13 +67,13 @@ def C(x, y):
width = dx * 3

if radius <= p.r_gl - width and x[i] < 0:
bc_mask[j, i] = 1.0
vel_bc_mask[j, i] = 1.0
elif radius <= p.r_gl and x[i] < 0:
bc_mask[j, i] = 1.0
vel_bc_mask[j, i] = 1.0
ubar[j, i] = p.vel_bc * (x[i] / radius)
vbar[j, i] = p.vel_bc * (y[j] / radius)
else:
bc_mask[j, i] = 0.0
vel_bc_mask[j, i] = 0.0

ncfile = PISMNC.PISMDataset(options.output_filename, 'w', format='NETCDF3_CLASSIC')
piktests_utils.prepare_output_file(ncfile, x, y)
Expand All @@ -82,9 +82,9 @@ def C(x, y):
"topg": bed,
"ice_surface_temp": Ts,
"climatic_mass_balance": accum,
"bc_mask": bc_mask,
"u_ssa_bc": ubar,
"v_ssa_bc": vbar}
"vel_bc_mask": vel_bc_mask,
"u_bc": ubar,
"v_bc": vbar}

piktests_utils.write_data(ncfile, variables)
ncfile.close()
Expand Down
34 changes: 17 additions & 17 deletions examples/marine/flowline/createSetup_flowline.py
Expand Up @@ -116,7 +116,7 @@
distbc = 50.0 # km
igl = int(np.floor(distbc / boxWidth))
vel_bc = 300 # m/yr
bc_mask = np.zeros((ny, nx))
vel_bc_mask = np.zeros((ny, nx))
ubar = np.zeros((ny, nx))
vbar = np.zeros((ny, nx))

Expand Down Expand Up @@ -162,7 +162,7 @@
if i <= igl:
ubar[j, i] = vel_bc / secpera
vbar[j, i] = 0.0
bc_mask[j, i] = 1.0
vel_bc_mask[j, i] = 1.0


##### define dimensions in NetCDF file #####
Expand Down Expand Up @@ -203,21 +203,21 @@
'land_ice_surface_specific_mass_balance_flux',
0.2 * 910.0,
precip],
'bc_mask': ['',
'bc_mask',
'bc_mask',
0.0,
bc_mask],
'u_ssa_bc': ['m s-1',
'X-component of the SSA velocity boundary conditions',
'ubar',
0.0,
ubar],
'v_ssa_bc': ['m s-1',
'Y-component of the SSA velocity boundary conditions',
'vbar',
0.0,
vbar],
'vel_bc_mask': ['',
'vel_bc_mask',
'vel_bc_mask',
0.0,
vel_bc_mask],
'u_bc': ['m s-1',
'X-component of the SSA velocity boundary conditions',
'ubar',
0.0,
ubar],
'v_bc': ['m s-1',
'Y-component of the SSA velocity boundary conditions',
'vbar',
0.0,
vbar],
}

for name in list(vars.keys()):
Expand Down
4 changes: 2 additions & 2 deletions examples/marine/flowline/run_flowline.sh
@@ -1,13 +1,13 @@
#!/bin/bash
# Copyright (C) 2011, 2013, 2014, 2015, 2016 Torsten Albrecht (torsten.albrecht@pik-potsdam.de)
# Copyright (C) 2011, 2013, 2014, 2015, 2016, 2021 Torsten Albrecht (torsten.albrecht@pik-potsdam.de)
# regression/verification test of SSA ice shelf solution against Van-der-Veen analytical solution

count=0
boxes=("11" "25" "51" "101" "251" "501") #cells

for res in 50 20 10 5 2 1 #km
do
pismr -verbose 2 -i flowline_setup_${res}km.nc -bootstrap -Mx ${boxes[$count]} -My 3 -Mz 5 -Lz 1000 -energy cold -ssa_flow_law isothermal_glen -energy none -stress_balance ssa -ssa_dirichlet_bc -config_override flowline_config.nc -ssa_method fd -cfbc -part_grid -ssafd_ksp_rtol 1e-7 -ys 0 -ye 3e3 -options_left -extra_file flowline_extra_${res}km.nc -extra_times 0:25:3e3 -extra_vars thk,topg,velbar_mag,flux_mag,mask,dHdt,usurf,hardav,usurf,velbase,velsurf,velbar,bc_mask -ts_file flowline_time_${res}km.nc -ts_times 0:25:3e3 -o flowline_result_${res}km.nc -o_order zyx -o_size big -calving thickness_calving -thickness_calving_threshold 250 | tee flowline_out_${res}km.out
pismr -verbose 2 -i flowline_setup_${res}km.nc -bootstrap -Mx ${boxes[$count]} -My 3 -Mz 5 -Lz 1000 -energy cold -ssa_flow_law isothermal_glen -energy none -stress_balance ssa -ssa_dirichlet_bc -config_override flowline_config.nc -ssa_method fd -cfbc -part_grid -ssafd_ksp_rtol 1e-7 -ys 0 -ye 3e3 -options_left -extra_file flowline_extra_${res}km.nc -extra_times 0:25:3e3 -extra_vars thk,topg,velbar_mag,flux_mag,mask,dHdt,usurf,hardav,usurf,velbase,velsurf,velbar,vel_bc_mask -ts_file flowline_time_${res}km.nc -ts_times 0:25:3e3 -o flowline_result_${res}km.nc -o_order zyx -o_size big -calving thickness_calving -thickness_calving_threshold 250 | tee flowline_out_${res}km.out

let count+=1
done
Expand Down

0 comments on commit 4c2498d

Please sign in to comment.