mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
rename WellInterfaceEval to WellAssemble
This commit is contained in:
parent
411e4d07e7
commit
b700ec9b53
@ -103,13 +103,13 @@ list (APPEND MAIN_SOURCE_FILES
|
|||||||
opm/simulators/wells/VFPHelpers.cpp
|
opm/simulators/wells/VFPHelpers.cpp
|
||||||
opm/simulators/wells/VFPProdProperties.cpp
|
opm/simulators/wells/VFPProdProperties.cpp
|
||||||
opm/simulators/wells/VFPInjProperties.cpp
|
opm/simulators/wells/VFPInjProperties.cpp
|
||||||
|
opm/simulators/wells/WellAssemble.cpp
|
||||||
opm/simulators/wells/WellBhpThpCalculator.cpp
|
opm/simulators/wells/WellBhpThpCalculator.cpp
|
||||||
opm/simulators/wells/WellConvergence.cpp
|
opm/simulators/wells/WellConvergence.cpp
|
||||||
opm/simulators/wells/WellGroupConstraints.cpp
|
opm/simulators/wells/WellGroupConstraints.cpp
|
||||||
opm/simulators/wells/WellGroupControls.cpp
|
opm/simulators/wells/WellGroupControls.cpp
|
||||||
opm/simulators/wells/WellGroupHelpers.cpp
|
opm/simulators/wells/WellGroupHelpers.cpp
|
||||||
opm/simulators/wells/WellHelpers.cpp
|
opm/simulators/wells/WellHelpers.cpp
|
||||||
opm/simulators/wells/WellInterfaceEval.cpp
|
|
||||||
opm/simulators/wells/WellInterfaceFluidSystem.cpp
|
opm/simulators/wells/WellInterfaceFluidSystem.cpp
|
||||||
opm/simulators/wells/WellInterfaceGeneric.cpp
|
opm/simulators/wells/WellInterfaceGeneric.cpp
|
||||||
opm/simulators/wells/WellInterfaceIndices.cpp
|
opm/simulators/wells/WellInterfaceIndices.cpp
|
||||||
@ -386,6 +386,7 @@ list (APPEND PUBLIC_HEADER_FILES
|
|||||||
opm/simulators/wells/VFPInjProperties.hpp
|
opm/simulators/wells/VFPInjProperties.hpp
|
||||||
opm/simulators/wells/VFPProdProperties.hpp
|
opm/simulators/wells/VFPProdProperties.hpp
|
||||||
opm/simulators/wells/VFPProperties.hpp
|
opm/simulators/wells/VFPProperties.hpp
|
||||||
|
opm/simulators/wells/WellAssemble.hpp
|
||||||
opm/simulators/wells/WellBhpThpCalculator.hpp
|
opm/simulators/wells/WellBhpThpCalculator.hpp
|
||||||
opm/simulators/wells/WellConnectionAuxiliaryModule.hpp
|
opm/simulators/wells/WellConnectionAuxiliaryModule.hpp
|
||||||
opm/simulators/wells/WellConvergence.hpp
|
opm/simulators/wells/WellConvergence.hpp
|
||||||
|
@ -33,9 +33,9 @@
|
|||||||
#include <opm/simulators/timestepping/ConvergenceReport.hpp>
|
#include <opm/simulators/timestepping/ConvergenceReport.hpp>
|
||||||
#include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp>
|
#include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp>
|
||||||
#include <opm/simulators/wells/MSWellHelpers.hpp>
|
#include <opm/simulators/wells/MSWellHelpers.hpp>
|
||||||
|
#include <opm/simulators/wells/WellAssemble.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>
|
||||||
|
|
||||||
@ -1228,7 +1228,7 @@ assembleControlEq(const WellState& well_state,
|
|||||||
}
|
}
|
||||||
const EvalWell injection_rate = getWQTotal() / scaling;
|
const EvalWell injection_rate = getWQTotal() / scaling;
|
||||||
// Setup function for evaluation of BHP from THP (used only if needed).
|
// Setup function for evaluation of BHP from THP (used only if needed).
|
||||||
auto bhp_from_thp = [&]() {
|
std::function<EvalWell()> bhp_from_thp = [&]() {
|
||||||
const auto rates = getRates();
|
const auto rates = getRates();
|
||||||
return WellBhpThpCalculator(baseif_).calculateBhpFromThp(well_state,
|
return WellBhpThpCalculator(baseif_).calculateBhpFromThp(well_state,
|
||||||
rates,
|
rates,
|
||||||
@ -1238,22 +1238,21 @@ assembleControlEq(const WellState& well_state,
|
|||||||
deferred_logger);
|
deferred_logger);
|
||||||
};
|
};
|
||||||
// Call generic implementation.
|
// Call generic implementation.
|
||||||
WellInterfaceEval(baseif_).
|
WellAssemble(baseif_).assembleControlEqInj(well_state,
|
||||||
assembleControlEqInj(well_state,
|
group_state,
|
||||||
group_state,
|
schedule,
|
||||||
schedule,
|
summaryState,
|
||||||
summaryState,
|
inj_controls,
|
||||||
inj_controls,
|
getBhp(),
|
||||||
getBhp(),
|
injection_rate,
|
||||||
injection_rate,
|
bhp_from_thp,
|
||||||
bhp_from_thp,
|
control_eq,
|
||||||
control_eq,
|
deferred_logger);
|
||||||
deferred_logger);
|
|
||||||
} else {
|
} else {
|
||||||
// Find rates.
|
// Find rates.
|
||||||
const auto rates = getRates();
|
const auto rates = getRates();
|
||||||
// Setup function for evaluation of BHP from THP (used only if needed).
|
// Setup function for evaluation of BHP from THP (used only if needed).
|
||||||
auto bhp_from_thp = [&]() {
|
std::function<EvalWell()> bhp_from_thp = [&]() {
|
||||||
return WellBhpThpCalculator(baseif_).calculateBhpFromThp(well_state,
|
return WellBhpThpCalculator(baseif_).calculateBhpFromThp(well_state,
|
||||||
rates,
|
rates,
|
||||||
well,
|
well,
|
||||||
@ -1262,17 +1261,16 @@ assembleControlEq(const WellState& well_state,
|
|||||||
deferred_logger);
|
deferred_logger);
|
||||||
};
|
};
|
||||||
// Call generic implementation.
|
// Call generic implementation.
|
||||||
WellInterfaceEval(baseif_).
|
WellAssemble(baseif_).assembleControlEqProd(well_state,
|
||||||
assembleControlEqProd(well_state,
|
group_state,
|
||||||
group_state,
|
schedule,
|
||||||
schedule,
|
summaryState,
|
||||||
summaryState,
|
prod_controls,
|
||||||
prod_controls,
|
getBhp(),
|
||||||
getBhp(),
|
rates,
|
||||||
rates,
|
bhp_from_thp,
|
||||||
bhp_from_thp,
|
control_eq,
|
||||||
control_eq,
|
deferred_logger);
|
||||||
deferred_logger);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// using control_eq to update the matrix and residuals
|
// using control_eq to update the matrix and residuals
|
||||||
|
@ -32,9 +32,9 @@
|
|||||||
#include <opm/simulators/timestepping/ConvergenceReport.hpp>
|
#include <opm/simulators/timestepping/ConvergenceReport.hpp>
|
||||||
#include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp>
|
#include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp>
|
||||||
#include <opm/simulators/wells/ParallelWellInfo.hpp>
|
#include <opm/simulators/wells/ParallelWellInfo.hpp>
|
||||||
|
#include <opm/simulators/wells/WellAssemble.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>
|
||||||
@ -393,7 +393,7 @@ assembleControlEq(const WellState& well_state,
|
|||||||
// Find injection rate.
|
// Find injection rate.
|
||||||
const EvalWell injection_rate = getWQTotal();
|
const EvalWell injection_rate = getWQTotal();
|
||||||
// Setup function for evaluation of BHP from THP (used only if needed).
|
// Setup function for evaluation of BHP from THP (used only if needed).
|
||||||
auto bhp_from_thp = [&]() {
|
std::function<EvalWell()> bhp_from_thp = [&]() {
|
||||||
const auto rates = getRates();
|
const auto rates = getRates();
|
||||||
return WellBhpThpCalculator(baseif_).calculateBhpFromThp(well_state,
|
return WellBhpThpCalculator(baseif_).calculateBhpFromThp(well_state,
|
||||||
rates,
|
rates,
|
||||||
@ -404,7 +404,7 @@ 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);
|
||||||
WellInterfaceEval(baseif_).
|
WellAssemble(baseif_).
|
||||||
assembleControlEqInj(well_state,
|
assembleControlEqInj(well_state,
|
||||||
group_state,
|
group_state,
|
||||||
schedule,
|
schedule,
|
||||||
@ -419,7 +419,7 @@ assembleControlEq(const WellState& well_state,
|
|||||||
// Find rates.
|
// Find rates.
|
||||||
const auto rates = getRates();
|
const auto rates = getRates();
|
||||||
// Setup function for evaluation of BHP from THP (used only if needed).
|
// Setup function for evaluation of BHP from THP (used only if needed).
|
||||||
auto bhp_from_thp = [&]() {
|
std::function<EvalWell()> bhp_from_thp = [&]() {
|
||||||
return WellBhpThpCalculator(baseif_).calculateBhpFromThp(well_state,
|
return WellBhpThpCalculator(baseif_).calculateBhpFromThp(well_state,
|
||||||
rates,
|
rates,
|
||||||
well,
|
well,
|
||||||
@ -429,7 +429,7 @@ 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);
|
||||||
WellInterfaceEval(baseif_).
|
WellAssemble(baseif_).
|
||||||
assembleControlEqProd(well_state,
|
assembleControlEqProd(well_state,
|
||||||
group_state,
|
group_state,
|
||||||
schedule,
|
schedule,
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <opm/simulators/wells/WellInterfaceEval.hpp>
|
#include <opm/simulators/wells/WellAssemble.hpp>
|
||||||
|
|
||||||
#include <opm/material/densead/Evaluation.hpp>
|
#include <opm/material/densead/Evaluation.hpp>
|
||||||
#include <opm/material/fluidsystems/BlackOilFluidSystem.hpp>
|
#include <opm/material/fluidsystems/BlackOilFluidSystem.hpp>
|
||||||
@ -44,29 +44,29 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
|
|
||||||
template<class FluidSystem>
|
template<class FluidSystem>
|
||||||
WellInterfaceEval<FluidSystem>::
|
WellAssemble<FluidSystem>::
|
||||||
WellInterfaceEval(const WellInterfaceFluidSystem<FluidSystem>& baseif)
|
WellAssemble(const WellInterfaceFluidSystem<FluidSystem>& well)
|
||||||
: baseif_(baseif)
|
: well_(well)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
template<class FluidSystem>
|
template<class FluidSystem>
|
||||||
template<class EvalWell>
|
template<class EvalWell>
|
||||||
void
|
void
|
||||||
WellInterfaceEval<FluidSystem>::
|
WellAssemble<FluidSystem>::
|
||||||
assembleControlEqProd_(const WellState& well_state,
|
assembleControlEqProd(const WellState& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState& group_state,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
const Well::ProductionControls& controls,
|
const Well::ProductionControls& controls,
|
||||||
const EvalWell& bhp,
|
const EvalWell& bhp,
|
||||||
const std::vector<EvalWell>& rates, // Always 3 canonical rates.
|
const std::vector<EvalWell>& rates, // Always 3 canonical rates.
|
||||||
const std::function<EvalWell()>& bhp_from_thp,
|
const std::function<EvalWell()>& bhp_from_thp,
|
||||||
EvalWell& control_eq,
|
EvalWell& control_eq,
|
||||||
DeferredLogger& deferred_logger) const
|
DeferredLogger& deferred_logger) const
|
||||||
{
|
{
|
||||||
const auto current = well_state.well(baseif_.indexOfWell()).production_cmode;
|
const auto current = well_state.well(well_.indexOfWell()).production_cmode;
|
||||||
const auto& pu = baseif_.phaseUsage();
|
const auto& pu = well_.phaseUsage();
|
||||||
const double efficiencyFactor = baseif_.wellEcl().getEfficiencyFactor();
|
const double efficiencyFactor = well_.wellEcl().getEfficiencyFactor();
|
||||||
|
|
||||||
switch (current) {
|
switch (current) {
|
||||||
case Well::ProducerCMode::ORAT: {
|
case Well::ProducerCMode::ORAT: {
|
||||||
@ -95,13 +95,13 @@ assembleControlEqProd_(const WellState& well_state,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Well::ProducerCMode::CRAT: {
|
case Well::ProducerCMode::CRAT: {
|
||||||
OPM_DEFLOG_THROW(std::runtime_error, "CRAT control not supported " << baseif_.name(), deferred_logger);
|
OPM_DEFLOG_THROW(std::runtime_error, "CRAT control not supported " << well_.name(), deferred_logger);
|
||||||
}
|
}
|
||||||
case Well::ProducerCMode::RESV: {
|
case Well::ProducerCMode::RESV: {
|
||||||
auto total_rate = rates[0]; // To get the correct type only.
|
auto total_rate = rates[0]; // To get the correct type only.
|
||||||
total_rate = 0.0;
|
total_rate = 0.0;
|
||||||
std::vector<double> convert_coeff(baseif_.numPhases(), 1.0);
|
std::vector<double> convert_coeff(well_.numPhases(), 1.0);
|
||||||
baseif_.rateConverter().calcCoeff(/*fipreg*/ 0, baseif_.pvtRegionIdx(), convert_coeff);
|
well_.rateConverter().calcCoeff(/*fipreg*/ 0, well_.pvtRegionIdx(), convert_coeff);
|
||||||
for (int phase = 0; phase < 3; ++phase) {
|
for (int phase = 0; phase < 3; ++phase) {
|
||||||
if (pu.phase_used[phase]) {
|
if (pu.phase_used[phase]) {
|
||||||
const int pos = pu.phase_pos[phase];
|
const int pos = pu.phase_pos[phase];
|
||||||
@ -111,7 +111,7 @@ assembleControlEqProd_(const WellState& well_state,
|
|||||||
if (controls.prediction_mode) {
|
if (controls.prediction_mode) {
|
||||||
control_eq = total_rate - controls.resv_rate;
|
control_eq = total_rate - controls.resv_rate;
|
||||||
} else {
|
} else {
|
||||||
std::vector<double> hrates(baseif_.numPhases(), 0.);
|
std::vector<double> hrates(well_.numPhases(), 0.);
|
||||||
if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) {
|
if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) {
|
||||||
hrates[pu.phase_pos[Water]] = controls.water_rate;
|
hrates[pu.phase_pos[Water]] = controls.water_rate;
|
||||||
}
|
}
|
||||||
@ -121,8 +121,8 @@ assembleControlEqProd_(const WellState& well_state,
|
|||||||
if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) {
|
if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) {
|
||||||
hrates[pu.phase_pos[Gas]] = controls.gas_rate;
|
hrates[pu.phase_pos[Gas]] = controls.gas_rate;
|
||||||
}
|
}
|
||||||
std::vector<double> hrates_resv(baseif_.numPhases(), 0.);
|
std::vector<double> hrates_resv(well_.numPhases(), 0.);
|
||||||
baseif_.rateConverter().calcReservoirVoidageRates(/*fipreg*/ 0, baseif_.pvtRegionIdx(), hrates, hrates_resv);
|
well_.rateConverter().calcReservoirVoidageRates(/*fipreg*/ 0, well_.pvtRegionIdx(), hrates, hrates_resv);
|
||||||
double target = std::accumulate(hrates_resv.begin(), hrates_resv.end(), 0.0);
|
double target = std::accumulate(hrates_resv.begin(), hrates_resv.end(), 0.0);
|
||||||
control_eq = total_rate - target;
|
control_eq = total_rate - target;
|
||||||
}
|
}
|
||||||
@ -137,8 +137,8 @@ assembleControlEqProd_(const WellState& well_state,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Well::ProducerCMode::GRUP: {
|
case Well::ProducerCMode::GRUP: {
|
||||||
assert(baseif_.wellEcl().isAvailableForGroupControl());
|
assert(well_.wellEcl().isAvailableForGroupControl());
|
||||||
const auto& group = schedule.getGroup(baseif_.wellEcl().groupName(), baseif_.currentStep());
|
const auto& group = schedule.getGroup(well_.wellEcl().groupName(), well_.currentStep());
|
||||||
// Annoying thing: the rates passed to this function are
|
// Annoying thing: the rates passed to this function are
|
||||||
// always of size 3 and in canonical (for PhaseUsage)
|
// always of size 3 and in canonical (for PhaseUsage)
|
||||||
// order. This is what is needed for VFP calculations if
|
// order. This is what is needed for VFP calculations if
|
||||||
@ -153,9 +153,9 @@ assembleControlEqProd_(const WellState& well_state,
|
|||||||
}
|
}
|
||||||
auto rCoeff = [this](const RegionId id, const int region, std::vector<double>& coeff)
|
auto rCoeff = [this](const RegionId id, const int region, std::vector<double>& coeff)
|
||||||
{
|
{
|
||||||
baseif_.rateConverter().calcCoeff(id, region, coeff);
|
well_.rateConverter().calcCoeff(id, region, coeff);
|
||||||
};
|
};
|
||||||
WellGroupControls(baseif_).getGroupProductionControl(group, well_state,
|
WellGroupControls(well_).getGroupProductionControl(group, well_state,
|
||||||
group_state,
|
group_state,
|
||||||
schedule,
|
schedule,
|
||||||
summaryState,
|
summaryState,
|
||||||
@ -166,10 +166,10 @@ assembleControlEqProd_(const WellState& well_state,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Well::ProducerCMode::CMODE_UNDEFINED: {
|
case Well::ProducerCMode::CMODE_UNDEFINED: {
|
||||||
OPM_DEFLOG_THROW(std::runtime_error, "Well control must be specified for well " + baseif_.name(), deferred_logger);
|
OPM_DEFLOG_THROW(std::runtime_error, "Well control must be specified for well " + well_.name(), deferred_logger);
|
||||||
}
|
}
|
||||||
case Well::ProducerCMode::NONE: {
|
case Well::ProducerCMode::NONE: {
|
||||||
OPM_DEFLOG_THROW(std::runtime_error, "Well control must be specified for well " + baseif_.name(), deferred_logger);
|
OPM_DEFLOG_THROW(std::runtime_error, "Well control must be specified for well " + well_.name(), deferred_logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -177,22 +177,22 @@ assembleControlEqProd_(const WellState& well_state,
|
|||||||
template<class FluidSystem>
|
template<class FluidSystem>
|
||||||
template<class EvalWell>
|
template<class EvalWell>
|
||||||
void
|
void
|
||||||
WellInterfaceEval<FluidSystem>::
|
WellAssemble<FluidSystem>::
|
||||||
assembleControlEqInj_(const WellState& well_state,
|
assembleControlEqInj(const WellState& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState& group_state,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
const Well::InjectionControls& controls,
|
const Well::InjectionControls& controls,
|
||||||
const EvalWell& bhp,
|
const EvalWell& bhp,
|
||||||
const EvalWell& injection_rate,
|
const EvalWell& injection_rate,
|
||||||
const std::function<EvalWell()>& bhp_from_thp,
|
const std::function<EvalWell()>& bhp_from_thp,
|
||||||
EvalWell& control_eq,
|
EvalWell& control_eq,
|
||||||
DeferredLogger& deferred_logger) const
|
DeferredLogger& deferred_logger) const
|
||||||
{
|
{
|
||||||
auto current = well_state.well(baseif_.indexOfWell()).injection_cmode;
|
auto current = well_state.well(well_.indexOfWell()).injection_cmode;
|
||||||
const InjectorType injectorType = controls.injector_type;
|
const InjectorType injectorType = controls.injector_type;
|
||||||
const auto& pu = baseif_.phaseUsage();
|
const auto& pu = well_.phaseUsage();
|
||||||
const double efficiencyFactor = baseif_.wellEcl().getEfficiencyFactor();
|
const double efficiencyFactor = well_.wellEcl().getEfficiencyFactor();
|
||||||
|
|
||||||
switch (current) {
|
switch (current) {
|
||||||
case Well::InjectorCMode::RATE: {
|
case Well::InjectorCMode::RATE: {
|
||||||
@ -200,8 +200,8 @@ assembleControlEqInj_(const WellState& well_state,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Well::InjectorCMode::RESV: {
|
case Well::InjectorCMode::RESV: {
|
||||||
std::vector<double> convert_coeff(baseif_.numPhases(), 1.0);
|
std::vector<double> convert_coeff(well_.numPhases(), 1.0);
|
||||||
baseif_.rateConverter().calcInjCoeff(/*fipreg*/ 0, baseif_.pvtRegionIdx(), convert_coeff);
|
well_.rateConverter().calcInjCoeff(/*fipreg*/ 0, well_.pvtRegionIdx(), convert_coeff);
|
||||||
|
|
||||||
double coeff = 1.0;
|
double coeff = 1.0;
|
||||||
|
|
||||||
@ -219,7 +219,7 @@ assembleControlEqInj_(const WellState& well_state,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
throw("Expected WATER, OIL or GAS as type for injectors " + baseif_.wellEcl().name());
|
throw("Expected WATER, OIL or GAS as type for injectors " + well_.wellEcl().name());
|
||||||
}
|
}
|
||||||
|
|
||||||
control_eq = coeff * injection_rate - controls.reservoir_rate;
|
control_eq = coeff * injection_rate - controls.reservoir_rate;
|
||||||
@ -234,13 +234,13 @@ assembleControlEqInj_(const WellState& well_state,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Well::InjectorCMode::GRUP: {
|
case Well::InjectorCMode::GRUP: {
|
||||||
assert(baseif_.wellEcl().isAvailableForGroupControl());
|
assert(well_.wellEcl().isAvailableForGroupControl());
|
||||||
const auto& group = schedule.getGroup(baseif_.wellEcl().groupName(), baseif_.currentStep());
|
const auto& group = schedule.getGroup(well_.wellEcl().groupName(), well_.currentStep());
|
||||||
auto rCoeff = [this](const RegionId id, const int region, std::vector<double>& coeff)
|
auto rCoeff = [this](const RegionId id, const int region, std::vector<double>& coeff)
|
||||||
{
|
{
|
||||||
baseif_.rateConverter().calcInjCoeff(id, region, coeff);
|
well_.rateConverter().calcInjCoeff(id, region, coeff);
|
||||||
};
|
};
|
||||||
WellGroupControls(baseif_).getGroupInjectionControl(group,
|
WellGroupControls(well_).getGroupInjectionControl(group,
|
||||||
well_state,
|
well_state,
|
||||||
group_state,
|
group_state,
|
||||||
schedule,
|
schedule,
|
||||||
@ -255,38 +255,38 @@ assembleControlEqInj_(const WellState& well_state,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Well::InjectorCMode::CMODE_UNDEFINED: {
|
case Well::InjectorCMode::CMODE_UNDEFINED: {
|
||||||
OPM_DEFLOG_THROW(std::runtime_error, "Well control must be specified for well " + baseif_.name(), deferred_logger);
|
OPM_DEFLOG_THROW(std::runtime_error, "Well control must be specified for well " + well_.name(), deferred_logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define INSTANCE_METHODS(A,...) \
|
#define INSTANCE_METHODS(A,...) \
|
||||||
template void WellInterfaceEval<A>:: \
|
template void WellAssemble<A>:: \
|
||||||
assembleControlEqProd_<__VA_ARGS__>(const WellState&, \
|
assembleControlEqProd<__VA_ARGS__>(const WellState&, \
|
||||||
const GroupState&, \
|
|
||||||
const Schedule&, \
|
|
||||||
const SummaryState&, \
|
|
||||||
const Well::ProductionControls&, \
|
|
||||||
const __VA_ARGS__&, \
|
|
||||||
const std::vector<__VA_ARGS__>&, \
|
|
||||||
const std::function<__VA_ARGS__()>&, \
|
|
||||||
__VA_ARGS__&, \
|
|
||||||
DeferredLogger&) const; \
|
|
||||||
template void WellInterfaceEval<A>:: \
|
|
||||||
assembleControlEqInj_<__VA_ARGS__>(const WellState&, \
|
|
||||||
const GroupState&, \
|
const GroupState&, \
|
||||||
const Schedule&, \
|
const Schedule&, \
|
||||||
const SummaryState&, \
|
const SummaryState&, \
|
||||||
const Well::InjectionControls&, \
|
const Well::ProductionControls&, \
|
||||||
const __VA_ARGS__&, \
|
|
||||||
const __VA_ARGS__&, \
|
const __VA_ARGS__&, \
|
||||||
|
const std::vector<__VA_ARGS__>&, \
|
||||||
const std::function<__VA_ARGS__()>&, \
|
const std::function<__VA_ARGS__()>&, \
|
||||||
__VA_ARGS__&, \
|
__VA_ARGS__&, \
|
||||||
DeferredLogger&) const;
|
DeferredLogger&) const; \
|
||||||
|
template void WellAssemble<A>:: \
|
||||||
|
assembleControlEqInj<__VA_ARGS__>(const WellState&, \
|
||||||
|
const GroupState&, \
|
||||||
|
const Schedule&, \
|
||||||
|
const SummaryState&, \
|
||||||
|
const Well::InjectionControls&, \
|
||||||
|
const __VA_ARGS__&, \
|
||||||
|
const __VA_ARGS__&, \
|
||||||
|
const std::function<__VA_ARGS__()>&, \
|
||||||
|
__VA_ARGS__&, \
|
||||||
|
DeferredLogger&) const;
|
||||||
|
|
||||||
using FluidSys = BlackOilFluidSystem<double, BlackOilDefaultIndexTraits>;
|
using FluidSys = BlackOilFluidSystem<double, BlackOilDefaultIndexTraits>;
|
||||||
|
|
||||||
template class WellInterfaceEval<FluidSys>;
|
template class WellAssemble<FluidSys>;
|
||||||
|
|
||||||
INSTANCE_METHODS(FluidSys, DenseAd::Evaluation<double,3,0u>)
|
INSTANCE_METHODS(FluidSys, DenseAd::Evaluation<double,3,0u>)
|
||||||
INSTANCE_METHODS(FluidSys, DenseAd::Evaluation<double,4,0u>)
|
INSTANCE_METHODS(FluidSys, DenseAd::Evaluation<double,4,0u>)
|
84
opm/simulators/wells/WellAssemble.hpp
Normal file
84
opm/simulators/wells/WellAssemble.hpp
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2017 SINTEF Digital, Mathematics and Cybernetics.
|
||||||
|
Copyright 2017 Statoil ASA.
|
||||||
|
Copyright 2017 IRIS
|
||||||
|
Copyright 2019 Norce
|
||||||
|
|
||||||
|
This file is part of the Open Porous Media project (OPM).
|
||||||
|
|
||||||
|
OPM is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OPM is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef OPM_WELL_ASSEMBLE_HEADER_INCLUDED
|
||||||
|
#define OPM_WELL_ASSEMBLE_HEADER_INCLUDED
|
||||||
|
|
||||||
|
#include <opm/core/props/BlackoilPhases.hpp>
|
||||||
|
|
||||||
|
#include <opm/input/eclipse/Schedule/ScheduleTypes.hpp>
|
||||||
|
#include <opm/input/eclipse/Schedule/Well/Well.hpp>
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
|
namespace Opm
|
||||||
|
{
|
||||||
|
|
||||||
|
class DeferredLogger;
|
||||||
|
class Group;
|
||||||
|
class GroupState;
|
||||||
|
class Schedule;
|
||||||
|
class SummaryState;
|
||||||
|
template<class FluidSystem> class WellInterfaceFluidSystem;
|
||||||
|
class WellState;
|
||||||
|
|
||||||
|
template<class FluidSystem>
|
||||||
|
class WellAssemble {
|
||||||
|
static constexpr int Water = BlackoilPhases::Aqua;
|
||||||
|
static constexpr int Oil = BlackoilPhases::Liquid;
|
||||||
|
static constexpr int Gas = BlackoilPhases::Vapour;
|
||||||
|
|
||||||
|
public:
|
||||||
|
WellAssemble(const WellInterfaceFluidSystem<FluidSystem>& well);
|
||||||
|
|
||||||
|
template<class EvalWell>
|
||||||
|
void assembleControlEqProd(const WellState& well_state,
|
||||||
|
const GroupState& group_state,
|
||||||
|
const Schedule& schedule,
|
||||||
|
const SummaryState& summaryState,
|
||||||
|
const Well::ProductionControls& controls,
|
||||||
|
const EvalWell& bhp,
|
||||||
|
const std::vector<EvalWell>& rates, // Always 3 canonical rates.
|
||||||
|
const std::function<EvalWell()>& bhp_from_thp,
|
||||||
|
EvalWell& control_eq,
|
||||||
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
|
template<class EvalWell>
|
||||||
|
void assembleControlEqInj(const WellState& well_state,
|
||||||
|
const GroupState& group_state,
|
||||||
|
const Schedule& schedule,
|
||||||
|
const SummaryState& summaryState,
|
||||||
|
const Well::InjectionControls& controls,
|
||||||
|
const EvalWell& bhp,
|
||||||
|
const EvalWell& injection_rate,
|
||||||
|
const std::function<EvalWell()>& bhp_from_thp,
|
||||||
|
EvalWell& control_eq,
|
||||||
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
const WellInterfaceFluidSystem<FluidSystem>& well_;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // OPM_WELL_ASSEMBLE_HEADER_INCLUDED
|
@ -1,134 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2017 SINTEF Digital, Mathematics and Cybernetics.
|
|
||||||
Copyright 2017 Statoil ASA.
|
|
||||||
Copyright 2017 IRIS
|
|
||||||
Copyright 2019 Norce
|
|
||||||
|
|
||||||
This file is part of the Open Porous Media project (OPM).
|
|
||||||
|
|
||||||
OPM is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
OPM is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef OPM_WELLINTERFACE_EVAL_HEADER_INCLUDED
|
|
||||||
#define OPM_WELLINTERFACE_EVAL_HEADER_INCLUDED
|
|
||||||
|
|
||||||
#include <opm/core/props/BlackoilPhases.hpp>
|
|
||||||
|
|
||||||
#include <opm/input/eclipse/Schedule/ScheduleTypes.hpp>
|
|
||||||
#include <opm/input/eclipse/Schedule/Well/Well.hpp>
|
|
||||||
|
|
||||||
#include <functional>
|
|
||||||
|
|
||||||
namespace Opm
|
|
||||||
{
|
|
||||||
|
|
||||||
class DeferredLogger;
|
|
||||||
class Group;
|
|
||||||
class GroupState;
|
|
||||||
class Schedule;
|
|
||||||
class SummaryState;
|
|
||||||
template<class FluidSystem> class WellInterfaceFluidSystem;
|
|
||||||
class WellState;
|
|
||||||
|
|
||||||
template<class FluidSystem>
|
|
||||||
class WellInterfaceEval {
|
|
||||||
static constexpr int Water = BlackoilPhases::Aqua;
|
|
||||||
static constexpr int Oil = BlackoilPhases::Liquid;
|
|
||||||
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,
|
|
||||||
const Schedule& schedule,
|
|
||||||
const SummaryState& summaryState,
|
|
||||||
const Well::ProductionControls& controls,
|
|
||||||
const EvalWell& bhp,
|
|
||||||
const std::vector<EvalWell>& rates, // Always 3 canonical rates.
|
|
||||||
BhpFromThpFunc bhp_from_thp,
|
|
||||||
EvalWell& control_eq,
|
|
||||||
DeferredLogger& deferred_logger) const
|
|
||||||
{
|
|
||||||
std::function<EvalWell()> eval = [&bhp_from_thp]() { return bhp_from_thp(); };
|
|
||||||
assembleControlEqProd_(well_state,
|
|
||||||
group_state,
|
|
||||||
schedule,
|
|
||||||
summaryState,
|
|
||||||
controls,
|
|
||||||
bhp,
|
|
||||||
rates,
|
|
||||||
eval,
|
|
||||||
control_eq,
|
|
||||||
deferred_logger);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class EvalWell>
|
|
||||||
void assembleControlEqProd_(const WellState& well_state,
|
|
||||||
const GroupState& group_state,
|
|
||||||
const Schedule& schedule,
|
|
||||||
const SummaryState& summaryState,
|
|
||||||
const Well::ProductionControls& controls,
|
|
||||||
const EvalWell& bhp,
|
|
||||||
const std::vector<EvalWell>& rates, // Always 3 canonical rates.
|
|
||||||
const std::function<EvalWell()>& bhp_from_thp,
|
|
||||||
EvalWell& control_eq,
|
|
||||||
DeferredLogger& deferred_logger) const;
|
|
||||||
|
|
||||||
template<class EvalWell, class BhpFromThpFunc>
|
|
||||||
void assembleControlEqInj(const WellState& well_state,
|
|
||||||
const GroupState& group_state,
|
|
||||||
const Schedule& schedule,
|
|
||||||
const SummaryState& summaryState,
|
|
||||||
const Well::InjectionControls& controls,
|
|
||||||
const EvalWell& bhp,
|
|
||||||
const EvalWell& injection_rate,
|
|
||||||
BhpFromThpFunc bhp_from_thp,
|
|
||||||
EvalWell& control_eq,
|
|
||||||
DeferredLogger& deferred_logger) const
|
|
||||||
{
|
|
||||||
std::function<EvalWell()> eval = [&bhp_from_thp]() { return bhp_from_thp(); };
|
|
||||||
assembleControlEqInj_(well_state,
|
|
||||||
group_state,
|
|
||||||
schedule,
|
|
||||||
summaryState,
|
|
||||||
controls,
|
|
||||||
bhp,
|
|
||||||
injection_rate,
|
|
||||||
eval,
|
|
||||||
control_eq,
|
|
||||||
deferred_logger);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class EvalWell>
|
|
||||||
void assembleControlEqInj_(const WellState& well_state,
|
|
||||||
const GroupState& group_state,
|
|
||||||
const Schedule& schedule,
|
|
||||||
const SummaryState& summaryState,
|
|
||||||
const Well::InjectionControls& controls,
|
|
||||||
const EvalWell& bhp,
|
|
||||||
const EvalWell& injection_rate,
|
|
||||||
const std::function<EvalWell()>& bhp_from_thp,
|
|
||||||
EvalWell& control_eq,
|
|
||||||
DeferredLogger& deferred_logger) const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
const WellInterfaceFluidSystem<FluidSystem>& baseif_;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // OPM_WELLINTERFACE_EVAL_HEADER_INCLUDED
|
|
Loading…
Reference in New Issue
Block a user