ParametricProblem#
Module for the ParametricProblem class
- class ParametricProblem[source]#
Bases:
AbstractProblem
The class for the definition of parametric problems, i.e., problems with parameters among the input variables.
Here’s an example of a spatial parametric ODE problem, i.e., a spatial ODE problem with an additional parameter alpha as coefficient of the derivative term.
- Example:
>>> from pina.problem import SpatialProblem, ParametricProblem >>> from pina.operators import grad >>> from pina.equations import Equation, FixedValue >>> from pina import Condition >>> from pina.geometry import CartesianDomain >>> import torch >>> >>> >>> class ParametricODE(SpatialProblem, ParametricProblem): >>> >>> output_variables = ['u'] >>> spatial_domain = CartesianDomain({'x': [0, 1]}) >>> parameter_domain = CartesianDomain({'alpha': [1, 10]}) >>> >>> def ode_equation(input_, output_): >>> u_x = grad(output_, input_, components=['u'], d=['x']) >>> u = output_.extract(['u']) >>> alpha = input_.extract(['alpha']) >>> return alpha * u_x - u >>> >>> conditions = { >>> 'x0': Condition(CartesianDomain({'x': 0, 'alpha':[1, 10]}), FixedValue(1.)), >>> 'D': Condition(CartesianDomain({'x': [0, 1], 'alpha':[1, 10]}), Equation(ode_equation))}
- property parameters#
The parameters’ variables of the problem.