You're reading the documentation for a development version. For the latest stable documentation, please have a look at v5.1.X.
Parameter dependences#
A parameter dependence replaces a constant model parameter by a function, either of the states (cadet::model::IParameterStateDependence) or of other parameters (cadet::model::IParameterParameterDependence).
An example of the latter is a dispersion coefficient that depends on the flow velocity.
Dependence on states#
-
class IParameterStateDependence#
[source] Defines how a parameter depends on a state.
Represents the dependence of a parameter on the state (i.e., concentrations inside a cell). Scalar as well as vector-valued parameters are considered. Both simple and extended cells are supported. A simple cell contains only liquid phase components. An extended cell contains liquid and solid phase components.
Subclassed by cadet::model::ParameterStateDependenceBase
Public Functions
-
virtual const char *name() const noexcept = 0#
[source] Returns the name of the parameter dependence.
This name is also used to identify and create the dependence in the factory.
- Returns:
Name of the parameter dependence
-
virtual bool requiresConfiguration() const noexcept = 0#
[source] Returns whether the parameter dependence requires additional parameters supplied by configure().
After construction of an IParameterStateDependence object, configureModelDiscretization() is called. The parameter dependence may require to read additional parameters from the reaction group of the parameter provider. This opportunity is given by a call to configure(). However, a parameter dependence may not require this. This function communicates to the outside whether a call to configure() is necessary.
- Returns:
trueif configure() has to be called, otherwisefalse
-
virtual bool usesParamProviderInDiscretizationConfig() const noexcept = 0#
[source] Returns whether the parameter dependence uses the IParameterProvider in configureModelDiscretization().
If the IParameterProvider is used in configureModelDiscretization(), it has to be in the correct scope.
- Returns:
trueif the IParameterProvider is used in configureModelDiscretization(), otherwisefalse
-
virtual bool configureModelDiscretization(IParameterProvider ¶mProvider, unsigned int nComp, unsigned int const *nBound, unsigned int const *boundOffset) = 0#
[source] Sets the number of components in the model.
This function is called prior to configure() by the underlying model. It can only be called once. Model parameters are configured by configure().
- Parameters:
paramProvider – [in] Parameter provider
nComp – [in] Number of components
nBound – [in] Array of size
nCompwhich contains the number of bound states for each componentboundOffset – [in] Array of size
nCompwith offsets to the first bound state of each component beginning from the solid phase
-
virtual bool configure(IParameterProvider ¶mProvider, UnitOpIdx unitOpIdx, ParticleTypeIdx parTypeIdx, const std::string &name) = 0#
[source] Configures the model by extracting all non-structural parameters (e.g., model parameters) from the given
paramProvider.The scope of the cadet::IParameterProvider is left unchanged on return.
The structure of the model is left unchanged, that is, the number of degrees of freedom stays the same (e.g., number of bound states is left unchanged). Only true (non-structural) model parameters are read and changed. This function may only be called if configureModelDiscretization() has been called in the past. Contrary to configureModelDiscretization(), it can be called multiple times.
- Parameters:
paramProvider – [in] Parameter provider
unitOpIdx – [in] Index of the unit operation this parameter dependence belongs to
parTypeIdx – [in] Index of the particle type this parameter dependence belongs to
name – [in] Name of the parameter
- Returns:
trueif the configuration was successful, otherwisefalse
-
virtual int jacobianElementsPerRowLiquid() const noexcept = 0#
[source] Returns the maximum number of non-zero Jacobian elements per row in the liquid cell.
- Returns:
Maximum number of non-zero Jacobian elements per row in liquid cell
-
virtual int jacobianElementsPerRowCombined() const noexcept = 0#
[source] Returns the maximum number of non-zero Jacobian elements per row in the combined cell.
- Returns:
Maximum number of non-zero Jacobian elements per row in combined cell
-
virtual bool hasParameter(const ParameterId &pId) const = 0#
[source] Checks whether a given parameter exists.
- Parameters:
pId – [in] ParameterId that identifies the parameter uniquely
- Returns:
trueif the parameter exists, otherwisefalse
-
virtual std::unordered_map<ParameterId, double> getAllParameterValues() const = 0#
[source] Returns all parameters with their current values that can be made sensitive.
- Returns:
Map with all parameters that can be made sensitive along with their current value
-
virtual bool setParameter(const ParameterId &pId, int value) = 0#
[source] Sets a parameter value.
The parameter identified by its unique parameter is set to the given value.
- Parameters:
pId – [in] ParameterId that identifies the parameter uniquely
value – [in] Value of the parameter
- Returns:
trueif the parameter has been successfully set to the given value, otherwisefalse(e.g., if the parameter is not available in this model)
-
virtual active *getParameter(const ParameterId &pId) = 0#
[source] Returns a pointer to the parameter identified by the given id.
- Parameters:
pId – [in] Parameter Id of the sensitive parameter
- Returns:
a pointer to the parameter if the parameter dependence contains the parameter, otherwise
nullptr
-
virtual active liquidParameter(const ColumnPosition &colPos, const active ¶m, active const *y, int comp) const = 0#
[source] Evaluates the parameter of component
compin one liquid phase cell.This function is called simultaneously from multiple threads.
- Parameters:
colPos – [in] Position in normalized coordinates (column inlet = 0, column outlet = 1; outer shell = 1, inner center = 0)
param – [in] Value of the unmodified parameter
y – [in] Pointer to first component in the current cell
comp – [in] Index of the component the parameter belongs to (or
-1if independent of components)
- Returns:
Actual parameter value
-
virtual active liquidParameter(const ColumnPosition &colPos, const active ¶m, double const *y, int comp) const = 0#
[source]
-
virtual active liquidParameter(const ColumnPosition &colPos, double param, active const *y, int comp) const = 0#
[source]
-
virtual double liquidParameter(const ColumnPosition &colPos, double param, double const *y, int comp) const = 0#
[source]
-
virtual void analyticJacobianAdd(const ColumnPosition &colPos, double param, double const *y, int comp, double factor, int offset, linalg::BandMatrix::RowIterator jac) const = 0#
[source] Adds the analytical Jacobian of the parameter dependence for one liquid phase cell.
Adds the Jacobian of the parameter dependence for the given component and liquid phase cell to the full Jacobian. The Jacobian is premultiplied with a given factor. That is, this function realizes
\[ \begin{align} J = J + \gamma J_P \end{align} \]where \( J_P \) is the Jacobian of the parameter dependence.This function is called simultaneously from multiple threads. It can be left out (empty implementation) if AD is used to evaluate the Jacobian.
- Parameters:
colPos – [in] Position in normalized coordinates (column inlet = 0, column outlet = 1; outer shell = 1, inner center = 0)
param – [in] Value of the unmodified parameter
y – [in] Pointer to first component in the current cell
comp – [in] Index of the component the parameter belongs to (or
-1if independent of components)factor – [in] Factor \( \gamma \)
offset – [in] Diaognal offset in the row iterator
jac – [inout] Row iterator pointing to the row of component
compin the underlying matrix that stores the Jacobian
-
virtual void analyticJacobianAdd(const ColumnPosition &colPos, double param, double const *y, int comp, double factor, int offset, linalg::DenseBandedRowIterator jac) const = 0#
[source]
-
virtual void analyticJacobianAdd(const ColumnPosition &colPos, double param, double const *y, int comp, double factor, int offset, int row, linalg::DoubleSparseMatrix &jac) const = 0#
[source] Adds the analytical Jacobian of the parameter dependence for one liquid phase cell.
Adds the Jacobian of the parameter dependence for the given component and liquid phase cell to the full Jacobian. The Jacobian is premultiplied with a given factor. That is, this function realizes
\[ \begin{align} J = J + \gamma J_P \end{align} \]where \( J_P \) is the Jacobian of the parameter dependence.This function is called simultaneously from multiple threads. It can be left out (empty implementation) if AD is used to evaluate the Jacobian.
- Parameters:
colPos – [in] Position in normalized coordinates (column inlet = 0, column outlet = 1; outer shell = 1, inner center = 0)
param – [in] Value of the unmodified parameter
y – [in] Pointer to first component in the current cell
comp – [in] Index of the component the parameter belongs to (or
-1if independent of components)factor – [in] Factor \( \gamma \)
offset – [in] Offset in the row pointing to the first liquid phase component
row – [in] Row index
jac – [inout] Jacobian
-
virtual active combinedParameterLiquid(const ColumnPosition &colPos, const active ¶m, active const *yLiquid, active const *ySolid, int comp) const = 0#
[source] Evaluates the parameter of component
compin the liquid phase of one combined phase cell.This function is called simultaneously from multiple threads.
- Parameters:
colPos – [in] Position in normalized coordinates (column inlet = 0, column outlet = 1; outer shell = 1, inner center = 0)
param – [in] Value of the unmodified parameter
yLiquid – [in] Pointer to first component in the current cell’s liquid phase
ySolid – [in] Pointer to first component in the current cell’s solid phase
comp – [in] Index of the component the parameter belongs to (or
-1if independent of components)
- Returns:
Actual parameter value
-
virtual active combinedParameterLiquid(const ColumnPosition &colPos, const active ¶m, double const *yLiquid, double const *ySolid, int comp) const = 0#
[source]
-
virtual active combinedParameterLiquid(const ColumnPosition &colPos, double param, active const *yLiquid, active const *ySolid, int comp) const = 0#
[source]
-
virtual double combinedParameterLiquid(const ColumnPosition &colPos, double param, double const *yLiquid, double const *ySolid, int comp) const = 0#
[source]
-
virtual active combinedParameterSolid(const ColumnPosition &colPos, const active ¶m, active const *yLiquid, active const *ySolid, int bnd) const = 0#
[source] Evaluates the parameter of component
compin the solid phase of one combined phase cell.This function is called simultaneously from multiple threads.
- Parameters:
colPos – [in] Position in normalized coordinates (column inlet = 0, column outlet = 1; outer shell = 1, inner center = 0)
param – [in] Value of the unmodified parameter
yLiquid – [in] Pointer to first component in the current cell’s liquid phase
ySolid – [in] Pointer to first component in the current cell’s solid phase
bnd – [in] Index of the bound state the parameter belongs to (or
-1if independent of bound states)
- Returns:
Actual parameter value
-
virtual active combinedParameterSolid(const ColumnPosition &colPos, const active ¶m, double const *yLiquid, double const *ySolid, int bnd) const = 0#
[source]
-
virtual active combinedParameterSolid(const ColumnPosition &colPos, double param, active const *yLiquid, active const *ySolid, int bnd) const = 0#
[source]
-
virtual double combinedParameterSolid(const ColumnPosition &colPos, double param, double const *yLiquid, double const *ySolid, int bnd) const = 0#
[source]
-
virtual void analyticJacobianCombinedAddLiquid(const ColumnPosition &colPos, double param, double const *yLiquid, double const *ySolid, int comp, double factor, int offset, linalg::BandMatrix::RowIterator jac) const = 0#
[source] Adds the analytical Jacobian of the parameter dependence for the liquid phase in one combined phase cell.
Adds the Jacobian of the parameter dependence for the given component and combined phase cell to the full Jacobian. The Jacobian is premultiplied with a given factor. That is, this function realizes
\[ \begin{align} J = J + \gamma J_P \end{align} \]where \( J_P \) is the Jacobian of the parameter dependence.This function is called simultaneously from multiple threads. It can be left out (empty implementation) if AD is used to evaluate the Jacobian.
- Parameters:
colPos – [in] Position in normalized coordinates (column inlet = 0, column outlet = 1; outer shell = 1, inner center = 0)
param – [in] Value of the unmodified parameter
yLiquid – [in] Pointer to first component in the current cell’s liquid phase
ySolid – [in] Pointer to first component in the current cell’s solid phase
comp – [in] Index of the component the parameter belongs to (or
-1if independent of components)factor – [in] Factor \( \gamma \)
offset – [in] Diaognal offset in the row iterator
jac – [inout] Row iterator pointing to the row of component
compin the underlying matrix that stores the Jacobian
-
virtual void analyticJacobianCombinedAddLiquid(const ColumnPosition &colPos, double param, double const *yLiquid, double const *ySolid, int comp, double factor, int offset, linalg::DenseBandedRowIterator jac) const = 0#
[source]
-
virtual void analyticJacobianCombinedAddLiquid(const ColumnPosition &colPos, double param, double const *yLiquid, double const *ySolid, int comp, double factor, int offset, int row, linalg::DoubleSparseMatrix &jac) const = 0#
[source] Adds the analytical Jacobian of the parameter dependence for the liquid phase in one combined phase cell.
Adds the Jacobian of the parameter dependence for the given component and combined phase cell to the full Jacobian. The Jacobian is premultiplied with a given factor. That is, this function realizes
\[ \begin{align} J = J + \gamma J_P \end{align} \]where \( J_P \) is the Jacobian of the parameter dependence.This function is called simultaneously from multiple threads. It can be left out (empty implementation) if AD is used to evaluate the Jacobian.
- Parameters:
colPos – [in] Position in normalized coordinates (column inlet = 0, column outlet = 1; outer shell = 1, inner center = 0)
param – [in] Value of the unmodified parameter
yLiquid – [in] Pointer to first component in the current cell’s liquid phase
ySolid – [in] Pointer to first component in the current cell’s solid phase
comp – [in] Index of the component the parameter belongs to (or
-1if independent of components)factor – [in] Factor \( \gamma \)
offset – [in] Offset in the row pointing to the first liquid phase component
row – [in] Row index
jac – [inout] Jacobian
-
virtual void analyticJacobianCombinedAddSolid(const ColumnPosition &colPos, double param, double const *yLiquid, double const *ySolid, int bnd, double factor, int offset, linalg::BandMatrix::RowIterator jac) const = 0#
[source] Adds the analytical Jacobian of the parameter dependence for the solid phase in one combined phase cell.
Adds the Jacobian of the parameter dependence for the given bound state and combined phase cell to the full Jacobian. The Jacobian is premultiplied with a given factor. That is, this function realizes
\[ \begin{align} J = J + \gamma J_P \end{align} \]where \( J_P \) is the Jacobian of the parameter dependence.This function is called simultaneously from multiple threads. It can be left out (empty implementation) if AD is used to evaluate the Jacobian.
- Parameters:
colPos – [in] Position in normalized coordinates (column inlet = 0, column outlet = 1; outer shell = 1, inner center = 0)
param – [in] Value of the unmodified parameter
yLiquid – [in] Pointer to first component in the current cell’s liquid phase
ySolid – [in] Pointer to first component in the current cell’s solid phase
bnd – [in] Index of the bound state the parameter belongs to (or
-1if independent of bound states)factor – [in] Factor \( \gamma \)
offset – [in] Diaognal offset in the row iterator
jac – [inout] Row iterator pointing to the row of bound state
bndin the underlying matrix that stores the Jacobian
-
virtual void analyticJacobianCombinedAddSolid(const ColumnPosition &colPos, double param, double const *yLiquid, double const *ySolid, int bnd, double factor, int offset, linalg::DenseBandedRowIterator jac) const = 0#
[source]
-
virtual void analyticJacobianCombinedAddSolid(const ColumnPosition &colPos, double param, double const *yLiquid, double const *ySolid, int bnd, double factor, int offset, int row, linalg::DoubleSparseMatrix &jac) const = 0#
[source] Adds the analytical Jacobian of the parameter dependence for the solid phase in one combined phase cell.
Adds the Jacobian of the parameter dependence for the given bound state and combined phase cell to the full Jacobian. The Jacobian is premultiplied with a given factor. That is, this function realizes
\[ \begin{align} J = J + \gamma J_P \end{align} \]where \( J_P \) is the Jacobian of the parameter dependence.This function is called simultaneously from multiple threads. It can be left out (empty implementation) if AD is used to evaluate the Jacobian.
- Parameters:
colPos – [in] Position in normalized coordinates (column inlet = 0, column outlet = 1; outer shell = 1, inner center = 0)
param – [in] Value of the unmodified parameter
yLiquid – [in] Pointer to first component in the current cell’s liquid phase
ySolid – [in] Pointer to first component in the current cell’s solid phase
bnd – [in] Index of the bound state the parameter belongs to (or
-1if independent of bound states)factor – [in] Factor \( \gamma \)
offset – [in] Offset in the row pointing to the first liquid phase component
row – [in] Row index
jac – [inout] Jacobian
-
virtual const char *name() const noexcept = 0#
-
class ParameterStateDependenceBase : public cadet::model::IParameterStateDependence#
[source] Defines a ParameterStateDependence base class that can be used to implement other parameter dependences.
This base class can be used as a starting point for new parameter dependences. Some common parameter handling is provided using a hash map (std::unordered_map).
Subclassed by cadet::model::ColloidalAffinityLiquidSaltSolidParameterStateDependence, cadet::model::ConstantOneParameterStateDependence, cadet::model::ConstantZeroParameterStateDependence, cadet::model::ExpLiquidSaltSolidParameterStateDependence, cadet::model::IdentityParameterStateDependence, cadet::model::PowerLiquidSaltSolidParameterStateDependence
Public Functions
-
inline virtual bool requiresConfiguration() const noexcept#
[source] Returns whether the parameter dependence requires additional parameters supplied by configure().
After construction of an IParameterStateDependence object, configureModelDiscretization() is called. The parameter dependence may require to read additional parameters from the reaction group of the parameter provider. This opportunity is given by a call to configure(). However, a parameter dependence may not require this. This function communicates to the outside whether a call to configure() is necessary.
- Returns:
trueif configure() has to be called, otherwisefalse
-
inline virtual bool usesParamProviderInDiscretizationConfig() const noexcept#
[source] Returns whether the parameter dependence uses the IParameterProvider in configureModelDiscretization().
If the IParameterProvider is used in configureModelDiscretization(), it has to be in the correct scope.
- Returns:
trueif the IParameterProvider is used in configureModelDiscretization(), otherwisefalse
-
virtual bool configure(IParameterProvider ¶mProvider, UnitOpIdx unitOpIdx, ParticleTypeIdx parTypeIdx, const std::string &name)#
[source] Configures the model by extracting all non-structural parameters (e.g., model parameters) from the given
paramProvider.The scope of the cadet::IParameterProvider is left unchanged on return.
The structure of the model is left unchanged, that is, the number of degrees of freedom stays the same (e.g., number of bound states is left unchanged). Only true (non-structural) model parameters are read and changed. This function may only be called if configureModelDiscretization() has been called in the past. Contrary to configureModelDiscretization(), it can be called multiple times.
- Parameters:
paramProvider – [in] Parameter provider
unitOpIdx – [in] Index of the unit operation this parameter dependence belongs to
parTypeIdx – [in] Index of the particle type this parameter dependence belongs to
name – [in] Name of the parameter
- Returns:
trueif the configuration was successful, otherwisefalse
-
virtual bool configureModelDiscretization(IParameterProvider ¶mProvider, unsigned int nComp, unsigned int const *nBound, unsigned int const *boundOffset)#
[source] Sets the number of components in the model.
This function is called prior to configure() by the underlying model. It can only be called once. Model parameters are configured by configure().
- Parameters:
paramProvider – [in] Parameter provider
nComp – [in] Number of components
nBound – [in] Array of size
nCompwhich contains the number of bound states for each componentboundOffset – [in] Array of size
nCompwith offsets to the first bound state of each component beginning from the solid phase
-
virtual std::unordered_map<ParameterId, double> getAllParameterValues() const#
[source] Returns all parameters with their current values that can be made sensitive.
- Returns:
Map with all parameters that can be made sensitive along with their current value
-
virtual bool hasParameter(const ParameterId &pId) const#
[source] Checks whether a given parameter exists.
- Parameters:
pId – [in] ParameterId that identifies the parameter uniquely
- Returns:
trueif the parameter exists, otherwisefalse
-
virtual bool setParameter(const ParameterId &pId, int value)#
[source] Sets a parameter value.
The parameter identified by its unique parameter is set to the given value.
- Parameters:
pId – [in] ParameterId that identifies the parameter uniquely
value – [in] Value of the parameter
- Returns:
trueif the parameter has been successfully set to the given value, otherwisefalse(e.g., if the parameter is not available in this model)
Protected Functions
-
virtual bool configureImpl(IParameterProvider ¶mProvider, UnitOpIdx unitOpIdx, ParticleTypeIdx parTypeIdx, const std::string &name) = 0#
[source] Configures the parameter dependence model.
This function implements the (re-)configuration of a parameter dependence model. It is called when the parameter dependence model is configured or reconfigured. On call the _parameters map will always be empty.
- Parameters:
paramProvider – [in] Parameter provider
unitOpIdx – [in] Unit operation index
parTypeIdx – [in] Particle type index
name – [in] Name of the parameter
- Returns:
trueif the configuration was successful, otherwisefalse
-
inline virtual bool requiresConfiguration() const noexcept#
Dependence on other parameters#
-
class IParameterParameterDependence#
[source] Defines how a parameter depends on another parameter.
Represents the dependence of a parameter on another parameter.
Subclassed by cadet::model::ParameterParameterDependenceBase
Public Functions
-
virtual const char *name() const noexcept = 0#
[source] Returns the name of the parameter dependence.
This name is also used to identify and create the dependence in the factory.
- Returns:
Name of the parameter dependence
-
virtual bool requiresConfiguration() const noexcept = 0#
[source] Returns whether the parameter dependence requires additional parameters supplied by configure().
After construction of an IParameterParameterDependence object, configureModelDiscretization() is called. The parameter dependence may require to read additional parameters from the reaction group of the parameter provider. This opportunity is given by a call to configure(). However, a parameter dependence may not require this. This function communicates to the outside whether a call to configure() is necessary.
- Returns:
trueif configure() has to be called, otherwisefalse
-
virtual bool usesParamProviderInDiscretizationConfig() const noexcept = 0#
[source] Returns whether the parameter dependence uses the IParameterProvider in configureModelDiscretization().
If the IParameterProvider is used in configureModelDiscretization(), it has to be in the correct scope.
- Returns:
trueif the IParameterProvider is used in configureModelDiscretization(), otherwisefalse
-
virtual bool configureModelDiscretization(IParameterProvider ¶mProvider) = 0#
[source] Configures the parameter dependence.
This function is called prior to configure() by the underlying model. It can only be called once. Model parameters are configured by configure().
- Parameters:
paramProvider – [in] Parameter provider
-
virtual bool configure(IParameterProvider ¶mProvider, UnitOpIdx unitOpIdx, ParticleTypeIdx parTypeIdx, BoundStateIdx bndIdx, const std::string &name) = 0#
[source] Configures the model by extracting all non-structural parameters (e.g., model parameters) from the given
paramProvider.The scope of the cadet::IParameterProvider is left unchanged on return.
The structure of the model is left unchanged, that is, the number of degrees of freedom stays the same (e.g., number of bound states is left unchanged). Only true (non-structural) model parameters are read and changed. This function may only be called if configureModelDiscretization() has been called in the past. Contrary to configureModelDiscretization(), it can be called multiple times.
- Parameters:
paramProvider – [in] Parameter provider
unitOpIdx – [in] Index of the unit operation this parameter dependence belongs to
parTypeIdx – [in] Index of the particle type this parameter dependence belongs to
bndIdx – [in] Index of the bound state this parameter dependence belongs to
name – [in] Name of the parameter
- Returns:
trueif the configuration was successful, otherwisefalse
-
virtual bool hasParameter(const ParameterId &pId) const = 0#
[source] Checks whether a given parameter exists.
- Parameters:
pId – [in] ParameterId that identifies the parameter uniquely
- Returns:
trueif the parameter exists, otherwisefalse
-
virtual std::unordered_map<ParameterId, double> getAllParameterValues() const = 0#
[source] Returns all parameters with their current values that can be made sensitive.
- Returns:
Map with all parameters that can be made sensitive along with their current value
-
virtual bool setParameter(const ParameterId &pId, int value) = 0#
[source] Sets a parameter value.
The parameter identified by its unique parameter is set to the given value.
- Parameters:
pId – [in] ParameterId that identifies the parameter uniquely
value – [in] Value of the parameter
- Returns:
trueif the parameter has been successfully set to the given value, otherwisefalse(e.g., if the parameter is not available in this model)
-
virtual active *getParameter(const ParameterId &pId) = 0#
[source] Returns a pointer to the parameter identified by the given id.
- Parameters:
pId – [in] Parameter Id of the sensitive parameter
- Returns:
a pointer to the parameter if the parameter dependence contains the parameter, otherwise
nullptr
-
virtual double getValue(const ColumnPosition &colPos, int comp, int parType, int bnd) const = 0#
[source] Evaluates the parameter.
This function is called simultaneously from multiple threads.
- Parameters:
model – [in] Model that owns this parameter dependence
colPos – [in] Position in normalized coordinates (column inlet = 0, column outlet = 1; outer shell = 1, inner center = 0)
comp – [in] Index of the component the parameter belongs to (or
-1if independent of components)parType – [in] Index of the particle type the parameter belongs to (or
-1if independent of particle types)bnd – [in] Index of the bound state the parameter belongs to (or
-1if independent of bound states)
- Returns:
Actual parameter value
-
virtual active getValueActive(const ColumnPosition &colPos, int comp, int parType, int bnd) const = 0#
[source] Evaluates the parameter.
This function is called simultaneously from multiple threads.
- Parameters:
model – [in] Model that owns this parameter dependence
colPos – [in] Position in normalized coordinates (column inlet = 0, column outlet = 1; outer shell = 1, inner center = 0)
comp – [in] Index of the component the parameter belongs to (or
-1if independent of components)parType – [in] Index of the particle type the parameter belongs to (or
-1if independent of particle types)bnd – [in] Index of the bound state the parameter belongs to (or
-1if independent of bound states)
- Returns:
Actual parameter value
-
virtual double getValue(const ColumnPosition &colPos, int comp, int parType, int bnd, double val) const = 0#
[source] Evaluates the parameter.
This function is called simultaneously from multiple threads.
- Parameters:
model – [in] Model that owns this parameter dependence
colPos – [in] Position in normalized coordinates (column inlet = 0, column outlet = 1; outer shell = 1, inner center = 0)
comp – [in] Index of the component the parameter belongs to (or
-1if independent of components)parType – [in] Index of the particle type the parameter belongs to (or
-1if independent of particle types)bnd – [in] Index of the bound state the parameter belongs to (or
-1if independent of bound states)val – [in] Additional parameter-dependent value
- Returns:
Actual parameter value
-
virtual active getValue(const ColumnPosition &colPos, int comp, int parType, int bnd, const active &val) const = 0#
[source] Evaluates the parameter.
This function is called simultaneously from multiple threads.
- Parameters:
model – [in] Model that owns this parameter dependence
colPos – [in] Position in normalized coordinates (column inlet = 0, column outlet = 1; outer shell = 1, inner center = 0)
comp – [in] Index of the component the parameter belongs to (or
-1if independent of components)parType – [in] Index of the particle type the parameter belongs to (or
-1if independent of particle types)bnd – [in] Index of the bound state the parameter belongs to (or
-1if independent of bound states)val – [in] Additional parameter-dependent value
- Returns:
Actual parameter value
-
virtual const char *name() const noexcept = 0#
-
class ParameterParameterDependenceBase : public cadet::model::IParameterParameterDependence#
[source] Defines a ParameterParameterDependence base class that can be used to implement other parameter dependences.
This base class can be used as a starting point for new parameter dependences. Some common parameter handling is provided using a hash map (std::unordered_map).
Subclassed by cadet::model::ConstantOneParameterParameterDependence, cadet::model::ConstantZeroParameterParameterDependence, cadet::model::IdentityParameterParameterDependence, cadet::model::PowerLawParameterParameterDependence, cadet::model::VanDeemterParameterParameterDependence
Public Functions
-
inline virtual bool requiresConfiguration() const noexcept#
[source] Returns whether the parameter dependence requires additional parameters supplied by configure().
After construction of an IParameterParameterDependence object, configureModelDiscretization() is called. The parameter dependence may require to read additional parameters from the reaction group of the parameter provider. This opportunity is given by a call to configure(). However, a parameter dependence may not require this. This function communicates to the outside whether a call to configure() is necessary.
- Returns:
trueif configure() has to be called, otherwisefalse
-
inline virtual bool usesParamProviderInDiscretizationConfig() const noexcept#
[source] Returns whether the parameter dependence uses the IParameterProvider in configureModelDiscretization().
If the IParameterProvider is used in configureModelDiscretization(), it has to be in the correct scope.
- Returns:
trueif the IParameterProvider is used in configureModelDiscretization(), otherwisefalse
-
virtual bool configure(IParameterProvider ¶mProvider, UnitOpIdx unitOpIdx, ParticleTypeIdx parTypeIdx, BoundStateIdx bndIdx, const std::string &name)#
[source] Configures the model by extracting all non-structural parameters (e.g., model parameters) from the given
paramProvider.The scope of the cadet::IParameterProvider is left unchanged on return.
The structure of the model is left unchanged, that is, the number of degrees of freedom stays the same (e.g., number of bound states is left unchanged). Only true (non-structural) model parameters are read and changed. This function may only be called if configureModelDiscretization() has been called in the past. Contrary to configureModelDiscretization(), it can be called multiple times.
- Parameters:
paramProvider – [in] Parameter provider
unitOpIdx – [in] Index of the unit operation this parameter dependence belongs to
parTypeIdx – [in] Index of the particle type this parameter dependence belongs to
bndIdx – [in] Index of the bound state this parameter dependence belongs to
name – [in] Name of the parameter
- Returns:
trueif the configuration was successful, otherwisefalse
-
virtual bool configureModelDiscretization(IParameterProvider ¶mProvider)#
[source] Configures the parameter dependence.
This function is called prior to configure() by the underlying model. It can only be called once. Model parameters are configured by configure().
- Parameters:
paramProvider – [in] Parameter provider
-
virtual std::unordered_map<ParameterId, double> getAllParameterValues() const#
[source] Returns all parameters with their current values that can be made sensitive.
- Returns:
Map with all parameters that can be made sensitive along with their current value
-
virtual bool hasParameter(const ParameterId &pId) const#
[source] Checks whether a given parameter exists.
- Parameters:
pId – [in] ParameterId that identifies the parameter uniquely
- Returns:
trueif the parameter exists, otherwisefalse
-
virtual bool setParameter(const ParameterId &pId, int value)#
[source] Sets a parameter value.
The parameter identified by its unique parameter is set to the given value.
- Parameters:
pId – [in] ParameterId that identifies the parameter uniquely
value – [in] Value of the parameter
- Returns:
trueif the parameter has been successfully set to the given value, otherwisefalse(e.g., if the parameter is not available in this model)
Protected Functions
-
virtual bool configureImpl(IParameterProvider ¶mProvider, UnitOpIdx unitOpIdx, ParticleTypeIdx parTypeIdx, BoundStateIdx bndIdx, const std::string &name) = 0#
[source] Configures the parameter dependence model.
This function implements the (re-)configuration of a parameter dependence model. It is called when the parameter dependence model is configured or reconfigured. On call the _parameters map will always be empty.
- Parameters:
paramProvider – [in] Parameter provider
unitOpIdx – [in] Unit operation index
parTypeIdx – [in] Particle type index
bndIdx – [in] Bound state index
name – [in] Name of the parameter
- Returns:
trueif the configuration was successful, otherwisefalse
-
inline virtual bool requiresConfiguration() const noexcept#