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

View File

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

View File

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

View File

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