From 13cc0a819779df7d8aa26ac4618de72967c0daa5 Mon Sep 17 00:00:00 2001 From: Trine Mykkeltvedt Date: Thu, 23 Jun 2022 14:35:51 +0200 Subject: [PATCH] cleaned PengRobinson, uncommented the stuff about extrema in the case of one rott - I think it can just be as it was --- opm/material/eos/PengRobinson.hpp | 62 +++++++++++-------------------- 1 file changed, 21 insertions(+), 41 deletions(-) diff --git a/opm/material/eos/PengRobinson.hpp b/opm/material/eos/PengRobinson.hpp index 5b531c09f..3c57743ec 100644 --- a/opm/material/eos/PengRobinson.hpp +++ b/opm/material/eos/PengRobinson.hpp @@ -186,10 +186,8 @@ public: Valgrind::CheckDefined(a2); Valgrind::CheckDefined(a3); Valgrind::CheckDefined(a4); - // std::cout << "Cubic params : " << a1 << " " << a2 << " " << a3 << " " << a4 << std::endl; // int numSol = invertCubicPolynomial(Z, a1, a2, a3, a4); int numSol = cubicRoots(Z, a1, a2, a3, a4); - // std::cout << "Z = " << Z[0] << " " << Z[1] << " " << Z[2] << std::endl; if (numSol == 3) { // the EOS has three intersections with the pressure, // i.e. the molar volume of gas is the largest one and the @@ -207,26 +205,26 @@ public: Vm = VmCubic; // find the extrema (if they are present) - // Evaluation Vmin, Vmax, pmin, pmax; - // if (findExtrema_(Vmin, Vmax, - // pmin, pmax, - // a, b, T)) - // { - // if (isGasPhase) - // Vm = std::max(Vmax, VmCubic); - // else { - // if (Vmin > 0) - // Vm = std::min(Vmin, VmCubic); - // else - // Vm = VmCubic; - // } - // } - // else { - // // the EOS does not exhibit any physically meaningful - // // extrema, and the fluid is critical... - // Vm = VmCubic; - // handleCriticalFluid_(Vm, fs, params, phaseIdx, isGasPhase); - // } + Evaluation Vmin, Vmax, pmin, pmax; + if (findExtrema_(Vmin, Vmax, + pmin, pmax, + a, b, T)) + { + if (isGasPhase) + Vm = std::max(Vmax, VmCubic); + else { + if (Vmin > 0) + Vm = std::min(Vmin, VmCubic); + else + Vm = VmCubic; + } + } + else { + // the EOS does not exhibit any physically meaningful + // extrema, and the fluid is critical... + Vm = VmCubic; + handleCriticalFluid_(Vm, fs, params, phaseIdx, isGasPhase); + } } Valgrind::CheckDefined(Vm); @@ -532,27 +530,9 @@ protected: const Evaluation& VmGas) { return fugacity(params, T, p, VmLiquid) - fugacity(params, T, p, VmGas); } -/* - static UniformTabulated2DFunction criticalTemperature_; - static UniformTabulated2DFunction criticalPressure_; - static UniformTabulated2DFunction criticalMolarVolume_; -*/ + }; -/* -template -const Scalar PengRobinson::R = Opm::Constants::R; - -template -UniformTabulated2DFunction PengRobinson::criticalTemperature_; - -template -UniformTabulated2DFunction PengRobinson::criticalPressure_; - -template -UniformTabulated2DFunction PengRobinson::criticalMolarVolume_; -*/ - } // namespace Opm #endif