cosapp.core.numerics.boundary¶
Classes
|
|
|
Numerical solver boundary. |
|
Explicit time derivative. |
|
Time-dependent solver unknown. |
|
Numerical solver unknown. |
-
class
cosapp.core.numerics.boundary.AbstractTimeUnknown(**kwargs)[source]¶ Bases:
abc.ABC-
property
constrained¶ is unknown constrained by a limiting time step?
- Type
bool
-
property
d_dt¶ Value of time derivative
-
abstract property
der¶ Expression of the time derivative, given as an EvalString
-
extrapolated_time_step(step: float) → float[source]¶ Time step necessary to attain a variation of step at a rate given by current value of the time derivative.
-
property
max_abs_step¶ Maximum absolute step in one iteration
- Type
float
-
abstract property
max_abs_step_expr¶ Expression of the maximum absolute step in one iteration, given as an EvalString.
-
property
max_time_step¶ Maximum admissible time step in one iteration
- Type
float
-
abstract property
max_time_step_expr¶ Expression of the maximum admissible time step, given as an EvalString.
-
property
-
class
cosapp.core.numerics.boundary.Boundary(context: cosapp.systems.System, name: str, mask: Optional[numpy.ndarray] = None, default: Union[Number, numpy.ndarray, None] = None, **kwargs)[source]¶ Bases:
objectNumerical solver boundary.
- Parameters
context (cosapp.systems.System) – System in which the boundary is defined.
name (str) – Name of the boundary
mask (numpy.ndarray or None) – Mask of the values in the vector boundary.
default (Number, numpy.ndarray or None) – Default value to set the boundary with.
-
property
basename¶ Contextual name of the boundary.
- Type
str
-
property
context¶ System in which the boundary is defined.
- Type
cosapp.systems.System
-
contextual_name(context: Optional[System] = None) → str[source]¶ str : Contextual name of the boundary, relative to context. If context is None (default), uses current variable context.
-
property
default_value¶ default value for the boundary.
- Type
Number, numpy.ndarray or None
-
property
mask¶ Mask of the values in the vector boundary.
- Type
numpy.ndarray or None
-
property
name¶ Contextual name of the boundary.
- Type
str
-
static
parse(context: cosapp.systems.System, name: str, mask: Optional[numpy.ndarray] = None) → SimpleNamespace[source]¶ Parse port and variable name from a name and its evaluation context. Also checks that the variable belongs to an input port.
- Parameters
context (-) – System in which the boundary is defined.
name (-) – Name of the boundary
mask (-) – Mask to apply on the variable; default is None (i.e. no mask)
- Returns
info – Structure containing fields varname, fullname, port and mask.
- Return type
SimpleNameSpace
-
property
ref¶ variable reference accessed by the boundary.
- Type
VariableReference
-
set_default_value(value: Optional[Union[numbers.Number, numpy.ndarray]], mask: Optional[numpy.ndarray] = None) → None[source]¶ Set the default value.
- Parameters
value (Number, numpy.ndarray or None) – Default value
mask (numpy.ndarray[bool] or None, optional) – Mask to apply on the default value; default None (i.e. no mask)
-
property
value¶ Current value of the boundary.
- Type
Number or numpy.ndarray
-
property
variable¶ name of the variable accessed by the boundary.
- Type
str
-
class
cosapp.core.numerics.boundary.TimeDerivative(context: cosapp.systems.System, name: str, source: Any, initial_value: Any = None)[source]¶ Bases:
cosapp.core.numerics.boundary.BoundaryExplicit time derivative.
- Parameters
context (cosapp.systems.System) – System in which the unknown is defined.
name (str) – Name of the variable
source (str) – Variable such that name = d(source)/dt
initial_value (Any) – Time derivative initial value
-
property
initial_value¶ Initial value of time derivative
-
property
initial_value_expr¶ Initial value of time derivative, returned as an EvalString
-
property
source¶ Value of the variable whose rate is evaluated
-
property
source_expr¶ Variable whose rate is evaluated, returned as an EvalString
-
static
source_type(expression: Any, context: cosapp.systems.System) → Tuple[source]¶ Static method to evaluate the type and default value of an expression used as rate source
-
to_dict() → Dict[str, Any][source]¶ Returns a JSONable representation of the time derivative.
- Returns
JSONable representation
- Return type
Dict[str, Any]
-
update(dt: numbers.Number) → numbers.Number[source]¶ Evaluate rate-of-change of source over time interval dt
-
property
value¶ Current value of the boundary.
- Type
Number or numpy.ndarray
-
class
cosapp.core.numerics.boundary.TimeUnknown(context: cosapp.systems.System, name: str, der: Any, max_time_step: Union[Number, str] = inf, max_abs_step: Union[Number, str] = inf, pulled_from: Optional[VariableReference] = None)[source]¶ Bases:
cosapp.core.numerics.boundary.Boundary,cosapp.core.numerics.boundary.AbstractTimeUnknownTime-dependent solver unknown.
- Parameters
context (cosapp.systems.System) – System in which the unknown is defined.
name (str) – Name of the unknown
-
max_time_step¶ Max time step authorized in one iteration; default numpy.inf
- Type
float
-
copy() → cosapp.core.numerics.boundary.TimeUnknown[source]¶ Copy time-dependent unknown object.
- Returns
Duplicated unknown
- Return type
-
property
d_dt¶ Value of time derivative
-
property
der¶ Expression of time derivative, given as an EvalString
-
static
der_type(expression: Any, context: cosapp.systems.System) → Tuple[EvalString, Any, Type][source]¶ Static method to evaluate the type and default value of an expression used as time derivative
-
property
max_abs_step¶ Maximum absolute step in one iteration
- Type
float
-
property
max_abs_step_expr¶ Maximum admissible step, given as an EvalString.
-
property
max_time_step¶ Maximum admissible time step in one iteration
- Type
float
-
property
max_time_step_expr¶ Maximum admissible time step, given as an EvalString.
-
property
pulled_from¶ Original time unknown before pulling; None otherwise.
- Type
VariableReference or None
-
reset() → None[source]¶ Reset transient unknown to a reference value. Inactive for class TimeUnknown.
-
to_dict() → Dict[str, Any][source]¶ Returns a JSONable representation of the transient unknown.
- Returns
JSONable representation
- Return type
Dict[str, Any]
-
property
value¶ Current value of the boundary.
- Type
Number or numpy.ndarray
-
class
cosapp.core.numerics.boundary.Unknown(context: cosapp.systems.System, name: str, max_abs_step: Number = inf, max_rel_step: Number = inf, lower_bound: Number = - inf, upper_bound: Number = inf, mask: Optional[numpy.ndarray] = None)[source]¶ Bases:
cosapp.core.numerics.boundary.BoundaryNumerical solver unknown.
- Parameters
context (cosapp.systems.System) – System in which the unknown is defined.
name (str) – Name of the unknown
lower_bound (float) – Minimum value authorized; default -numpy.inf
upper_bound (float) – Maximum value authorized; default numpy.inf
max_abs_step (float) – Max absolute step authorized in one iteration; default numpy.inf
max_rel_step (float) – Max relative step authorized in one iteration; default numpy.inf
mask (numpy.ndarray or None) – Mask of unknown values in the vector variable.
-
lower_bound¶ Minimum value authorized; default -numpy.inf
- Type
float
-
upper_bound¶ Maximum value authorized; default numpy.inf
- Type
float
-
max_abs_step¶ Largest absolute step authorized in one iteration; default numpy.inf
- Type
float
-
max_rel_step¶ Largest relative step authorized in one iteration; default numpy.inf
- Type
float
Notes
The dimensionality of the variable should be taken into account in the bounding process.
-
copy() → cosapp.core.numerics.boundary.Unknown[source]¶ Copy the unknown object.
- Returns
Duplicated unknown
- Return type