gnome.spills.substance
¶
The substance is an abstraction for the various types of “things” one might model with pyGNOME.
The role of a substance is to:
Define what data is carried with the elements
Provide a way to initialize the elements
Optionally, provide tools to support computation during the run
for example, GnomeOil can compute changes in density, etc of the elements as the model runs.
Module Contents¶
Classes¶
A class for assigning a unique ID for an object |
|
A class for assigning a unique ID for an object |
|
Substance that can be used subsurface |
- class gnome.spills.substance.Substance(windage_range=None, windage_persist=None, standard_density=1000.0, *args, **kwargs)¶
Bases:
gnome.gnomeobject.GnomeId
A class for assigning a unique ID for an object
- Parameters:
windage_range (tuple of values between 0 and 1) – Range of windages for the substance (leeway). Default: (.01, .04)
windage_persist=900 – persistence of windage settings in seconds. -1 or Inf means infinite.
standard_density=1000.0 – The density of the substance, used to convert mass to/from volume
- property all_array_types¶
- Fixme: should the initializers be what holds the array types?
don’t we know that this should have already?
- property is_weatherable¶
- property windage_range¶
- property windage_persist¶
- _schema¶
- _ref_as = 'substance'¶
- get_initializer_by_name(name)¶
get first initializer in list whose name matches ‘name’
- has_initializer(name)¶
Returns True if an initializer is present in the list which sets the data_array corresponding with ‘name’, otherwise returns False
- initialize_LEs(to_rel, arrs, environment=None)¶
:param to_rel - number of new LEs to initialize :param arrs - dict-like of data arrays representing LEs
- _pick_water(environment)¶
- density_at_temp(temp=273.15)¶
For non-weathering substance, we just return the standard density.
- _attach_default_refs(ref_dict)¶
!!!IMPORTANT!!! If this object requires default references (self._req_refs exists), this function will use the name of the references as keys into a reference dictionary to get a list of satisfactory references (objects that have obj._ref_as == self._req_refs). It will then attach the first object in the reference list to that attribute on this object.
This behavior can be overridden if the object needs more specific attachment behavior than simply ‘first in line’
In addition, this function SHOULD BE EXTENDED if this object should provide default references to any contained child objects. When doing so, please be careful to respect already existing references. The reference attachment system should only act if the requested reference ‘is None’ when the function is invoked. See Model._attach_default_refs() for an example.
- class gnome.spills.substance.NonWeatheringSubstance(windage_range=None, windage_persist=None, standard_density=1000.0, *args, **kwargs)¶
Bases:
Substance
A class for assigning a unique ID for an object
- Parameters:
windage_range (tuple of values between 0 and 1) – Range of windages for the substance (leeway). Default: (.01, .04)
windage_persist=900 – persistence of windage settings in seconds. -1 or Inf means infinite.
standard_density=1000.0 – The density of the substance, used to convert mass to/from volume
- property is_weatherable¶
- _schema¶
The simplest substance that can be used with the model
It can not be weathered, but does have basic properties for transport:
Windage, density, etc.
- initialize_LEs(to_rel, arrs, environment=None)¶
:param to_rel - number of new LEs to initialize :param arrs - dict-like of data arrays representing LEs
- class gnome.spills.substance.SubsurfaceSubstance(distribution, *args, **kwargs)¶
Bases:
NonWeatheringSubstance
Substance that can be used subsurface
key feature is that it initializes rise velocity from a distribution
Note: this should probably be part of a Release Object, not a Substance.
- Parameters:
distribution='UniformDistribution' – which distribution to use
Note: distribution should return values in m/s
See gnome.utilities.distributions for details