cosapp.drivers.abstractsolver¶
Classes
|
Solve a System |
-
class
cosapp.drivers.abstractsolver.AbstractSolver(name: str, owner: Optional[cosapp.systems.System] = None, **kwargs)[source]¶ Bases:
cosapp.drivers.driver.DriverSolve a System
- Parameters
-
force_init¶
-
initial_values¶
-
load_solution(solution: Union[Dict[str, Union[numbers.Number, numpy.ndarray]], AnyStr], case: Optional[str] = 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¶
-
property
raw_problem¶ raw problem defined at solver level
- Type
-
abstract
resolution_method(fresidues: Callable[[Sequence[float], Union[float, str], bool], numpy.ndarray], x0: Sequence[float], args: Tuple[Union[float, str]] = (), options: Optional[cosapp.utils.options_dictionary.OptionsDictionary] = None) → cosapp.core.numerics.basics.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: Optional[str] = None) → Dict[str, Union[numbers.Number, List[numbers.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¶