Has Exact Solution Mixin (has_exact_solution_mixin)

class pypint.problems.has_exact_solution_mixin.HasExactSolutionMixin(*args, **kwargs)[source]

Bases: builtins.object

Provides exact analytical solution function for a problem.

__init__(*args, **kwargs)[source]
Parameters:exact_function (callable) – (optional) If given initializes the problem with the exact solution function.
exact(time)[source]

Evaluates given exact solution function at given time and with given time-dependent data.

Parameters:

time (float) – Time point \(t\)

Returns:

exact_solution

Return type:

numpy.ndarray

Raises:

ValueError

  • if time is not a float
  • if phi_of_time is not a numpy.ndarray
  • if not exact function is given
__weakref__

list of weak references to the object (if defined)

exact_function[source]

Accessor for the exact solution function.

Raises:ValueError – On setting, if the new exact solution function is not callable.
pypint.problems.has_exact_solution_mixin.problem_has_exact_solution(problem, checking_obj=None)[source]

Convenience accessor for exact solution.

Parameters:
  • problem (IProblem) – The problem to check for an exact solution function.
  • checking_obj (object) – (optional) The object calling this function for a meaningful error message. For debugging purposes only.
Returns:

has_exact_solutionTrue if exact solution was given, False otherwise

Return type:

bool

Raises:

ValueError – If the given problem is not an instance of IProblem.