pyissm.model.classes.amr
- class pyissm.model.classes.amr(other=None)
Bases:
manage_stateAdaptive Mesh Refinement (AMR) class for ISSM
This class contains parameters and configuration options for adaptive mesh refinement (AMR) in the ISSM framework. It allows users to control mesh resolution based on various criteria such as velocity, thickness error, and deviatoric stress error, as well as to refine mesh near grounding lines and ice fronts.
- 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.
- hmin
Minimum element length.
- Type:
float, default=100
- hmax
Maximum element length.
- Type:
float, default=100000
- fieldname
Name of the input field used to compute the metric (should be an input of FemModel).
- Type:
str, default=’Vel’
- err
Error estimator type or flag.
- Type:
int, default=3
- keepmetric
Indicates whether the metric should be kept at every remeshing time.
- Type:
int, default=1
- gradation
Maximum ratio between two adjacent edge lengths.
- Type:
float, default=1.5
- groundingline_resolution
Element length near the grounding line.
- Type:
float, default=500
- groundingline_distance
Distance around the grounding line for mesh refinement.
- Type:
float, default=0
- icefront_resolution
Element length near the ice front.
- Type:
float, default=500
- icefront_distance
Distance around the ice front for mesh refinement.
- Type:
float, default=0
- thicknesserror_resolution
Element length when thickness error estimator is used.
- Type:
float, default=500
- thicknesserror_threshold
Maximum threshold for thickness error.
- Type:
float, default=0
- thicknesserror_groupthreshold
Maximum group threshold for thickness error.
- Type:
float, default=0
- thicknesserror_maximum
Maximum permitted thickness error.
- Type:
float, default=0
- deviatoricerror_resolution
Element length when deviatoric stress error estimator is used.
- Type:
float, default=500
- deviatoricerror_threshold
Maximum threshold for deviatoric stress error.
- Type:
float, default=0
- deviatoricerror_groupthreshold
Maximum group threshold for deviatoric stress error.
- Type:
float, default=0
- deviatoricerror_maximum
Maximum permitted deviatoric stress error.
- Type:
float, default=0
- restart
Indicates if ReMesh() should be called before the first time step.
- Type:
int, default=0
Examples
>>> md.amr = pyissm.model.classes.amr() >>> md.amr.hmin = 50 >>> md.amr.fieldname = 'Thickness'
- __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 [amr] parameters.
issm_enum_string()Default ISSM C++ enum string used during marshalling.
marshall_class(fid, prefix[, md])Marshall [amr.amr] parameters to a binary file.
- check_consistency(md, solution, analyses)
Check consistency of the [amr] 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 [amr.amr] 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 (
pyissm.model.Model, optional) – ISSM model object needed in some cases.
- Return type:
None