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

Used to compute the Hessian matrix of the Gibbs energy function. More...

#include <EquilibriumHessian.hpp>

Public Member Functions

 EquilibriumHessian (ChemicalSystem const &system)
 Construct an EquilibriumHessian object with given specifications.
 
 EquilibriumHessian (EquilibriumHessian const &other)
 Construct a copy of an EquilibriumHessian object.
 
 ~EquilibriumHessian ()
 Destroy this EquilibriumHessian object.
 
auto operator= (EquilibriumHessian other) -> EquilibriumHessian &
 Assign a copy of an EquilibriumHessian object to this.
 
auto exact (real const &T, real const &P, VectorXrConstRef const &n) -> MatrixXdConstRef
 Evaluate the Hessian matrix ∂(µ/RT)/∂n with exact derivatives. More...
 
auto partiallyExact (real const &T, real const &P, VectorXrConstRef const &n, VectorXlConstRef const &idxs) -> MatrixXdConstRef
 Evaluate the Hessian matrix ∂(µ/RT)/∂n with exact derivatives for selected species. More...
 
auto approximate (VectorXrConstRef const &n) -> MatrixXdConstRef
 Evaluate the Hessian matrix ∂(µ/RT)/∂n with approximate derivatives. More...
 
auto diagonal (VectorXrConstRef const &n) -> MatrixXdConstRef
 Evaluate the Hessian matrix ∂(µ/RT)/∂n as a diagonal matrix using approximate derivatives. More...
 

Detailed Description

Used to compute the Hessian matrix of the Gibbs energy function.

Member Function Documentation

◆ exact()

auto exact ( real const &  T,
real const &  P,
VectorXrConstRef const &  n 
) -> MatrixXdConstRef

Evaluate the Hessian matrix ∂(µ/RT)/∂n with exact derivatives.

This method uses automatic differentiation to compute the exact derivatives of µ/RT with respect to all species in the system.

◆ partiallyExact()

auto partiallyExact ( real const &  T,
real const &  P,
VectorXrConstRef const &  n,
VectorXlConstRef const &  idxs 
) -> MatrixXdConstRef

Evaluate the Hessian matrix ∂(µ/RT)/∂n with exact derivatives for selected species.

This method uses automatic differentiation to compute the exact derivatives of µ/RT with respect to the species whose indices are given in idxs. For all other species, approximate derivatives are used instead. These approximate derivatives are obtained from ideal thermodynamic models for the phases. Thus, with this method, the derivatives in ∂(µ/RT)/∂n associated with species with low amounts, which can be a large number, are quickly evaluated. This is appropriate for chemical equilibrium calculations in which several or many species have very low amounts and play no major role in the chemical equilibrium state being calculated. Approximate derivatives for these species suffice for numerical convergence.

◆ approximate()

auto approximate ( VectorXrConstRef const &  n) -> MatrixXdConstRef

Evaluate the Hessian matrix ∂(µ/RT)/∂n with approximate derivatives.

These derivatives are analytically (and thus quickly) computed from ideal thermodynamic models for the phases in the system. For example, for liquid, gaseous, and solid solutions ∂(µ/RT)/∂n ≡ ∂(ln(x))/∂n, where x are species mole fractions. For an aqueous solution, however, ∂(µ/RT)/∂n ≡ ∂(ln(m))/∂n, where m are species molalities.

◆ diagonal()

auto diagonal ( VectorXrConstRef const &  n) -> MatrixXdConstRef

Evaluate the Hessian matrix ∂(µ/RT)/∂n as a diagonal matrix using approximate derivatives.

The computed diagonal matrix with this function is equivalent to extracting the diagonal entries from the matrix produced with dudnApproximate.


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