ode_solvers_factory module¶
A factory to instantiate ODE solvers from their class names.
- class gemseo.algos.ode.ode_solvers_factory.ODESolversFactory(use_cache=False)[source]¶
Bases:
BaseAlgoFactory
This class instantiates and ODE solver from its class name.
- Parameters:
use_cache (bool) –
Whether to cache the created objects.
By default it is set to False.
- clear_lib_cache()¶
Clear the library cache.
- Return type:
None
- create(name)¶
Create a driver library from an algorithm name.
- Parameters:
name (str) – The name of an algorithm.
- Returns:
The driver.
- Raises:
ImportError – If the library is not available.
- Return type:
- execute(problem, algo_name='RK45', **options)[source]¶
Execute the solver.
Find the appropriate library and execute the solver on the problem to solve the ordinary differential equation
s(t)' = f(t, s(t))
- Parameters:
problem (ODEProblem) – The ordinary differential equation that defines the problem
algo_name (str) –
The algorithm name.
By default it is set to “RK45”.
**options (Any) – The options for the algorithm, see associated JSON file.
- Returns:
The solution.
- Return type:
- get_class(name)¶
Return a class from its name.
- Parameters:
name (str) – The name of the class.
- Returns:
The class.
- Raises:
ImportError – If the class is not available.
- Return type:
- get_library_name(name)¶
Return the name of the library related to the name of a class.
- is_available(name)¶
Check the availability of a library name or algorithm name.
Examples using ODESolversFactory¶
Solve an ODE: the Van der Pol problem