cosapp.drivers.runsinglecase¶
Functions
|
Extract the names of all variables involved in targets within problem. |
Classes
|
Set new boundary conditions and equations on the system. |
- class cosapp.drivers.runsinglecase.RunSingleCase(name: str, owner: System | None = None, **kwargs)[source]¶
Bases:
IterativeCase
Set new boundary conditions and equations on the system.
By default, it has a
RunOnce
driver as child to run the system.- case_values¶
List of requested variable assignments to set up the case
- Type:
List[AssignString]
- initial_values¶
List of variables to set with the values to set and associated indices selection
- Type:
Dict[str, Tuple[Any, Optional[numpy.ndarray]]]
- Parameters:
- add_equation(equation: str | Iterable[dict | str], *args, **kwargs) MathematicalProblem [source]¶
Add local equation(s). Shortcut to self.offdesign.add_equation(equation, *args, **kwargs).
More details in MathematicalProblem.add_equation.
- Parameters:
equation (-) – Equation or list of equations to add
*args (-) –
**kwargs (Forwarded to MathematicalProblem.add_equation)
- Returns:
The modified mathematical problem
- Return type:
- add_offdesign_problem(offdesign: MathematicalProblem) MathematicalProblem [source]¶
Add outer off-design problem to inner problem.
Returns:¶
- MathematicalProblem
The modified mathematical problem
- add_target(expression: str | Iterable[str], *args, **kwargs) MathematicalProblem [source]¶
Add deferred equation(s) on current point. Shortcut to self.offdesign.add_target(expression, *args, **kwargs).
More details in MathematicalProblem.add_target.
- Parameters:
expression (-) – Targetted expression
*args (-) –
**kwargs (Forwarded to MathematicalProblem.add_target)
- Returns:
The modified mathematical problem
- Return type:
- add_unknown(name: str | Iterable[dict | str], *args, **kwargs) MathematicalProblem [source]¶
Add local unknown(s). Shortcut to self.offdesign.add_unknown(name, *args, **kwargs).
More details in MathematicalProblem.add_unknown.
- Parameters:
name (-) – Name of the variable or list of variables to add
*args (-) –
**kwargs (Forwarded to MathematicalProblem.add_unknown)
- Returns:
The modified mathematical problem
- Return type:
- add_value(variable: str, value: Any) None [source]¶
Add a single variable to list of case values.
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:
variable (str) – Name of the variable
value (Any) – Value to be used.
Examples
>>> driver.add_value('myvar', 42)
- add_values(modifications: Dict[str, Any]) None [source]¶
Add a set of variables to the list of case values, from a dictionary of the kind {‘variable1’: value1, …}
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.add_values({'myvar': 42, 'port.dummy': 'banana'})
- property case_values: List[AssignString]¶
- property design: MathematicalProblem¶
Design problem solved for case
- Type:
- extend(problem: MathematicalProblem) MathematicalProblem [source]¶
Extend local problem. Shortcut to self.offdesign.extend(problem).
- Parameters:
problem (-)
- Returns:
The extended mathematical problem
- Return type:
- get_problem() MathematicalProblem [source]¶
Returns the full mathematical for the case.
- Returns:
The full mathematical problem to solve for the case
- Return type:
- merged_problem(copy=True) MathematicalProblem [source]¶
- property offdesign: MathematicalProblem¶
Local problem solved for case
- Type:
- problem: MathematicalProblem | None¶
- property processed_problems: DesignProblemHandler¶
design/off-design problem handler
- Type:
- set_values(modifications: Dict[str, Any]) None [source]¶
Enter the set of variables defining the case, from a dictionary of the kind {‘variable1’: value1, …} Note: will erase all previously defined values. Use ‘add_values’ to append new case values.
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_values({'myvar': 42, 'port.dummy': 'banana'})
- cosapp.drivers.runsinglecase.get_target_varnames(problem: MathematicalProblem) Set[str] [source]¶
Extract the names of all variables involved in targets within problem.
Parameters:¶
problem [MathematicalProblem]
Returns:¶
set[str]: set of variable names.