Skip to content

field

Plot scalar and vector fields.

valid_field_var

valid_field_var(var: str) -> bool

Whether a field variable is defined.

Parameters:

Name Type Description Default
var str

the variable name to be checked.

required

Returns:

Type Description
bool

whether the var is defined in either FIELD or FIELD_EXTRA.

get_meshes_fld

get_meshes_fld(
    conf: Config, step: Step, var: str, walls: bool = False
) -> tuple[NDArray, NDArray, NDArray, Varf]

Return scalar field along with coordinates meshes.

Only works properly in 2D geometry and 3D cartesian.

Parameters:

Name Type Description Default
conf Config

configuration.

required
step Step

a Step of a StagyyData instance.

required
var str

scalar field name.

required
walls bool

consider the walls as the relevant mesh.

False

Returns:

Name Type Description
xmesh NDArray

x position

ymesh NDArray

y position

fld NDArray

field values

meta Varf

metadata

get_meshes_vec

get_meshes_vec(
    conf: Config, step: Step, var: str
) -> tuple[NDArray, NDArray, NDArray, NDArray]

Return vector field components along with coordinates meshes.

Only works properly in 2D geometry and 3D cartesian.

Parameters:

Name Type Description Default
conf Config

configuration.

required
step Step

a Step of a StagyyData instance.

required
var str

vector field name.

required

Returns:

Name Type Description
xmesh NDArray

x position

ymesh NDArray

y position

fldx NDArray

x component

fldy NDArray

y component

plot_scalar

plot_scalar(
    step: Step,
    var: str,
    field: Optional[NDArray] = None,
    axis: Optional[Axes] = None,
    conf: Optional[Config] = None,
    **extra: Any
) -> tuple[Figure, Axes, QuadMesh, Optional[Colorbar]]

Plot scalar field.

Parameters:

Name Type Description Default
step Step

a Step of a StagyyData instance.

required
var str

the scalar field name.

required
field Optional[NDArray]

if not None, it is plotted instead of step.fields[var]. This is useful to plot a masked or rescaled array.

None
axis Optional[Axes]

the matplotlib.axes.Axes object where the field should be plotted. If set to None, a new figure with one subplot is created.

None
conf Optional[Config]

configuration.

None
extra Any

options that will be passed on to matplotlib.axes.Axes.pcolormesh.

{}

Returns:

Name Type Description
fig Figure

matplotlib figure

axes Axes

matplotlib axes

surf QuadMesh

surface returned by pcolormesh

cbar Optional[Colorbar]

colorbar

plot_iso

plot_iso(
    axis: Axes,
    step: Step,
    var: str,
    field: Optional[NDArray] = None,
    conf: Optional[Config] = None,
    **extra: Any
) -> None

Plot isocontours of scalar field.

Parameters:

Name Type Description Default
axis Axes

the matplotlib.axes.Axes of an existing matplotlib figure where the isocontours should be plotted.

required
step Step

a Step of a StagyyData instance.

required
var str

the scalar field name.

required
field Optional[NDArray]

if not None, it is plotted instead of step.fields[var]. This is useful to plot a masked or rescaled array.

None
conf Optional[Config]

configuration.

None
extra Any

options that will be passed on to Axes.contour.

{}

plot_vec

plot_vec(
    axis: Axes,
    step: Step,
    var: str,
    conf: Optional[Config] = None,
) -> None

Plot vector field.

Parameters:

Name Type Description Default
axis Axes

the :class:matplotlib.axes.Axes of an existing matplotlib figure where the vector field should be plotted.

required
step Step

a Step of a StagyyData instance.

required
var str

the vector field name.

required
conf Optional[Config]

configuration.

None

cmd

cmd(conf: Config) -> None

Implementation of field subcommand.