Medium

class stride.problem.medium.Medium(name='medium', problem=None, **kwargs)[source]

Bases: stride.problem.base.ProblemBase

A Medium contains the fields that define a physical medium, such as density or longitudinal speed of sound.

A Medium defines these properties by keeping track of a series of named fields, that can be added to it through Medium.add.

A field with a name field_name can be accessed directly through medium.field_name or medium['field_name'].

The Medium also provides utilities for loading and dumping these fields and for plotting them.

Parameters
  • name (str) – Alternative name to give to the medium.

  • problem (Problem) – Problem to which the Medium belongs.

  • grid (Grid or any of Space or Time) – Grid on which the Medium is defined

add(field)[source]

Add a named field to the Medium.

Parameters

field (Field object) – Field to add to the Medium.

dump(*args, **kwargs)[source]

Dump all fields in the Medium.

See HDF5 for more information on the parameters of this method.

property fields

Access fields dictionary.

items()[source]

Access all fields as (name, field) pairs.

Returns

Iterable of (name, field) pairs.

Return type

Fields

load(*args, **kwargs)[source]

Load all fields in the Medium.

See HDF5 for more information on the parameters of this method.

plot(**kwargs)[source]

Plot all fields in the Medium.

Parameters

kwargs – Arguments for plotting the fields.

Returns

Axes on which the plotting is done.

Return type

axes