You're reading the documentation for a development version. For the latest stable documentation, please have a look at v5.1.X.

Binding models#

A binding model describes the exchange between the mobile and the stationary phase in a particle or bulk volume. Every binding model implements cadet::model::IBindingModel; most derive from cadet::model::BindingModelBase, which handles the common configuration.

Interface#

class IBindingModel#
[source]

Defines an internal BindingModel interface.

The binding model calculates the fluxes \( v\left( c_p, q \right) \) of the binding reactions between liquid and solid phase. There can be multiple bound states in the solid phase, if the binding model supports it. Some binding models require a dedicated salt component, which is always given by component 0.

Each binding reaction can be quasi-stationary, that is, it is always in equilibrium. A dynamic reaction generates the terms

\[\begin{split}\begin{align} \frac{\mathrm{d}c_{p,i}}{\mathrm{d}t} + \dots - \frac{1-\varepsilon_p}{\varepsilon_p} v_{i,j}\left( c_p, q \right) &= 0\\ \frac{\mathrm{d}q_{i,j}}{\mathrm{d}t} + \dots + v_{i,j}\left( c_p, q \right) &= 0 \end{align}\end{split}\]
where \( v_{i,j} \) is the flux of the reaction between \( c_{p,i} \) and \( q_{i,j} \). Here, \( q_{i,j} \) denotes bound state \( j \) of component \( i \).

A quasi-stationary reaction, on the other hand, results in

\[\begin{split}\begin{align} \frac{\mathrm{d}c_{p,i}}{\mathrm{d}t} + \frac{1-\varepsilon_p}{\varepsilon_p} \frac{\mathrm{d}q_{i,j}}{\mathrm{d}t} + \dots &= 0 \\ v_{i,j}\left( c_p, q \right) &= 0. \end{align}\end{split}\]

The ordering inside the solid phase is component-major, that means, all bound phases for each component are listed one after the other. For a model having 4 components with 1, 0, 3, 2 bound states, respectively, the ordering is comp0bnd0, comp2bnd0, comp2bnd1, comp2bnd2, comp3bnd0, comp3bnd1. Note that the second component is not present in the solid phase at all since it has no bound state. The bound states of the other components are ordered consecutively.

Subclassed by cadet::model::LinearBindingBase< LinearParamHandler >, cadet::model::LinearBindingBase< ExtLinearParamHandler >, cadet::model::BindingModelBase, cadet::model::DummyBinding, cadet::model::LinearBindingBase< ParamHandler_t >

Public Functions

inline virtual ~IBindingModel() noexcept#
[source]
virtual const char *name() const noexcept = 0#
[source]

Returns the name of the binding model.

This name is also used to identify and create the binding model in the factory.

Returns:

Name of the binding model

virtual bool requiresConfiguration() const noexcept = 0#
[source]

Returns whether the binding model requires additional parameters supplied by configure().

After construction of an IBindingModel object, configureModelDiscretization() is called. The binding model may require to read additional parameters from the adsorption group of the parameter provider. This opportunity is given by a call to configure(). However, a binding model may not require this. This function communicates to the outside whether a call to configure() is necessary.

Returns:

true if configure() has to be called, otherwise false

virtual bool usesParamProviderInDiscretizationConfig() const noexcept = 0#
[source]

Returns whether the dynamic reaction model uses the IParameterProvider in configureModelDiscretization().

If the IParameterProvider is used in configureModelDiscretization(), it has to be in the correct scope.

Returns:

true if the IParameterProvider is used in configureModelDiscretization(), otherwise false

virtual bool configureModelDiscretization(IParameterProvider &paramProvider, unsigned int nComp, unsigned int const *nBound, unsigned int const *boundOffset) = 0#
[source]

Sets fixed parameters of the binding model (e.g., the number of components and bound states).

This function is called prior to configure() by the underlying model. It can only be called once. Whereas non-structural model parameters (e.g., rate constants) are configured by configure(), this function sets structural parameters (e.g., number of components and bound states). In particular, it determines whether each binding reaction is quasi-stationary.

Before this function is called, usesParamProviderInDiscretizationConfig() is queried to determine whether the paramProvider is used by this function. If it is used, the paramProvider is put in the corresponding parameter scope. On exit, the paramProvider has to point to the same scope.

Parameters:
  • paramProvider – [in] Parameter provider

  • nComp – [in] Number of components

  • nBound – [in] Array of size nComp which contains the number of bound states for each component

  • boundOffset – [in] Array of size nComp with offsets to the first bound state of each component beginning from the solid phase

virtual bool configure(IParameterProvider &paramProvider, UnitOpIdx unitOpIdx, ParticleTypeIdx parTypeIdx) = 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 binding model belongs to

  • parTypeIdx – [in] Index of the particle type this binding model belongs to

Returns:

true if the configuration was successful, otherwise false

virtual void fillBoundPhaseInitialParameters(ParameterId *params, UnitOpIdx unitOpIdx, ParticleTypeIdx parTypeIdx) const noexcept = 0#
[source]

Returns the ParameterId of all bound phase initial conditions (equations).

The array has to be filled in the order of the equations.

Parameters:
  • params – [out] Array with ParameterId objects to fill

  • unitOpIdx – [in] Index of the unit operation this binding model belongs to

  • parTypeIdx – [in] Index of the particle type this binding model belongs to

virtual void setExternalFunctions(IExternalFunction **extFuns, unsigned int size) = 0#
[source]

Sets external functions for this binding model.

The external functions are not owned by this IBindingModel.

Parameters:
  • extFuns – [in] Pointer to array of IExternalFunction objects of size size

  • size – [in] Number of elements in the IExternalFunction array extFuns

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:

true if the parameter exists, otherwise false

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:

true if the parameter has been successfully set to the given value, otherwise false (e.g., if the parameter is not available in this model)

virtual bool setParameter(const ParameterId &pId, double value) = 0#
[source]
virtual bool setParameter(const ParameterId &pId, bool value) = 0#
[source]
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 binding model contains the parameter, otherwise nullptr

virtual bool hasSalt() const noexcept = 0#
[source]

Returns whether this binding model has a salt component.

The salt component is given by component 0, if present.

Returns:

true if salt is required, otherwise false

virtual bool supportsMultistate() const noexcept = 0#
[source]

Returns whether this binding model supports multi-state binding.

Returns:

true if multi-state binding is supported, otherwise false

virtual bool supportsNonBinding() const noexcept = 0#
[source]

Returns whether this binding model supports non-binding components.

Non-binding components do not have an entry in the solid phase.

Returns:

true if non-binding components are supported, otherwise false

virtual bool hasQuasiStationaryReactions() const noexcept = 0#
[source]

Returns whether this binding model has quasi-stationary reaction fluxes.

Returns:

true if quasi-stationary fluxes are present, otherwise false

virtual bool hasDynamicReactions() const noexcept = 0#
[source]

Returns whether this binding model has dynamic reaction fluxes.

Returns:

true if dynamic fluxes are present, otherwise false

virtual bool dependsOnTime() const noexcept = 0#
[source]

Returns whether this binding model depends on time.

Binding models may depend on time if external functions are used.

Returns:

true if the model is time-dependent, otherwise false

virtual bool requiresWorkspace() const noexcept = 0#
[source]

Returns whether this binding model requires workspace.

The workspace may be required for consistent initialization and / or evaluation of residual and Jacobian. A workspace is a memory buffer whose size is given by workspaceSize().

Returns:

true if the model requires a workspace, otherwise false

virtual unsigned int workspaceSize(unsigned int nComp, unsigned int totalNumBoundStates, unsigned int const *nBoundStates) const noexcept = 0#
[source]

Returns the size of the required workspace in bytes.

The memory is required for externally dependent binding models.

Parameters:
  • nComp – [in] Number of components

  • totalNumBoundStates – [in] Total number of bound states

  • nBoundStates – [in] Array with bound states for each component

Returns:

Size of the workspace in bytes

virtual unsigned int requiredADdirs() const noexcept = 0#
[source]

Returns the amount of required AD seed vectors / directions.

Only internally required AD directions count (e.g., for Jacobian computation). Directions used for parameter sensitivities should not be included here.

Returns:

The number of required AD seed vectors / directions

virtual int flux(double t, unsigned int secIdx, const ColumnPosition &colPos, active const *y, active const *yCp, active *res, LinearBufferAllocator workSpace, WithParamSensitivity) const = 0#
[source]

Evaluates the fluxes.

The binding model is responsible for calculating the flux from the mobile to the solid phase.

     This function is called simultaneously from multiple threads.
     It needs to overwrite all values of @p res as the result array @p res is not
     zeroed on entry.

Parameters:
  • t – [in] Current time point

  • secIdx – [in] Index of the current section

  • colPos – [in] Position in normalized coordinates (column inlet = 0, column outlet = 1; outer shell = 1, inner center = 0)

  • y – [in] Pointer to first bound state of the first component in the current particle shell

  • yCp – [in] Pointer to first component of the mobile phase in the current particle shell

  • res – [out] Pointer to result array that is filled with the fluxes

  • workSpace – [inout] Memory work space

Returns:

0 on success, -1 on non-recoverable error, and +1 on recoverable error

virtual int flux(double t, unsigned int secIdx, const ColumnPosition &colPos, active const *y, active const *yCp, active *res, LinearBufferAllocator workSpace, WithoutParamSensitivity) const = 0#
[source]
virtual int flux(double t, unsigned int secIdx, const ColumnPosition &colPos, double const *y, double const *yCp, active *res, LinearBufferAllocator workSpace) const = 0#
[source]
virtual int flux(double t, unsigned int secIdx, const ColumnPosition &colPos, double const *y, double const *yCp, double *res, LinearBufferAllocator workSpace) const = 0#
[source]
virtual void analyticJacobian(double t, unsigned int secIdx, const ColumnPosition &colPos, double const *y, int offsetCp, linalg::BandMatrix::RowIterator jac, LinearBufferAllocator workSpace) const = 0#
[source]

Evaluates the Jacobian of the fluxes analytically.

This function is called simultaneously from multiple threads. It can be left out (empty implementation) if AD is used to evaluate the Jacobian.

The Jacobian matrix is assumed to be zeroed out by the caller.

Parameters:
  • t – [in] Current time point

  • secIdx – [in] Index of the current section

  • colPos – [in] Position in normalized coordinates (column inlet = 0, column outlet = 1; outer shell = 1, inner center = 0)

  • y – [in] Pointer to first bound state of the first component in the current particle shell

  • offsetCp – [in] Offset from the first component of the mobile phase in the current particle shell to y

  • jac – [inout] Row iterator pointing to the first bound states row of the underlying matrix in which the Jacobian is stored

  • workSpace – [inout] Memory work space

virtual void analyticJacobian(double t, unsigned int secIdx, const ColumnPosition &colPos, double const *y, int offsetCp, linalg::DenseBandedRowIterator jac, LinearBufferAllocator workSpace) const = 0#
[source]
virtual void analyticJacobian(double t, unsigned int secIdx, const ColumnPosition &colPos, double const *y, int offsetCp, linalg::BandedEigenSparseRowIterator jac, LinearBufferAllocator workSpace) const = 0#
[source]
virtual void timeDerivativeQuasiStationaryFluxes(double t, unsigned int secIdx, const ColumnPosition &colPos, double const *yCp, double const *y, double *dResDt, LinearBufferAllocator workSpace) const = 0#
[source]

Calculates the time derivative of the quasi-stationary bound state equations.

Calculates \( \frac{\partial \text{flux}_{\text{qs}}}{\partial t} \) for the quasi-stationary equations in the flux.

This function is called simultaneously from multiple threads. It can be left out (empty implementation) which leads to slightly incorrect initial conditions when using externally dependent binding models.

Parameters:
  • t – [in] Current time point

  • secIdx – [in] Index of the current section

  • colPos – [in] Position in normalized coordinates (column inlet = 0, column outlet = 1; outer shell = 1, inner center = 0)

  • yCp – [in] Pointer to first component in the liquid phase of the current particle shell

  • y – [in] Pointer to first bound state of the first component in the current particle shell

  • dResDt – [out] Pointer to array that stores the time derivative

  • workSpace – [inout] Memory work space

virtual int const *reactionQuasiStationarity() const noexcept = 0#
[source]

Returns an array that determines whether each binding reaction is quasi-stationary.

Each entry represents a truth value (converts to bool) that determines whether the corresponding binding reaction is quasi-stationary (true) or not (false).

Returns:

Array that determines quasi-stationarity of binding reactions

virtual bool preConsistentInitialState(double t, unsigned int secIdx, const ColumnPosition &colPos, double *y, double const *yCp, LinearBufferAllocator workSpace) const = 0#
[source]

Returns whether a nonlinear solver is required to perform consistent initialization.

This function is called before a nonlinear solver attempts to solve the algebraic equations. If consistent initialization can be performed using analytic / direct formulas (i.e., without running a nonlinear solver), this function would be the correct place to do it.

This function is called simultaneously from multiple threads.

Parameters:
  • t – [in] Current time point

  • secIdx – [in] Index of the current section

  • colPos – [in] Position in normalized coordinates (column inlet = 0, column outlet = 1; outer shell = 1, inner center = 0)

  • y – [inout] Pointer to first bound state of the first component in the current particle shell

  • yCp – [in] Pointer to first component of the mobile phase in the current particle shell

  • workSpace – [inout] Memory work space

Returns:

true if a nonlinear solver is required for consistent initialization, otherwise false

virtual void postConsistentInitialState(double t, unsigned int secIdx, const ColumnPosition &colPos, double *y, double const *yCp, LinearBufferAllocator workSpace) const = 0#
[source]

Called after a nonlinear solver has attempted consistent initialization.

In consistent initialization, first preConsistentInitialState() is called. Depending on the return value, a nonlinear solver is applied to the algebraic equations and, afterwards, this function is called to clean up or refine the solution.

This function is called simultaneously from multiple threads.

Parameters:
  • t – [in] Current time point

  • secIdx – [in] Index of the current section

  • colPos – [in] Position in normalized coordinates (column inlet = 0, column outlet = 1; outer shell = 1, inner center = 0)

  • y – [inout] Pointer to first bound state of the first component in the current particle shell

  • yCp – [in] Pointer to first component of the mobile phase in the current particle shell

  • workSpace – [inout] Memory work space

Base class#

class BindingModelBase : public cadet::model::IBindingModel#
[source]

Defines a BindingModel base class that can be used to implement other binding models.

This base class can be used as a starting point for new binding models. Some common parameter handling is provided using a hash map (std::unordered_map).

By default, this base class assumes that the binding model does not use salt and does not support multiple bound states. Non-binding components are assumed to be supported, though. Note that these default settings can be overwritten and do not influence the features provided by this base class.

Subclassed by cadet::model::ParamHandlerBindingModelBase< ParamHandler_t >, cadet::model::ParamHandlerBindingModelBase< handler_t >, cadet::model::SimplifiedMultiStateStericMassActionBinding

Public Functions

inline virtual bool requiresConfiguration() const noexcept#
[source]

Returns whether the binding model requires additional parameters supplied by configure().

After construction of an IBindingModel object, configureModelDiscretization() is called. The binding model may require to read additional parameters from the adsorption group of the parameter provider. This opportunity is given by a call to configure(). However, a binding model may not require this. This function communicates to the outside whether a call to configure() is necessary.

Returns:

true if configure() has to be called, otherwise false

inline virtual bool usesParamProviderInDiscretizationConfig() const noexcept#
[source]

Returns whether the dynamic reaction model uses the IParameterProvider in configureModelDiscretization().

If the IParameterProvider is used in configureModelDiscretization(), it has to be in the correct scope.

Returns:

true if the IParameterProvider is used in configureModelDiscretization(), otherwise false

virtual bool configure(IParameterProvider &paramProvider, UnitOpIdx unitOpIdx, ParticleTypeIdx parTypeIdx)#
[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 binding model belongs to

  • parTypeIdx – [in] Index of the particle type this binding model belongs to

Returns:

true if the configuration was successful, otherwise false

virtual bool configureModelDiscretization(IParameterProvider &paramProvider, unsigned int nComp, unsigned int const *nBound, unsigned int const *boundOffset)#
[source]

Sets fixed parameters of the binding model (e.g., the number of components and bound states).

This function is called prior to configure() by the underlying model. It can only be called once. Whereas non-structural model parameters (e.g., rate constants) are configured by configure(), this function sets structural parameters (e.g., number of components and bound states). In particular, it determines whether each binding reaction is quasi-stationary.

Before this function is called, usesParamProviderInDiscretizationConfig() is queried to determine whether the paramProvider is used by this function. If it is used, the paramProvider is put in the corresponding parameter scope. On exit, the paramProvider has to point to the same scope.

Parameters:
  • paramProvider – [in] Parameter provider

  • nComp – [in] Number of components

  • nBound – [in] Array of size nComp which contains the number of bound states for each component

  • boundOffset – [in] Array of size nComp with offsets to the first bound state of each component beginning from the solid phase

virtual void fillBoundPhaseInitialParameters(ParameterId *params, UnitOpIdx unitOpIdx, ParticleTypeIdx parTypeIdx) const noexcept#
[source]

Returns the ParameterId of all bound phase initial conditions (equations).

The array has to be filled in the order of the equations.

Parameters:
  • params – [out] Array with ParameterId objects to fill

  • unitOpIdx – [in] Index of the unit operation this binding model belongs to

  • parTypeIdx – [in] Index of the particle type this binding model belongs to

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:

true if the parameter exists, otherwise false

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:

true if the parameter has been successfully set to the given value, otherwise false (e.g., if the parameter is not available in this model)

virtual active *getParameter(const ParameterId &pId)#
[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 binding model contains the parameter, otherwise nullptr

inline virtual bool hasSalt() const noexcept#
[source]

Returns whether this binding model has a salt component.

The salt component is given by component 0, if present.

Returns:

true if salt is required, otherwise false

inline virtual bool supportsMultistate() const noexcept#
[source]

Returns whether this binding model supports multi-state binding.

Returns:

true if multi-state binding is supported, otherwise false

inline virtual bool supportsNonBinding() const noexcept#
[source]

Returns whether this binding model supports non-binding components.

Non-binding components do not have an entry in the solid phase.

Returns:

true if non-binding components are supported, otherwise false

inline virtual bool requiresWorkspace() const noexcept#
[source]

Returns whether this binding model requires workspace.

The workspace may be required for consistent initialization and / or evaluation of residual and Jacobian. A workspace is a memory buffer whose size is given by workspaceSize().

Returns:

true if the model requires a workspace, otherwise false

inline virtual unsigned int workspaceSize(unsigned int nComp, unsigned int totalNumBoundStates, unsigned int const *nBoundStates) const noexcept#
[source]

Returns the size of the required workspace in bytes.

The memory is required for externally dependent binding models.

Parameters:
  • nComp – [in] Number of components

  • totalNumBoundStates – [in] Total number of bound states

  • nBoundStates – [in] Array with bound states for each component

Returns:

Size of the workspace in bytes

inline virtual void setExternalFunctions(IExternalFunction **extFuns, unsigned int size)#
[source]

Sets external functions for this binding model.

The external functions are not owned by this IBindingModel.

Parameters:
  • extFuns – [in] Pointer to array of IExternalFunction objects of size size

  • size – [in] Number of elements in the IExternalFunction array extFuns

inline virtual void timeDerivativeQuasiStationaryFluxes(double t, unsigned int secIdx, const ColumnPosition &colPos, double const *yCp, double const *y, double *dResDt, LinearBufferAllocator workSpace) const#
[source]

Calculates the time derivative of the quasi-stationary bound state equations.

Calculates \( \frac{\partial \text{flux}_{\text{qs}}}{\partial t} \) for the quasi-stationary equations in the flux.

This function is called simultaneously from multiple threads. It can be left out (empty implementation) which leads to slightly incorrect initial conditions when using externally dependent binding models.

Parameters:
  • t – [in] Current time point

  • secIdx – [in] Index of the current section

  • colPos – [in] Position in normalized coordinates (column inlet = 0, column outlet = 1; outer shell = 1, inner center = 0)

  • yCp – [in] Pointer to first component in the liquid phase of the current particle shell

  • y – [in] Pointer to first bound state of the first component in the current particle shell

  • dResDt – [out] Pointer to array that stores the time derivative

  • workSpace – [inout] Memory work space

inline virtual int const *reactionQuasiStationarity() const noexcept#
[source]

Returns an array that determines whether each binding reaction is quasi-stationary.

Each entry represents a truth value (converts to bool) that determines whether the corresponding binding reaction is quasi-stationary (true) or not (false).

Returns:

Array that determines quasi-stationarity of binding reactions

inline virtual bool hasQuasiStationaryReactions() const noexcept#
[source]

Returns whether this binding model has quasi-stationary reaction fluxes.

Returns:

true if quasi-stationary fluxes are present, otherwise false

inline virtual bool hasDynamicReactions() const noexcept#
[source]

Returns whether this binding model has dynamic reaction fluxes.

Returns:

true if dynamic fluxes are present, otherwise false

inline virtual bool preConsistentInitialState(double t, unsigned int secIdx, const ColumnPosition &colPos, double *y, double const *yCp, LinearBufferAllocator workSpace) const#
[source]

Returns whether a nonlinear solver is required to perform consistent initialization.

This function is called before a nonlinear solver attempts to solve the algebraic equations. If consistent initialization can be performed using analytic / direct formulas (i.e., without running a nonlinear solver), this function would be the correct place to do it.

This function is called simultaneously from multiple threads.

Parameters:
  • t – [in] Current time point

  • secIdx – [in] Index of the current section

  • colPos – [in] Position in normalized coordinates (column inlet = 0, column outlet = 1; outer shell = 1, inner center = 0)

  • y – [inout] Pointer to first bound state of the first component in the current particle shell

  • yCp – [in] Pointer to first component of the mobile phase in the current particle shell

  • workSpace – [inout] Memory work space

Returns:

true if a nonlinear solver is required for consistent initialization, otherwise false

inline virtual void postConsistentInitialState(double t, unsigned int secIdx, const ColumnPosition &colPos, double *y, double const *yCp, LinearBufferAllocator workSpace) const#
[source]

Called after a nonlinear solver has attempted consistent initialization.

In consistent initialization, first preConsistentInitialState() is called. Depending on the return value, a nonlinear solver is applied to the algebraic equations and, afterwards, this function is called to clean up or refine the solution.

This function is called simultaneously from multiple threads.

Parameters:
  • t – [in] Current time point

  • secIdx – [in] Index of the current section

  • colPos – [in] Position in normalized coordinates (column inlet = 0, column outlet = 1; outer shell = 1, inner center = 0)

  • y – [inout] Pointer to first bound state of the first component in the current particle shell

  • yCp – [in] Pointer to first component of the mobile phase in the current particle shell

  • workSpace – [inout] Memory work space

inline virtual unsigned int requiredADdirs() const noexcept#
[source]

Returns the amount of required AD seed vectors / directions.

Only internally required AD directions count (e.g., for Jacobian computation). Directions used for parameter sensitivities should not be included here.

Returns:

The number of required AD seed vectors / directions

Protected Functions

virtual bool implementsAnalyticJacobian() const noexcept = 0#
[source]

Returns whether the function analyticJacobian() is implemented.

The Jacobian can be calculated using automatic differentiation (AD) if analyticJacobian() is not implemented.

Returns:

true if analyticJacobian() is implemented, otherwise false

virtual bool configureImpl(IParameterProvider &paramProvider, UnitOpIdx unitOpIdx, ParticleTypeIdx parTypeIdx) = 0#
[source]

Configures the binding model.

This function implements the (re-)configuration of a binding model. It is called when the binding model is configured or reconfigured. On call the _parameters map will always be empty and _kineticBinding is already configured.

Parameters:
  • paramProvider – [in] Parameter provider

  • unitOpIdx – [in] Unit operation index

  • parTypeIdx – [in] Particle type index

Returns:

true if the configuration was successful, otherwise false

Protected Attributes

int _nComp#
[source]

Number of components.

unsigned int const *_nBoundStates#
[source]

Array with number of bound states for each component.

std::vector<int> _reactionQuasistationarity#
[source]

Determines whether each bound state is quasi-stationary (true) or not (false).

bool _hasQuasiStationary#
[source]

Caches whether the model contains quasi-stationary reaction fluxes.

bool _hasDynamic#
[source]

Caches whether the model contains dynamic reaction fluxes.

std::unordered_map<ParameterId, active*> _parameters#
[source]

Map used to translate ParameterIds to actual variables.