ChemicalPropsPhase.hpp
136 return { T, P, n, nsum, msum, x, G0, H0, V0, VT0, VP0, Cp0, Vx, VxT, VxP, Vxi, Gx, Hx, Cpx, ln_g, ln_a, u, som };
143 return { T, P, n, nsum, msum, x, G0, H0, V0, VT0, VP0, Cp0, Vx, VxT, VxP, Vxi, Gx, Hx, Cpx, ln_g, ln_a, u, som };
149 array.to(T, P, n, nsum, msum, x, G0, H0, V0, VT0, VP0, Cp0, Vx, VxT, VxP, Vxi, Gx, Hx, Cpx, ln_g, ln_a, u, som);
156 return { T, P, n, nsum, msum, x, G0, H0, V0, VT0, VP0, Cp0, Vx, VxT, VxP, Vxi, Gx, Hx, Cpx, ln_g, ln_a, u, som };
170 using ChemicalPropsPhaseFn = Fn<void(ChemicalPropsPhaseDataRef, const real&, const real&, ArrayXrConstRef)>;
351 return mdata.G0 - mdata.P * mdata.V0; // from A0 = U0 - T*S0 = (H0 - P*V0) + (G0 - H0) = G0 - P*V0
425 const auto A0 = mdata.G0 - mdata.P * mdata.V0; // from A0 = U0 - T*S0 = (H0 - P*V0) + (G0 - H0) = G0 - P*V0
426 const auto Ax = mdata.Gx - mdata.P * mdata.Vx; // from Ax = U0 - T*Sx = (Hx - P*Vx) + (Gx - Hx) = Gx - P*Vx
702 const ActivityModel& activity_model = use_ideal_activity_model ? // IMPORTANT: Use `const ActivityModel&` here instead of `ActivityModel`, otherwise a new model is constructed without cache, and so memoization will not take effect.
The class used to serialize/deserialize data using array.
Definition: ArrayStream.hpp:28
auto to(Args &... args) const
Transfer this ArrayStream object data to given list of scalars and/or arrays.
Definition: ArrayStream.hpp:54
The base type for chemical properties of a phase and its species.
Definition: ChemicalPropsPhase.hpp:175
auto molarVolume() const -> real
Return the molar volume of the phase (in m³/mol).
Definition: ChemicalPropsPhase.hpp:377
auto molarVolumeP() const -> real
Return the pressure derivative of the molar volume of the phase (in m³/(mol·Pa)).
Definition: ChemicalPropsPhase.hpp:389
auto temperature() const -> real
Return the temperature of the phase (in K).
Definition: ChemicalPropsPhase.hpp:259
auto speciesStandardVolumesT() const -> ArrayXrConstRef
Return the temperature derivative of the standard molar volumes of the species in the phase (in m³/(m...
Definition: ChemicalPropsPhase.hpp:313
auto specificGibbsEnergy() const -> real
Return the specific Gibbs energy of formation of the phase (in J/kg).
Definition: ChemicalPropsPhase.hpp:465
auto pressure() const -> real
Return the pressure of the phase (in Pa).
Definition: ChemicalPropsPhase.hpp:265
auto volumeT() const -> real
Return the temperature derivative of the volume of the phase (in m³/K).
Definition: ChemicalPropsPhase.hpp:531
auto speciesStandardInternalEnergies() const -> ArrayXr
Return the standard partial molar internal energies of formation of the species in the phase (in J/mo...
Definition: ChemicalPropsPhase.hpp:343
auto mass() const -> real
Return the sum of species masses in the phase (in kg).
Definition: ChemicalPropsPhase.hpp:519
auto speciesActivitiesLn() const -> ArrayXrConstRef
Return the ln activities of the species in the phase.
Definition: ChemicalPropsPhase.hpp:289
auto heatCapacityConstP() const -> real
Return the isobaric heat capacity of the phase (in J/K).
Definition: ChemicalPropsPhase.hpp:573
auto speciesChemicalPotentials() const -> ArrayXrConstRef
Return the chemical potentials of the species in the phase (in J/mol).
Definition: ChemicalPropsPhase.hpp:295
auto speciesStandardHeatCapacitiesConstP() const -> ArrayXrConstRef
Return the standard partial molar isobaric heat capacities of the species in the phase (in J/(mol·K))...
Definition: ChemicalPropsPhase.hpp:355
auto speciesStandardEntropies() const -> ArrayXr
Return the standard partial molar entropies of formation of the species in the phase (in J/(mol·K)).
Definition: ChemicalPropsPhase.hpp:337
auto speciesStandardGibbsEnergies() const -> ArrayXrConstRef
Return the standard partial molar Gibbs energies of formation of the species in the phase (in J/mol).
Definition: ChemicalPropsPhase.hpp:325
auto updateWithData(const ChemicalPropsPhaseBaseData< TypeOp > &data)
Update the chemical properties of the phase with given data.
Definition: ChemicalPropsPhase.hpp:235
auto entropy() const -> real
Return the entropy of the phase (in J/K).
Definition: ChemicalPropsPhase.hpp:555
ChemicalPropsPhaseBase(ChemicalPropsPhaseBase< OtherTypeOp > &other)
Construct a ChemicalPropsPhaseBase instance.
Definition: ChemicalPropsPhase.hpp:204
auto specificInternalEnergy() const -> real
Return the specific internal energy of formation of the phase (in J/kg).
Definition: ChemicalPropsPhase.hpp:483
auto speciesStandardEnthalpies() const -> ArrayXrConstRef
Return the standard partial molar enthalpies of formation of the species in the phase (in J/mol).
Definition: ChemicalPropsPhase.hpp:331
auto volume() const -> real
Return the volume of the phase (in m³).
Definition: ChemicalPropsPhase.hpp:525
auto data() const -> const ChemicalPropsPhaseBaseData< TypeOp > &
Return the primary chemical property data of the phase from which others are calculated.
Definition: ChemicalPropsPhase.hpp:247
auto molarHeatCapacityConstV() const -> real
Return the molar isochoric heat capacity of the phase (in J/(mol·K)).
Definition: ChemicalPropsPhase.hpp:437
auto speciesActivityCoefficientsLn() const -> ArrayXrConstRef
Return the ln activity coefficients of the species in the phase.
Definition: ChemicalPropsPhase.hpp:283
auto phase() const -> const Phase &
Return the underlying Phase object.
Definition: ChemicalPropsPhase.hpp:241
auto specificVolume() const -> real
Return the specific volume of the phase (in m³/kg).
Definition: ChemicalPropsPhase.hpp:447
auto speciesStandardVolumes() const -> ArrayXrConstRef
Return the standard partial molar volumes of the species in the phase (in m³/mol).
Definition: ChemicalPropsPhase.hpp:307
auto specificEnthalpy() const -> real
Return the specific enthalpy of formation of the phase (in J/kg).
Definition: ChemicalPropsPhase.hpp:471
auto speciesAmounts() const -> ArrayXrConstRef
Return the amounts of the species in the phase (in mol).
Definition: ChemicalPropsPhase.hpp:271
auto specificVolumeT() const -> real
Return the temperature derivative of the specific volume of the phase (in m³/(kg·K)).
Definition: ChemicalPropsPhase.hpp:453
auto specificHeatCapacityConstV() const -> real
Return the specific isochoric heat capacity of the phase (in J/(kg·K)).
Definition: ChemicalPropsPhase.hpp:501
auto specificHeatCapacityConstP() const -> real
Return the specific isobaric heat capacity of the phase (in J/(kg·K)).
Definition: ChemicalPropsPhase.hpp:495
auto internalEnergy() const -> real
Return the internal energy of the phase (in J).
Definition: ChemicalPropsPhase.hpp:561
auto molarGibbsEnergy() const -> real
Return the molar Gibbs energy of formation of the phase (in J/mol).
Definition: ChemicalPropsPhase.hpp:395
auto speciesPartialMolarVolumes() const -> ArrayXrConstRef
Return the partial molar volumes of the species in the phase (in m³/mol).
Definition: ChemicalPropsPhase.hpp:301
auto update(const real &T, const real &P, ArrayXrConstRef n, Map< String, Any > &extra)
Update the chemical properties of the phase.
Definition: ChemicalPropsPhase.hpp:219
auto molarHeatCapacityConstP() const -> real
Return the molar isobaric heat capacity of the phase (in J/(mol·K)).
Definition: ChemicalPropsPhase.hpp:431
auto molarHelmholtzEnergy() const -> real
Return the molar Helmholtz energy of formation of the phase (in J/mol).
Definition: ChemicalPropsPhase.hpp:423
auto specificHelmholtzEnergy() const -> real
Return the specific Helmholtz energy of formation of the phase (in J/kg).
Definition: ChemicalPropsPhase.hpp:489
auto helmholtzEnergy() const -> real
Return the Helmholtz energy of the phase (in J).
Definition: ChemicalPropsPhase.hpp:567
auto amount() const -> real
Return the sum of species amounts in the phase (in mol).
Definition: ChemicalPropsPhase.hpp:513
auto molarEntropy() const -> real
Return the molar entropy of formation of the phase (in J/(mol·K)).
Definition: ChemicalPropsPhase.hpp:407
ChemicalPropsPhaseBase(const ChemicalPropsPhaseBase< OtherTypeOp > &other)
Construct a ChemicalPropsPhaseBase instance.
Definition: ChemicalPropsPhase.hpp:210
auto speciesMoleFractions() const -> ArrayXrConstRef
Return the mole fractions of the species in the phase.
Definition: ChemicalPropsPhase.hpp:277
auto stateOfMatter() const -> StateOfMatter
Return the state of matter of the phase.
Definition: ChemicalPropsPhase.hpp:253
auto speciesStandardVolumesP() const -> ArrayXrConstRef
Return the pressure derivative of the standard molar volumes of the species in the phase (in m³/(mol·...
Definition: ChemicalPropsPhase.hpp:319
auto heatCapacityConstV() const -> real
Return the isochoric heat capacity of the phase (in J/K).
Definition: ChemicalPropsPhase.hpp:579
auto molarInternalEnergy() const -> real
Return the molar internal energy of formation of the phase (in J/mol).
Definition: ChemicalPropsPhase.hpp:415
auto volumeP() const -> real
Return the pressure derivative of the volume of the phase (in m³/Pa).
Definition: ChemicalPropsPhase.hpp:537
auto operator=(const ArrayStream< real > &array)
Assign the given array data to this ChemicalPropsPhaseBase object.
Definition: ChemicalPropsPhase.hpp:596
ChemicalPropsPhaseBase(const Phase &phase)
Construct a ChemicalPropsPhaseBase instance.
Definition: ChemicalPropsPhase.hpp:178
auto gibbsEnergy() const -> real
Return the Gibbs energy of the phase (in J).
Definition: ChemicalPropsPhase.hpp:543
auto speciesStandardHeatCapacitiesConstV() const -> ArrayXr
Return the standard partial molar isochoric heat capacities of the species in the phase (in J/(mol·K)...
Definition: ChemicalPropsPhase.hpp:361
auto molarMass() const -> real
Return the molar mass of the phase (in kg/mol).
Definition: ChemicalPropsPhase.hpp:371
auto molarVolumeT() const -> real
Return the temperature derivative of the molar volume of the phase (in m³/(mol·K)).
Definition: ChemicalPropsPhase.hpp:383
auto updateIdeal(const real &T, const real &P, ArrayXrConstRef n, Map< String, Any > &extra)
Update the chemical properties of the phase using ideal activity models.
Definition: ChemicalPropsPhase.hpp:229
auto soundSpeed() const -> real
Return the speed of sound in the phase (in m/s).
Definition: ChemicalPropsPhase.hpp:585
ChemicalPropsPhaseBase(const Phase &phase, const ChemicalPropsPhaseBaseData< TypeOp > &data)
Construct a ChemicalPropsPhaseBase instance.
Definition: ChemicalPropsPhase.hpp:198
auto speciesStandardHelmholtzEnergies() const -> ArrayXr
Return the standard partial molar Helmholtz energies of formation of the species in the phase (in J/m...
Definition: ChemicalPropsPhase.hpp:349
auto enthalpy() const -> real
Return the enthalpy of the phase (in J).
Definition: ChemicalPropsPhase.hpp:549
auto specificEntropy() const -> real
Return the specific entropy of formation of the phase (in J/(kg·K)).
Definition: ChemicalPropsPhase.hpp:477
auto specificVolumeP() const -> real
Return the pressure derivative of the specific volume of the phase (in m³/(kg·Pa)).
Definition: ChemicalPropsPhase.hpp:459
auto density() const -> real
Return the density of the phase (in kg/m³).
Definition: ChemicalPropsPhase.hpp:507
auto molarEnthalpy() const -> real
Return the molar enthalpy of formation of the phase (in J/mol).
Definition: ChemicalPropsPhase.hpp:401
auto speciesMolarMasses() const -> ArrayXdConstRef
Return the molar masses of the species in the phase (in kg/mol).
The namespace containing all components of the Reaktoro library.
Definition: Algorithms.hpp:29
Fn< void(ChemicalPropsPhaseDataRef, const real &, const real &, ArrayXrConstRef)> ChemicalPropsPhaseFn
The type of functions that computes the primary chemical property data of a phase.
Definition: ChemicalPropsPhase.hpp:170
constexpr auto universalGasConstant
The universal gas constant (in J/(mol*K))
Definition: Constants.hpp:26
Model< ActivityProps(ActivityModelArgs)> ActivityModel
The function type for the calculation of activity and corrective thermodynamic properties of a phase.
Definition: ActivityModel.hpp:49
autodiff::real real
The number type used throughout the library.
Definition: Real.hpp:26
ActivityPropsBase< TypeOpRef > ActivityPropsRef
The non-const view to the activity and corrective thermodynamic properties of a phase.
Definition: ActivityProps.hpp:162
auto sum(std::size_t ibegin, std::size_t iend, const Function &f)
Return the sum f(ibegin) + ... + f(iend-1) for a given function f.
Definition: Algorithms.hpp:257
auto error(bool condition, Args... items) -> void
Raise a runtime error if condition is true.
Definition: Exception.hpp:106
auto sqrt(const Eigen::MatrixBase< Derived > &mat) -> decltype(mat.cwiseSqrt())
Return the component-wise square root of a matrix.
Definition: Matrix.hpp:804
std::function< F > Fn
Convenient alias for std::function<R(Args...)>.
Definition: Types.hpp:110
StateOfMatter
The list of states of matter for phases.
Definition: StateOfMatter.hpp:27
Eigen::Ref< const ArrayXr > ArrayXrConstRef
Convenient alias to Eigen type.
Definition: Matrix.hpp:89
autodiff::ArrayXreal ArrayXr
Convenient alias to Eigen type.
Definition: Matrix.hpp:87
std::unordered_map< Key, T > Map
Convenient alias for std::unordered_map<Key, T>.
Definition: Types.hpp:74
The base type for primary chemical property data of a phase from which others are computed.
Definition: ChemicalPropsPhase.hpp:32
TypeOp< real > nsum
The amount of the phase as the sum of species amounts (in mol).
Definition: ChemicalPropsPhase.hpp:43
TypeOp< real > msum
The mass of the phase as the sum of species masses (in kg).
Definition: ChemicalPropsPhase.hpp:46
TypeOp< real > P
The pressure of the phase (in Pa).
Definition: ChemicalPropsPhase.hpp:37
TypeOp< ArrayXr > ln_a
The activities (natural log) of the species in the phase.
Definition: ChemicalPropsPhase.hpp:94
TypeOp< real > Gx
The corrective molar Gibbs energy of the phase (in units of J/mol).
Definition: ChemicalPropsPhase.hpp:82
TypeOp< real > VxT
The derivative of the corrective molar volume with respect to temperature at constant pressure and sp...
Definition: ChemicalPropsPhase.hpp:73
TypeOp< ArrayXr > Vxi
The derivatives of the corrective molar volume with respect to species mole fractions at constant tem...
Definition: ChemicalPropsPhase.hpp:79
TypeOp< ArrayXr > x
The mole fractions of the species in the phase (in mol/mol).
Definition: ChemicalPropsPhase.hpp:49
TypeOp< ArrayXr > G0
The standard molar Gibbs energies of formation of the species in the phase (in J/mol)
Definition: ChemicalPropsPhase.hpp:52
auto operator=(const ChemicalPropsPhaseBaseData< OtherTypeOp > &other)
Assign a ChemicalPropsPhaseBaseData object to this.
Definition: ChemicalPropsPhase.hpp:104
TypeOp< real > Hx
The corrective molar enthalpy of the phase (in units of J/mol).
Definition: ChemicalPropsPhase.hpp:85
TypeOp< real > Cpx
The corrective molar isobaric heat capacity of the phase (in units of J/(mol·K)).
Definition: ChemicalPropsPhase.hpp:88
TypeOp< ArrayXr > ln_g
The activity coefficients (natural log) of the species in the phase.
Definition: ChemicalPropsPhase.hpp:91
TypeOp< ArrayXr > V0
The standard molar volumes of the species in the phase (in m³/mol)
Definition: ChemicalPropsPhase.hpp:58
TypeOp< ArrayXr > Cp0
The standard molar isobaric heat capacities of the species in the phase (in J/(mol·K))
Definition: ChemicalPropsPhase.hpp:67
TypeOp< ArrayXr > VP0
The pressure derivative of the standard molar volumes of the species in the phase (in m³/(mol·Pa)).
Definition: ChemicalPropsPhase.hpp:64
TypeOp< ArrayXr > H0
The standard molar enthalpies of formation of the species in the phase (in J/mol)
Definition: ChemicalPropsPhase.hpp:55
TypeOp< ArrayXr > VT0
The temperature derivative of the standard molar volumes of the species in the phase (in m³/(mol·K)).
Definition: ChemicalPropsPhase.hpp:61
TypeOp< ArrayXr > n
The amounts of each species in the phase (in mol).
Definition: ChemicalPropsPhase.hpp:40
TypeOp< ArrayXr > u
The chemical potentials of the species in the phase.
Definition: ChemicalPropsPhase.hpp:97
TypeOp< StateOfMatter > som
The state of matter of the phase.
Definition: ChemicalPropsPhase.hpp:100
auto operator=(const ArrayStream< real > &array)
Assign the given array data to this ChemicalPropsPhaseBaseData object.
Definition: ChemicalPropsPhase.hpp:147
TypeOp< real > Vx
The corrective molar volume of the phase (in m³/mol).
Definition: ChemicalPropsPhase.hpp:70
TypeOp< real > VxP
The derivative of the corrective molar volume with respect to pressure at constant temperature and sp...
Definition: ChemicalPropsPhase.hpp:76
TypeOp< real > T
The temperature of the phase (in K).
Definition: ChemicalPropsPhase.hpp:34
The primary standard thermodynamic properties of a chemical species.
Definition: StandardThermoProps.hpp:27
real VP0
The pressure derivative of the standard molar volume of the species (in m³/(mol·Pa)).
Definition: StandardThermoProps.hpp:44
real VT0
The temperature derivative of the standard molar volume of the species (in m³/(mol·K)).
Definition: StandardThermoProps.hpp:41
real H0
The standard molar enthalpy of formation of the species (in J/mol).
Definition: StandardThermoProps.hpp:32
real G0
The standard molar Gibbs energy of formation of the species (in J/mol).
Definition: StandardThermoProps.hpp:29
real V0
The standard molar volume of the species (in m³/mol).
Definition: StandardThermoProps.hpp:35
real Cp0
The standard molar isobaric heat capacity of the species (in J/(mol·K)).
Definition: StandardThermoProps.hpp:38