From d53b6ad9fa2ee289c5700ce77c1be597a2603797 Mon Sep 17 00:00:00 2001 From: hnil Date: Tue, 14 Jun 2022 21:03:09 +0200 Subject: [PATCH] added spesialisation for using simple property updating --- flow/flow_blackoil_tpfa.cpp | 6 +++++ opm/simulators/flow/BlackoilModelEbos.hpp | 30 +++++++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/flow/flow_blackoil_tpfa.cpp b/flow/flow_blackoil_tpfa.cpp index e013505aa..bca00970f 100644 --- a/flow/flow_blackoil_tpfa.cpp +++ b/flow/flow_blackoil_tpfa.cpp @@ -20,6 +20,7 @@ #include // modifications from standard #include +#include #include #include #include @@ -76,6 +77,11 @@ namespace Opm { struct FluxModule { using type = EclTransFluxModuleTPFA; }; + template + struct IntensiveQuantities { + using type = BlackOilIntensiveQuantitiesSimple; + }; + } } // namespace Opm { diff --git a/opm/simulators/flow/BlackoilModelEbos.hpp b/opm/simulators/flow/BlackoilModelEbos.hpp index e0c6643cd..21d58aaf8 100644 --- a/opm/simulators/flow/BlackoilModelEbos.hpp +++ b/opm/simulators/flow/BlackoilModelEbos.hpp @@ -52,6 +52,8 @@ #include +#include + #include #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 7) #include @@ -170,6 +172,8 @@ namespace Opm { using Indices = GetPropType; using MaterialLaw = GetPropType; using MaterialLawParams = GetPropType; + using IntensiveQuantities = GetPropType; + using Problem = GetPropType; typedef double Scalar; static const int numEq = Indices::numEq; @@ -568,11 +572,28 @@ namespace Opm { ebosSolver.solve(x); } + template + void updateIntensiveQuantity(const Problem& /*problem*/, + const SolutionVector& /*solution*/, + const IntensiveQuantity*) + { + ebosSimulator_.model().invalidateAndUpdateIntensiveQuantities(/*timeIdx=*/0); + } - + + void updateIntensiveQuantity(const Problem& problem, + const SolutionVector& solution, + const BlackOilIntensiveQuantitiesSimple* /*intensive*/) + { + ebosSimulator_.model().invalidateAndUpdateIntensiveQuantitiesSimple(problem, + solution, + /*timeIdx*/0); + } + /// Apply an update to the primary variables. void updateSolution(const BVector& dx) { + auto& problem = ebosSimulator_.problem(); auto& ebosNewtonMethod = ebosSimulator_.model().newtonMethod(); SolutionVector& solution = ebosSimulator_.model().solution(/*timeIdx=*/0); @@ -584,7 +605,12 @@ namespace Opm { // residual // if the solution is updated, the intensive quantities need to be recalculated - ebosSimulator_.model().invalidateAndUpdateIntensiveQuantities(/*timeIdx=*/0); + //ebosSimulator_.model().invalidateAndUpdateIntensiveQuantities(/*timeIdx=*/0); + IntensiveQuantities* dummy = NULL;//only for template spesialization + this->updateIntensiveQuantity(problem,solution, dummy); + //ebosSimulator_.model().invalidateAndUpdateIntensiveQuantitiesSimple(problem, + //solution, + // /*timeIdx=*/0); } /// Return true if output to cout is wanted.