From 818b653c1583bbd08841fb305f49a6ff6cf22368 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Fri, 6 Mar 2015 09:34:07 +0100 Subject: [PATCH] Removed extra overload of relperm(). --- opm/autodiff/BlackoilPropsAdFromDeck.cpp | 41 ----------------------- opm/autodiff/BlackoilPropsAdFromDeck.hpp | 12 ------- opm/autodiff/BlackoilPropsAdInterface.hpp | 13 ------- opm/autodiff/ImpesTPFAAD.cpp | 22 +++++++++--- opm/autodiff/ImpesTPFAAD.hpp | 1 + 5 files changed, 19 insertions(+), 70 deletions(-) diff --git a/opm/autodiff/BlackoilPropsAdFromDeck.cpp b/opm/autodiff/BlackoilPropsAdFromDeck.cpp index ffea06fbb..9d328ce88 100644 --- a/opm/autodiff/BlackoilPropsAdFromDeck.cpp +++ b/opm/autodiff/BlackoilPropsAdFromDeck.cpp @@ -628,47 +628,6 @@ BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck& // ------ Relative permeability ------ - /// Relative permeabilities for all phases. - /// \param[in] sw Array of n water saturation values. - /// \param[in] so Array of n oil saturation values. - /// \param[in] sg Array of n gas saturation values. - /// \param[in] cells Array of n cell indices to be associated with the saturation values. - /// \return An std::vector with 3 elements, each an array of n relperm values, - /// containing krw, kro, krg. Use PhaseIndex for indexing into the result. - std::vector BlackoilPropsAdFromDeck::relperm(const V& sw, - const V& so, - const V& sg, - const Cells& cells) const - { - const int n = cells.size(); - const int np = numPhases(); - Block s_all(n, np); - if (phase_usage_.phase_used[Water]) { - assert(sw.size() == n); - s_all.col(phase_usage_.phase_pos[Water]) = sw; - } - if (phase_usage_.phase_used[Oil]) { - assert(so.size() == n); - s_all.col(phase_usage_.phase_pos[Oil]) = so; - } - if (phase_usage_.phase_used[Gas]) { - assert(sg.size() == n); - s_all.col(phase_usage_.phase_pos[Gas]) = sg; - } - Block kr(n, np); - satprops_->relperm(n, s_all.data(), cells.data(), kr.data(), 0); - std::vector relperms; - relperms.reserve(3); - for (int phase = 0; phase < 3; ++phase) { - if (phase_usage_.phase_used[phase]) { - relperms.emplace_back(kr.col(phase_usage_.phase_pos[phase])); - } else { - relperms.emplace_back(); - } - } - return relperms; - } - /// Relative permeabilities for all phases. /// \param[in] sw Array of n water saturation values. /// \param[in] so Array of n oil saturation values. diff --git a/opm/autodiff/BlackoilPropsAdFromDeck.hpp b/opm/autodiff/BlackoilPropsAdFromDeck.hpp index 158024263..2aef0ac7e 100644 --- a/opm/autodiff/BlackoilPropsAdFromDeck.hpp +++ b/opm/autodiff/BlackoilPropsAdFromDeck.hpp @@ -260,18 +260,6 @@ namespace Opm // ------ Relative permeability ------ - /// Relative permeabilities for all phases. - /// \param[in] sw Array of n water saturation values. - /// \param[in] so Array of n oil saturation values. - /// \param[in] sg Array of n gas saturation values. - /// \param[in] cells Array of n cell indices to be associated with the saturation values. - /// \return An std::vector with 3 elements, each an array of n relperm values, - /// containing krw, kro, krg. Use PhaseIndex for indexing into the result. - std::vector relperm(const V& sw, - const V& so, - const V& sg, - const Cells& cells) const; - /// Relative permeabilities for all phases. /// \param[in] sw Array of n water saturation values. /// \param[in] so Array of n oil saturation values. diff --git a/opm/autodiff/BlackoilPropsAdInterface.hpp b/opm/autodiff/BlackoilPropsAdInterface.hpp index f7b0342d9..e90987e30 100644 --- a/opm/autodiff/BlackoilPropsAdInterface.hpp +++ b/opm/autodiff/BlackoilPropsAdInterface.hpp @@ -214,19 +214,6 @@ namespace Opm // ------ Relative permeability ------ - /// Relative permeabilities for all phases. - /// \param[in] sw Array of n water saturation values. - /// \param[in] so Array of n oil saturation values. - /// \param[in] sg Array of n gas saturation values. - /// \param[in] cells Array of n cell indices to be associated with the saturation values. - /// \return An std::vector with 3 elements, each an array of n relperm values, - /// containing krw, kro, krg. Use PhaseIndex for indexing into the result. - virtual - std::vector relperm(const V& sw, - const V& so, - const V& sg, - const Cells& cells) const = 0; - /// Relative permeabilities for all phases. /// \param[in] sw Array of n water saturation values. /// \param[in] so Array of n oil saturation values. diff --git a/opm/autodiff/ImpesTPFAAD.cpp b/opm/autodiff/ImpesTPFAAD.cpp index 75226ce6c..90fcaa3d3 100644 --- a/opm/autodiff/ImpesTPFAAD.cpp +++ b/opm/autodiff/ImpesTPFAAD.cpp @@ -180,7 +180,7 @@ namespace { // Compute relperms once and for all (since saturations are explicit). DataBlock s = Eigen::Map(state.saturation().data(), nc, np); assert(np == 2); - kr_ = fluid_.relperm(s.col(0), s.col(1), V::Zero(nc,1), buildAllCells(nc)); + kr_ = fluidRelperm(s.col(0), s.col(1), V::Zero(nc,1), buildAllCells(nc)); // Compute relperms for wells. This must be revisited for crossflow. const int nw = wells_.number_of_wells; const int nperf = wells_.well_connpos[nw]; @@ -193,7 +193,7 @@ namespace { } const std::vector well_cells(wells_.well_cells, wells_.well_cells + nperf); - well_kr_ = fluid_.relperm(well_s.col(0), well_s.col(1), V::Zero(nperf,1), well_cells); + well_kr_ = fluidRelperm(well_s.col(0), well_s.col(1), V::Zero(nperf,1), well_cells); const double atol = 1.0e-10; const double rtol = 5.0e-6; @@ -255,7 +255,7 @@ namespace { // Compute relperms. DataBlock s = Eigen::Map(state.saturation().data(), nc, np); assert(np == 2); - kr_ = fluid_.relperm(s.col(0), s.col(1), V::Zero(nc,1), buildAllCells(nc)); + kr_ = fluidRelperm(s.col(0), s.col(1), V::Zero(nc,1), buildAllCells(nc)); // Compute relperms for wells. This must be revisited for crossflow. DataBlock well_s(nperf, np); @@ -267,7 +267,7 @@ namespace { } const std::vector well_cells(wells_.well_cells, wells_.well_cells + nperf); - well_kr_ = fluid_.relperm(well_s.col(0), well_s.col(1), V::Zero(nperf,1), well_cells); + well_kr_ = fluidRelperm(well_s.col(0), well_s.col(1), V::Zero(nperf,1), well_cells); // Compute well pressure differentials. // Construct pressure difference vector for wells. @@ -641,6 +641,20 @@ namespace { + std::vector ImpesTPFAAD::fluidRelperm(const V& sw, + const V& so, + const V& sg, + const std::vector& cells) const + { + std::vector kr_ad = fluid_.relperm(ADB::constant(sw), ADB::constant(so), ADB::constant(sg), cells); + std::vector kr = { kr_ad[0].value(), kr_ad[1].value(), kr_ad[2].value() }; + return kr; + } + + + + + V ImpesTPFAAD::fluidKr(const int phase) const { return kr_[phase]; diff --git a/opm/autodiff/ImpesTPFAAD.hpp b/opm/autodiff/ImpesTPFAAD.hpp index aa137f4ea..b45d29ee7 100644 --- a/opm/autodiff/ImpesTPFAAD.hpp +++ b/opm/autodiff/ImpesTPFAAD.hpp @@ -110,6 +110,7 @@ namespace Opm { ADB fluidFvf(const int phase, const ADB& p, const ADB& T, const std::vector& cells) const; V fluidRho(const int phase, const V& p, const V& T, const std::vector& cells) const; ADB fluidRho(const int phase, const ADB& p, const ADB& T, const std::vector& cells) const; + std::vector fluidRelperm(const V& sw, const V& so, const V& sg, const std::vector& cells) const; V fluidKr(const int phase) const; V fluidKrWell(const int phase) const; };