pyissm.model.classes.constants
- class pyissm.model.classes.constants(other=None)
Bases:
manage_statePhysical constants class for ISSM.
This class contains fundamental physical constants used in the ISSM framework. It provides standardized values for gravitational acceleration, Earth’s rotation, time conversions, and other physical constants required for ice sheet modeling calculations.
- Parameters:
other (any, optional) – Any other class object that contains common fields to inherit from. If values in
otherdiffer from default values, they will override the default values.
- g
Gravitational acceleration [m/s^2].
- Type:
float, default=9.81
- omega
Angular velocity of Earth [rad/s].
- Type:
float, default=7.292e-5
- yts
Number of seconds in a year [s/yr] (365.0 * 24.0 * 3600.0).
- Type:
float, default=31536000.0
- referencetemperature
Reference temperature used in the enthalpy model [K].
- Type:
float, default=223.15
- gravitational_constant
Newtonian constant of gravitation [m^3/kg/s^2].
- Type:
float, default=6.67259e-11
Examples
>>> md.constants = pyissm.model.classes.constants() >>> md.constants.g = 9.81 >>> md.constants.yts = 365.25 * 24.0 * 3600.0
- __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 [constants] parameters.
issm_enum_string()Default ISSM C++ enum string used during marshalling.
marshall_class(fid, prefix[, md])Marshall [constants.constants] parameters to a binary file.
- check_consistency(md, solution, analyses)
Check consistency of the [constants] 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 [constants.constants] 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