sympde.expr package¶
Submodules¶
sympde.expr.basic module¶
sympde.expr.equation module¶
- class sympde.expr.equation.BasicBoundaryCondition(*args)[source]¶
Bases:
Basic- default_assumptions = {}¶
- class sympde.expr.equation.Equation(lhs, rhs, trials, tests, bc=None, constraint=None)[source]¶
Bases:
Basic- property bc¶
- property constraint¶
- default_assumptions = {}¶
- property lhs¶
- property rhs¶
- property test_functions¶
- property trial_functions¶
- class sympde.expr.equation.EssentialBC(lhs, rhs, boundary, position=None, index_component=None)[source]¶
Bases:
BasicBoundaryCondition- property boundary¶
- default_assumptions = {}¶
- property index_component¶
- property lhs¶
- property normal_component¶
- property order¶
- property position¶
- property rhs¶
- property variable¶
- class sympde.expr.equation.Mean(lhs, rhs)[source]¶
Bases:
BasicConstraint- default_assumptions = {}¶
- property lhs¶
- property rhs¶
sympde.expr.errors module¶
- exception sympde.expr.errors.UnconsistentArgumentsError(*args, **kwargs)[source]¶
Bases:
UnconsistentError
- exception sympde.expr.errors.UnconsistentBCError(*args, **kwargs)[source]¶
Bases:
UnconsistentError
- exception sympde.expr.errors.UnconsistentLhsError(*args, **kwargs)[source]¶
Bases:
UnconsistentError
- exception sympde.expr.errors.UnconsistentLinearExpressionError(*args, **kwargs)[source]¶
Bases:
UnconsistentError
- exception sympde.expr.errors.UnconsistentRhsError(*args, **kwargs)[source]¶
Bases:
UnconsistentError
sympde.expr.evaluation module¶
- class sympde.expr.evaluation.Advection(axis, weight=1)[source]¶
Bases:
Basic1dForm- default_assumptions = {}¶
- class sympde.expr.evaluation.AdvectionT(axis, weight=1)[source]¶
Bases:
Basic1dForm- default_assumptions = {}¶
- class sympde.expr.evaluation.Basic1dForm(name, axis, weight=1)[source]¶
Bases:
AtomicExpr- property axis¶
- default_assumptions = {}¶
- property name¶
- property weight¶
- class sympde.expr.evaluation.Bilaplacian(axis, weight=1)[source]¶
Bases:
Basic1dForm- default_assumptions = {}¶
- class sympde.expr.evaluation.BoundaryExpression(target, expr)[source]¶
Bases:
KernelExpression- default_assumptions = {}¶
- class sympde.expr.evaluation.DomainExpression(target, expr)[source]¶
Bases:
KernelExpression- default_assumptions = {}¶
- class sympde.expr.evaluation.InterfaceExpression(target, u, v, expr)[source]¶
Bases:
KernelExpression- default_assumptions = {}¶
- property test¶
- property trial¶
- class sympde.expr.evaluation.KernelExpression(target, expr)[source]¶
Bases:
BasicA generic SymPDE expression
exprdefined over thetargetdomain. This is a lightweight object which stores just the input values. In addition, if the expression is a 1x1 matrix, the content of its only entry is taken.Parameters¶
- targetBasicDomain (from sympde.topology.basic)
The domain in which the expression is defined. This may be a Domain, a Boundary, an Interface, or an object of any subclasses.
- exprExpr (from sympy)
The mathematical expression.
- default_assumptions = {}¶
- property expr¶
- property target¶
- class sympde.expr.evaluation.Mass(axis, weight=1)[source]¶
Bases:
Basic1dForm- default_assumptions = {}¶
- class sympde.expr.evaluation.Stiffness(axis, weight=1)[source]¶
Bases:
Basic1dForm- default_assumptions = {}¶
- class sympde.expr.evaluation.TensorExpr(*_args, **kwargs)[source]¶
Bases:
CalculusFunction- default_assumptions = {}¶
- class sympde.expr.evaluation.TerminalExpr(expr, domain)[source]¶
Bases:
CalculusFunctionThis class takes a SymPDE expression and transforms its vector operators into atomic ones for a specified domain.
Parameters¶
- exprExpr or Matrix or ImmutableDenseMatrix or LogicalExpr
The mathematical expression.
- domainBasicDomain (from sympde.topology.basic)
The domain in which the expression is defined. This may be a Domain, a Boundary, an Interface, or an object of any subclasses.
- evaluatebool, optional
Whether the input expression should be evaluated (default = True).
Returns¶
- Expr | tuple[Expr] | TerminalExpr
The atomized expression. A tuple of expressions is returned in the case of
exprbeing a BasicForm (i.e. a BilinearForm, LinearForm, or Functional), as the domain could contain multiple patches. The transformation applied to the input argumentexprdepends on its exact type. Ifexprdoes not match any of the specificisinstancechecks, the input object is returned unchanged.
- default_assumptions = {}¶
- property domain¶
- classmethod eval(expr, domain)[source]¶
Process the whole AST of
exprto generate a new expression where the vector operators have been replaced by atomic operators. The inputdomainis used to determine essential information like the number of dimensions, the coordinate variables, the boundary orientation, etc.Parameters¶
- exprExpr (from sympy)
The mathematical expression.
- domainBasicDomain (from sympde.topology.basic)
The domain in which the expression is defined. This may be a Domain, a Boundary, an Interface, or an object of any subclasses.
Returns¶
- Expr | tuple[Expr] | TerminalExpr
The atomized expression. A tuple of expressions is returned in the case of
exprbeing a BasicForm (i.e. a BilinearForm, LinearForm, or Functional), as the domain could contain multiple patches. An unevaluatedTerminalExprobject (which only stores its arguments) is returned ifevaluate is False.
- property expr¶
sympde.expr.expr module¶
- class sympde.expr.expr.BilinearForm(arguments, expr, check_linearity=True, ignore_linearity_errors=False, **options)[source]¶
Bases:
BasicForm- property coordinates¶
- default_assumptions = {}¶
- property domain¶
- property expr¶
- is_bilinear = True¶
- property is_symmetric¶
- property ldim¶
- property test_functions¶
- property test_spaces¶
- property trial_functions¶
- property trial_spaces¶
- property variables¶
- class sympde.expr.expr.Functional(expr, domain, evaluate=True, **options)[source]¶
Bases:
BasicForm- property coordinates¶
- default_assumptions = {}¶
- property domain¶
- property expr¶
- is_functional = True¶
- property space¶
- class sympde.expr.expr.Integral(*args)[source]¶
Bases:
CalculusFunction- default_assumptions = {}¶
- property domain¶
- property expr¶
- is_boundary_integral = None¶
- is_domain_integral = None¶
- is_interface_integral = None¶
- class sympde.expr.expr.LinearExpr(arguments, expr, **options)[source]¶
Bases:
BasicExpr- default_assumptions = {}¶
- property expr¶
- is_linear = True¶
- property variables¶
- class sympde.expr.expr.LinearForm(arguments, expr, check_linearity=True, ignore_linearity_errors=False, **options)[source]¶
Bases:
BasicForm- property coordinates¶
- default_assumptions = {}¶
- property domain¶
- property expr¶
- is_linear = True¶
- property ldim¶
- property test_functions¶
- property test_spaces¶
- property variables¶
- class sympde.expr.expr.Norm(expr, domain, kind='l2', evaluate=True, **options)[source]¶
Bases:
Functional- default_assumptions = {}¶
- property exponent¶
- is_norm = True¶
- class sympde.expr.expr.SemiNorm(expr, domain, kind='l2', evaluate=True, **options)[source]¶
Bases:
Functional- default_assumptions = {}¶
- property exponent¶
- is_norm = True¶
- sympde.expr.expr.expand(expr)[source]¶
Expand an expression by making sure that Mul objects are evaluated by using the * operator (which might be overloaded by the types in the expression).
- sympde.expr.expr.is_linear_expression(expr, args, debug=True)[source]¶
Checks if expression is linear with respect to each argument in
args:Additivity: f(x + y) = f(x) + f(y)
Homogeneity: f(alpha * x) = alpha * f(x)
In general,
fmay have an arbitrary number of arguments:xandyrepresent independent copies of the same list of arguments.Parameters¶
- exprExpr
Symbolic expression to test.
- argsiterable
Arguments with respect to which expr is tested for linearity. Only one instance of each argument needs to be provided; the function internally creates the independent copies required for the additivity and homogeneity checks. Each argument must be ScalarFunction or VectorFunction.
- debugbool, optional
Print diagnostic info if a check fails.
Returns¶
- bool
True if the expression is linear with respect to all given arguments, False otherwise.
- sympde.expr.expr.linearize(form, fields, trials=None)[source]¶
Parameters¶
- formLinearForm
Linear form F(v; u) to be linearized. F is nonlinear in the parameter u
- fields{Scalar|Vector}Function or tuple
Function u with respect to which F should be differentiated. Tuple if element of ProductSpace.
- trials{Scalar|Vector}Function or tuple
Trial function to be used in resulting bilinear form.
Results¶
- aBilinearForm
a(u, v) is bilinear form obtained from linearization of F(v; u).