pyissm.model.classes.stressbalance
- class pyissm.model.classes.stressbalance(other=None)
Bases:
manage_stateStress balance solution parameters class for ISSM.
This class encapsulates parameters for configuring stress balance simulations in the ISSM (Ice Sheet System Model) framework. It controls velocity constraints, convergence criteria, numerical methods, and other parameters for solving the momentum balance equations in ice sheet dynamics.
- 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.
- spcvx
Velocity constraints in x-direction (NaN means no constraint) [m/yr].
- Type:
ndarray, default=nan
- spcvy
Velocity constraints in y-direction (NaN means no constraint) [m/yr].
- Type:
ndarray, default=nan
- spcvx_base
Base velocity constraints in x-direction (NaN means no constraint) [m/yr].
- Type:
ndarray, default=nan
- spcvy_base
Base velocity constraints in y-direction (NaN means no constraint) [m/yr].
- Type:
ndarray, default=nan
- spcvx_shear
Shear velocity constraints in x-direction (NaN means no constraint) [m/yr].
- Type:
ndarray, default=nan
- spcvy_shear
Shear velocity constraints in y-direction (NaN means no constraint) [m/yr].
- Type:
ndarray, default=nan
- spcvz
Velocity constraints in z-direction (NaN means no constraint) [m/yr].
- Type:
ndarray, default=nan
- restol
Mechanical equilibrium residual convergence criterion.
- Type:
float, default=1e-4
- reltol
Velocity relative convergence criterion (NaN: not applied).
- Type:
float, default=0.01
- abstol
Velocity absolute convergence criterion (NaN: not applied).
- Type:
float, default=10
- ishydrologylayer
Is hydrology layer enabled.
- Type:
int, default=0
- isnewton
Numerical method: 0=Picard’s fixed point, 1=Newton’s method, 2=hybrid.
- Type:
int, default=0
- FSreconditioning
Full-Stokes reconditioning parameter.
- Type:
float, default=1e13
- maxiter
Maximum number of nonlinear iterations.
- Type:
int, default=100
- shelf_dampening
Shelf dampening parameter.
- Type:
float, default=0
- vertex_pairing
Vertex pairing parameter.
- Type:
float, default=nan
- penalty_factor
Penalty factor for constraint enforcement.
- Type:
float, default=3
- rift_penalty_lock
Rift penalty lock parameter.
- Type:
float, default=10
- rift_penalty_threshold
Rift penalty threshold parameter.
- Type:
float, default=0
- referential
Referential parameter.
- Type:
float, default=nan
- loadingforce
Loading force parameter.
- Type:
float, default=nan
- requested_outputs
Additional outputs requested.
- Type:
list, default=[‘default’]
- __init__(self, other=None)
Initializes the stressbalance parameters, optionally inheriting from another instance.
- __repr__(self)
Returns a detailed string representation of the stressbalance parameters.
- __str__(self)
Returns a short string identifying the class.
- process_outputs(self, md=None, return_default_outputs=False)
Process requested outputs, expanding ‘default’ to appropriate outputs.
- marshall_class(self, fid, prefix, md=None)
Marshall parameters to a binary file
Examples
md.stressbalance = pyissm.model.classes.stressbalance() md.stressbalance.restol = 1e-5 md.stressbalance.isnewton = 1 md.stressbalance.maxiter = 200
- __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 [stressbalance.stressbalance] parameters.
issm_enum_string()Default ISSM C++ enum string used during marshalling.
marshall_class(fid, prefix[, md])Marshall [stressbalance.stressbalance] parameters to a binary file.
- check_consistency(md, solution, analyses)
Check consistency of the [stressbalance.stressbalance] 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 [stressbalance.stressbalance] 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