Snapshot

Module for discretized solution object

class Snapshot(values, space=None)[source]

Bases: object

Class for representing a discretized solution snapshot.

This class encapsulates solution values and their spatial coordinates, providing methods for manipulation and visualization.

Parameters:
  • values (array_like) – The solution values.

  • space (array_like) – The spatial coordinates corresponding to the values. Default is None.

Example:
>>> import numpy as np
>>> from ezyrb import Snapshot
>>> space = np.linspace(0, 1, 50)
>>> values = np.sin(2 * np.pi * space)
>>> snap = Snapshot(values, space)
>>> print(snap.values.shape)
(50,)
>>> print(snap.space.shape)
(50,)

Initialize a Snapshot object.

Parameters:
  • values – The solution values. Can be a Snapshot instance or an array-like object.

  • space – The spatial coordinates. Default is None.

property flattened

return the values in 1D array

plot()[source]

Plot the snapshot, if possible.

property space

Get the snapshot space.

property values

Get the snapshot values.