CADETProcess.solution.SolutionBase#
- class CADETProcess.solution.SolutionBase(name, time, component_system, solution, c_min)[source]#
Bases:
StructureBase 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.
- 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:
tytypeAn 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
ParameterBoolIntegerTupleFloatStringDictionary
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.
- dimensions = ['time']#
- name#
Parameter descriptor constrained to string values.
- solution#
Descriptor for NumPy arrays whose size may depend on other instance attributes.
- time#
Parameter descriptor for one-dimensional numpy arrays (vectors).
- Attributes:
- n_dimint
Dimensionality of the numpy array, set to 1 for vectors.
See also
DimensionalizedNdArray
Examples
>>> class MyModel: ... coordinates = Vector() >>> model.coordinates = np.array([1, 2, 3]) # Valid >>> model.coordinates = np.array([[1, 2], [3, 4]]) # Raises ValueError