mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
added: WellTest
this will hold the code for well tests. start by moving checkMaxRatioLimitWell to the new class
This commit is contained in:
@@ -108,6 +108,7 @@ list (APPEND MAIN_SOURCE_FILES
|
||||
opm/simulators/wells/WellInterfaceIndices.cpp
|
||||
opm/simulators/wells/WellProdIndexCalculator.cpp
|
||||
opm/simulators/wells/WellState.cpp
|
||||
opm/simulators/wells/WellTest.cpp
|
||||
opm/simulators/wells/WGState.cpp
|
||||
)
|
||||
|
||||
@@ -381,6 +382,7 @@ list (APPEND PUBLIC_HEADER_FILES
|
||||
opm/simulators/wells/WellInterface_impl.hpp
|
||||
opm/simulators/wells/WellProdIndexCalculator.hpp
|
||||
opm/simulators/wells/WellState.hpp
|
||||
opm/simulators/wells/WellTest.hpp
|
||||
opm/simulators/wells/WGState.hpp
|
||||
)
|
||||
|
||||
|
@@ -28,13 +28,14 @@
|
||||
#include <opm/input/eclipse/Schedule/Schedule.hpp>
|
||||
|
||||
#include <opm/simulators/utils/DeferredLogger.hpp>
|
||||
#include <opm/simulators/wells/RateConverter.hpp>
|
||||
#include <opm/simulators/wells/GroupState.hpp>
|
||||
#include <opm/simulators/wells/ParallelWellInfo.hpp>
|
||||
#include <opm/simulators/wells/RateConverter.hpp>
|
||||
#include <opm/simulators/wells/SingleWellState.hpp>
|
||||
#include <opm/simulators/wells/TargetCalculator.hpp>
|
||||
#include <opm/simulators/wells/WellGroupHelpers.hpp>
|
||||
#include <opm/simulators/wells/WellState.hpp>
|
||||
#include <opm/simulators/wells/SingleWellState.hpp>
|
||||
#include <opm/simulators/wells/GroupState.hpp>
|
||||
#include <opm/simulators/wells/TargetCalculator.hpp>
|
||||
#include <opm/simulators/wells/WellTest.hpp>
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
@@ -579,7 +580,8 @@ checkMaxWaterCutLimit(const WellEconProductionLimits& econ_production_limits,
|
||||
const double max_water_cut_limit = econ_production_limits.maxWaterCut();
|
||||
assert(max_water_cut_limit > 0.);
|
||||
|
||||
const bool watercut_limit_violated = checkMaxRatioLimitWell(ws, max_water_cut_limit, waterCut);
|
||||
const bool watercut_limit_violated =
|
||||
WellTest(*this).checkMaxRatioLimitWell(ws, max_water_cut_limit, waterCut);
|
||||
|
||||
if (watercut_limit_violated) {
|
||||
report.ratio_limit_violated = true;
|
||||
@@ -613,7 +615,7 @@ checkMaxGORLimit(const WellEconProductionLimits& econ_production_limits,
|
||||
const double max_gor_limit = econ_production_limits.maxGasOilRatio();
|
||||
assert(max_gor_limit > 0.);
|
||||
|
||||
const bool gor_limit_violated = checkMaxRatioLimitWell(ws, max_gor_limit, gor);
|
||||
const bool gor_limit_violated = WellTest(*this).checkMaxRatioLimitWell(ws, max_gor_limit, gor);
|
||||
|
||||
if (gor_limit_violated) {
|
||||
report.ratio_limit_violated = true;
|
||||
@@ -648,7 +650,7 @@ checkMaxWGRLimit(const WellEconProductionLimits& econ_production_limits,
|
||||
const double max_wgr_limit = econ_production_limits.maxWaterGasRatio();
|
||||
assert(max_wgr_limit > 0.);
|
||||
|
||||
const bool wgr_limit_violated = checkMaxRatioLimitWell(ws, max_wgr_limit, wgr);
|
||||
const bool wgr_limit_violated = WellTest(*this).checkMaxRatioLimitWell(ws, max_wgr_limit, wgr);
|
||||
|
||||
if (wgr_limit_violated) {
|
||||
report.ratio_limit_violated = true;
|
||||
@@ -922,24 +924,6 @@ checkMaxRatioLimitCompletions(const SingleWellState& ws,
|
||||
}
|
||||
}
|
||||
|
||||
template<typename FluidSystem>
|
||||
template<typename RatioFunc>
|
||||
bool WellInterfaceFluidSystem<FluidSystem>::
|
||||
checkMaxRatioLimitWell(const SingleWellState& ws,
|
||||
const double max_ratio_limit,
|
||||
const RatioFunc& ratioFunc) const
|
||||
{
|
||||
const int np = number_of_phases_;
|
||||
|
||||
std::vector<double> well_rates(np, 0.0);
|
||||
for (int p = 0; p < np; ++p) {
|
||||
well_rates[p] = ws.surface_rates[p];
|
||||
}
|
||||
|
||||
const double well_ratio = ratioFunc(well_rates, phaseUsage());
|
||||
return (well_ratio > max_ratio_limit);
|
||||
}
|
||||
|
||||
template<typename FluidSystem>
|
||||
int
|
||||
WellInterfaceFluidSystem<FluidSystem>::
|
||||
|
@@ -182,11 +182,6 @@ private:
|
||||
const double max_ratio_limit,
|
||||
const RatioFunc& ratioFunc,
|
||||
RatioLimitCheckReport& report) const;
|
||||
|
||||
template<typename RatioFunc>
|
||||
bool checkMaxRatioLimitWell(const SingleWellState& well_state,
|
||||
const double max_ratio_limit,
|
||||
const RatioFunc& ratioFunc) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
46
opm/simulators/wells/WellTest.cpp
Normal file
46
opm/simulators/wells/WellTest.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
Copyright 2017 SINTEF Digital, Mathematics and Cybernetics.
|
||||
Copyright 2017 Statoil ASA.
|
||||
Copyright 2018 IRIS
|
||||
|
||||
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/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <opm/simulators/wells/WellTest.hpp>
|
||||
|
||||
#include <opm/simulators/wells/SingleWellState.hpp>
|
||||
#include <opm/simulators/wells/WellInterfaceGeneric.hpp>
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
bool WellTest::checkMaxRatioLimitWell(const SingleWellState& ws,
|
||||
const double max_ratio_limit,
|
||||
const RatioFunc& ratioFunc) const
|
||||
{
|
||||
const int np = well_.numPhases();
|
||||
|
||||
std::vector<double> well_rates(np, 0.0);
|
||||
for (int p = 0; p < np; ++p) {
|
||||
well_rates[p] = ws.surface_rates[p];
|
||||
}
|
||||
|
||||
const double well_ratio = ratioFunc(well_rates, well_.phaseUsage());
|
||||
return (well_ratio > max_ratio_limit);
|
||||
}
|
||||
|
||||
} // namespace Opm
|
56
opm/simulators/wells/WellTest.hpp
Normal file
56
opm/simulators/wells/WellTest.hpp
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
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_TEST_HEADER_INCLUDED
|
||||
#define OPM_WELL_TEST_HEADER_INCLUDED
|
||||
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
class PhaseUsage;
|
||||
class SingleWellState;
|
||||
class WellInterfaceGeneric;
|
||||
|
||||
//! \brief Class for performing well tests.
|
||||
class WellTest {
|
||||
public:
|
||||
//! \brief Constructor sets reference to well.
|
||||
WellTest(const WellInterfaceGeneric& well) : well_(well) {}
|
||||
|
||||
using RatioFunc = std::function<double(const std::vector<double>& rates,
|
||||
const PhaseUsage& pu)>;
|
||||
|
||||
bool checkMaxRatioLimitWell(const SingleWellState& ws,
|
||||
const double max_ratio_limit,
|
||||
const RatioFunc& ratioFunc) const;
|
||||
|
||||
private:
|
||||
const WellInterfaceGeneric& well_; //!< Reference to well interface
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // OPM_WELL_TEST_HEADER_INCLUDED
|
Reference in New Issue
Block a user