pyissm.model.classes.levelset
- class pyissm.model.classes.levelset(other=None)
Bases:
manage_stateLevel-set method parameters class for ISSM.
This class encapsulates parameters for configuring level-set method simulations in the ISSM (Ice Sheet System Model) framework. The level-set method is used to track moving boundaries such as ice fronts and calving fronts, allowing for dynamic changes in ice sheet geometry during simulations.
- Parameters:
other (any, optional) – Any other class object that contains common fields to inherit from. If values in other differ from default values, they will override the default values.
- stabilization
Stabilization method: 0=No Stabilization, 1=Artificial Diffusivity (most stable, least accurate), 2=Streamline Upwinding, 5=SUPG (most accurate, may be unstable).
- Type:
int, default=1
- spclevelset
Levelset constraints (NaN means no constraint).
- Type:
ndarray, default=nan
- reinit_frequency
Amount of time steps after which the levelset function is re-initialized.
- Type:
int, default=10
- kill_icebergs
Remove floating icebergs to prevent rigid body motions (1=true, 0=false).
- Type:
int, default=1
- migration_max
Maximum allowed migration rate [m/a].
- Type:
float, default=1e12
- __init__(self, other=None)
Initializes the levelset parameters, optionally inheriting from another instance.
- __repr__(self)
Returns a detailed string representation of the levelset parameters.
- __str__(self)
Returns a short string identifying the class.
- marshall_class(self, fid, prefix, md=None)
Marshall parameters to a binary file
Examples
md.levelset = pyissm.model.classes.levelset() md.levelset.stabilization = 5 md.levelset.reinit_frequency = 5 md.levelset.kill_icebergs = 0 md.levelset.migration_max = 1e10
- __init__(other=None)
Initialize the instance with optional field inheritance.
- Parameters:
other (
object, optional) – Another instance to inherit field values from. If provided, any fields in the current instance that differ from the default values and exist in ‘other’ will be replaced with the values from ‘other’.
Notes
The inheritance process:
Iterates through all attributes of the current instance
Checks if the same attribute exists in the ‘other’ instance
Compares field values using _fields_equal()
If different, replaces the current value with the ‘other’ value
This enables the common ISSM pattern where classes can inherit configurations from existing instances while maintaining their default values for unspecified fields.
Methods
__init__([other])Initialize the instance with optional field inheritance.
check_consistency(md, solution, analyses)Check consistency of the [levelset.levelset] parameters.
issm_enum_string()Default ISSM C++ enum string used during marshalling.
marshall_class(fid, prefix[, md])Marshall [levelset.levelset] parameters to a binary file.
- check_consistency(md, solution, analyses)
Check consistency of the [levelset.levelset] parameters.
- Parameters:
md (
pyissm.model.Model) – The model object to check.solution (
str) – The solution name to check.analyses (list of
str) – List of analyses to check consistency for.
- Returns:
md – The model object with any consistency errors noted.
- Return type:
- marshall_class(fid, prefix, md=None)
Marshall [levelset.levelset] parameters to a binary file.
- Parameters:
fid (file object) – The file object to write the binary data to.
prefix (str) – Prefix string used for data identification in the binary file.
md (ISSM model object, optional.) – ISSM model object needed in some cases.
- Return type:
None