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.

Classes

Substance

A class for assigning a unique ID for an object

NonWeatheringSubstance

A class for assigning a unique ID for an object

SubsurfaceSubstance

Substance that can be used subsurface

Module Contents

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 windage_range
property windage_persist
initializers
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
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

density_at_temp(temp=273.15)

For non-weathering substance, we just return the standard density.

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
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