:py:mod:`symfem.functionals` ============================ .. py:module:: symfem.functionals .. autoapi-nested-parse:: Functionals used to define the dual sets. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: symfem.functionals.BaseFunctional symfem.functionals.PointEvaluation symfem.functionals.WeightedPointEvaluation symfem.functionals.DerivativePointEvaluation symfem.functionals.PointDirectionalDerivativeEvaluation symfem.functionals.PointNormalDerivativeEvaluation symfem.functionals.PointComponentSecondDerivativeEvaluation symfem.functionals.PointInnerProduct symfem.functionals.DotPointEvaluation symfem.functionals.PointDivergenceEvaluation symfem.functionals.IntegralAgainst symfem.functionals.IntegralOfDivergenceAgainst symfem.functionals.IntegralOfDirectionalMultiderivative symfem.functionals.IntegralMoment symfem.functionals.DerivativeIntegralMoment symfem.functionals.DivergenceIntegralMoment symfem.functionals.TangentIntegralMoment symfem.functionals.NormalIntegralMoment symfem.functionals.NormalDerivativeIntegralMoment symfem.functionals.InnerProductIntegralMoment symfem.functionals.NormalInnerProductIntegralMoment Functions ~~~~~~~~~ .. autoapisummary:: symfem.functionals._to_tex symfem.functionals._nth Attributes ~~~~~~~~~~ .. autoapisummary:: symfem.functionals.ScalarValueOrFloat symfem.functionals.ListOfFunctionals .. py:data:: ScalarValueOrFloat .. py:function:: _to_tex(f: symfem.functions.FunctionInput, tfrac: bool = False) -> str Convert an expresson to TeX. :param f: the function :param tfrac: Should \\tfrac be used in the place of \\frac? :returns: The function as TeX .. py:function:: _nth(n: int) -> str Add th, st or nd to a number. :param n: The number :returns: The string (n)th, (n)st, (n)rd or (n)nd .. py:class:: BaseFunctional(reference: symfem.references.Reference, entity: Tuple[int, int], mapping: Union[str, None]) Bases: :py:obj:`abc.ABC` A functional. .. py:attribute:: name :value: 'Base functional' .. py:method:: entity_dim() -> int Get the dimension of the entity this DOF is associated with. :returns: The dimension of the entity this DOF is associated with .. py:method:: entity_number() -> int Get the number of the entity this DOF is associated with. :returns: The number of the entity this DOF is associated with .. py:method:: perform_mapping(fs: List[symfem.functions.AnyFunction], map: symfem.geometry.PointType, inverse_map: symfem.geometry.PointType) -> List[symfem.functions.AnyFunction] Map functions to a cell. :param fs: functions :param map: Map from the reference cell to a physical cell :param inverse_map: Map to the reference cell from a physical cell :returns: Mapped functions .. py:method:: entity_tex() -> str Get the entity the DOF is associated with in TeX format. :returns: TeX representation of entity .. py:method:: entity_definition() -> str Get the definition of the entity the DOF is associated with. :returns: The definition .. py:method:: dof_direction() -> Union[symfem.geometry.PointType, None] Get the direction of the DOF. :returns: The direction .. py:method:: eval(function: symfem.functions.AnyFunction, symbolic: bool = True) -> Union[symfem.functions.ScalarFunction, float] Apply to the functional to a function. :param function: The function :param symbolic: Should it be applied symbolically? :returns: The value of the functional for the function .. py:method:: dof_point() -> symfem.geometry.PointType :abstractmethod: Get the location of the DOF in the cell. :returns: The point .. py:method:: adjusted_dof_point() -> symfem.geometry.PointType Get the adjusted position of the DOF in the cell for plotting. :returns: The point .. py:method:: eval_symbolic(function: symfem.functions.AnyFunction) -> symfem.functions.ScalarFunction Symbolically apply the functional to a function. :param function: The function :returns: The value of the functional for the function .. py:method:: _eval_symbolic(function: symfem.functions.AnyFunction) -> symfem.functions.AnyFunction :abstractmethod: Apply to the functional to a function. :param function: The function :returns: The value of the functional for the function .. py:method:: get_tex() -> Tuple[str, List[str]] :abstractmethod: Get a representation of the functional as TeX, and list of terms involved. :returns: Representation of the functional as TeX, and list of terms involved .. py:class:: PointEvaluation(reference: symfem.references.Reference, point_in: symfem.functions.FunctionInput, entity: Tuple[int, int], mapping: Union[str, None] = 'identity') Bases: :py:obj:`BaseFunctional` A point evaluation. .. py:attribute:: name :value: 'Point evaluation' .. py:method:: _eval_symbolic(function: symfem.functions.AnyFunction) -> symfem.functions.AnyFunction Apply to the functional to a function. :param function: The function :returns: The value of the functional for the function .. py:method:: dof_point() -> symfem.geometry.PointType Get the location of the DOF in the cell. :returns: The point .. py:method:: adjusted_dof_point() -> symfem.geometry.PointType Get the adjusted position of the DOF in the cell for plotting. :returns: The point .. py:method:: get_tex() -> Tuple[str, List[str]] Get a representation of the functional as TeX, and list of terms involved. :returns: Representation of the functional as TeX, and list of terms involved .. py:class:: WeightedPointEvaluation(reference: symfem.references.Reference, point_in: symfem.functions.FunctionInput, weight: sympy.core.expr.Expr, entity: Tuple[int, int], mapping: Union[str, None] = 'identity') Bases: :py:obj:`BaseFunctional` A point evaluation. .. py:attribute:: name :value: 'Weighted point evaluation' .. py:method:: _eval_symbolic(function: symfem.functions.AnyFunction) -> symfem.functions.AnyFunction Apply to the functional to a function. :param function: The function :returns: The value of the functional for the function .. py:method:: dof_point() -> symfem.geometry.PointType Get the location of the DOF in the cell. :returns: The point .. py:method:: adjusted_dof_point() -> symfem.geometry.PointType Get the adjusted position of the DOF in the cell for plotting. :returns: The point .. py:method:: get_tex() -> Tuple[str, List[str]] Get a representation of the functional as TeX, and list of terms involved. :returns: Representation of the functional as TeX, and list of terms involved .. py:class:: DerivativePointEvaluation(reference: symfem.references.Reference, point_in: symfem.functions.FunctionInput, derivative: Tuple[int, Ellipsis], entity: Tuple[int, int], mapping: Optional[str] = None) Bases: :py:obj:`BaseFunctional` A point evaluation of a given derivative. .. py:attribute:: name :value: 'Point derivative evaluation' .. py:method:: _eval_symbolic(function: symfem.functions.AnyFunction) -> symfem.functions.AnyFunction Apply to the functional to a function. :param function: The function :returns: The value of the functional for the function .. py:method:: dof_point() -> symfem.geometry.PointType Get the location of the DOF in the cell. :returns: The point .. py:method:: adjusted_dof_point() -> symfem.geometry.PointType Get the adjusted position of the DOF in the cell for plotting. :returns: The point .. py:method:: perform_mapping(fs: List[symfem.functions.AnyFunction], map: symfem.geometry.PointType, inverse_map: symfem.geometry.PointType) -> List[symfem.functions.AnyFunction] Map functions to a cell. :param fs: functions :param map: Map from the reference cell to a physical cell :param inverse_map: Map to the reference cell from a physical cell :returns: Mapped functions .. py:method:: get_tex() -> Tuple[str, List[str]] Get a representation of the functional as TeX, and list of terms involved. :returns: Representation of the functional as TeX, and list of terms involved .. py:class:: PointDirectionalDerivativeEvaluation(reference: symfem.references.Reference, point_in: symfem.functions.FunctionInput, direction_in: symfem.functions.FunctionInput, entity: Tuple[int, int], mapping: Union[str, None] = 'identity') Bases: :py:obj:`BaseFunctional` A point evaluation of a derivative in a fixed direction. .. py:attribute:: name :value: 'Point evaluation of directional derivative' .. py:method:: _eval_symbolic(function: symfem.functions.AnyFunction) -> symfem.functions.AnyFunction Apply to the functional to a function. :param function: The function :returns: The value of the functional for the function .. py:method:: dof_point() -> symfem.geometry.PointType Get the location of the DOF in the cell. :returns: The point .. py:method:: dof_direction() -> Union[symfem.geometry.PointType, None] Get the direction of the DOF. :returns: The direction .. py:method:: adjusted_dof_point() -> symfem.geometry.PointType Get the adjusted position of the DOF in the cell for plotting. :returns: The point .. py:method:: get_tex() -> Tuple[str, List[str]] Get a representation of the functional as TeX, and list of terms involved. :returns: Representation of the functional as TeX, and list of terms involved .. py:class:: PointNormalDerivativeEvaluation(reference: symfem.references.Reference, point_in: symfem.functions.FunctionInput, edge: symfem.references.Reference, entity: Tuple[int, int], mapping: Union[str, None] = 'identity') Bases: :py:obj:`PointDirectionalDerivativeEvaluation` A point evaluation of a normal derivative. .. py:attribute:: name :value: 'Point evaluation of normal derivative' .. py:method:: get_tex() -> Tuple[str, List[str]] Get a representation of the functional as TeX, and list of terms involved. :returns: Representation of the functional as TeX, and list of terms involved .. py:class:: PointComponentSecondDerivativeEvaluation(reference: symfem.references.Reference, point_in: symfem.functions.FunctionInput, component: Tuple[int, int], entity: Tuple[int, int], mapping: Union[str, None] = 'identity') Bases: :py:obj:`BaseFunctional` A point evaluation of a component of a second derivative. .. py:attribute:: name :value: 'Point evaluation of Jacobian component' .. py:method:: _eval_symbolic(function: symfem.functions.AnyFunction) -> symfem.functions.AnyFunction Apply to the functional to a function. :param function: The function :returns: The value of the functional for the function .. py:method:: dof_point() -> symfem.geometry.PointType Get the location of the DOF in the cell. :returns: The point .. py:method:: adjusted_dof_point() -> symfem.geometry.PointType Get the adjusted position of the DOF in the cell for plotting. :returns: The point .. py:method:: get_tex() -> Tuple[str, List[str]] Get a representation of the functional as TeX, and list of terms involved. :returns: Representation of the functional as TeX, and list of terms involved .. py:class:: PointInnerProduct(reference: symfem.references.Reference, point_in: symfem.functions.FunctionInput, lvec: symfem.functions.FunctionInput, rvec: symfem.functions.FunctionInput, entity: Tuple[int, int], mapping: Union[str, None] = 'identity') Bases: :py:obj:`BaseFunctional` An evaluation of an inner product at a point. .. py:attribute:: name :value: 'Point inner product' .. py:method:: _eval_symbolic(function: symfem.functions.AnyFunction) -> symfem.functions.AnyFunction Apply to the functional to a function. :param function: The function :returns: The value of the functional for the function .. py:method:: dof_point() -> symfem.geometry.PointType Get the location of the DOF in the cell. :returns: The point .. py:method:: dof_direction() -> Union[symfem.geometry.PointType, None] Get the direction of the DOF. :returns: The direction .. py:method:: adjusted_dof_point() -> symfem.geometry.PointType Get the adjusted position of the DOF in the cell for plotting. :returns: The point .. py:method:: get_tex() -> Tuple[str, List[str]] Get a representation of the functional as TeX, and list of terms involved. :returns: Representation of the functional as TeX, and list of terms involved .. py:class:: DotPointEvaluation(reference: symfem.references.Reference, point_in: symfem.functions.FunctionInput, vector_in: symfem.functions.FunctionInput, entity: Tuple[int, int], mapping: Union[str, None] = 'identity') Bases: :py:obj:`BaseFunctional` A point evaluation in a given direction. .. py:attribute:: name :value: 'Dot point evaluation' .. py:method:: _eval_symbolic(function: symfem.functions.AnyFunction) -> symfem.functions.AnyFunction Apply to the functional to a function. :param function: The function :returns: The value of the functional for the function .. py:method:: dof_point() -> symfem.geometry.PointType Get the location of the DOF in the cell. :returns: The point .. py:method:: dof_direction() -> Union[symfem.geometry.PointType, None] Get the direction of the DOF. :returns: The direction .. py:method:: adjusted_dof_point() -> symfem.geometry.PointType Get the adjusted position of the DOF in the cell for plotting. :returns: The point .. py:method:: get_tex() -> Tuple[str, List[str]] Get a representation of the functional as TeX, and list of terms involved. :returns: Representation of the functional as TeX, and list of terms involved .. py:class:: PointDivergenceEvaluation(reference: symfem.references.Reference, point_in: symfem.functions.FunctionInput, entity: Tuple[int, int], mapping: Union[str, None] = 'identity') Bases: :py:obj:`BaseFunctional` A point evaluation of the divergence. .. py:attribute:: name :value: 'Point evaluation of divergence' .. py:method:: _eval_symbolic(function: symfem.functions.AnyFunction) -> symfem.functions.AnyFunction Apply to the functional to a function. :param function: The function :returns: The value of the functional for the function .. py:method:: dof_point() -> symfem.geometry.PointType Get the location of the DOF in the cell. :returns: The point .. py:method:: dof_direction() -> Union[symfem.geometry.PointType, None] Get the direction of the DOF. :returns: The direction .. py:method:: adjusted_dof_point() -> symfem.geometry.PointType Get the adjusted position of the DOF in the cell for plotting. :returns: The point .. py:method:: get_tex() -> Tuple[str, List[str]] Get a representation of the functional as TeX, and list of terms involved. :returns: Representation of the functional as TeX, and list of terms involved .. py:class:: IntegralAgainst(reference: symfem.references.Reference, f_in: symfem.functions.FunctionInput, entity: Tuple[int, int], mapping: Union[str, None] = 'identity') Bases: :py:obj:`BaseFunctional` An integral against a function. .. py:attribute:: f :type: symfem.functions.AnyFunction .. py:attribute:: name :value: 'Integral against' .. py:method:: dof_point() -> symfem.geometry.PointType Get the location of the DOF in the cell. :returns: The point .. py:method:: _eval_symbolic(function: symfem.functions.AnyFunction) -> symfem.functions.AnyFunction Apply to the functional to a function. :param function: The function :returns: The value of the functional for the function .. py:method:: dot(function: symfem.functions.AnyFunction) -> symfem.functions.ScalarFunction Dot a function with the moment function. :param function: The function :returns: The product of the function and the moment function .. py:method:: get_tex() -> Tuple[str, List[str]] Get a representation of the functional as TeX, and list of terms involved. :returns: Representation of the functional as TeX, and list of terms involved .. py:class:: IntegralOfDivergenceAgainst(reference: symfem.references.Reference, f_in: symfem.functions.FunctionInput, entity: Tuple[int, int], mapping: Union[str, None] = 'identity') Bases: :py:obj:`BaseFunctional` An integral of the divergence against a function. .. py:attribute:: name :value: 'Integral of divergence against' .. py:method:: dof_point() -> symfem.geometry.PointType Get the location of the DOF in the cell. :returns: The point .. py:method:: _eval_symbolic(function: symfem.functions.AnyFunction) -> symfem.functions.AnyFunction Apply to the functional to a function. :param function: The function :returns: The value of the functional for the function .. py:method:: dot(function: symfem.functions.ScalarFunction) -> symfem.functions.ScalarFunction Dot a function with the moment function. :param function: The function :returns: The product of the function and the moment function .. py:method:: get_tex() -> Tuple[str, List[str]] Get a representation of the functional as TeX, and list of terms involved. :returns: Representation of the functional as TeX, and list of terms involved .. py:class:: IntegralOfDirectionalMultiderivative(reference: symfem.references.Reference, directions: symfem.geometry.SetOfPoints, orders: Tuple[int, Ellipsis], entity: Tuple[int, int], scale: int = 1, mapping: Union[str, None] = 'identity') Bases: :py:obj:`BaseFunctional` An integral of a directional derivative of a scalar function. .. py:attribute:: name :value: 'Integral of a directional derivative' .. py:method:: dof_point() -> symfem.geometry.PointType Get the location of the DOF in the cell. :returns: The point .. py:method:: _eval_symbolic(function: symfem.functions.AnyFunction) -> symfem.functions.AnyFunction Apply to the functional to a function. :param function: The function :returns: The value of the functional for the function .. py:method:: perform_mapping(fs: List[symfem.functions.AnyFunction], map: symfem.geometry.PointType, inverse_map: symfem.geometry.PointType) -> List[symfem.functions.AnyFunction] Map functions to a cell. :param fs: functions :param map: Map from the reference cell to a physical cell :param inverse_map: Map to the reference cell from a physical cell :returns: Mapped functions .. py:method:: get_tex() -> Tuple[str, List[str]] Get a representation of the functional as TeX, and list of terms involved. :returns: Representation of the functional as TeX, and list of terms involved .. py:class:: IntegralMoment(reference: symfem.references.Reference, f_in: symfem.functions.FunctionInput, dof: BaseFunctional, entity: Tuple[int, int], mapping: Union[str, None] = 'identity', map_function: bool = True) Bases: :py:obj:`BaseFunctional` An integral moment. .. py:attribute:: f :type: symfem.functions.AnyFunction .. py:attribute:: name :value: 'Integral moment' .. py:method:: _eval_symbolic(function: symfem.functions.AnyFunction) -> symfem.functions.AnyFunction Apply to the functional to a function. :param function: The function :returns: The value of the functional for the function .. py:method:: dot(function: symfem.functions.AnyFunction) -> symfem.functions.ScalarFunction Dot a function with the moment function. :param function: The function :returns: The product of the function and the moment function .. py:method:: dof_point() -> symfem.geometry.PointType Get the location of the DOF in the cell. :returns: The point .. py:method:: dof_direction() -> Union[symfem.geometry.PointType, None] Get the direction of the DOF. :returns: The direction .. py:method:: get_tex() -> Tuple[str, List[str]] Get a representation of the functional as TeX, and list of terms involved. :returns: Representation of the functional as TeX, and list of terms involved .. py:class:: DerivativeIntegralMoment(reference: symfem.references.Reference, f: symfem.functions.FunctionInput, dot_with_in: symfem.functions.FunctionInput, dof: BaseFunctional, entity: Tuple[int, int], mapping: Union[str, None] = 'identity') Bases: :py:obj:`IntegralMoment` An integral moment of the derivative of a scalar function. .. py:attribute:: name :value: 'Derivative integral moment' .. py:method:: dot(function: symfem.functions.AnyFunction) -> symfem.functions.ScalarFunction Dot a function with the moment function. :param function: The function :returns: The product of the function and the moment function .. py:method:: dof_direction() -> Union[symfem.geometry.PointType, None] Get the direction of the DOF. :returns: The direction .. py:method:: _eval_symbolic(function: symfem.functions.AnyFunction) -> symfem.functions.AnyFunction Apply to the functional to a function. :param function: The function :returns: The value of the functional for the function .. py:class:: DivergenceIntegralMoment(reference: symfem.references.Reference, f_in: symfem.functions.FunctionInput, dof: BaseFunctional, entity: Tuple[int, int], mapping: Union[str, None] = 'identity') Bases: :py:obj:`IntegralMoment` An integral moment of the divergence of a vector function. .. py:attribute:: name :value: 'Integral moment of divergence' .. py:method:: _eval_symbolic(function: symfem.functions.AnyFunction) -> symfem.functions.AnyFunction Apply to the functional to a function. :param function: The function :returns: The value of the functional for the function .. py:method:: get_tex() -> Tuple[str, List[str]] Get a representation of the functional as TeX, and list of terms involved. :returns: Representation of the functional as TeX, and list of terms involved .. py:class:: TangentIntegralMoment(reference: symfem.references.Reference, f_in: symfem.functions.FunctionInput, dof: BaseFunctional, entity: Tuple[int, int], mapping: Union[str, None] = 'covariant') Bases: :py:obj:`IntegralMoment` An integral moment in the tangential direction. .. py:attribute:: name :value: 'Tangential integral moment' .. py:method:: dof_direction() -> Union[symfem.geometry.PointType, None] Get the direction of the DOF. :returns: The direction .. py:method:: get_tex() -> Tuple[str, List[str]] Get a representation of the functional as TeX, and list of terms involved. :returns: Representation of the functional as TeX, and list of terms involved .. py:class:: NormalIntegralMoment(reference: symfem.references.Reference, f_in: symfem.functions.FunctionInput, dof: BaseFunctional, entity: Tuple[int, int], mapping: Union[str, None] = 'contravariant') Bases: :py:obj:`IntegralMoment` An integral moment in the normal direction. .. py:attribute:: name :value: 'Normal integral moment' .. py:method:: dof_direction() -> Union[symfem.geometry.PointType, None] Get the direction of the DOF. :returns: The direction .. py:method:: get_tex() -> Tuple[str, List[str]] Get a representation of the functional as TeX, and list of terms involved. :returns: Representation of the functional as TeX, and list of terms involved .. py:class:: NormalDerivativeIntegralMoment(reference: symfem.references.Reference, f_in: symfem.functions.FunctionInput, dof: BaseFunctional, entity: Tuple[int, int], mapping: Union[str, None] = 'identity') Bases: :py:obj:`DerivativeIntegralMoment` An integral moment in the normal direction. .. py:attribute:: name :value: 'Normal derivative integral moment' .. py:method:: get_tex() -> Tuple[str, List[str]] Get a representation of the functional as TeX, and list of terms involved. :returns: Representation of the functional as TeX, and list of terms involved .. py:class:: InnerProductIntegralMoment(reference: symfem.references.Reference, f_in: symfem.functions.FunctionInput, inner_with_left_in: symfem.functions.FunctionInput, inner_with_right_in: symfem.functions.FunctionInput, dof: BaseFunctional, entity: Tuple[int, int], mapping: Union[str, None] = 'identity') Bases: :py:obj:`IntegralMoment` An integral moment of the inner product with a vector. .. py:attribute:: name :value: 'Inner product integral moment' .. py:method:: dot(function: symfem.functions.AnyFunction) -> symfem.functions.ScalarFunction Take the inner product of a function with the moment direction. :param function: The function :returns: The inner product of the function and the moment direction .. py:method:: dof_direction() -> Union[symfem.geometry.PointType, None] Get the direction of the DOF. :returns: The direction .. py:method:: get_tex() -> Tuple[str, List[str]] Get a representation of the functional as TeX, and list of terms involved. :returns: Representation of the functional as TeX, and list of terms involved .. py:class:: NormalInnerProductIntegralMoment(reference: symfem.references.Reference, f_in: symfem.functions.FunctionInput, dof: BaseFunctional, entity: Tuple[int, int], mapping: Union[str, None] = 'double_contravariant') Bases: :py:obj:`InnerProductIntegralMoment` An integral moment of the inner product with the normal direction. .. py:attribute:: name :value: 'Normal inner product integral moment' .. py:method:: get_tex() -> Tuple[str, List[str]] Get a representation of the functional as TeX, and list of terms involved. :returns: Representation of the functional as TeX, and list of terms involved .. py:data:: ListOfFunctionals