Symbolic Operator Representation

Based on pymbolic.

Basic Objects

DOF description

class grudge.sym.DTAG_SCALAR
class grudge.sym.DTAG_VOLUME_ALL
class grudge.sym.DTAG_BOUNDARY(tag)
class grudge.sym.QTAG_NONE
class grudge.sym.DOFDesc(domain_tag, quadrature_tag=None)

Describes the meaning of degrees of freedom.

domain_tag
quadrature_tag
is_scalar()
is_discretized()
is_volume()
is_boundary_or_partition_interface()
is_trace()
uses_quadrature()
with_qtag(qtag)
with_dtag(dtag)
__eq__(other)

Return self==value.

__ne__(other)

Return self!=value.

__hash__()

Return hash(self).

grudge.sym.as_dofdesc(dd)
grudge.sym.DD_SCALAR
grudge.sym.DD_VOLUME

Symbols

class grudge.sym.Variable(name, dd=None)

A user-supplied input variable with a known DOFDesc.

class grudge.sym.ScalarVariable(name)
class grudge.sym.FunctionSymbol(name)

A symbol to be used as the function argument of Call.

grudge.sym.make_sym_array(name, shape, dd=None)
grudge.sym.make_sym_mv(name, dim, var_factory=None)
grudge.sym.fabs(arg)
grudge.sym.sqrt(arg)
grudge.sym.exp(arg)
grudge.sym.sin(arg)
grudge.sym.cos(arg)
grudge.sym.besesl_j(n, arg)
grudge.sym.besesl_y(n, arg)

Helpers

class grudge.sym.OperatorBinding(op, field)
class grudge.sym.PrioritizedSubexpression(child, priority=0)

When the optemplate-to-code transformation is performed, prioritized subexpressions work like common subexpression in that they are assigned their own separate identifier/register location. In addition to this behavior, prioritized subexpressions are evaluated with a settable priority, allowing the user to expedite or delay the evaluation of the subexpression.

class grudge.sym.Ones(*args, **kwargs)

Geometry data

class grudge.sym.NodeCoordinateComponent(axis, dd=None)
grudge.sym.nodes(ambient_dim, dd=None)
grudge.sym.mv_nodes(ambient_dim, dd=None)
grudge.sym.forward_metric_derivative(xyz_axis, rst_axis, dd=None)

Pointwise metric derivatives representing

\[\frac{\partial x_{\mathrm{xyz\_axis}} }{\partial r_{\mathrm{rst\_axis}}}\]
grudge.sym.inverse_metric_derivative(rst_axis, xyz_axis, ambient_dim, dim=None, dd=None)
grudge.sym.forward_metric_derivative_mat(ambient_dim, dim=None, dd=None)
grudge.sym.inverse_metric_derivative_mat(ambient_dim, dim=None, dd=None)
grudge.sym.first_fundamental_form(ambient_dim, dim=None, dd=None)
grudge.sym.inverse_first_fundamental_form(ambient_dim, dim=None, dd=None)
grudge.sym.inverse_surface_metric_derivative(rst_axis, xyz_axis, ambient_dim, dim=None, dd=None)
grudge.sym.second_fundamental_form(ambient_dim, dim=None, dd=None)
grudge.sym.shape_operator(ambient_dim, dim=None, dd=None)
grudge.sym.pseudoscalar(ambient_dim, dim=None, dd=None)
grudge.sym.area_element(ambient_dim, dim=None, dd=None)
grudge.sym.mv_normal(dd, ambient_dim, dim=None)

Exterior unit normal as a MultiVector.

grudge.sym.normal(dd, ambient_dim, dim=None)
grudge.sym.surface_normal(ambient_dim, dim=None, dd=None)
grudge.sym.summed_curvature(ambient_dim, dim=None, dd=None)

Sum of the principal curvatures

grudge.sym.mean_curvature(ambient_dim, dim=None, dd=None)

Averaged (by dimension) sum of the principal curvatures.

Trace Pair

class grudge.sym.TracePair(dd, *, interior, exterior)
dd

an instance of grudge.sym.DOFDesc describing the discretization on which interior and exterior live.

interior

a value (symbolic expression or DOFArray or object array of either) representing the interior value to be used for the flux.

exterior

a value (symbolic expression or DOFArray or object array of either) representing the exterior value to be used for the flux.

Note

TracePair is used both by the symbolic and the eager interface, with symbolic information or concrete data.

grudge.sym.int_tpair(expression, qtag=None, from_dd=None)
grudge.sym.bv_tpair(dd, interior, exterior)
Parameters
  • interior – an expression that lives in the volume and will be restricted to the boundary identified by tag before use.

  • exterior – an expression that already lives on the boundary representing the exterior value to be used for the flux.

grudge.sym.bdry_tpair(dd, interior, exterior)
Parameters
  • interior – an expression that already lives on the boundary representing the interior value to be used for the flux.

  • exterior – an expression that already lives on the boundary representing the exterior value to be used for the flux.

Operators

Building blocks and mappers for operator expression trees.

Basic Operators

class grudge.symbolic.operators.Operator(dd_in, dd_out)[source]
dd_in

an instance of DOFDesc describing the input discretization.

dd_out

an instance of DOFDesc describing the output discretization.

class grudge.symbolic.operators.ElementwiseLinearOperator(dd_in, dd_out)[source]
class grudge.symbolic.operators.ProjectionOperator(dd_in, dd_out)[source]
grudge.symbolic.operators.project

Reductions

class grudge.symbolic.operators.ElementwiseSumOperator(dd)[source]

Returns a vector of DOFs with all entries on each element set to the sum of DOFs on that element.

class grudge.symbolic.operators.ElementwiseMinOperator(dd)[source]

Returns a vector of DOFs with all entries on each element set to the minimum of DOFs on that element.

class grudge.symbolic.operators.ElementwiseMaxOperator(dd)[source]

Returns a vector of DOFs with all entries on each element set to the maximum of DOFs on that element.

class grudge.symbolic.operators.NodalReductionOperator(dd_in, dd_out=None)[source]
class grudge.symbolic.operators.NodalSum(dd_in, dd_out=None)[source]
class grudge.symbolic.operators.NodalMax(dd_in, dd_out=None)[source]
class grudge.symbolic.operators.NodalMin(dd_in, dd_out=None)[source]

Differentiation

class grudge.symbolic.operators.StrongFormDiffOperatorBase(xyz_axis, dd_in=None, dd_out=None)[source]
class grudge.symbolic.operators.WeakFormDiffOperatorBase(xyz_axis, dd_in=None, dd_out=None)[source]
class grudge.symbolic.operators.StiffnessOperator(xyz_axis, dd_in=None, dd_out=None)[source]
class grudge.symbolic.operators.DiffOperator(xyz_axis, dd_in=None, dd_out=None)[source]
class grudge.symbolic.operators.StiffnessTOperator(xyz_axis, dd_in=None, dd_out=None)[source]
class grudge.symbolic.operators.MInvSTOperator(xyz_axis, dd_in=None, dd_out=None)[source]
class grudge.symbolic.operators.RefDiffOperator(rst_axis, dd_in=None, dd_out=None)[source]
class grudge.symbolic.operators.RefStiffnessTOperator(rst_axis, dd_in=None, dd_out=None)[source]
grudge.symbolic.operators.nabla(dim)[source]
grudge.symbolic.operators.minv_stiffness_t(dim)[source]
grudge.symbolic.operators.stiffness(dim)[source]
grudge.symbolic.operators.stiffness_t(dim, dd_in=None, dd_out=None)[source]

Mass Operators

class grudge.symbolic.operators.MassOperatorBase(dd_in=None, dd_out=None)[source]

Inherits from Operator.

dd_in and dd_out may be surface or volume discretizations.

class grudge.symbolic.operators.MassOperator(dd_in=None, dd_out=None)[source]
class grudge.symbolic.operators.InverseMassOperator(dd_in=None, dd_out=None)[source]
class grudge.symbolic.operators.FaceMassOperator(dd_in=None, dd_out=None)[source]
class grudge.symbolic.operators.RefMassOperator(dd_in, dd_out)[source]
class grudge.symbolic.operators.RefInverseMassOperator(dd_in, dd_out)[source]
class grudge.symbolic.operators.RefFaceMassOperator(dd_in, dd_out)[source]