ChemicalPropsPhase.hpp
132 return { T, P, n, nsum, msum, x, G0, H0, V0, VT0, VP0, Cp0, Vx, VxT, VxP, Gx, Hx, Cpx, ln_g, ln_a, u, som };
139 return { T, P, n, nsum, msum, x, G0, H0, V0, VT0, VP0, Cp0, Vx, VxT, VxP, Gx, Hx, Cpx, ln_g, ln_a, u, som };
145 array.to(T, P, n, nsum, msum, x, G0, H0, V0, VT0, VP0, Cp0, Vx, VxT, VxP, Gx, Hx, Cpx, ln_g, ln_a, u, som);
152 return { T, P, n, nsum, msum, x, G0, H0, V0, VT0, VP0, Cp0, Vx, VxT, VxP, Gx, Hx, Cpx, ln_g, ln_a, u, som };
166 using ChemicalPropsPhaseFn = Fn<void(ChemicalPropsPhaseDataRef, const real&, const real&, ArrayXrConstRef)>;
340 return mdata.G0 - mdata.P * mdata.V0; // from A0 = U0 - T*S0 = (H0 - P*V0) + (G0 - H0) = G0 - P*V0
414 const auto A0 = mdata.G0 - mdata.P * mdata.V0; // from A0 = U0 - T*S0 = (H0 - P*V0) + (G0 - H0) = G0 - P*V0
415 const auto Ax = mdata.Gx - mdata.P * mdata.Vx; // from Ax = U0 - T*Sx = (Hx - P*Vx) + (Gx - Hx) = Gx - P*Vx
689 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:171
auto molarVolume() const -> real
Return the molar volume of the phase (in m³/mol).
Definition: ChemicalPropsPhase.hpp:366
auto molarVolumeP() const -> real
Return the pressure derivative of the molar volume of the phase (in m³/(mol·Pa)).
Definition: ChemicalPropsPhase.hpp:378
auto temperature() const -> real
Return the temperature of the phase (in K).
Definition: ChemicalPropsPhase.hpp:254
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:302
auto specificGibbsEnergy() const -> real
Return the specific Gibbs energy of formation of the phase (in J/kg).
Definition: ChemicalPropsPhase.hpp:454
auto pressure() const -> real
Return the pressure of the phase (in Pa).
Definition: ChemicalPropsPhase.hpp:260
auto volumeT() const -> real
Return the temperature derivative of the volume of the phase (in m³/K).
Definition: ChemicalPropsPhase.hpp:520
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:332
auto mass() const -> real
Return the sum of species masses in the phase (in kg).
Definition: ChemicalPropsPhase.hpp:508
auto speciesActivitiesLn() const -> ArrayXrConstRef
Return the ln activities of the species in the phase.
Definition: ChemicalPropsPhase.hpp:284
auto heatCapacityConstP() const -> real
Return the isobaric heat capacity of the phase (in J/K).
Definition: ChemicalPropsPhase.hpp:562
auto speciesChemicalPotentials() const -> ArrayXrConstRef
Return the chemical potentials of the species in the phase (in J/mol).
Definition: ChemicalPropsPhase.hpp:290
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:344
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:326
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:314
auto updateWithData(const ChemicalPropsPhaseBaseData< TypeOp > &data)
Update the chemical properties of the phase with given data.
Definition: ChemicalPropsPhase.hpp:230
auto entropy() const -> real
Return the entropy of the phase (in J/K).
Definition: ChemicalPropsPhase.hpp:544
ChemicalPropsPhaseBase(ChemicalPropsPhaseBase< OtherTypeOp > &other)
Construct a ChemicalPropsPhaseBase instance.
Definition: ChemicalPropsPhase.hpp:199
auto specificInternalEnergy() const -> real
Return the specific internal energy of formation of the phase (in J/kg).
Definition: ChemicalPropsPhase.hpp:472
auto speciesStandardEnthalpies() const -> ArrayXrConstRef
Return the standard partial molar enthalpies of formation of the species in the phase (in J/mol).
Definition: ChemicalPropsPhase.hpp:320
auto volume() const -> real
Return the volume of the phase (in m³).
Definition: ChemicalPropsPhase.hpp:514
auto data() const -> const ChemicalPropsPhaseBaseData< TypeOp > &
Return the primary chemical property data of the phase from which others are calculated.
Definition: ChemicalPropsPhase.hpp:242
auto molarHeatCapacityConstV() const -> real
Return the molar isochoric heat capacity of the phase (in J/(mol·K)).
Definition: ChemicalPropsPhase.hpp:426
auto speciesActivityCoefficientsLn() const -> ArrayXrConstRef
Return the ln activity coefficients of the species in the phase.
Definition: ChemicalPropsPhase.hpp:278
auto phase() const -> const Phase &
Return the underlying Phase object.
Definition: ChemicalPropsPhase.hpp:236
auto specificVolume() const -> real
Return the specific volume of the phase (in m³/kg).
Definition: ChemicalPropsPhase.hpp:436
auto speciesStandardVolumes() const -> ArrayXrConstRef
Return the standard partial molar volumes of the species in the phase (in m³/mol).
Definition: ChemicalPropsPhase.hpp:296
auto specificEnthalpy() const -> real
Return the specific enthalpy of formation of the phase (in J/kg).
Definition: ChemicalPropsPhase.hpp:460
auto speciesAmounts() const -> ArrayXrConstRef
Return the amounts of the species in the phase (in mol).
Definition: ChemicalPropsPhase.hpp:266
auto specificVolumeT() const -> real
Return the temperature derivative of the specific volume of the phase (in m³/(kg·K)).
Definition: ChemicalPropsPhase.hpp:442
auto specificHeatCapacityConstV() const -> real
Return the specific isochoric heat capacity of the phase (in J/(kg·K)).
Definition: ChemicalPropsPhase.hpp:490
auto specificHeatCapacityConstP() const -> real
Return the specific isobaric heat capacity of the phase (in J/(kg·K)).
Definition: ChemicalPropsPhase.hpp:484
auto internalEnergy() const -> real
Return the internal energy of the phase (in J).
Definition: ChemicalPropsPhase.hpp:550
auto molarGibbsEnergy() const -> real
Return the molar Gibbs energy of formation of the phase (in J/mol).
Definition: ChemicalPropsPhase.hpp:384
auto update(const real &T, const real &P, ArrayXrConstRef n, Map< String, Any > &extra)
Update the chemical properties of the phase.
Definition: ChemicalPropsPhase.hpp:214
auto molarHeatCapacityConstP() const -> real
Return the molar isobaric heat capacity of the phase (in J/(mol·K)).
Definition: ChemicalPropsPhase.hpp:420
auto molarHelmholtzEnergy() const -> real
Return the molar Helmholtz energy of formation of the phase (in J/mol).
Definition: ChemicalPropsPhase.hpp:412
auto specificHelmholtzEnergy() const -> real
Return the specific Helmholtz energy of formation of the phase (in J/kg).
Definition: ChemicalPropsPhase.hpp:478
auto helmholtzEnergy() const -> real
Return the Helmholtz energy of the phase (in J).
Definition: ChemicalPropsPhase.hpp:556
auto amount() const -> real
Return the sum of species amounts in the phase (in mol).
Definition: ChemicalPropsPhase.hpp:502
auto molarEntropy() const -> real
Return the molar entropy of formation of the phase (in J/(mol·K)).
Definition: ChemicalPropsPhase.hpp:396
ChemicalPropsPhaseBase(const ChemicalPropsPhaseBase< OtherTypeOp > &other)
Construct a ChemicalPropsPhaseBase instance.
Definition: ChemicalPropsPhase.hpp:205
auto speciesMoleFractions() const -> ArrayXrConstRef
Return the mole fractions of the species in the phase.
Definition: ChemicalPropsPhase.hpp:272
auto stateOfMatter() const -> StateOfMatter
Return the state of matter of the phase.
Definition: ChemicalPropsPhase.hpp:248
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:308
auto heatCapacityConstV() const -> real
Return the isochoric heat capacity of the phase (in J/K).
Definition: ChemicalPropsPhase.hpp:568
auto molarInternalEnergy() const -> real
Return the molar internal energy of formation of the phase (in J/mol).
Definition: ChemicalPropsPhase.hpp:404
auto volumeP() const -> real
Return the pressure derivative of the volume of the phase (in m³/Pa).
Definition: ChemicalPropsPhase.hpp:526
auto operator=(const ArrayStream< real > &array)
Assign the given array data to this ChemicalPropsPhaseBase object.
Definition: ChemicalPropsPhase.hpp:585
ChemicalPropsPhaseBase(const Phase &phase)
Construct a ChemicalPropsPhaseBase instance.
Definition: ChemicalPropsPhase.hpp:174
auto gibbsEnergy() const -> real
Return the Gibbs energy of the phase (in J).
Definition: ChemicalPropsPhase.hpp:532
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:350
auto molarMass() const -> real
Return the molar mass of the phase (in kg/mol).
Definition: ChemicalPropsPhase.hpp:360
auto molarVolumeT() const -> real
Return the temperature derivative of the molar volume of the phase (in m³/(mol·K)).
Definition: ChemicalPropsPhase.hpp:372
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:224
auto soundSpeed() const -> real
Return the speed of sound in the phase (in m/s).
Definition: ChemicalPropsPhase.hpp:574
ChemicalPropsPhaseBase(const Phase &phase, const ChemicalPropsPhaseBaseData< TypeOp > &data)
Construct a ChemicalPropsPhaseBase instance.
Definition: ChemicalPropsPhase.hpp:193
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:338
auto enthalpy() const -> real
Return the enthalpy of the phase (in J).
Definition: ChemicalPropsPhase.hpp:538
auto specificEntropy() const -> real
Return the specific entropy of formation of the phase (in J/(kg·K)).
Definition: ChemicalPropsPhase.hpp:466
auto specificVolumeP() const -> real
Return the pressure derivative of the specific volume of the phase (in m³/(kg·Pa)).
Definition: ChemicalPropsPhase.hpp:448
auto density() const -> real
Return the density of the phase (in kg/m³).
Definition: ChemicalPropsPhase.hpp:496
auto molarEnthalpy() const -> real
Return the molar enthalpy of formation of the phase (in J/mol).
Definition: ChemicalPropsPhase.hpp:390
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:28
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:166
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:157
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:256
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:91
TypeOp< real > Gx
The corrective molar Gibbs energy of the phase (in units of J/mol).
Definition: ChemicalPropsPhase.hpp:79
TypeOp< real > VxT
The temperature derivative of the corrective molar volume at constant pressure (in m³/(mol·K)).
Definition: ChemicalPropsPhase.hpp:73
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:101
TypeOp< real > Hx
The corrective molar enthalpy of the phase (in units of J/mol).
Definition: ChemicalPropsPhase.hpp:82
TypeOp< real > Cpx
The corrective molar isobaric heat capacity of the phase (in units of J/(mol·K)).
Definition: ChemicalPropsPhase.hpp:85
TypeOp< ArrayXr > ln_g
The activity coefficients (natural log) of the species in the phase.
Definition: ChemicalPropsPhase.hpp:88
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:94
TypeOp< StateOfMatter > som
The state of matter of the phase.
Definition: ChemicalPropsPhase.hpp:97
auto operator=(const ArrayStream< real > &array)
Assign the given array data to this ChemicalPropsPhaseBaseData object.
Definition: ChemicalPropsPhase.hpp:143
TypeOp< real > Vx
The corrective molar volume of the phase (in m³/mol).
Definition: ChemicalPropsPhase.hpp:70
TypeOp< real > VxP
The pressure derivative of the corrective molar volume at constant temperature (in m³/(mol·Pa)).
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