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

allgather_data(layout=None)

Build global data on all processes.

allreduce_L2_norm(normalize_volume=True)
allreduce_data_max(layout=None)
allreduce_data_norm(layout=None, order=2)
broadcast_ghosts(output_nonconst_dims)

Copy data over constant distributed dimensions for arithmetic broadcasting.

change_layout(layout)

Change data to specified layout.

change_scales(scales)

Change data to specified scales.

copy()
fill_random(layout=None, scales=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.

  • scales (number or tuple of numbers, optional) – Scales for setting field data. Default: current scales.

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

gather_data(root=0, layout=None)
get_basis(coord)
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.

load_from_global_coeff_data(global_data, pre_slices=tuple(), func=None)

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

load_from_global_grid_data(global_data, pre_slices=tuple(), func=None)

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

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

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

local_elements()
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.

normalize(normalize_volume=True)

Normalize field inplace using L2 norm.

Parameters:

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

require_coeff_space(axis=None)

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

require_grid_space(axis=None)

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

require_local(axis)

Require an axis to be local.

set_global_data(global_data)
set_local_data(local_data)
towards_coeff_space()

Change to next layout towards coefficient space.

towards_grid_space()

Change to next layout towards grid space.

buffer_size = -1
dist
domain
dtype = None
property global_shape
property is_scalar
layout
name = None
scales = None
tensorsig = None
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.

lock_axis_to_grid(axis)
lock_to_layouts(*layouts)
towards_coeff_space()

Change to next layout towards coefficient space.

towards_grid_space()

Change to next layout towards grid space.

unlock()

Return regular Field object with same data and no layout locking.

TensorField(dist, coordsys, *args, order=2, **kw)
VectorField(dist, coordsys, *args, **kw)
ScalarField