From 600e7ea2f710b35bb2c84b3269989b8eaf05ed7c Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 12 Apr 2024 17:06:27 +0200 Subject: [PATCH] Transmissibility: consistently use Scalar type --- opm/simulators/flow/Transmissibility.hpp | 2 +- opm/simulators/flow/Transmissibility_impl.hpp | 24 ++++++++++++++----- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/opm/simulators/flow/Transmissibility.hpp b/opm/simulators/flow/Transmissibility.hpp index 3d977c793..9838231a0 100644 --- a/opm/simulators/flow/Transmissibility.hpp +++ b/opm/simulators/flow/Transmissibility.hpp @@ -227,7 +227,7 @@ protected: void applyEditNncToGridTransHelper_(const std::unordered_map& globalToLocal, const std::string& keyword, const std::vector& nncs, const std::function& getLocation, - const std::function& apply); + const std::function& apply); void extractPermeability_(); diff --git a/opm/simulators/flow/Transmissibility_impl.hpp b/opm/simulators/flow/Transmissibility_impl.hpp index 9cdf891e0..310a8c61a 100644 --- a/opm/simulators/flow/Transmissibility_impl.hpp +++ b/opm/simulators/flow/Transmissibility_impl.hpp @@ -679,7 +679,13 @@ extractPorosity_() // over several processes.) const auto& fp = eclState_.fieldProps(); if (fp.has_double("PORO")) { - porosity_ = this-> lookUpData_.assignFieldPropsDoubleOnLeaf(fp,"PORO"); + if constexpr (std::is_same_v) { + porosity_ = this-> lookUpData_.assignFieldPropsDoubleOnLeaf(fp,"PORO"); + } else { + const auto por = this-> lookUpData_.assignFieldPropsDoubleOnLeaf(fp,"PORO"); + porosity_.resize(por.size()); + std::copy(por.begin(), por.end(), porosity_.begin()); + } } else throw std::logic_error("Can't read the porosityfrom the ecl state. " @@ -695,7 +701,13 @@ extractDispersion_() "contains the DISPERC keyword."); } const auto& fp = eclState_.fieldProps(); - dispersion_ = this-> lookUpData_.assignFieldPropsDoubleOnLeaf(fp,"DISPERC"); + if constexpr (std::is_same_v) { + dispersion_ = this-> lookUpData_.assignFieldPropsDoubleOnLeaf(fp,"DISPERC"); + } else { + const auto disp = this-> lookUpData_.assignFieldPropsDoubleOnLeaf(fp,"DISPERC"); + dispersion_.resize(disp.size()); + std::copy(disp.begin(), disp.end(), dispersion_.begin()); + } } template @@ -760,7 +772,7 @@ applyAllZMultipliers_(Scalar& trans, auto multiplier = transMult.getMultiplier(cartElemIdx, FaceDir::ZPlus); cartElemIdx += cartDims[0]*cartDims[1]; multiplier *= transMult.getMultiplier(cartElemIdx, FaceDir::ZMinus); - mult = std::min(mult, multiplier); + mult = std::min(mult, static_cast(multiplier)); } } @@ -1105,7 +1117,7 @@ applyEditNncToGridTrans_(const std::unordered_map& globalToLoca [&input](const NNCdata& nnc){ return input.edit_location(nnc);}, // Multiply transmissibility with EDITNNC value - [](double& trans, const double& rhs){ trans *= rhs;}); + [](Scalar& trans, const Scalar& rhs){ trans *= rhs;}); } template @@ -1118,7 +1130,7 @@ applyEditNncrToGridTrans_(const std::unordered_map& globalToLoc [&input](const NNCdata& nnc){ return input.editr_location(nnc);}, // Replace Transmissibility with EDITNNCR value - [](double& trans, const double& rhs){ trans = rhs;}); + [](Scalar& trans, const Scalar& rhs){ trans = rhs;}); } template @@ -1127,7 +1139,7 @@ applyEditNncToGridTransHelper_(const std::unordered_map& global const std::string& keyword, const std::vector& nncs, const std::function& getLocation, - const std::function& apply) + const std::function& apply) { if (nncs.empty()) return;