CADETProcess.solution.SolutionBase#

class CADETProcess.solution.SolutionBase(name, time, component_system, solution, c_min)[source]#

Bases: Structure

Base class for solutions of component systems.

This class represents a solution of a component system at different time points. It provides several properties that allow access to information about the solution, such as the number of components, the total concentration, and the local purity.

Attributes:
namestr

Name of the solution.

timenp.ndarray

Array of time points.

solutionnp.ndarray

Array of solution values.

c_minfloat

Minimum concentration threshold, below which concentrations are considered zero.

dimensionslist of str

Names of the dimensions in the solution.

Notes

This class is not meant to be used directly, but to be subclassed by specific solution types.

c_min#

Parameter descriptor for unsigned floating-point parameters.

property component_coordinates: ndarray#

np.ndarray: Indices of the components.

component_system#

Mixin for parameters constrained to a specific type.

Typed extends the base Parameter class with type constraints. When instantiated with a specific type (ty), it ensures values are of that type or can be cast to that type. If ty is not specified during instantiation and is not predefined by a subclass, an error is raised.

Attributes:
tytype

An ordered collection of components defining the chemical system.

Methods

cast_value(value) -> Any:

Attempts to cast the value to the target type. By default, returns the value as is. Subclasses can override for specific casting behavior.

_prepare(instance, value, recursive=False) -> Any:

Prepares and optionally type-casts the value before checking its type. This method uses cast_value to attempt to cast the value to the required type.

_check(instance, value, recursive=False) -> bool:

Validates if the value matches the desired type (ty). Raises a TypeError if validation fails.

See also

Parameter
Bool
Integer
Tuple
Float
String
Dictionary

Notes

  • If ty is specified during instantiation, any value assigned to this parameter undergoes validation against this type.

  • Override cast_value in subclasses for custom casting logic.

  • Assigning None to the parameter removes its current value from the instance.

  • An error is raised during instantiation if ty is neither provided nor predefined by a subclass.

property coordinates: dict[str, ndarray]#

dict[str, np.ndarray]: Coordinates of the Solution.

property cycle_time: float#

float: Cycle time.

dimensions = ['time']#
property local_purity_components: ndarray#

np.ndarray: Local purity of each component.

property local_purity_species: ndarray#

np.ndarray: Local purity of components.

property n_comp: int#

int: Number of components.

name#

Parameter descriptor constrained to string values.

property nt: int#

int: Number of time steps.

solution#

Descriptor for NumPy arrays whose size may depend on other instance attributes.

property solution_shape: tuple[int]#

tuple[int]: (Expected) shape of the solution.

time#

Parameter descriptor for one-dimensional numpy arrays (vectors).

Attributes:
n_dimint

Dimensionality of the numpy array, set to 1 for vectors.

See also

Dimensionalized
NdArray

Examples

>>> class MyModel:
...     coordinates = Vector()
>>> model.coordinates = np.array([1, 2, 3])  # Valid
>>> model.coordinates = np.array([[1, 2], [3, 4]])  # Raises ValueError
property total_concentration: ndarray#

np.ndarray: Total concentration (sum) of all components.

property total_concentration_components: ndarray#

np.ndarray: Total concentration of components (sum of species).

update_solution() None[source]#

Update the solution.

update_transform() None[source]#

Update the transforms.