cosapp.drivers.fixedpoint

Functions

default_array_factory([shape, dtype])

Default factory for dataclass fields.

Classes

FixedPointSolver([name, owner])

Driver attempting to solve the internal cyclic dependencies of its owner System by iteratively running it.

SolverResults(x, r, success, message, tol, ...)

Data class for solver solution

class cosapp.drivers.fixedpoint.FixedPointSolver(name='solver', owner: System | None = None, **options)[source]

Bases: Driver

Driver attempting to solve the internal cyclic dependencies of its owner System by iteratively running it.

Parameters:
  • name (str) – Name of the driver

  • owner (System,) – System to which driver belongs.

  • **options (Any) – Keyword arguments used to set driver options

apply_init() None[source]

Apply initial values in owner system.

compute() None[source]

Execute drivers on all child System belonging to the driver System owner.

get_init() Dict[str, Any][source]

Get the initial values used by the solver.

Returns:

Dictionary of initial values, referenced by variable names.

Return type:

dict[str, Any]

initial_values: Dict[str, Boundary]
is_standalone() bool[source]

Is this Driver able to solve a system?

Returns:

Ability to solve a system or not.

Return type:

bool

problem: MathematicalProblem
results
run_once() None[source]

Run solver once, assuming driver has already been initialized.

set_init(modifications: Dict[str, Any]) None[source]

Define initial values for one or more variables.

The variable can be contextual child1.port2.var. The only rule is that it should belong to the owner System of this driver or any of its descendants.

Parameters:

modifications (dict[str, Any]) – Dictionary of (variable name, value)

Examples

>>> driver.set_init({'myvar': 42, 'foo.dummy': 'banana'})
setup_run()[source]

Method called once before starting any simulation.

class cosapp.drivers.fixedpoint.SolverResults(x: ~numpy.ndarray = <factory>, r: ~numpy.ndarray = <factory>, success: bool = False, message: str = '', tol: float = nan, n_iter: int = 0)[source]

Bases: object

Data class for solver solution

- x [numpy.ndarray[float]]

Solution vector.

- r [numpy.ndarray[float]]

Residue vector.

- success [bool]

Whether or not the solver exited successfully.

- message [str]

Description of the cause of the termination.

- tol [float, optional]

Tolerance level; NaN if not available.

- n_iter [int]

Number of iterations.

message: str = ''
n_iter: int = 0
r: ndarray
success: bool = False
tol: float = nan
x: ndarray
cosapp.drivers.fixedpoint.default_array_factory(shape=0, dtype=<class 'float'>)[source]

Default factory for dataclass fields.