cosapp.drivers.abstractsolver¶
Classes
|
Solve a System |
- class cosapp.drivers.abstractsolver.AbstractSolver(name: str, owner: System | None = None, **options)[source]¶
Bases:
DriverSolve a System
- Parameters:
- add_recorder(recorder: AnyRecorder, history: bool | None = None) AnyRecorder[source]¶
Add an internal recorder storing the time evolution of values of interest.
- Parameters:
[BaseRecorder] (- recorder) – The recorder to be added.
[bool (- history) – Shortcut to modify the history option of the solver, if specified. Defaults to None. If the history option is set to True, the recorder will store the owner system’s state at each solver iteration. If set to False, the recorder will only store the final state.
optional] – Shortcut to modify the history option of the solver, if specified. Defaults to None. If the history option is set to True, the recorder will store the owner system’s state at each solver iteration. If set to False, the recorder will only store the final state.
- force_init: bool¶
- initial_values¶
- load_solution(solution: dict[str, Number | ndarray] | AnyStr, case: str | None = None)[source]¶
Load the provided solution to initialize the solver.
The solution can be provided directly as a dictionary or from a filename to be read.
- Parameters:
solution (dict[str, Union[Number, numpy.ndarray]] or str) – Dictionary of the latest solution to load or the filename in JSON format to read from.
case (str, optional) – Case to initialize with the solution; default None (i.e. will be guessed from variable name)
- problem: MathematicalProblem¶
- property raw_problem: MathematicalProblem¶
raw problem defined at solver level
- Type:
- abstract resolution_method(fresidues: Callable[[Sequence[float], float | str, bool], ndarray], x0: Sequence[float], args: tuple[float | str] = (), options: OptionsDictionary | None = None) SolverResults[source]¶
Function call to cancel the residues.
- Parameters:
fresidues (Callable[[Sequence[float], Union[float, str]], numpy.ndarray]) – Residues function taking two parameters (evaluation vector, time/ref) and returning the residues
x0 (Sequence[float]) – The initial values vector to converge to the solution
args (tuple[Union[float, str], bool], optional) – A tuple of additional argument for fresidues starting with the time/ref parameter and the need to update residues reference
options (OptionsDictionary, optional) – Options for the numerical resolution method
- Returns:
Solution container
- Return type:
- save_solution(file: str | None = None) dict[str, Number | list[Number]][source]¶
Save the latest solver solution.
If file is specified, the solution will be saved in it in JSON format.
- Parameters:
file (str, optional) – Filename to save the answer in; default None (i.e. data will not be saved)
- Returns:
Dictionary of the latest solution
- Return type:
dict[str, Union[Number, list[Number]]]
- solution: dict[str, float]¶