dedalus.core.field

Class for data fields.

Module Contents

class Field(dist, bases=None, name=None, tensorsig=None, dtype=None)

Scalar field over a domain.

Parameters:
  • domain (domain object) – Problem domain

  • name (str, optional) – Field name (default: Python object id)

Variables:
  • layout (layout object) – Current layout of field

  • data (ndarray) – View of internal buffer in current layout

property global_shape
property is_scalar
get_basis(coord)
copy()
set_global_data(global_data)
set_local_data(local_data)
change_scales(scales)

Change data to specified scales.

change_layout(layout)

Change data to specified layout.

towards_grid_space()

Change to next layout towards grid space.

towards_coeff_space()

Change to next layout towards coefficient space.

require_grid_space(axis=None)

Require one axis (default: all axes) to be in grid space.

require_coeff_space(axis=None)

Require one axis (default: all axes) to be in coefficient space.

require_local(axis)

Require an axis to be local.

local_elements()
load_from_hdf5(file, index, task=None)

Load grid data from an hdf5 file. Task correpsonds to field name by default.

load_from_global_grid_data(global_data, pre_slices=tuple())

Load local grid data from array-like global grid data.

allgather_data(layout=None)

Build global data on all processes.

gather_data(root=0, layout=None)
allreduce_data_norm(layout=None, order=2)
allreduce_data_max(layout=None)
allreduce_L2_norm(normalize_volume=True)
normalize(normalize_volume=True)

Normalize field inplace using L2 norm.

Parameters:

normalize_volume (bool, optional) – Normalize inner product by domain volume. Default: True.

broadcast_ghosts(output_nonconst_dims)

Copy data over constant distributed dimensions for arithmetic broadcasting.

fill_random(layout=None, seed=None, chunk_size=2**20, distribution='standard_normal', **kw)

Fill field with random data. If a seed is specified, the global data is reproducibly generated for any process mesh.

Parameters:
  • layout (Layout object, ‘c’, or ‘g’, optional) – Layout for setting field data. Default: current layout.

  • seed (int, optional) – RNG seed. Default: None.

  • chunk_size (int, optional) – Chunk size for drawing from distribution. Should be less than locally available memory. Default: 2**20, corresponding to 8 MB of float64.

  • distribution (str, optional) – Distribution name, corresponding to numpy random Generator method. Default: ‘standard_normal’.

  • **kw (dict) – Other keywords passed to the distribution method.

low_pass_filter(shape=None, scales=None)

Apply a spectral low-pass filter by zeroing modes above specified relative scales. The scales can be specified directly or deduced from a specified global grid shape.

Parameters:
  • shape (tuple of ints, optional) – Global grid shape for inferring truncation scales.

  • scales (float or tuple of floats, optional) – Scale factors for truncation.

high_pass_filter(shape=None, scales=None)

Apply a spectral high-pass filter by zeroing modes below specified relative scales. The scales can be specified directly or deduced from a specified global grid shape.

Parameters:
  • shape (tuple of ints, optional) – Global grid shape for inferring truncation scales.

  • scales (float or tuple of floats, optional) – Scale factors for truncation.

ScalarField
VectorField(dist, coordsys, *args, **kw)
TensorField(dist, coordsys, *args, order=2, **kw)
class LockedField(dist, bases=None, name=None, tensorsig=None, dtype=None)

Field locked to particular layouts, disallowing changes to other layouts.

change_scales(scales)

Change data to specified scales.

towards_grid_space()

Change to next layout towards grid space.

towards_coeff_space()

Change to next layout towards coefficient space.

lock_to_layouts(*layouts)
lock_axis_to_grid(axis)