Skip to content
This repository was archived by the owner on Jun 14, 2022. It is now read-only.

Commit e20d1b4

Browse files
authored
Rename Residual and ResidualP (#43)
1 parent e3a780c commit e20d1b4

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

src/phase_equilibria/vle_pure.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ impl<U: EosUnit, E: EquationOfState> PhaseEquilibrium<U, E, 2> {
260260
let density = 0.75 * eos.max_density(None)?;
261261
let liquid = State::new_nvt(eos, temperature, U::reference_moles() / density, &m)?;
262262
let z = liquid.compressibility(Contributions::Total);
263-
let mu = liquid.chemical_potential(Contributions::Residual);
263+
let mu = liquid.chemical_potential(Contributions::ResidualNvt);
264264
let p = temperature
265265
* density
266266
* U::gas_constant()
@@ -427,7 +427,8 @@ impl<U: EosUnit, E: EquationOfState> PhaseEquilibrium<U, E, 2> {
427427
(0..eos.components())
428428
.map(|i| {
429429
let pure_eos = Rc::new(eos.subset(&[i]));
430-
PhaseEquilibrium::pure_t(&pure_eos, temperature, None, SolverOptions::default()).ok()
430+
PhaseEquilibrium::pure_t(&pure_eos, temperature, None, SolverOptions::default())
431+
.ok()
431432
})
432433
.collect()
433434
}

src/state/properties.rs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ pub enum Contributions {
2222
/// Only compute the ideal gas contribution
2323
IdealGas,
2424
/// Only compute the difference between the total and the ideal gas contribution
25-
Residual,
25+
ResidualNvt,
2626
/// Compute the differnce between the total and the ideal gas contribution for a (N,p,T) reference state
27-
ResidualP,
27+
ResidualNpt,
2828
/// Compute ideal gas and residual contributions
2929
Total,
3030
}
@@ -144,14 +144,14 @@ impl<U: EosUnit, E: EquationOfState> State<U, E> {
144144
match contributions {
145145
Contributions::IdealGas => f(self, Evaluate::IdealGas),
146146
Contributions::Total => f(self, Evaluate::Total),
147-
Contributions::Residual => {
147+
Contributions::ResidualNvt => {
148148
if additive {
149149
f(self, Evaluate::Residual)
150150
} else {
151151
f(self, Evaluate::Total) - f(self, Evaluate::IdealGas)
152152
}
153153
}
154-
Contributions::ResidualP => {
154+
Contributions::ResidualNpt => {
155155
let p = self.pressure_(Evaluate::Total);
156156
let state_p = Self::new_nvt(
157157
&self.eos,
@@ -293,7 +293,8 @@ impl<U: EosUnit, E: EquationOfState> State<U, E> {
293293

294294
/// Logarithm of the fugacity coefficient: $\ln\varphi_i=\beta\mu_i^\mathrm{res}\left(T,p,\lbrace N_i\rbrace\right)$
295295
pub fn ln_phi(&self) -> Array1<f64> {
296-
(self.chemical_potential(Contributions::ResidualP) / (U::gas_constant() * self.temperature))
296+
(self.chemical_potential(Contributions::ResidualNpt)
297+
/ (U::gas_constant() * self.temperature))
297298
.into_value()
298299
.unwrap()
299300
}
@@ -305,18 +306,18 @@ impl<U: EosUnit, E: EquationOfState> State<U, E> {
305306
- s.chemical_potential_(evaluate) / self.temperature)
306307
/ (U::gas_constant() * self.temperature)
307308
};
308-
self.evaluate_property(func, Contributions::ResidualP, false)
309+
self.evaluate_property(func, Contributions::ResidualNpt, false)
309310
}
310311

311312
/// Partial derivative of the logarithm of the fugacity coefficient w.r.t. pressure: $\left(\frac{\partial\ln\varphi_i}{\partial p}\right)_{T,N_i}$
312313
pub fn dln_phi_dp(&self) -> QuantityArray1<U> {
313-
self.molar_volume(Contributions::ResidualP) / (U::gas_constant() * self.temperature)
314+
self.molar_volume(Contributions::ResidualNpt) / (U::gas_constant() * self.temperature)
314315
}
315316

316317
/// Partial derivative of the logarithm of the fugacity coefficient w.r.t. moles: $\left(\frac{\partial\ln\varphi_i}{\partial N_j}\right)_{T,p,N_k}$
317318
pub fn dln_phi_dnj(&self) -> QuantityArray2<U> {
318319
let n = self.eos.components();
319-
let dmu_dni = self.dmu_dni(Contributions::Residual);
320+
let dmu_dni = self.dmu_dni(Contributions::ResidualNvt);
320321
let dp_dni = self.dp_dni(Contributions::Total);
321322
let dp_dv = self.dp_dv(Contributions::Total);
322323
let dp_dn_2 = QuantityArray::from_shape_fn((n, n), |(i, j)| dp_dni.get(i) * dp_dni.get(j));
@@ -620,7 +621,7 @@ impl<U: EosUnit, E: EquationOfState + EntropyScaling<U>> State<U, E> {
620621
/// Return the viscosity via entropy scaling.
621622
pub fn viscosity(&self) -> EosResult<QuantityScalar<U>> {
622623
let s = self
623-
.molar_entropy(Contributions::Residual)
624+
.molar_entropy(Contributions::ResidualNvt)
624625
.to_reduced(U::reference_molar_entropy())?;
625626
Ok(self
626627
.eos
@@ -634,7 +635,7 @@ impl<U: EosUnit, E: EquationOfState + EntropyScaling<U>> State<U, E> {
634635
/// that is used for entropy scaling.
635636
pub fn ln_viscosity_reduced(&self) -> EosResult<f64> {
636637
let s = self
637-
.molar_entropy(Contributions::Residual)
638+
.molar_entropy(Contributions::ResidualNvt)
638639
.to_reduced(U::reference_molar_entropy())?;
639640
self.eos.viscosity_correlation(s, &self.molefracs)
640641
}
@@ -648,7 +649,7 @@ impl<U: EosUnit, E: EquationOfState + EntropyScaling<U>> State<U, E> {
648649
/// Return the diffusion via entropy scaling.
649650
pub fn diffusion(&self) -> EosResult<QuantityScalar<U>> {
650651
let s = self
651-
.molar_entropy(Contributions::Residual)
652+
.molar_entropy(Contributions::ResidualNvt)
652653
.to_reduced(U::reference_molar_entropy())?;
653654
Ok(self
654655
.eos
@@ -662,7 +663,7 @@ impl<U: EosUnit, E: EquationOfState + EntropyScaling<U>> State<U, E> {
662663
/// that is used for entropy scaling.
663664
pub fn ln_diffusion_reduced(&self) -> EosResult<f64> {
664665
let s = self
665-
.molar_entropy(Contributions::Residual)
666+
.molar_entropy(Contributions::ResidualNvt)
666667
.to_reduced(U::reference_molar_entropy())?;
667668
self.eos.diffusion_correlation(s, &self.molefracs)
668669
}
@@ -676,7 +677,7 @@ impl<U: EosUnit, E: EquationOfState + EntropyScaling<U>> State<U, E> {
676677
/// Return the thermal conductivity via entropy scaling.
677678
pub fn thermal_conductivity(&self) -> EosResult<QuantityScalar<U>> {
678679
let s = self
679-
.molar_entropy(Contributions::Residual)
680+
.molar_entropy(Contributions::ResidualNvt)
680681
.to_reduced(U::reference_molar_entropy())?;
681682
Ok(self
682683
.eos
@@ -693,7 +694,7 @@ impl<U: EosUnit, E: EquationOfState + EntropyScaling<U>> State<U, E> {
693694
/// that is used for entropy scaling.
694695
pub fn ln_thermal_conductivity_reduced(&self) -> EosResult<f64> {
695696
let s = self
696-
.molar_entropy(Contributions::Residual)
697+
.molar_entropy(Contributions::ResidualNvt)
697698
.to_reduced(U::reference_molar_entropy())?;
698699
self.eos
699700
.thermal_conductivity_correlation(s, &self.molefracs)

0 commit comments

Comments
 (0)