dedalus.core.operators ====================== .. py:module:: dedalus.core.operators .. autoapi-nested-parse:: Abstract and built-in classes defining deferred operations on fields. Module Contents --------------- .. py: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*) .. py:method:: check_conditions() Check that operands are in full grid space. .. py:method:: compute_cfl_frequency(velocity, out) :abstractmethod: Return a scalar multi-D field of the cfl frequency everywhere in the domain. .. py:method:: enforce_conditions() Require operands to be in full grid space. .. py:method:: new_operand(operand, **kw) .. py:method:: operate(out) Perform operation. .. py:attribute:: coords .. py:attribute:: domain .. py:attribute:: dtype .. py:attribute:: input_basis .. py:attribute:: name :value: 'cfl' .. py:attribute:: operand .. py:attribute:: tensorsig :value: () .. py: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 .. py:method:: new_operand(operand, **kw) .. py:attribute:: name :value: 'Angular' .. py:class:: Average(operand, coord) Average over operand bases. :Parameters: * **operand** (*number or Operand object*) * **coords** (*Coordinate or CoordinateSystem object, or list of these*) .. py:attribute:: coord .. py:attribute:: domain .. py:attribute:: dtype .. py:attribute:: first_axis .. py:attribute:: input_basis .. py:attribute:: last_axis .. py:attribute:: name :value: 'Average' .. py:attribute:: operand .. py:attribute:: output_basis .. py:attribute:: tensorsig .. py: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 .. py:method:: new_operand(operand, **kw) .. py:attribute:: name :value: 'Azimuthal' .. py:attribute:: tensorsig .. py: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 .. py:method:: check_conditions() Can always take components .. py:method:: enforce_conditions() Can always take components .. py:method:: matrix_coupling(*vars) .. py:method:: matrix_dependence(*vars) .. py:attribute:: coordsys .. py:attribute:: domain .. py:attribute:: dtype .. py:attribute:: index :value: 0 .. py:attribute:: input_basis .. py:attribute:: name :value: 'Component' .. py:attribute:: operand .. py:attribute:: tensorsig .. py: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*) .. py:method:: check_conditions() Check that arguments are in a proper layout. .. py:method:: enforce_conditions() Require arguments to be in a proper layout. .. py:method:: new_operand(operand, **kw) .. py:method:: operate(out) Perform operation. .. py:method:: replace(old, new) Replace specified operand/operator. .. py:method:: replace_dict(subs) Replace specified operands/operators according to a dictionary. .. py:method:: subspace_matrix(layout) Build matrix operating on global subspace data. .. py:attribute:: coords .. py:attribute:: domain .. py:attribute:: dtype .. py:attribute:: first_axis .. py:attribute:: input_basis .. py:attribute:: last_axis .. py:attribute:: name :value: 'Convert' .. py:attribute:: operand .. py:attribute:: output_basis .. py:attribute:: tensorsig .. py: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 .. py:method:: new_operand(operand, **kw) .. py:attribute:: name :value: 'Curl' .. py:class:: Differentiate(operand, coord, out=None) Differentiation along one dimension. :Parameters: * **operand** (*number or Operand object*) * **space** (*Space object*) .. py:method:: new_operand(operand, **kw) .. py:attribute:: axis .. py:attribute:: coord .. py:attribute:: domain .. py:attribute:: dtype .. py:attribute:: first_axis .. py:attribute:: input_basis .. py:attribute:: last_axis .. py:attribute:: name :value: 'Diff' .. py:attribute:: operand .. py:attribute:: output_basis .. py:attribute:: tensorsig .. py: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 .. py:method:: new_operand(operand, **kw) .. py:attribute:: name :value: 'Div' .. py: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) .. rubric:: Notes On evaluation, this wrapper evaluates the provided function with the given arguments and keywords, and takes the output to be data in the specified layout, i.e. out[layout] = func(*args, **kw) .. py:method:: check_conditions() Check that arguments are in a proper layout. .. py:method:: enforce_conditions() Require arguments to be in a proper layout. .. py:method:: operate(out) Perform operation. .. py:attribute:: args :value: [] .. py:attribute:: dist .. py:attribute:: domain .. py:attribute:: dtype .. py:attribute:: func .. py:attribute:: kw .. py:attribute:: last_id :value: None .. py:attribute:: layout .. py:attribute:: original_args :value: [] .. py:attribute:: out :value: None .. py:attribute:: tensorsig .. py: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 .. py:method:: new_operand(operand, **kw) .. py:attribute:: name :value: 'Grad' .. py:class:: Integrate(operand, coord) Integrate over operand bases. :Parameters: * **operand** (*number or Operand object*) * **coords** (*Coordinate or CoordinateSystem object, or list of these*) .. py:method:: new_operand(operand, **kw) .. py:attribute:: coord .. py:attribute:: domain .. py:attribute:: dtype .. py:attribute:: first_axis .. py:attribute:: input_basis .. py:attribute:: last_axis .. py:attribute:: name :value: 'Integrate' .. py:attribute:: operand .. py:attribute:: output_basis .. py:attribute:: tensorsig .. py: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*) .. py:method:: new_operand(operand, **kw) .. py:method:: subspace_matrix(layout) Build matrix operating on global subspace data. .. py:attribute:: coord .. py:attribute:: domain .. py:attribute:: dtype .. py:attribute:: first_axis .. py:attribute:: input_basis .. py:attribute:: last_axis .. py:attribute:: name :value: 'interp' .. py:attribute:: operand .. py:attribute:: output_basis .. py:attribute:: position .. py:attribute:: tensorsig .. py: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 .. py:method:: new_operand(operand, **kw) .. py:attribute:: name :value: 'Lap' .. py: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 .. py:method:: new_operand(operand, **kw) .. py:attribute:: domain .. py:attribute:: dtype .. py:attribute:: first_axis .. py:attribute:: input_basis .. py:attribute:: last_axis .. py:attribute:: n .. py:attribute:: name :value: 'Lift' .. py:attribute:: operand .. py:attribute:: output_basis .. py:attribute:: tensorsig .. py:class:: MulCosine(operand, coordsys=None, out=None) Cosine multiplication for S2. .. py:method:: new_operand(operand, **kw) .. py:method:: radial_matrix(spinindex_in, spinindex_out, m) .. py:method:: spinindex_out(spinindex_in) .. py:attribute:: domain .. py:attribute:: dtype .. py:attribute:: name :value: 'MulCos' .. py:attribute:: tensorsig .. py: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 .. py:method:: new_operand(operand, **kw) .. py:attribute:: name :value: 'Radial' .. py:attribute:: tensorsig .. py: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 .. py:method:: check_conditions() Can always take components .. py:method:: enforce_conditions() Can always take components .. py:method:: matrix_coupling(*vars) .. py:method:: matrix_dependence(*vars) .. py:method:: new_operand(operand, **kw) .. py:attribute:: coordsys .. py:attribute:: domain .. py:attribute:: dtype .. py:attribute:: index :value: 0 .. py:attribute:: name :value: 'Skew' .. py:attribute:: operand .. py:attribute:: tensorsig .. py: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 .. py:method:: new_operand(operand, **kw) .. py:attribute:: name :value: 'SphericalEllProduct' .. py:class:: TimeDerivative(operand, out=None) Class for representing time derivative while parsing. .. py:method:: matrix_coupling(*vars) .. py:method:: matrix_dependence(*vars) .. py:property:: base .. py:attribute:: domain .. py:attribute:: dtype .. py:attribute:: name :value: 'dt' .. py:attribute:: operand .. py:attribute:: tensorsig .. py: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 .. py:method:: check_conditions() Right now require grid space .. py:method:: enforce_conditions() Require arguments to be in a proper layout. .. py:method:: matrix_coupling(*vars) .. py:method:: matrix_dependence(*vars) .. py:method:: new_operand(operand, **kw) .. py:method:: operate(out) Perform operation. .. py:property:: base .. py:attribute:: coordsys .. py:attribute:: domain .. py:attribute:: dtype .. py:attribute:: input_basis .. py:attribute:: name :value: 'Trace' .. py:attribute:: operand .. py:attribute:: tensorsig .. py: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 .. py:method:: check_conditions() Can always take the transpose .. py:method:: enforce_conditions() Can always take the transpose .. py:method:: matrix_coupling(*vars) .. py:method:: matrix_dependence(*vars) .. py:method:: new_operand(operand, **kw) .. py:attribute:: coordsys .. py:attribute:: domain .. py:attribute:: dtype .. py:attribute:: indices .. py:attribute:: input_basis .. py:attribute:: name :value: 'TransposeComponents' .. py:attribute:: new_axis_order .. py:attribute:: operand .. py:attribute:: tensorsig .. py:class:: UnaryGridFunction(func, arg, deriv=None, out=None) Wrapper for applying unary functions to fields in grid space. This can be used with arbitrary user-defined functions, but symbolic differentiation is only implemented for some scipy/numpy universal functions. :Parameters: * **func** (*function*) -- Unary function acting on grid data. Must be vectorized and include an output array argument, e.g. func(x, out). * **arg** (*dedalus operand*) -- Argument field or operator. * **deriv** (*function, optional*) -- Symbolic derivative of func. Defaults are provided for some common numpy/scipy ufuncs (default: None). * **out** (*field, optional*) -- Output field (default: new field). .. rubric:: Notes The supplied function must support an output argument called 'out' and act in a vectorized fashion. The action is essentially: func(arg['g'], out=out['g']) .. py:method:: check_conditions() Check that arguments are in a proper layout. .. py:method:: enforce_conditions() Require arguments to be in a proper layout. .. py:method:: new_operand(arg) .. py:method:: new_operands(arg) .. py:method:: operate(out) Perform operation. .. py:method:: reinitialize(**kw) .. py:method:: sym_diff(var) Symbolically differentiate with respect to specified operand. .. py:attribute:: domain .. py:attribute:: dtype .. py:attribute:: func .. py:property:: name .. py:attribute:: tensorsig .. py:attribute:: ufunc_derivatives .. py:function:: Coeff(operand) .. py:function:: Grid(operand) .. py:function:: LiftTau(*args, **kw)