WellInterfaceEval: separate from inheritance hierarcy

This commit is contained in:
Arne Morten Kvarving 2022-10-31 15:54:21 +01:00
parent 4c2ebbd445
commit 411e4d07e7
5 changed files with 48 additions and 45 deletions

View File

@ -35,6 +35,7 @@
#include <opm/simulators/wells/MSWellHelpers.hpp> #include <opm/simulators/wells/MSWellHelpers.hpp>
#include <opm/simulators/wells/WellBhpThpCalculator.hpp> #include <opm/simulators/wells/WellBhpThpCalculator.hpp>
#include <opm/simulators/wells/WellConvergence.hpp> #include <opm/simulators/wells/WellConvergence.hpp>
#include <opm/simulators/wells/WellInterfaceEval.hpp>
#include <opm/simulators/wells/WellInterfaceIndices.hpp> #include <opm/simulators/wells/WellInterfaceIndices.hpp>
#include <opm/simulators/wells/WellState.hpp> #include <opm/simulators/wells/WellState.hpp>
@ -1237,16 +1238,17 @@ assembleControlEq(const WellState& well_state,
deferred_logger); deferred_logger);
}; };
// Call generic implementation. // Call generic implementation.
baseif_.assembleControlEqInj(well_state, WellInterfaceEval(baseif_).
group_state, assembleControlEqInj(well_state,
schedule, group_state,
summaryState, schedule,
inj_controls, summaryState,
getBhp(), inj_controls,
injection_rate, getBhp(),
bhp_from_thp, injection_rate,
control_eq, bhp_from_thp,
deferred_logger); control_eq,
deferred_logger);
} else { } else {
// Find rates. // Find rates.
const auto rates = getRates(); const auto rates = getRates();
@ -1260,16 +1262,17 @@ assembleControlEq(const WellState& well_state,
deferred_logger); deferred_logger);
}; };
// Call generic implementation. // Call generic implementation.
baseif_.assembleControlEqProd(well_state, WellInterfaceEval(baseif_).
group_state, assembleControlEqProd(well_state,
schedule, group_state,
summaryState, schedule,
prod_controls, summaryState,
getBhp(), prod_controls,
rates, getBhp(),
bhp_from_thp, rates,
control_eq, bhp_from_thp,
deferred_logger); control_eq,
deferred_logger);
} }
// using control_eq to update the matrix and residuals // using control_eq to update the matrix and residuals

View File

@ -34,6 +34,7 @@
#include <opm/simulators/wells/ParallelWellInfo.hpp> #include <opm/simulators/wells/ParallelWellInfo.hpp>
#include <opm/simulators/wells/WellBhpThpCalculator.hpp> #include <opm/simulators/wells/WellBhpThpCalculator.hpp>
#include <opm/simulators/wells/WellConvergence.hpp> #include <opm/simulators/wells/WellConvergence.hpp>
#include <opm/simulators/wells/WellInterfaceEval.hpp>
#include <opm/simulators/wells/WellInterfaceIndices.hpp> #include <opm/simulators/wells/WellInterfaceIndices.hpp>
#include <opm/simulators/wells/WellState.hpp> #include <opm/simulators/wells/WellState.hpp>
#include <opm/simulators/linalg/bda/WellContributions.hpp> #include <opm/simulators/linalg/bda/WellContributions.hpp>
@ -403,16 +404,17 @@ assembleControlEq(const WellState& well_state,
}; };
// Call generic implementation. // Call generic implementation.
const auto& inj_controls = well.injectionControls(summaryState); const auto& inj_controls = well.injectionControls(summaryState);
baseif_.assembleControlEqInj(well_state, WellInterfaceEval(baseif_).
group_state, assembleControlEqInj(well_state,
schedule, group_state,
summaryState, schedule,
inj_controls, summaryState,
getBhp(), inj_controls,
injection_rate, getBhp(),
bhp_from_thp, injection_rate,
control_eq, bhp_from_thp,
deferred_logger); control_eq,
deferred_logger);
} else { } else {
// Find rates. // Find rates.
const auto rates = getRates(); const auto rates = getRates();
@ -427,16 +429,17 @@ assembleControlEq(const WellState& well_state,
}; };
// Call generic implementation. // Call generic implementation.
const auto& prod_controls = well.productionControls(summaryState); const auto& prod_controls = well.productionControls(summaryState);
baseif_.assembleControlEqProd(well_state, WellInterfaceEval(baseif_).
group_state, assembleControlEqProd(well_state,
schedule, group_state,
summaryState, schedule,
prod_controls, summaryState,
getBhp(), prod_controls,
rates, getBhp(),
bhp_from_thp, rates,
control_eq, bhp_from_thp,
deferred_logger); control_eq,
deferred_logger);
} }
// using control_eq to update the matrix and residuals // using control_eq to update the matrix and residuals

View File

@ -49,6 +49,8 @@ class WellInterfaceEval {
static constexpr int Gas = BlackoilPhases::Vapour; static constexpr int Gas = BlackoilPhases::Vapour;
public: public:
WellInterfaceEval(const WellInterfaceFluidSystem<FluidSystem>& baseif);
template<class EvalWell, class BhpFromThpFunc> template<class EvalWell, class BhpFromThpFunc>
void assembleControlEqProd(const WellState& well_state, void assembleControlEqProd(const WellState& well_state,
const GroupState& group_state, const GroupState& group_state,
@ -124,8 +126,6 @@ public:
DeferredLogger& deferred_logger) const; DeferredLogger& deferred_logger) const;
protected: protected:
WellInterfaceEval(const WellInterfaceFluidSystem<FluidSystem>& baseif);
const WellInterfaceFluidSystem<FluidSystem>& baseif_; const WellInterfaceFluidSystem<FluidSystem>& baseif_;
}; };

View File

@ -53,7 +53,6 @@ WellInterfaceIndices(const Well& well,
num_phases, num_phases,
index_of_well, index_of_well,
perf_data) perf_data)
, WellInterfaceEval<FluidSystem>(static_cast<const WellInterfaceFluidSystem<FluidSystem>&>(*this))
{ {
} }

View File

@ -24,14 +24,12 @@
#define OPM_WELLINTERFACE_INDICES_HEADER_INCLUDED #define OPM_WELLINTERFACE_INDICES_HEADER_INCLUDED
#include <opm/simulators/wells/WellInterfaceFluidSystem.hpp> #include <opm/simulators/wells/WellInterfaceFluidSystem.hpp>
#include <opm/simulators/wells/WellInterfaceEval.hpp>
namespace Opm namespace Opm
{ {
template<class FluidSystem, class Indices, class Scalar> template<class FluidSystem, class Indices, class Scalar>
class WellInterfaceIndices : public WellInterfaceFluidSystem<FluidSystem> class WellInterfaceIndices : public WellInterfaceFluidSystem<FluidSystem>
, public WellInterfaceEval<FluidSystem>
{ {
public: public:
using WellInterfaceFluidSystem<FluidSystem>::Gas; using WellInterfaceFluidSystem<FluidSystem>::Gas;