Reaktoro  v2.11.0
A unified framework for modeling chemically reactive systems
EquilibriumProps Class Reference

The class that computes chemical properties of a system during equilibrium calculations. More...

#include <EquilibriumProps.hpp>

Public Member Functions

 EquilibriumProps (const EquilibriumSpecs &specs)
 Construct a EquilibriumProps object with given equilibrium specifications.
 
 EquilibriumProps (const EquilibriumProps &other)
 Construct a copy of a EquilibriumProps object.
 
 ~EquilibriumProps ()
 Destroy this EquilibriumProps object.
 
auto operator= (EquilibriumProps other) -> EquilibriumProps &
 Assign a EquilibriumProps object to this.
 
auto update (VectorXrConstRef n, VectorXrConstRef p, VectorXrConstRef w, bool useIdealModel=false) -> void
 Update the chemical properties of the chemical system. More...
 
auto update (VectorXrConstRef n, VectorXrConstRef p, VectorXrConstRef w, bool useIdealModel, long inpw) -> void
 Update the chemical properties of the chemical system. More...
 
auto assembleFullJacobianBegin () -> void
 Enable recording of derivatives of the chemical properties with respect to *(n, p, w)* to contruct its full Jacobian matrix. More...
 
auto assembleFullJacobianEnd () -> void
 Disable recording of derivatives of the chemical properties with respect to *(n, p, w)* to indicate the end of the full Jacobian matrix construction.
 
auto chemicalState () const -> const ChemicalState &
 Return the underlying chemical state of the system and its updated properties.
 
auto chemicalProps () const -> const ChemicalProps &
 Return the underlying chemical properties of the system.
 
auto dudn () const -> MatrixXdConstRef
 Return the partial derivatives of the serialized chemical properties u with respect to species amounts n.
 
auto dudp () const -> MatrixXdConstRef
 Return the partial derivatives of the serialized chemical properties u with respect to control variables p.
 
auto dudw () const -> MatrixXdConstRef
 Return the partial derivatives of the serialized chemical properties u with respect to input variables w.
 

Detailed Description

The class that computes chemical properties of a system during equilibrium calculations.

This class exists to allow derivatives of these chemical properties to be collected during their computations.

Member Function Documentation

◆ update() [1/2]

auto update ( VectorXrConstRef  n,
VectorXrConstRef  p,
VectorXrConstRef  w,
bool  useIdealModel = false 
) -> void

Update the chemical properties of the chemical system.

Parameters
nThe amounts of the species.
pThe values of the p control variables (e.g., T, P, n[H+] in case U, V and pH are given).
wThe input variables w in the chemical equilibrium problem (e.g., U, V, pH).
useIdealModelIf true, ideal thermodynamic models are used for the phases.

◆ update() [2/2]

auto update ( VectorXrConstRef  n,
VectorXrConstRef  p,
VectorXrConstRef  w,
bool  useIdealModel,
long  inpw 
) -> void

Update the chemical properties of the chemical system.

This is an special update method compared to ChemicalProps::update. Here, the variables in n, p, and w are inspected for seed state. This is seed in the sense of automatic differentiation. When one of this variables are detected to be seeded, this implies that automatic differentiation is computing derivatives of the chemical properties with respect to this seeded variable. The computed derivatives are then stored in a matrix. Access to these derivatives can be obtained with methods dudn, dudp, and dudw.

Parameters
nThe amounts of the species.
pThe values of the p control variables (e.g., T, P, n[H+] in case U, V and pH are given).
wThe input variables w in the chemical equilibrium problem (e.g., U, V, pH).
useIdealModelIf true, ideal thermodynamic models are used for the phases.
inpwThe index of the variable in (n, p, w) currently seeded for autodiff computation.

◆ assembleFullJacobianBegin()

auto assembleFullJacobianBegin ( ) -> void

Enable recording of derivatives of the chemical properties with respect to *(n, p, w)* to contruct its full Jacobian matrix.

Consider a series of forward automatic differentiation passes to compute the partial derivatives of the chemical properties with respect to the variables *(n, p, w)*. Use this method before these operations so that these derivatives are recorded in this EquilibriumProps object. At the end of all forward passes, the full Jacobian of the chemical properties will have been constructed.

Note
Call assembleFullJacobianEnd after these forward passes have ended to eliminates the minor overhead of recording derivatives.
Access these derivatives with methods dudn, dudp, and dudw.

The documentation for this class was generated from the following file: