pyissm.model.Model
- class pyissm.model.Model
Bases:
objectHigh-level container for all components of an Ice-sheet and Sea-level System Model (ISSM) model. Initializes a collection of model components, each of which may store inputs, settings, and results related to ice sheet simulation.
- mesh
Mesh properties.
- Type:
- mask
Defines grounded and floating elements.
- Type:
- geometry
Surface elevation, bedrock topography, ice thickness, etc.
- Type:
- constants
Physical constants.
- Type:
- smb
Surface mass balance.
- Type:
- basalforcings
Bed forcings.
- materials
Material properties.
- Type:
- damage
Damage propagation laws.
- Type:
- friction
Basal friction / drag properties.
- Type:
- flowequation
Flow equations.
- Type:
- timestepping
Timestepping for transient models.
- initialization
Initial guess / state.
- Type:
- rifts
Rifts properties.
- Type:
- solidearth
Solidearth inputs and settings.
- Type:
- dsl
Dynamic sea level.
- Type:
- debug
Debugging tools (valgrind, gprof).
- Type:
- verbose
Verbosity level in solve.
- Type:
- settings
Settings properties.
- Type:
- toolkits
Toolkit options for each solution.
- Type:
- cluster
Cluster parameters (number of CPUs, etc.).
- Type:
- balancethickness
Parameters for balancethickness solution.
- Type:
- stressbalance
Parameters for stressbalance solution.
- Type:
- groundingline
Parameters for groundingline solution.
- Type:
- hydrology
Parameters for hydrology solution.
- Type:
- masstransport
Parameters for masstransport solution.
- Type:
- thermal
Parameters for thermal solution.
- Type:
- steadystate
Parameters for steadystate solution.
- Type:
- transient
Parameters for transient solution.
- Type:
- levelset
Parameters for moving boundaries (level-set method).
- Type:
- calving
Parameters for calving.
- Type:
- frontalforcings
Parameters for frontalforcings.
- love
Parameters for love solution.
- Type:
- esa
Parameters for elastic adjustment solution.
- Type:
- sampling
Parameters for stochastic sampler.
- Type:
- autodiff
Automatic differentiation parameters.
- Type:
- inversion
Parameters for inverse methods.
- qmu
Dakota properties.
- Type:
- amr
Adaptive mesh refinement properties.
- Type:
- results
Model results.
- Type:
- outputdefinition
Output definition.
- Type:
- radaroverlay
Radar image for plot overlay.
- Type:
- miscellaneous
Miscellaneous fields.
- Type:
- stochasticforcing
Stochasticity applied to model forcings.
Examples
>>> md = pyissm.model.Model() >>> md.mesh <mesh object> >>> md.mask <mask object> >>> md.geometry <geometry object>
- __init__()
Initialize default sub-classes and parameterizations for the ISSM model object.
This constructor initializes all default model components and their associated classes, setting up the complete structure for an Ice-sheet and Sea-level System Model (ISSM) simulation.
Notes
All attributes are initialized with their default class implementations. See the class docstring for detailed descriptions of each attribute.
Methods
__init__()Initialize default sub-classes and parameterizations for the ISSM model object.
check_message(string)Notify about a model consistency error, update internal state, and return the instance.
collapse()Collapse a 3D mesh into a 2D mesh.
extract(area)Extract a submodel from a larger model based on a domain or flag list.
extrude([num_layers, extrusion_exponent, ...])Vertically extrude a 2D mesh to create a 3D mesh.
model_class_names()Return a sorted list of registered model class attribute names.
- check_message(string)
Notify about a model consistency error, update internal state, and return the instance.
This method prints a formatted consistency error message to standard output, marks the instance as inconsistent by setting
self.private.isconsistent, and returns the instance to allow for method chaining.- Parameters:
string (
str) – Human-readable description of the consistency error. This will be inserted into the printed message:Model consistency error: {string}.- Returns:
The same instance on which the method was called, enabling fluent/chained calls.
- Return type:
self
Notes
This method mutates the instance state (
self.private.isconsistent) and prints output. It does not raise exceptions.Examples
>>> obj.check_message("missing parameter") Model consistency error: missing parameter >>> obj.private.isconsistent False
- collapse()
Collapse a 3D mesh into a 2D mesh.
This method collapses a 3D model into a 2D model by depth-averaging all fields. The original 3D mesh information is preserved, but the model is modified in-place.
The following operations are performed:
Projects 3D friction coefficients to 2D (at bedrock level)
Averages or projects 3D observations and initialization fields to 2D
Collapses boundary conditions from 3D to 2D
Depth-averages velocity and material properties
Projects 3D results and output definitions to 2D
Rebuilds mesh connectivity for the 2D mesh
- Returns:
md – The same model instance with updated 2D mesh and collapsed fields. Original 3D mesh information is preserved.
- Return type:
- Raises:
Exception –
If the model does not contain a 3D mesh. - If an unsupported friction type is encountered.
Notes
This method modifies the model in-place. All 3D fields are projected or averaged to create 2D equivalents.
Examples
>>> md = pyissm.model.Model() >>> md.collapse()
See also
pyissm.model.Model.extract()Extract sub-model from larger domain
pyissm.model.Model.extrude()Extrude model in vertical direction
- extract(area)
Extract a submodel from a larger model based on a domain or flag list.
This routine extracts a submodel from a bigger model with respect to a given contour. The contour must be followed by the corresponding .exp file or a flags list. It can either be a domain file (argus type, .exp extension), or an array of element flags. If the user wants every element outside the domain to be extracted, add ‘~’ to the name of the domain file (e.g., ‘~HO.exp’). An empty string ‘’ will be considered as an empty domain. A string ‘all’ will be considered as the entire domain.
The function performs the following operations:
Flags elements inside the specified area
Removes elements with all three nodes in excluded regions
Renumbers elements and nodes to maintain consistency
Updates mesh connectivity and vertex information
Adjusts boundary conditions at extraction boundaries
Handles 2D/3D mesh types and their specific properties
Processes results and output definitions if present
- Parameters:
area (
strorarray_like) –Domain specification. Can be:
A domain file path (
str- Argus file time, with .exp extension)A domain file path prefixed with ‘~’ to invert the domain
An array of element flags (
boolorint)An empty string ‘’ for empty domain
The string ‘all’ for entire domain
- Returns:
md2 – Extracted submodel containing only the elements and nodes within the specified area. The model includes updated mesh properties, renumbered elements and nodes, adjusted boundary conditions, and extracted results and output definitions if present.
- Return type:
- Raises:
RuntimeError –
If the extracted model is empty (no elements found in the specified area).
Examples
>>> md2 = md.extract('Domain.exp') >>> md3 = md.extract('~Domain.exp') # Extract outside domain >>> md4 = md.extract(flag_array) # Extract based on flag array
See also
pyissm.model.Model.extrude()Extrude model in vertical direction
pyissm.model.Model.collapse()Collapse model layers
- extrude(num_layers=None, extrusion_exponent=None, lower_exponent=None, upper_exponent=None, coefficients=None)
Vertically extrude a 2D mesh to create a 3D mesh.
Vertically extrude a 2D mesh and create corresponding 3D prism mesh. The vertical distribution can follow a polynomial law, two polynomial laws (one for lower part and one for upper part), or be described by a list of coefficients between 0 and 1.
- Parameters:
num_layers (
int, optional) – Number of vertical layers to create. Required when using polynomial extrusion (single or dual exponent). Must be at least 2.extrusion_exponent (
float, optional) – Single polynomial exponent for uniform vertical distribution. Must be >= 0. When specified, creates extrusion list using this exponent.lower_exponent (
float, optional) – Polynomial exponent for the lower part of the mesh. Must be >= 0. Used in conjunction withupper_exponentfor non-uniform vertical distribution.upper_exponent (
float, optional) – Polynomial exponent for the upper part of the mesh. Must be >= 0. Used in conjunction withlower_exponentfor non-uniform vertical distribution.coefficients (
array_like, optional) – List of coefficients between 0 and 1 defining custom vertical distribution. Automatically includes 0 and 1 if not present. Alternative to polynomial extrusion.
- Returns:
md – The same model instance with updated 3D mesh and extruded model fields. Original 2D mesh is preserved in
mesh.x2d,mesh.y2d,mesh.elements2d, etc.- Return type:
- Raises:
TypeError –
If
extrusion_exponentorlower_exponent/upper_exponent<= 0. - Ifcoefficientscontain values outside [0, 1] range. - Ifnum_layers< 2. - If mesh is already 3D (extrude called more than once).
Notes
The function performs the following operations:
Creates 3D prism elements from 2D elements
Distributes nodes vertically between bed and surface according to extrusion parameters
Maintains vertex and element numbering relationships via
lowervertex,
uppervertex,lowerelements, andupperelements- Projects all 2D model fields to 3D usingextrudemethods - Updates mesh connectivity and boundary information - Preserves the original 2D mesh information for referenceExamples
Single exponent (uniform-like distribution):
>>> md = md.extrude(num_layers=15, extrusion_exponent=1.3)
Dual exponents (non-uniform distribution):
>>> md = md.extrude(num_layers=15, lower_exponent=1.3, upper_exponent=1.2)
Custom coefficients (specific layer distribution):
>>> md = md.extrude(coefficients=[0, 0.2, 0.5, 0.7, 0.9, 0.95, 1])
See also
pyissm.model.Model.extract()Extract sub-model from larger domain
pyissm.model.Model.collapse()Collapse model layers
- model_class_names()
Return a sorted list of registered model class attribute names.
The method inspects the instance attributes and returns those whose classes are registered in
classes.class_registry.CLASS_REGISTRY.- Returns:
Sorted list of attribute names corresponding to registered model classes.
- Return type:
listofstr
Examples
>>> md.model_class_names() ['amr', 'autodiff', 'balancethickness', 'basalforcings', 'calving', 'cluster', 'constants', 'damage', 'debris', 'debug', 'dsl', 'esa', 'flowequation', 'friction', 'frontalforcings', 'geometry', 'groundingline', 'hydrology', 'initialization', 'inversion', 'levelset', 'love', 'mask', 'masstransport', 'materials', 'mesh', 'miscellaneous', 'outputdefinition', 'private', 'qmu', 'radaroverlay', 'results', 'rifts', 'sampling', 'settings', 'smb', 'solidearth', 'steadystate', 'stochasticforcing', 'stressbalance', 'thermal', 'timestepping', 'toolkits', 'transient', 'verbose']