Placeholder

In pyinduct.placeholder you find placeholders for symbolic Term definitions.

class FieldVariable(function_label, order=(0, 0), weight_label=None, location=None, exponent=1, raised_spatially=False)[source]

Bases: pyinduct.placeholder.Placeholder

Class that represents terms of the systems field variable x(z, t).

Note

Use TemporalDerivedFieldVariable and SpatialDerivedFieldVariable if no mixed derivatives occur.

Parameters:
  • function_label (str) – Label of shapefunctions to use for approximation, see register_base() for more information about how to register an approximation basis.
  • tuple of int (order) – Tuple of temporal_order and spatial_order derivation order.
  • weight_label (str) – Label of weights for which coefficients are to be calculated (defaults to function_label).
  • location – Where the expression is to be evaluated.
  • exponent – Exponent of the term.

Examples

Assuming some shapefunctions have been registered under the label "phi" the following expressions hold:

  • \frac{\partial^{2}}{\partial t \partial z}x(z, t)
>>> x_dtdz = FieldVariable("phi", order=(1, 1))
  • \frac{\partial^2}{\partial t^2}x(3, t)
>>> x_ddt_at_3 = FieldVariable("phi", order=(2, 0), location=3)
  • \frac{\partial}{\partial t}x^2(z, t)
>>> x_dt_squared = FieldVariable("phi", order=(1, 0), exponent=2)
class TestFunction(function_label, order=0, location=None)[source]

Bases: pyinduct.placeholder.SpatialPlaceholder

Class that works as a placeholder for test-functions in an equation.

Parameters:
  • function_label (str) –
  • order (int) –
  • location
class EquationTerm(scale, arg)[source]

Bases: object

Base class for all accepted terms in a weak formulation.

Parameters:
  • scale
  • arg
class Input(function_handle, index=0, order=0, exponent=1)[source]

Bases: pyinduct.placeholder.Placeholder

Class that works as a placeholder for the input of a system.

Parameters:
  • function_handle (callable) –
  • index – If input is a vector, which element shall be used.
  • order – See Placeholder.
  • exponent – See FieldVariable.
class IntegralTerm(integrand, limits, scale=1.0)[source]

Bases: pyinduct.placeholder.EquationTerm

Class that represents an integral term in a weak equation.

Parameters:
  • integrand
  • limits (tuple) –
  • scale
class Placeholder(data, order=(0, 0), location=None)[source]

Bases: object

Base class that works as a placeholder for terms that are later parsed into a canonical form.

Parameters:
  • data (arbitrary) – Data to store in the placeholder.
  • order (tuple) – (temporal_order, spatial_order) derivative orders that are to be applied before evaluation.
  • location (numbers.Number) – Location to evaluate at before further computation.
derive(temp_order=0, spat_order=0)[source]

Mimics a copy constructor and adds the given derivative orders.

Note

The desired derivative orders temp_order and spat_order are added to the original orders.

Parameters:
  • temp_order – Temporal derivative order to be added.
  • spat_order – Spatial derivative order to be added.
Returns:

New Placeholder instance with the desired derivative order.

class Product(a, b=None)[source]

Bases: object

Represents a product.

Parameters:
  • a
  • b
get_arg_by_class(cls)[source]

Extract element from product that is an instance of cls.

Parameters:cls
Returns:
Return type:list
class ScalarFunction(function_label, order=0, location=None)[source]

Bases: pyinduct.placeholder.SpatialPlaceholder

Class that works as a placeholder for spatial-functions in an equation such as spatial dependent coefficients.

Parameters:
  • function_label (str) –
  • order (int) –
  • location
class ScalarTerm(argument, scale=1.0)[source]

Bases: pyinduct.placeholder.EquationTerm

Class that represents a scalar term in a weak equation.

Parameters:
  • argument
  • scale
class Scalars(values, target_term=None, target_weight_label=None)[source]

Bases: pyinduct.placeholder.Placeholder

Placeholder for scalars that will be replaced later.

Parameters:
  • values – Iterable object containing the scalars for every n-th equation.
  • target_term (dict) – Coefficient matrix to add_to().
  • target_weight_label (str) – Desired weight label.
class SpatialDerivedFieldVariable(function_label, order, weight_label=None, location=None)[source]

Bases: pyinduct.placeholder.FieldVariable

class SpatialPlaceholder(data, order=0, location=None)[source]

Bases: pyinduct.placeholder.Placeholder

Base class for all spatially-only dependent placeholders. The deeper meaning of this abstraction layer is to offer an easier to use interface.

derive(order=0)[source]
class TemporalDerivedFieldVariable(function_label, order, weight_label=None, location=None)[source]

Bases: pyinduct.placeholder.FieldVariable

get_common_target(scalars)[source]

Extracts the common target from list of scalars while making sure that targets are equivalent.

Parameters:scalars (Scalars) –
Returns:Weight label as string and common target as dict.
Return type:tuple