Condition#
- class Condition(*args, **kwargs)[source]#
Bases:
object
The class
Condition
is used to represent the constraints (physical equations, boundary conditions, etc.) that should be satisfied in the problem at hand. Condition objects are used to formulate the PINApina.problem.abstract_problem.AbstractProblem
object. Conditions can be specified in three ways:1. By specifying the input and output points of the condition; in such a case, the model is trained to produce the output points given the input points.
2. By specifying the location and the equation of the condition; in such a case, the model is trained to minimize the equation residual by evaluating it at some samples of the location.
3. By specifying the input points and the equation of the condition; in such a case, the model is trained to minimize the equation residual by evaluating it at the passed input points.
Example:
>>> example_domain = Span({'x': [0, 1], 'y': [0, 1]}) >>> def example_dirichlet(input_, output_): >>> value = 0.0 >>> return output_.extract(['u']) - value >>> example_input_pts = LabelTensor( >>> torch.tensor([[0, 0, 0]]), ['x', 'y', 'z']) >>> example_output_pts = LabelTensor(torch.tensor([[1, 2]]), ['a', 'b']) >>> >>> Condition( >>> input_points=example_input_pts, >>> output_points=example_output_pts) >>> Condition( >>> location=example_domain, >>> equation=example_dirichlet) >>> Condition( >>> input_points=example_input_pts, >>> equation=example_dirichlet)
Constructor for the Condition class.