From 17554b4921920dc51774b426be5bc0a134a4c40c Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Thu, 10 Dec 2015 12:53:09 +0100 Subject: [PATCH] Add support for TLMIXPAR Add support for Todd-Longstaff mixing paramters --- opm/autodiff/SolventPropsAdFromDeck.cpp | 34 +++++++++++++++++++++++++ opm/autodiff/SolventPropsAdFromDeck.hpp | 9 +++++++ 2 files changed, 43 insertions(+) diff --git a/opm/autodiff/SolventPropsAdFromDeck.cpp b/opm/autodiff/SolventPropsAdFromDeck.cpp index 470bf3bc2a..d205331140 100644 --- a/opm/autodiff/SolventPropsAdFromDeck.cpp +++ b/opm/autodiff/SolventPropsAdFromDeck.cpp @@ -247,6 +247,31 @@ SolventPropsAdFromDeck::SolventPropsAdFromDeck(DeckConstPtr deck, } } + if (deck->hasKeyword("TLMIXPAR")) { + const auto tlmixparRecord = deck->getKeyword("TLMIXPAR")->getRecord(0); + std::vector mix_params_viscosity = tlmixparRecord->getItem("TL_VISCOSITY_PARAMETER")->getSIDoubleData(); + const int numRegions = mix_params_viscosity.size(); + if (numRegions > 1) { + OPM_THROW(std::runtime_error, "Only singel miscibility region is supported for TLMIXPAR."); + } + mix_param_viscosity_ = mix_params_viscosity[0]; + + std::vector mix_params_density = tlmixparRecord->getItem("TL_DENSITY_PARAMETER")->getSIDoubleData(); + const int numDensityItems = mix_params_density.size(); + if (numDensityItems == 0) { + mix_param_density_ = mix_param_viscosity_; + } else if (numDensityItems == 1) { + mix_param_density_ = mix_params_density[0]; + } else { + OPM_THROW(std::runtime_error, "Only singel miscibility region is supported for TLMIXPAR."); + } + } else { + mix_param_viscosity_ = 0.0; + mix_param_density_ = 0.0; + } + + + } } @@ -385,4 +410,13 @@ V SolventPropsAdFromDeck::solventSurfaceDensity(const Cells& cells) const { return density; } +double SolventPropsAdFromDeck::mixingParamterViscosity() const { + return mix_param_viscosity_; +} + +double SolventPropsAdFromDeck::mixingParamterDensity() const { + return mix_param_density_; +} + + } //namespace OPM diff --git a/opm/autodiff/SolventPropsAdFromDeck.hpp b/opm/autodiff/SolventPropsAdFromDeck.hpp index 6fb349d9e7..5995b66d27 100644 --- a/opm/autodiff/SolventPropsAdFromDeck.hpp +++ b/opm/autodiff/SolventPropsAdFromDeck.hpp @@ -127,6 +127,13 @@ public: /// \return Array of n solvent density values. V solventSurfaceDensity(const Cells& cells) const; + /// Todd-Longstaff mixing paramter for viscosity calculation + double mixingParamterViscosity() const; + + /// Todd-Longstaff mixing paramter for density calculation + double mixingParamterDensity() const; + + private: ADB makeAD(const ADB& X, const Cells& cells, std::vector > table) const; @@ -145,6 +152,8 @@ private: std::vector > misc_; std::vector > sorwmis_; std::vector > sgcwmis_; + double mix_param_viscosity_; + double mix_param_density_; }; } // namespace OPM