dedalus.core.operators

Abstract and built-in classes defining deferred operations on fields.

Module Contents

class GeneralFunction(dist, domain, tensorsig, dtype, layout, func, args=[], kw={}, out=None)

Operator wrapping a general python function to return a field.

Parameters:
  • dist (distributor object) – Distributor

  • domain (domain object) – Domain

  • tensorsig (tuple of coordinate systems) – Tensor signature of output field (corresponding to, e.g., scalar, vector, rank-2 tensor, etc.)

  • dtype (dtype) – Data type of output field

  • layout (layout object or identifier) – Layout of output field

  • func (function) – Function producing field data

  • args (list) – Arguments to pass to func

  • kw (dict) – Keywords to pass to func

  • out (field, optional) – Output field (default: new field)

Notes

On evaluation, this wrapper evaluates the provided funciton with the given arguments and keywords, and takes the output to be data in the specified layout, i.e.

out[layout] = func(*args, **kw)

check_conditions()

Check that arguments are in a proper layout.

enforce_conditions()

Require arguments to be in a proper layout.

operate(out)

Perform operation.

class UnaryGridFunction(func, arg, **kw)

Base class for deferred operations on data.

Parameters:
  • *args (Operands) – Operands. Number must match class attribute arity, if present.

  • out (data, optional) – Output data object. If not specified, a new object will be used.

Notes

Operators are stacked (i.e. provided as arguments to other operators) to construct trees that represent compound expressions. Nodes are evaluated by first recursively evaluating their subtrees, and then calling the operate method.

property name
supported
aliased
new_operands(arg)
reinitialize(**kw)
sym_diff(var)

Symbolically differentiate with respect to specified operand.

check_conditions()

Check that arguments are in a proper layout.

enforce_conditions()

Require arguments to be in a proper layout.

operate(out)

Perform operation.

Grid(operand)
Coeff(operand)
class TimeDerivative(operand, out=None)

Class for representing time derivative while parsing.

property base
name = 'dt'
matrix_dependence(*vars)
matrix_coupling(*vars)
class Interpolate(operand, coord, position, out=None)

Interpolation along one dimension.

Parameters:
  • operand (number or Operand object)

  • space (Space object)

  • position (‘left’, ‘center’, ‘right’, or float)

name = 'interp'
new_operand(operand, **kw)
subspace_matrix(layout)

Build matrix operating on global subspace data.

class Integrate(operand, coord)

Integrate over operand bases.

Parameters:
  • operand (number or Operand object)

  • coords (Coordinate or CoordinateSystem object, or list of these)

name = 'Integrate'
new_operand(operand, **kw)
class Average(operand, coord)

Average over operand bases.

Parameters:
  • operand (number or Operand object)

  • coords (Coordinate or CoordinateSystem object, or list of these)

name = 'Average'
class Differentiate(operand, coord, out=None)

Differentiation along one dimension.

Parameters:
  • operand (number or Operand object)

  • space (Space object)

name = 'Diff'
new_operand(operand, **kw)
class Convert(operand, output_basis, out=None)

Convert an operand between two bases, assuming coupling over just the last axis of the bases.

Parameters:
  • operand (Operand object)

  • output_basis (Basis object)

name = 'Convert'
new_operand(operand, **kw)
check_conditions()

Check that arguments are in a proper layout.

enforce_conditions()

Require arguments to be in a proper layout.

replace(old, new)

Replace specified operand/operator.

subspace_matrix(layout)

Build matrix operating on global subspace data.

operate(out)

Perform operation.

class Trace(operand, out=None)

Base class for linear operators.

Subclasses must define the following attributes:

# LinearOperator requirements self.operand

# FutureField requirements self.domain self.tensorsig self.dtype

property base
name = 'Trace'
new_operand(operand, **kw)
matrix_dependence(*vars)
matrix_coupling(*vars)
check_conditions()

Right now require grid space

enforce_conditions()

Require arguments to be in a proper layout.

operate(out)

Perform operation.

class TransposeComponents(operand, indices=(0, 1), out=None)

Base class for linear operators.

Subclasses must define the following attributes:

# LinearOperator requirements self.operand

# FutureField requirements self.domain self.tensorsig self.dtype

name = 'TransposeComponents'
new_operand(operand, **kw)
matrix_dependence(*vars)
matrix_coupling(*vars)
check_conditions()

Can always take the transpose

enforce_conditions()

Can always take the transpose

class Skew(operand, index=0, out=None)

Base class for linear operators.

Subclasses must define the following attributes:

# LinearOperator requirements self.operand

# FutureField requirements self.domain self.tensorsig self.dtype

name = 'Skew'
new_operand(operand, **kw)
check_conditions()

Can always take components

enforce_conditions()

Can always take components

matrix_dependence(*vars)
matrix_coupling(*vars)
class Component(operand, index=0, out=None)

Base class for linear operators.

Subclasses must define the following attributes:

# LinearOperator requirements self.operand

# FutureField requirements self.domain self.tensorsig self.dtype

name = 'Component'
check_conditions()

Can always take components

enforce_conditions()

Can always take components

matrix_dependence(*vars)
matrix_coupling(*vars)
class RadialComponent(operand, index=0, out=None)

Base class for linear operators.

Subclasses must define the following attributes:

# LinearOperator requirements self.operand

# FutureField requirements self.domain self.tensorsig self.dtype

name = 'Radial'
new_operand(operand, **kw)
class AngularComponent(operand, index=0, out=None)

Base class for linear operators.

Subclasses must define the following attributes:

# LinearOperator requirements self.operand

# FutureField requirements self.domain self.tensorsig self.dtype

name = 'Angular'
new_operand(operand, **kw)
class AzimuthalComponent(operand, index=0, out=None)

Base class for linear operators.

Subclasses must define the following attributes:

# LinearOperator requirements self.operand

# FutureField requirements self.domain self.tensorsig self.dtype

name = 'Azimuthal'
new_operand(operand, **kw)
class Gradient(*args, out=None)

Base class for linear operators.

Subclasses must define the following attributes:

# LinearOperator requirements self.operand

# FutureField requirements self.domain self.tensorsig self.dtype

name = 'Grad'
new_operand(operand, **kw)
class MulCosine(operand, coordsys=None, out=None)

Cosine multiplication for S2.

name = 'MulCos'
spinindex_out(spinindex_in)
new_operand(operand, **kw)
radial_matrix(spinindex_in, spinindex_out, m)
class Divergence(*args, out=None)

Base class for linear operators.

Subclasses must define the following attributes:

# LinearOperator requirements self.operand

# FutureField requirements self.domain self.tensorsig self.dtype

name = 'Div'
new_operand(operand, **kw)
class Curl(*args, out=None)

Base class for linear operators.

Subclasses must define the following attributes:

# LinearOperator requirements self.operand

# FutureField requirements self.domain self.tensorsig self.dtype

name = 'Curl'
new_operand(operand, **kw)
class Laplacian(*args, out=None)

Base class for linear operators.

Subclasses must define the following attributes:

# LinearOperator requirements self.operand

# FutureField requirements self.domain self.tensorsig self.dtype

name = 'Lap'
new_operand(operand, **kw)
class SphericalEllProduct(operand, coordsys)

Base class for linear operators acting on the coefficients of an individual spectral basis.

Subclasses must define the following attributes:

# SpectralOperator requirements self.coord self.input_basis self.output_basis self.first_axis self.last_axis self.subaxis_dependence self.subaxis_coupling

# LinearOperator requirements self.operand

# FutureField requirements self.domain self.tensorsig self.dtype

name = 'SphericalEllProduct'
new_operand(operand, **kw)
class Lift(operand, output_basis, n, out=None)

Base class for linear operators.

Subclasses must define the following attributes:

# LinearOperator requirements self.operand

# FutureField requirements self.domain self.tensorsig self.dtype

name = 'Lift'
new_operand(operand, **kw)
LiftTau(*args, **kw)
class AdvectiveCFL(operand, coords)

Calculates the scalar advective grid-crossing frequency associated with a given velocity vector.

Parameters:
  • operand (number or Operand object)

  • space (Space object)

name = 'cfl'
new_operand(operand, **kw)
check_conditions()

Check that operands are in full grid space.

enforce_conditions()

Require operands to be in full grid space.

operate(out)

Perform operation.

abstract compute_cfl_frequency(velocity, out)

Return a scalar multi-D field of the cfl frequency everywhere in the domain.