cosapp.drivers.abstractsolver¶
Classes
|
Solve a System |
- class cosapp.drivers.abstractsolver.AbstractSolver(name: str, owner: cosapp.systems.System | None = None, **kwargs)[source]¶
Bases:
Driver
Solve a System
- Parameters:
- 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]¶