mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-11-02 20:30:55 -06:00
Merge pull request #3213 from akva2/no_opm_in_opm
fixed: do not use Opm:: prefix when inside namespace Opm
This commit is contained in:
66 files changed
+1017
-1016
No files matched your search
@@ -70,7 +70,7 @@ public:
|
||||
comm.sum(&this->fluxValue_, 1);
|
||||
}
|
||||
|
||||
Opm::data::AquiferData aquiferData() const
|
||||
data::AquiferData aquiferData() const
|
||||
{
|
||||
data::AquiferData data;
|
||||
data.aquiferID = this->aquiferID;
|
||||
@@ -82,7 +82,7 @@ public:
|
||||
}
|
||||
data.volume = this->W_flux_.value();
|
||||
data.initPressure = this->pa0_;
|
||||
data.type = Opm::data::AquiferType::CarterTracy;
|
||||
data.type = data::AquiferType::CarterTracy;
|
||||
|
||||
data.aquCT = std::make_shared<data::CarterTracyData>();
|
||||
data.aquCT->dimensionless_time = this->dimensionless_time_;
|
||||
@@ -113,17 +113,17 @@ protected:
|
||||
{
|
||||
// We use the opm-common numeric linear interpolator
|
||||
this->dimensionless_pressure_ =
|
||||
Opm::linearInterpolation(this->aquct_data_.td,
|
||||
this->aquct_data_.pi,
|
||||
this->dimensionless_time_);
|
||||
linearInterpolation(this->aquct_data_.td,
|
||||
this->aquct_data_.pi,
|
||||
this->dimensionless_time_);
|
||||
|
||||
const auto PItd =
|
||||
Opm::linearInterpolation(this->aquct_data_.td,
|
||||
this->aquct_data_.pi, td_plus_dt);
|
||||
linearInterpolation(this->aquct_data_.td,
|
||||
this->aquct_data_.pi, td_plus_dt);
|
||||
|
||||
const auto PItdprime =
|
||||
Opm::linearInterpolationDerivative(this->aquct_data_.td,
|
||||
this->aquct_data_.pi, td_plus_dt);
|
||||
linearInterpolationDerivative(this->aquct_data_.td,
|
||||
this->aquct_data_.pi, td_plus_dt);
|
||||
|
||||
return std::make_pair(PItd, PItdprime);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
aquifer_pressure_ = aquiferPressure();
|
||||
}
|
||||
|
||||
Opm::data::AquiferData aquiferData() const
|
||||
data::AquiferData aquiferData() const
|
||||
{
|
||||
// TODO: how to unify the two functions?
|
||||
data::AquiferData data;
|
||||
@@ -80,7 +80,7 @@ public:
|
||||
}
|
||||
data.volume = this->W_flux_.value();
|
||||
data.initPressure = this->pa0_;
|
||||
data.type = Opm::data::AquiferType::Fetkovich;
|
||||
data.type = data::AquiferType::Fetkovich;
|
||||
// Not handling std::shared_ptr<FetkovichData> aquFet for now,
|
||||
// because we do not need it yet
|
||||
return data;
|
||||
|
||||
@@ -61,13 +61,13 @@ public:
|
||||
|
||||
typedef DenseAd::Evaluation<double, /*size=*/numEq> Eval;
|
||||
|
||||
typedef Opm::BlackOilFluidState<Eval,
|
||||
FluidSystem,
|
||||
enableTemperature,
|
||||
enableEnergy,
|
||||
BlackoilIndices::gasEnabled,
|
||||
enableBrine,
|
||||
BlackoilIndices::numPhases>
|
||||
typedef BlackOilFluidState<Eval,
|
||||
FluidSystem,
|
||||
enableTemperature,
|
||||
enableEnergy,
|
||||
BlackoilIndices::gasEnabled,
|
||||
enableBrine,
|
||||
BlackoilIndices::numPhases>
|
||||
FluidState;
|
||||
|
||||
static const auto waterCompIdx = FluidSystem::waterCompIdx;
|
||||
@@ -126,7 +126,7 @@ public:
|
||||
|
||||
elemCtx.updateIntensiveQuantities(0);
|
||||
const auto& iq = elemCtx.intensiveQuantities(0, 0);
|
||||
pressure_previous_[idx] = Opm::getValue(iq.fluidState().pressure(waterPhaseIdx));
|
||||
pressure_previous_[idx] = getValue(iq.fluidState().pressure(waterPhaseIdx));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ protected:
|
||||
this->faceArea_connected_.resize(this->size(), 0.0);
|
||||
|
||||
// Translate the C face tag into the enum used by opm-parser's TransMult class
|
||||
Opm::FaceDir::DirEnum faceDirection;
|
||||
FaceDir::DirEnum faceDirection;
|
||||
|
||||
// denom_face_areas is the sum of the areas connected to an aquifer
|
||||
Scalar denom_face_areas = 0.;
|
||||
@@ -278,22 +278,22 @@ protected:
|
||||
int insideFaceIdx = intersection.indexInInside();
|
||||
switch (insideFaceIdx) {
|
||||
case 0:
|
||||
faceDirection = Opm::FaceDir::XMinus;
|
||||
faceDirection = FaceDir::XMinus;
|
||||
break;
|
||||
case 1:
|
||||
faceDirection = Opm::FaceDir::XPlus;
|
||||
faceDirection = FaceDir::XPlus;
|
||||
break;
|
||||
case 2:
|
||||
faceDirection = Opm::FaceDir::YMinus;
|
||||
faceDirection = FaceDir::YMinus;
|
||||
break;
|
||||
case 3:
|
||||
faceDirection = Opm::FaceDir::YPlus;
|
||||
faceDirection = FaceDir::YPlus;
|
||||
break;
|
||||
case 4:
|
||||
faceDirection = Opm::FaceDir::ZMinus;
|
||||
faceDirection = FaceDir::ZMinus;
|
||||
break;
|
||||
case 5:
|
||||
faceDirection = Opm::FaceDir::ZPlus;
|
||||
faceDirection = FaceDir::ZPlus;
|
||||
break;
|
||||
default:
|
||||
OPM_THROW(std::logic_error,
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
static const int numEq = BlackoilIndices::numEq;
|
||||
|
||||
using Eval = DenseAd::Evaluation<double, numEq>;
|
||||
using Toolbox = Opm::MathToolbox<Eval>;
|
||||
using Toolbox = MathToolbox<Eval>;
|
||||
|
||||
// Constructor
|
||||
AquiferNumerical(const SingleNumericalAquifer& aquifer,
|
||||
@@ -84,7 +84,7 @@ public:
|
||||
this->cumulative_flux_ += this->flux_rate_ * this->ebos_simulator_.timeStepSize();
|
||||
}
|
||||
|
||||
Opm::data::AquiferData aquiferData() const
|
||||
data::AquiferData aquiferData() const
|
||||
{
|
||||
data::AquiferData data;
|
||||
data.aquiferID = this->id_;
|
||||
@@ -92,7 +92,7 @@ public:
|
||||
data.pressure = this->pressure_;
|
||||
data.fluxRate = this->flux_rate_;
|
||||
data.volume = this->cumulative_flux_;
|
||||
data.type = Opm::data::AquiferType::Numerical;
|
||||
data.type = data::AquiferType::Numerical;
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
void endTimeStep();
|
||||
void endEpisode();
|
||||
|
||||
Opm::data::Aquifers aquiferData() const;
|
||||
data::Aquifers aquiferData() const;
|
||||
|
||||
template <class Restarter>
|
||||
void serialize(Restarter& res);
|
||||
|
||||
@@ -204,7 +204,7 @@ BlackoilAquiferModel<TypeTag>::init()
|
||||
const auto& num_aquifers = aquifer.numericalAquifers().aquifers();
|
||||
const auto& ugrid = simulator_.vanguard().grid();
|
||||
const int number_of_cells = simulator_.gridView().size(0);
|
||||
const int* global_cell = Opm::UgGridHelpers::globalCell(ugrid);
|
||||
const int* global_cell = UgGridHelpers::globalCell(ugrid);
|
||||
const std::unordered_map<int, int> cartesian_to_compressed = cartesianToCompressed(number_of_cells,
|
||||
global_cell);
|
||||
for ([[maybe_unused]]const auto& [id, aqu] : num_aquifers) {
|
||||
@@ -234,25 +234,25 @@ BlackoilAquiferModel<TypeTag>::aquiferNumericalActive() const
|
||||
}
|
||||
|
||||
template<typename TypeTag>
|
||||
Opm::data::Aquifers BlackoilAquiferModel<TypeTag>::aquiferData() const {
|
||||
Opm::data::Aquifers data;
|
||||
data::Aquifers BlackoilAquiferModel<TypeTag>::aquiferData() const {
|
||||
data::Aquifers data;
|
||||
if (this->aquiferCarterTracyActive()) {
|
||||
for (const auto& aqu : aquifers_CarterTracy) {
|
||||
Opm::data::AquiferData aqu_data = aqu.aquiferData();
|
||||
data::AquiferData aqu_data = aqu.aquiferData();
|
||||
data[aqu_data.aquiferID] = aqu_data;
|
||||
}
|
||||
}
|
||||
|
||||
if (this->aquiferFetkovichActive()) {
|
||||
for (const auto& aqu : aquifers_Fetkovich) {
|
||||
Opm::data::AquiferData aqu_data = aqu.aquiferData();
|
||||
data::AquiferData aqu_data = aqu.aquiferData();
|
||||
data[aqu_data.aquiferID] = aqu_data;
|
||||
}
|
||||
}
|
||||
|
||||
if (this->aquiferNumericalActive()) {
|
||||
for (const auto& aqu : this->aquifers_numerical) {
|
||||
Opm::data::AquiferData aqu_data = aqu.aquiferData();
|
||||
data::AquiferData aqu_data = aqu.aquiferData();
|
||||
data[aqu_data.aquiferID] = aqu_data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ struct UseVolumetricResidual<TypeTag, TTag::EclFlowProblem> {
|
||||
|
||||
template<class TypeTag>
|
||||
struct EclAquiferModel<TypeTag, TTag::EclFlowProblem> {
|
||||
using type = Opm::BlackoilAquiferModel<TypeTag>;
|
||||
using type = BlackoilAquiferModel<TypeTag>;
|
||||
};
|
||||
|
||||
// disable all extensions supported by black oil model. this should not really be
|
||||
@@ -128,7 +128,7 @@ struct EnableBrine<TypeTag, TTag::EclFlowProblem> {
|
||||
|
||||
template<class TypeTag>
|
||||
struct EclWellModel<TypeTag, TTag::EclFlowProblem> {
|
||||
using type = Opm::BlackoilWellModel<TypeTag>;
|
||||
using type = BlackoilWellModel<TypeTag>;
|
||||
};
|
||||
template<class TypeTag>
|
||||
struct LinearSolverSplice<TypeTag, TTag::EclFlowProblem> {
|
||||
@@ -316,9 +316,9 @@ namespace Opm {
|
||||
|
||||
// Throw if any NaN or too large residual found.
|
||||
if (severity == ConvergenceReport::Severity::NotANumber) {
|
||||
OPM_THROW(Opm::NumericalIssue, "NaN residual found!");
|
||||
OPM_THROW(NumericalIssue, "NaN residual found!");
|
||||
} else if (severity == ConvergenceReport::Severity::TooLarge) {
|
||||
OPM_THROW(Opm::NumericalIssue, "Too large residual found!");
|
||||
OPM_THROW(NumericalIssue, "Too large residual found!");
|
||||
}
|
||||
}
|
||||
report.update_time += perfTimer.stop();
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace Opm
|
||||
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
|
||||
using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
|
||||
|
||||
typedef Opm::SimulatorFullyImplicitBlackoilEbos<TypeTag> Simulator;
|
||||
typedef SimulatorFullyImplicitBlackoilEbos<TypeTag> Simulator;
|
||||
|
||||
FlowMainEbos(int argc, char **argv, bool output_cout, bool output_files )
|
||||
: argc_{argc}, argv_{argv},
|
||||
@@ -127,7 +127,7 @@ namespace Opm
|
||||
Simulator::registerParameters();
|
||||
|
||||
// register the parameters inherited from ebos
|
||||
Opm::registerAllParameters_<TypeTag>(/*finalizeRegistration=*/false);
|
||||
registerAllParameters_<TypeTag>(/*finalizeRegistration=*/false);
|
||||
|
||||
// hide the parameters unused by flow. TODO: this is a pain to maintain
|
||||
EWOMS_HIDE_PARAM(TypeTag, EnableGravity);
|
||||
@@ -219,14 +219,14 @@ namespace Opm
|
||||
#endif
|
||||
|
||||
// read in the command line parameters
|
||||
int status = Opm::setupParameters_<TypeTag>(argc, const_cast<const char**>(argv), /*doRegistration=*/false, /*allowUnused=*/true, /*handleHelp=*/(mpiRank==0));
|
||||
int status = ::Opm::setupParameters_<TypeTag>(argc, const_cast<const char**>(argv), /*doRegistration=*/false, /*allowUnused=*/true, /*handleHelp=*/(mpiRank==0));
|
||||
if (status == 0) {
|
||||
|
||||
// deal with unknown parameters.
|
||||
|
||||
int unknownKeyWords = 0;
|
||||
if (mpiRank == 0) {
|
||||
unknownKeyWords = Opm::Parameters::printUnused<TypeTag>(std::cerr);
|
||||
unknownKeyWords = Parameters::printUnused<TypeTag>(std::cerr);
|
||||
}
|
||||
#if HAVE_MPI
|
||||
int globalUnknownKeyWords;
|
||||
@@ -258,13 +258,13 @@ namespace Opm
|
||||
if (EWOMS_GET_PARAM(TypeTag, int, PrintProperties) == 1) {
|
||||
doExit = true;
|
||||
if (mpiRank == 0)
|
||||
Opm::Properties::printValues<TypeTag>();
|
||||
Properties::printValues<TypeTag>();
|
||||
}
|
||||
|
||||
if (EWOMS_GET_PARAM(TypeTag, int, PrintParameters) == 1) {
|
||||
doExit = true;
|
||||
if (mpiRank == 0)
|
||||
Opm::Parameters::printValues<TypeTag>();
|
||||
Parameters::printValues<TypeTag>();
|
||||
}
|
||||
|
||||
if (doExit)
|
||||
@@ -384,7 +384,7 @@ namespace Opm
|
||||
ss << "Simulation started on " << tmstr << " hrs\n";
|
||||
|
||||
ss << "Parameters used by Flow:\n";
|
||||
Opm::Parameters::printValues<TypeTag>(ss);
|
||||
Parameters::printValues<TypeTag>(ss);
|
||||
|
||||
OpmLog::note(ss.str());
|
||||
}
|
||||
@@ -475,7 +475,7 @@ namespace Opm
|
||||
return;
|
||||
}
|
||||
|
||||
namespace fs = Opm::filesystem;
|
||||
namespace fs = ::Opm::filesystem;
|
||||
const std::string& output_dir = eclState().getIOConfig().getOutputDir();
|
||||
fs::path output_path(output_dir);
|
||||
fs::path deck_filename(EWOMS_GET_PARAM(TypeTag, std::string, EclDeckFileName));
|
||||
@@ -587,7 +587,7 @@ namespace Opm
|
||||
report.reportFullyImplicit(ss);
|
||||
OpmLog::info(ss.str());
|
||||
const std::string dir = eclState().getIOConfig().getOutputDir();
|
||||
namespace fs = Opm::filesystem;
|
||||
namespace fs = ::Opm::filesystem;
|
||||
fs::path output_dir(dir);
|
||||
{
|
||||
std::string filename = eclState().getIOConfig().getBaseName() + ".INFOSTEP";
|
||||
@@ -615,7 +615,7 @@ namespace Opm
|
||||
|
||||
// This allows a user to catch typos and misunderstandings in the
|
||||
// use of simulator parameters.
|
||||
if (Opm::Parameters::printUnused<TypeTag>(oss)) {
|
||||
if (Parameters::printUnused<TypeTag>(oss)) {
|
||||
std::cout << "----------------- Unrecognized parameters: -----------------\n";
|
||||
std::cout << oss.str();
|
||||
std::cout << "----------------------------------------------------------------" << std::endl;
|
||||
|
||||
@@ -94,14 +94,14 @@ namespace Opm {
|
||||
{
|
||||
// we always want to use the default locale, and thus spare us the trouble
|
||||
// with incorrect locale settings.
|
||||
Opm::resetLocale();
|
||||
resetLocale();
|
||||
|
||||
# if HAVE_DUNE_FEM
|
||||
Dune::Fem::MPIManager::initialize(argc, argv);
|
||||
# else
|
||||
Dune::MPIHelper::instance(argc, argv);
|
||||
# endif
|
||||
Opm::FlowMainEbos<TypeTag> mainfunc(argc, argv, outputCout, outputFiles);
|
||||
FlowMainEbos<TypeTag> mainfunc(argc, argv, outputCout, outputFiles);
|
||||
return mainfunc.execute();
|
||||
}
|
||||
}
|
||||
@@ -120,7 +120,7 @@ namespace Opm
|
||||
class Main
|
||||
{
|
||||
private:
|
||||
using FlowMainEbosType = Opm::FlowMainEbos<Opm::Properties::TTag::EclFlowProblem>;
|
||||
using FlowMainEbosType = FlowMainEbos<Properties::TTag::EclFlowProblem>;
|
||||
|
||||
public:
|
||||
Main(int argc, char** argv) : argc_(argc), argv_(argv) { }
|
||||
@@ -137,10 +137,10 @@ namespace Opm
|
||||
|
||||
Main(int argc,
|
||||
char** argv,
|
||||
std::unique_ptr<Opm::Deck> deck,
|
||||
std::unique_ptr<Opm::EclipseState> eclipseState,
|
||||
std::unique_ptr<Opm::Schedule> schedule,
|
||||
std::unique_ptr<Opm::SummaryConfig> summaryConfig)
|
||||
std::unique_ptr<Deck> deck,
|
||||
std::unique_ptr<EclipseState> eclipseState,
|
||||
std::unique_ptr<Schedule> schedule,
|
||||
std::unique_ptr<SummaryConfig> summaryConfig)
|
||||
: argc_(argc)
|
||||
, argv_(argv)
|
||||
, deck_(std::move(deck))
|
||||
@@ -181,13 +181,13 @@ namespace Opm
|
||||
if (initialize_<Properties::TTag::FlowEarlyBird>(exitCode)) {
|
||||
// TODO: check that this deck really represents a blackoil
|
||||
// case. E.g. check that number of phases == 3
|
||||
Opm::flowEbosBlackoilSetDeck(
|
||||
flowEbosBlackoilSetDeck(
|
||||
setupTime_,
|
||||
std::move(deck_),
|
||||
std::move(eclipseState_),
|
||||
std::move(schedule_),
|
||||
std::move(summaryConfig_));
|
||||
return Opm::flowEbosBlackoilMainInit(
|
||||
return flowEbosBlackoilMainInit(
|
||||
argc_, argv_, outputCout_, outputFiles_);
|
||||
} else {
|
||||
//NOTE: exitCode was set by initialize_() above;
|
||||
@@ -209,23 +209,23 @@ namespace Opm
|
||||
// Twophase cases
|
||||
else if( phases.size() == 2 ) {
|
||||
// oil-gas
|
||||
if (phases.active( Opm::Phase::OIL ) && phases.active( Opm::Phase::GAS )) {
|
||||
Opm::flowEbosGasOilSetDeck(setupTime_, std::move(deck_), std::move(eclipseState_),
|
||||
std::move(schedule_), std::move(summaryConfig_));
|
||||
return Opm::flowEbosGasOilMain(argc_, argv_, outputCout_, outputFiles_);
|
||||
if (phases.active( Phase::OIL ) && phases.active( Phase::GAS )) {
|
||||
flowEbosGasOilSetDeck(setupTime_, std::move(deck_), std::move(eclipseState_),
|
||||
std::move(schedule_), std::move(summaryConfig_));
|
||||
return flowEbosGasOilMain(argc_, argv_, outputCout_, outputFiles_);
|
||||
}
|
||||
// oil-water
|
||||
else if ( phases.active( Opm::Phase::OIL ) && phases.active( Opm::Phase::WATER ) ) {
|
||||
Opm::flowEbosOilWaterSetDeck(setupTime_, std::move(deck_), std::move(eclipseState_), std::move(schedule_), std::move(summaryConfig_));
|
||||
return Opm::flowEbosOilWaterMain(argc_, argv_, outputCout_, outputFiles_);
|
||||
else if ( phases.active( Phase::OIL ) && phases.active( Phase::WATER ) ) {
|
||||
flowEbosOilWaterSetDeck(setupTime_, std::move(deck_), std::move(eclipseState_), std::move(schedule_), std::move(summaryConfig_));
|
||||
return flowEbosOilWaterMain(argc_, argv_, outputCout_, outputFiles_);
|
||||
}
|
||||
// gas-water
|
||||
else if ( phases.active( Opm::Phase::GAS ) && phases.active( Opm::Phase::WATER ) ) {
|
||||
else if ( phases.active( Phase::GAS ) && phases.active( Phase::WATER ) ) {
|
||||
if (outputCout_)
|
||||
std::cerr << "Gas-water systems are not yet supported" << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
Opm::flowEbosGasWaterSetDeck(setupTime_, std::move(deck_), std::move(eclipseState_), std::move(schedule_), std::move(summaryConfig_));
|
||||
return Opm::flowEbosGasWaterMain(argc_, argv_, outputCout_, outputFiles_);
|
||||
flowEbosGasWaterSetDeck(setupTime_, std::move(deck_), std::move(eclipseState_), std::move(schedule_), std::move(summaryConfig_));
|
||||
return flowEbosGasWaterMain(argc_, argv_, outputCout_, outputFiles_);
|
||||
}
|
||||
else {
|
||||
if (outputCout_)
|
||||
@@ -234,8 +234,8 @@ namespace Opm
|
||||
}
|
||||
}
|
||||
// Polymer case
|
||||
else if ( phases.active( Opm::Phase::POLYMER ) ) {
|
||||
if ( !phases.active( Opm::Phase::WATER) ) {
|
||||
else if ( phases.active( Phase::POLYMER ) ) {
|
||||
if ( !phases.active( Phase::WATER) ) {
|
||||
if (outputCout_)
|
||||
std::cerr << "No valid configuration is found for polymer simulation, valid options include "
|
||||
<< "oilwater + polymer and blackoil + polymer" << std::endl;
|
||||
@@ -244,88 +244,88 @@ namespace Opm
|
||||
|
||||
// Need to track the polymer molecular weight
|
||||
// for the injectivity study
|
||||
if ( phases.active( Opm::Phase::POLYMW ) ) {
|
||||
if ( phases.active( Phase::POLYMW ) ) {
|
||||
// only oil water two phase for now
|
||||
assert( phases.size() == 4);
|
||||
return Opm::flowEbosOilWaterPolymerInjectivityMain(argc_, argv_, outputCout_, outputFiles_);
|
||||
return flowEbosOilWaterPolymerInjectivityMain(argc_, argv_, outputCout_, outputFiles_);
|
||||
}
|
||||
|
||||
if ( phases.size() == 3 ) { // oil water polymer case
|
||||
Opm::flowEbosOilWaterPolymerSetDeck(setupTime_, std::move(deck_),
|
||||
std::move(eclipseState_),
|
||||
std::move(schedule_),
|
||||
std::move(summaryConfig_));
|
||||
return Opm::flowEbosOilWaterPolymerMain(argc_, argv_, outputCout_, outputFiles_);
|
||||
flowEbosOilWaterPolymerSetDeck(setupTime_, std::move(deck_),
|
||||
std::move(eclipseState_),
|
||||
std::move(schedule_),
|
||||
std::move(summaryConfig_));
|
||||
return flowEbosOilWaterPolymerMain(argc_, argv_, outputCout_, outputFiles_);
|
||||
} else {
|
||||
Opm::flowEbosPolymerSetDeck(setupTime_, std::move(deck_),
|
||||
flowEbosPolymerSetDeck(setupTime_, std::move(deck_),
|
||||
std::move(eclipseState_),
|
||||
std::move(schedule_),
|
||||
std::move(summaryConfig_));
|
||||
return Opm::flowEbosPolymerMain(argc_, argv_, outputCout_, outputFiles_);
|
||||
return flowEbosPolymerMain(argc_, argv_, outputCout_, outputFiles_);
|
||||
}
|
||||
}
|
||||
// Foam case
|
||||
else if ( phases.active( Opm::Phase::FOAM ) ) {
|
||||
Opm::flowEbosFoamSetDeck(setupTime_, std::move(deck_),
|
||||
std::move(eclipseState_),
|
||||
std::move(schedule_),
|
||||
std::move(summaryConfig_));
|
||||
return Opm::flowEbosFoamMain(argc_, argv_, outputCout_, outputFiles_);
|
||||
else if ( phases.active( Phase::FOAM ) ) {
|
||||
flowEbosFoamSetDeck(setupTime_, std::move(deck_),
|
||||
std::move(eclipseState_),
|
||||
std::move(schedule_),
|
||||
std::move(summaryConfig_));
|
||||
return flowEbosFoamMain(argc_, argv_, outputCout_, outputFiles_);
|
||||
}
|
||||
// Brine case
|
||||
else if ( phases.active( Opm::Phase::BRINE ) ) {
|
||||
if ( !phases.active( Opm::Phase::WATER) ) {
|
||||
else if ( phases.active( Phase::BRINE ) ) {
|
||||
if ( !phases.active( Phase::WATER) ) {
|
||||
if (outputCout_)
|
||||
std::cerr << "No valid configuration is found for brine simulation, valid options include "
|
||||
<< "oilwater + brine and blackoil + brine" << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
if ( phases.size() == 3 ) { // oil water brine case
|
||||
Opm::flowEbosOilWaterBrineSetDeck(setupTime_, std::move(deck_),
|
||||
std::move(eclipseState_),
|
||||
std::move(schedule_),
|
||||
std::move(summaryConfig_));
|
||||
return Opm::flowEbosOilWaterBrineMain(argc_, argv_, outputCout_, outputFiles_);
|
||||
flowEbosOilWaterBrineSetDeck(setupTime_, std::move(deck_),
|
||||
std::move(eclipseState_),
|
||||
std::move(schedule_),
|
||||
std::move(summaryConfig_));
|
||||
return flowEbosOilWaterBrineMain(argc_, argv_, outputCout_, outputFiles_);
|
||||
} else {
|
||||
Opm::flowEbosBrineSetDeck(setupTime_, std::move(deck_),
|
||||
std::move(eclipseState_),
|
||||
std::move(schedule_),
|
||||
std::move(summaryConfig_));
|
||||
return Opm::flowEbosBrineMain(argc_, argv_, outputCout_, outputFiles_);
|
||||
flowEbosBrineSetDeck(setupTime_, std::move(deck_),
|
||||
std::move(eclipseState_),
|
||||
std::move(schedule_),
|
||||
std::move(summaryConfig_));
|
||||
return flowEbosBrineMain(argc_, argv_, outputCout_, outputFiles_);
|
||||
}
|
||||
}
|
||||
// Solvent case
|
||||
else if ( phases.active( Opm::Phase::SOLVENT ) ) {
|
||||
Opm::flowEbosSolventSetDeck(setupTime_, std::move(deck_),
|
||||
std::move(eclipseState_),
|
||||
std::move(schedule_),
|
||||
std::move(summaryConfig_));
|
||||
return Opm::flowEbosSolventMain(argc_, argv_, outputCout_, outputFiles_);
|
||||
else if ( phases.active( Phase::SOLVENT ) ) {
|
||||
flowEbosSolventSetDeck(setupTime_, std::move(deck_),
|
||||
std::move(eclipseState_),
|
||||
std::move(schedule_),
|
||||
std::move(summaryConfig_));
|
||||
return flowEbosSolventMain(argc_, argv_, outputCout_, outputFiles_);
|
||||
}
|
||||
// Extended BO case
|
||||
else if ( phases.active( Opm::Phase::ZFRACTION ) ) {
|
||||
Opm::flowEbosExtboSetDeck(setupTime_, std::move(deck_),
|
||||
std::move(eclipseState_),
|
||||
std::move(schedule_),
|
||||
std::move(summaryConfig_));
|
||||
return Opm::flowEbosExtboMain(argc_, argv_, outputCout_, outputFiles_);
|
||||
else if ( phases.active( Phase::ZFRACTION ) ) {
|
||||
flowEbosExtboSetDeck(setupTime_, std::move(deck_),
|
||||
std::move(eclipseState_),
|
||||
std::move(schedule_),
|
||||
std::move(summaryConfig_));
|
||||
return flowEbosExtboMain(argc_, argv_, outputCout_, outputFiles_);
|
||||
}
|
||||
// Energy case
|
||||
else if (eclipseState_->getSimulationConfig().isThermal()) {
|
||||
Opm::flowEbosEnergySetDeck(setupTime_, std::move(deck_),
|
||||
std::move(eclipseState_),
|
||||
std::move(schedule_),
|
||||
std::move(summaryConfig_));
|
||||
return Opm::flowEbosEnergyMain(argc_, argv_, outputCout_, outputFiles_);
|
||||
flowEbosEnergySetDeck(setupTime_, std::move(deck_),
|
||||
std::move(eclipseState_),
|
||||
std::move(schedule_),
|
||||
std::move(summaryConfig_));
|
||||
return flowEbosEnergyMain(argc_, argv_, outputCout_, outputFiles_);
|
||||
}
|
||||
#endif // FLOW_BLACKOIL_ONLY
|
||||
// Blackoil case
|
||||
else if( phases.size() == 3 ) {
|
||||
Opm::flowEbosBlackoilSetDeck(setupTime_, std::move(deck_),
|
||||
std::move(eclipseState_),
|
||||
std::move(schedule_),
|
||||
std::move(summaryConfig_));
|
||||
return Opm::flowEbosBlackoilMain(argc_, argv_, outputCout_, outputFiles_);
|
||||
flowEbosBlackoilSetDeck(setupTime_, std::move(deck_),
|
||||
std::move(eclipseState_),
|
||||
std::move(schedule_),
|
||||
std::move(summaryConfig_));
|
||||
return flowEbosBlackoilMain(argc_, argv_, outputCout_, outputFiles_);
|
||||
}
|
||||
else {
|
||||
if (outputCout_)
|
||||
@@ -337,11 +337,11 @@ namespace Opm
|
||||
template <class TypeTag>
|
||||
int dispatchStatic_()
|
||||
{
|
||||
Opm::flowEbosSetDeck<TypeTag>(std::move(deck_),
|
||||
std::move(eclipseState_),
|
||||
std::move(schedule_),
|
||||
std::move(summaryConfig_));
|
||||
return Opm::flowEbosMain<TypeTag>(argc_, argv_, outputCout_, outputFiles_);
|
||||
flowEbosSetDeck<TypeTag>(std::move(deck_),
|
||||
std::move(eclipseState_),
|
||||
std::move(schedule_),
|
||||
std::move(summaryConfig_));
|
||||
return flowEbosMain<TypeTag>(argc_, argv_, outputCout_, outputFiles_);
|
||||
}
|
||||
|
||||
/// \brief Initialize
|
||||
@@ -370,7 +370,7 @@ namespace Opm
|
||||
|
||||
// we always want to use the default locale, and thus spare us the trouble
|
||||
// with incorrect locale settings.
|
||||
Opm::resetLocale();
|
||||
resetLocale();
|
||||
|
||||
// this is a work-around for a catch 22: we do not know what code path to use without
|
||||
// parsing the deck, but we don't know the deck without having access to the
|
||||
@@ -382,7 +382,7 @@ namespace Opm
|
||||
using PreProblem = GetPropType<PreTypeTag, Properties::Problem>;
|
||||
|
||||
PreProblem::setBriefDescription("Flow, an advanced reservoir simulator for ECL-decks provided by the Open Porous Media project.");
|
||||
int status = Opm::FlowMainEbos<PreTypeTag>::setupParameters_(argc_, argv_);
|
||||
int status = FlowMainEbos<PreTypeTag>::setupParameters_(argc_, argv_);
|
||||
if (status != 0) {
|
||||
// if setupParameters_ returns a value smaller than 0, there was no error, but
|
||||
// the program should abort. This is the case e.g. for the --help and the
|
||||
@@ -427,11 +427,11 @@ namespace Opm
|
||||
return false;
|
||||
}
|
||||
if (outputCout_) {
|
||||
Opm::FlowMainEbos<PreTypeTag>::printBanner();
|
||||
FlowMainEbos<PreTypeTag>::printBanner();
|
||||
}
|
||||
// Create Deck and EclipseState.
|
||||
try {
|
||||
auto python = std::make_shared<Opm::Python>();
|
||||
auto python = std::make_shared<Python>();
|
||||
const bool init_from_restart_file = !EWOMS_GET_PARAM(PreTypeTag, bool, SchedRestart);
|
||||
if (outputDir.empty())
|
||||
outputDir = EWOMS_GET_PARAM(PreTypeTag, std::string, OutputDir);
|
||||
@@ -441,15 +441,15 @@ namespace Opm
|
||||
EWOMS_GET_PARAM(PreTypeTag, std::string, OutputMode),
|
||||
outputCout_, "STDOUT_LOGGER");
|
||||
auto parseContext =
|
||||
std::make_unique<Opm::ParseContext>(std::vector<std::pair<std::string , InputError::Action>>
|
||||
{{Opm::ParseContext::PARSE_RANDOM_SLASH, Opm::InputError::IGNORE},
|
||||
{Opm::ParseContext::PARSE_MISSING_DIMS_KEYWORD, Opm::InputError::WARN},
|
||||
{Opm::ParseContext::SUMMARY_UNKNOWN_WELL, Opm::InputError::WARN},
|
||||
{Opm::ParseContext::SUMMARY_UNKNOWN_GROUP, Opm::InputError::WARN}});
|
||||
std::make_unique<ParseContext>(std::vector<std::pair<std::string , InputError::Action>>
|
||||
{{ParseContext::PARSE_RANDOM_SLASH, InputError::IGNORE},
|
||||
{ParseContext::PARSE_MISSING_DIMS_KEYWORD, InputError::WARN},
|
||||
{ParseContext::SUMMARY_UNKNOWN_WELL, InputError::WARN},
|
||||
{ParseContext::SUMMARY_UNKNOWN_GROUP, InputError::WARN}});
|
||||
if (EWOMS_GET_PARAM(PreTypeTag, bool, EclStrictParsing))
|
||||
parseContext->update(Opm::InputError::DELAYED_EXIT1);
|
||||
parseContext->update(InputError::DELAYED_EXIT1);
|
||||
|
||||
Opm::FlowMainEbos<PreTypeTag>::printPRTHeader(outputCout_);
|
||||
FlowMainEbos<PreTypeTag>::printPRTHeader(outputCout_);
|
||||
|
||||
if (outputCout_) {
|
||||
OpmLog::info("Reading deck file '" + deckFilename + "'");
|
||||
@@ -484,8 +484,8 @@ namespace Opm
|
||||
return true;
|
||||
}
|
||||
|
||||
Opm::filesystem::path simulationCaseName_( const std::string& casename ) {
|
||||
namespace fs = Opm::filesystem;
|
||||
filesystem::path simulationCaseName_( const std::string& casename ) {
|
||||
namespace fs = ::Opm::filesystem;
|
||||
|
||||
const auto exists = []( const fs::path& f ) -> bool {
|
||||
if( !fs::exists( f ) ) return false;
|
||||
@@ -523,7 +523,7 @@ namespace Opm
|
||||
for ( int i = 1; i < argc; ++i )
|
||||
{
|
||||
if (std::strcmp(argv[i], "--version") == 0) {
|
||||
std::cout << "flow " << Opm::moduleVersionName() << std::endl;
|
||||
std::cout << "flow " << moduleVersionName() << std::endl;
|
||||
std::exit(EXIT_SUCCESS);
|
||||
}
|
||||
}
|
||||
@@ -538,10 +538,10 @@ namespace Opm
|
||||
std::string deckFilename_;
|
||||
std::string flowProgName_;
|
||||
char *saveArgs_[2];
|
||||
std::unique_ptr<Opm::Deck> deck_;
|
||||
std::unique_ptr<Opm::EclipseState> eclipseState_;
|
||||
std::unique_ptr<Opm::Schedule> schedule_;
|
||||
std::unique_ptr<Opm::SummaryConfig> summaryConfig_;
|
||||
std::unique_ptr<Deck> deck_;
|
||||
std::unique_ptr<EclipseState> eclipseState_;
|
||||
std::unique_ptr<Schedule> schedule_;
|
||||
std::unique_ptr<SummaryConfig> summaryConfig_;
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
@@ -220,7 +220,7 @@ namespace Opm {
|
||||
failureReport_ = report;
|
||||
|
||||
std::string msg = "Solver convergence failure - Failed to complete a time step within " + std::to_string(maxIter()) + " iterations.";
|
||||
OPM_THROW_NOLOG(Opm::TooManyIterations, msg);
|
||||
OPM_THROW_NOLOG(TooManyIterations, msg);
|
||||
}
|
||||
|
||||
// Do model-specific post-step actions.
|
||||
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
using MaterialLawParams = GetPropType<TypeTag, Properties::MaterialLawParams>;
|
||||
|
||||
typedef AdaptiveTimeSteppingEbos<TypeTag> TimeStepper;
|
||||
typedef Opm::BlackOilPolymerModule<TypeTag> PolymerModule;
|
||||
typedef BlackOilPolymerModule<TypeTag> PolymerModule;
|
||||
|
||||
typedef WellStateFullyImplicitBlackoil WellState;
|
||||
typedef BlackoilModelEbos<TypeTag> Model;
|
||||
@@ -157,15 +157,15 @@ public:
|
||||
ebosSimulator_.setEpisodeIndex(-1);
|
||||
|
||||
// Create timers and file for writing timing info.
|
||||
solverTimer_ = std::make_unique<Opm::time::StopWatch>();
|
||||
totalTimer_ = std::make_unique<Opm::time::StopWatch>();
|
||||
solverTimer_ = std::make_unique<time::StopWatch>();
|
||||
totalTimer_ = std::make_unique<time::StopWatch>();
|
||||
totalTimer_->start();
|
||||
|
||||
// adaptive time stepping
|
||||
bool enableAdaptive = EWOMS_GET_PARAM(TypeTag, bool, EnableAdaptiveTimeStepping);
|
||||
bool enableTUNING = EWOMS_GET_PARAM(TypeTag, bool, EnableTuning);
|
||||
if (enableAdaptive) {
|
||||
const Opm::UnitSystem& unitSystem = this->ebosSimulator_.vanguard().eclState().getUnits();
|
||||
const UnitSystem& unitSystem = this->ebosSimulator_.vanguard().eclState().getUnits();
|
||||
if (enableTUNING) {
|
||||
adaptiveTimeStepping_ = std::make_unique<TimeStepper>(schedule()[timer.currentStepNum()].tuning(),
|
||||
unitSystem, terminalOutput_);
|
||||
@@ -383,8 +383,8 @@ protected:
|
||||
bool terminalOutput_;
|
||||
|
||||
SimulatorReport report_;
|
||||
std::unique_ptr<Opm::time::StopWatch> solverTimer_;
|
||||
std::unique_ptr<Opm::time::StopWatch> totalTimer_;
|
||||
std::unique_ptr<time::StopWatch> solverTimer_;
|
||||
std::unique_ptr<time::StopWatch> totalTimer_;
|
||||
std::unique_ptr<TimeStepper> adaptiveTimeStepping_;
|
||||
};
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ struct LinearSolverIgnoreConvergenceFailure<TypeTag, TTag::FlowIstlSolverParams>
|
||||
};
|
||||
template<class TypeTag>
|
||||
struct LinearSolverBackend<TypeTag, TTag::FlowIstlSolverParams> {
|
||||
using type = Opm::ISTLSolverEbos<TypeTag>;
|
||||
using type = ISTLSolverEbos<TypeTag>;
|
||||
};
|
||||
template<class TypeTag>
|
||||
struct PreconditionerAddWellContributions<TypeTag, TTag::FlowIstlSolverParams> {
|
||||
@@ -252,7 +252,7 @@ namespace Opm
|
||||
int linear_solver_restart_;
|
||||
int linear_solver_verbosity_;
|
||||
int ilu_fillin_level_;
|
||||
Opm::MILU_VARIANT ilu_milu_;
|
||||
MILU_VARIANT ilu_milu_;
|
||||
bool ilu_redblack_;
|
||||
bool ilu_reorder_sphere_;
|
||||
bool newton_use_gmres_;
|
||||
|
||||
@@ -58,10 +58,10 @@ struct SparseMatrixAdapter<TypeTag, TTag::FlowIstlSolver>
|
||||
private:
|
||||
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
|
||||
enum { numEq = getPropValue<TypeTag, Properties::NumEq>() };
|
||||
typedef Opm::MatrixBlock<Scalar, numEq, numEq> Block;
|
||||
typedef MatrixBlock<Scalar, numEq, numEq> Block;
|
||||
|
||||
public:
|
||||
typedef typename Opm::Linear::IstlSparseMatrixAdapter<Block> type;
|
||||
typedef typename Linear::IstlSparseMatrixAdapter<Block> type;
|
||||
};
|
||||
|
||||
} // namespace Opm::Properties
|
||||
@@ -241,10 +241,10 @@ namespace Opm
|
||||
const int verbosity = prm_.get<int>("verbosity", 0);
|
||||
const bool write_matrix = verbosity > 10;
|
||||
if (write_matrix) {
|
||||
Opm::Helper::writeSystem(simulator_, //simulator is only used to get names
|
||||
getMatrix(),
|
||||
*rhs_,
|
||||
comm_.get());
|
||||
Helper::writeSystem(simulator_, //simulator is only used to get names
|
||||
getMatrix(),
|
||||
*rhs_,
|
||||
comm_.get());
|
||||
}
|
||||
|
||||
// Solve system.
|
||||
@@ -428,7 +428,7 @@ namespace Opm
|
||||
if (weightsType == "quasiimpes") {
|
||||
// weighs will be created as default in the solver
|
||||
weightsCalculator = [this, transpose, pressureIndex]() {
|
||||
return Opm::Amg::getQuasiImpesWeights<Matrix, Vector>(this->getMatrix(), pressureIndex, transpose);
|
||||
return Amg::getQuasiImpesWeights<Matrix, Vector>(this->getMatrix(), pressureIndex, transpose);
|
||||
};
|
||||
} else if (weightsType == "trueimpes") {
|
||||
weightsCalculator = [this, pressureIndex]() {
|
||||
@@ -451,9 +451,9 @@ namespace Opm
|
||||
{
|
||||
Vector weights(rhs_->size());
|
||||
ElementContext elemCtx(simulator_);
|
||||
Opm::Amg::getTrueImpesWeights(pressureVarIndex, weights, simulator_.vanguard().gridView(),
|
||||
elemCtx, simulator_.model(),
|
||||
ThreadManager::threadId());
|
||||
Amg::getTrueImpesWeights(pressureVarIndex, weights, simulator_.vanguard().gridView(),
|
||||
elemCtx, simulator_.model(),
|
||||
ThreadManager::threadId());
|
||||
return weights;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Helper
|
||||
} else if (!dir.empty() && dir.back() != '/') {
|
||||
dir += "/";
|
||||
}
|
||||
namespace fs = Opm::filesystem;
|
||||
namespace fs = ::Opm::filesystem;
|
||||
fs::path output_dir(dir);
|
||||
fs::path subdir("reports");
|
||||
output_dir = output_dir / subdir;
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace Amg
|
||||
if (transpose) {
|
||||
diag_block.solve(bweights, rhs);
|
||||
} else {
|
||||
auto diag_block_transpose = Opm::Details::transposeDenseMatrix(diag_block);
|
||||
auto diag_block_transpose = Details::transposeDenseMatrix(diag_block);
|
||||
diag_block_transpose.solve(bweights, rhs);
|
||||
}
|
||||
double abs_max = *std::max_element(
|
||||
|
||||
@@ -41,7 +41,7 @@ setupPropertyTree(FlowLinearSolverParameters p) // Note: copying the parameters
|
||||
// Get configuration from file.
|
||||
if (conf.size() > 5 && conf.substr(conf.size() - 5, 5) == ".json") { // the ends_with() method is not available until C++20
|
||||
#if BOOST_VERSION / 100 % 1000 > 48
|
||||
if ( !Opm::filesystem::exists(conf) ) {
|
||||
if ( !filesystem::exists(conf) ) {
|
||||
OPM_THROW(std::invalid_argument, "JSON file " << conf << " does not exist.");
|
||||
}
|
||||
try {
|
||||
|
||||
@@ -409,21 +409,21 @@ namespace Opm {
|
||||
OpmLog::debug("Overall linear iterations used: " + std::to_string(substepReport.total_linear_iterations));
|
||||
}
|
||||
}
|
||||
catch (const Opm::TooManyIterations& e) {
|
||||
catch (const TooManyIterations& e) {
|
||||
substepReport = solver.failureReport();
|
||||
causeOfFailure = "Solver convergence failure - Iteration limit reached";
|
||||
|
||||
logException_(e, solverVerbose_);
|
||||
// since linearIterations is < 0 this will restart the solver
|
||||
}
|
||||
catch (const Opm::LinearSolverProblem& e) {
|
||||
catch (const LinearSolverProblem& e) {
|
||||
substepReport = solver.failureReport();
|
||||
causeOfFailure = "Linear solver convergence failure";
|
||||
|
||||
logException_(e, solverVerbose_);
|
||||
// since linearIterations is < 0 this will restart the solver
|
||||
}
|
||||
catch (const Opm::NumericalIssue& e) {
|
||||
catch (const NumericalIssue& e) {
|
||||
substepReport = solver.failureReport();
|
||||
causeOfFailure = "Solver convergence failure - Numerical problem encountered";
|
||||
|
||||
@@ -496,7 +496,7 @@ namespace Opm {
|
||||
if (fipnum) {
|
||||
solver.computeFluidInPlace(*fipnum);
|
||||
}
|
||||
Opm::time::StopWatch perfTimer;
|
||||
time::StopWatch perfTimer;
|
||||
perfTimer.start();
|
||||
|
||||
ebosProblem.writeOutput();
|
||||
@@ -522,7 +522,7 @@ namespace Opm {
|
||||
if (solverVerbose_) {
|
||||
OpmLog::error(msg);
|
||||
}
|
||||
OPM_THROW_NOLOG(Opm::NumericalIssue, msg);
|
||||
OPM_THROW_NOLOG(NumericalIssue, msg);
|
||||
}
|
||||
|
||||
// The new, chopped timestep.
|
||||
@@ -538,7 +538,7 @@ namespace Opm {
|
||||
if (solverVerbose_) {
|
||||
OpmLog::error(msg);
|
||||
}
|
||||
OPM_THROW_NOLOG(Opm::NumericalIssue, msg);
|
||||
OPM_THROW_NOLOG(NumericalIssue, msg);
|
||||
}
|
||||
|
||||
// Define utility function for chopping timestep.
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Opm
|
||||
namespace detail
|
||||
{
|
||||
|
||||
namespace fs = Opm::filesystem;
|
||||
namespace fs = ::Opm::filesystem;
|
||||
|
||||
/// \brief A functor that merges multiple files of a parallel run to one file.
|
||||
///
|
||||
|
||||
@@ -52,9 +52,9 @@ FileOutputMode setupLogging(int mpi_rank_, const std::string& deck_filename, con
|
||||
/// \brief Reads the deck and creates all necessary objects if needed
|
||||
///
|
||||
/// If pointers already contains objects then they are used otherwise they are created and can be used outside later.
|
||||
void readDeck(int rank, std::string& deckFilename, std::unique_ptr<Opm::Deck>& deck, std::unique_ptr<Opm::EclipseState>& eclipseState,
|
||||
std::unique_ptr<Opm::Schedule>& schedule, std::unique_ptr<Opm::SummaryConfig>& summaryConfig,
|
||||
std::unique_ptr<ErrorGuard> errorGuard, std::shared_ptr<Opm::Python>& python, std::unique_ptr<ParseContext> parseContext,
|
||||
void readDeck(int rank, std::string& deckFilename, std::unique_ptr<Deck>& deck, std::unique_ptr<EclipseState>& eclipseState,
|
||||
std::unique_ptr<Schedule>& schedule, std::unique_ptr<SummaryConfig>& summaryConfig,
|
||||
std::unique_ptr<ErrorGuard> errorGuard, std::shared_ptr<Python>& python, std::unique_ptr<ParseContext> parseContext,
|
||||
bool initFromRestart, bool checkDeck, const std::optional<int>& outputInterval);
|
||||
} // end namespace Opm
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace Opm {
|
||||
|
||||
/// Class for handling the blackoil well model.
|
||||
template<typename TypeTag>
|
||||
class BlackoilWellModel : public Opm::BaseAuxiliaryModule<TypeTag>
|
||||
class BlackoilWellModel : public BaseAuxiliaryModule<TypeTag>
|
||||
{
|
||||
public:
|
||||
// --------- Types ---------
|
||||
@@ -106,10 +106,10 @@ namespace Opm {
|
||||
using GlobalEqVector = GetPropType<TypeTag, Properties::GlobalEqVector>;
|
||||
using SparseMatrixAdapter = GetPropType<TypeTag, Properties::SparseMatrixAdapter>;
|
||||
|
||||
typedef typename Opm::BaseAuxiliaryModule<TypeTag>::NeighborSet NeighborSet;
|
||||
using GasLiftSingleWell = Opm::GasLiftSingleWell<TypeTag>;
|
||||
using GasLiftStage2 = Opm::GasLiftStage2<TypeTag>;
|
||||
using GLiftWellState = Opm::GasLiftWellState<TypeTag>;
|
||||
typedef typename BaseAuxiliaryModule<TypeTag>::NeighborSet NeighborSet;
|
||||
using GasLiftSingleWell = ::Opm::GasLiftSingleWell<TypeTag>;
|
||||
using GasLiftStage2 = ::Opm::GasLiftStage2<TypeTag>;
|
||||
using GLiftWellState = ::Opm::GasLiftWellState<TypeTag>;
|
||||
using GLiftWellStateMap =
|
||||
std::map<std::string,std::unique_ptr<GLiftWellState>>;
|
||||
using GLiftOptWells =
|
||||
@@ -130,7 +130,7 @@ namespace Opm {
|
||||
|
||||
typedef Dune::FieldMatrix<Scalar, numEq, numEq > MatrixBlockType;
|
||||
|
||||
typedef Opm::BlackOilPolymerModule<TypeTag> PolymerModule;
|
||||
typedef BlackOilPolymerModule<TypeTag> PolymerModule;
|
||||
|
||||
// For the conversion between the surface volume rate and resrevoir voidage rate
|
||||
using RateConverterType = RateConverter::
|
||||
@@ -217,8 +217,8 @@ namespace Opm {
|
||||
|
||||
void initFromRestartFile(const RestartValue& restartValues);
|
||||
|
||||
Opm::data::GroupAndNetworkValues
|
||||
groupAndNetworkData(const int reportStepIdx, const Opm::Schedule& sched) const
|
||||
data::GroupAndNetworkValues
|
||||
groupAndNetworkData(const int reportStepIdx, const Schedule& sched) const
|
||||
{
|
||||
auto grp_nwrk_values = ::Opm::data::GroupAndNetworkValues{};
|
||||
|
||||
@@ -337,9 +337,9 @@ namespace Opm {
|
||||
return this->active_wgstate_.group_state;
|
||||
}
|
||||
|
||||
Opm::data::Wells wellData() const
|
||||
data::Wells wellData() const
|
||||
{
|
||||
auto wsrpt = this->wellState().report(Opm::UgGridHelpers::globalCell(grid()),
|
||||
auto wsrpt = this->wellState().report(UgGridHelpers::globalCell(grid()),
|
||||
[this](const int well_ndex) -> bool
|
||||
{
|
||||
return this->wasDynamicallyShutThisTimeStep(well_ndex);
|
||||
@@ -400,12 +400,12 @@ namespace Opm {
|
||||
// twice at the beginning of the time step
|
||||
/// Calculating the explict quantities used in the well calculation. By explicit, we mean they are cacluated
|
||||
/// at the beginning of the time step and no derivatives are included in these quantities
|
||||
void calculateExplicitQuantities(Opm::DeferredLogger& deferred_logger) const;
|
||||
void calculateExplicitQuantities(DeferredLogger& deferred_logger) const;
|
||||
// some preparation work, mostly related to group control and RESV,
|
||||
// at the beginning of each time step (Not report step)
|
||||
void prepareTimeStep(Opm::DeferredLogger& deferred_logger);
|
||||
void prepareTimeStep(DeferredLogger& deferred_logger);
|
||||
void initPrimaryVariablesEvaluation() const;
|
||||
void updateWellControls(Opm::DeferredLogger& deferred_logger, const bool checkGroupControls);
|
||||
void updateWellControls(DeferredLogger& deferred_logger, const bool checkGroupControls);
|
||||
WellInterfacePtr getWell(const std::string& well_name) const;
|
||||
protected:
|
||||
Simulator& ebosSimulator_;
|
||||
@@ -451,7 +451,7 @@ namespace Opm {
|
||||
createTypedWellPointer(const int wellID,
|
||||
const int time_step) const;
|
||||
|
||||
WellInterfacePtr createWellForWellTest(const std::string& well_name, const int report_step, Opm::DeferredLogger& deferred_logger) const;
|
||||
WellInterfacePtr createWellForWellTest(const std::string& well_name, const int report_step, DeferredLogger& deferred_logger) const;
|
||||
|
||||
|
||||
const ModelParameters param_;
|
||||
@@ -497,7 +497,7 @@ namespace Opm {
|
||||
|
||||
void gliftDebug(
|
||||
const std::string &msg,
|
||||
Opm::DeferredLogger& deferred_logger) const;
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
/// \brief Get the wells of our partition that are not shut.
|
||||
/// \param timeStepIdx The index of the time step.
|
||||
@@ -528,7 +528,7 @@ namespace Opm {
|
||||
void updateNetworkPressures();
|
||||
|
||||
// setting the well_solutions_ based on well_state.
|
||||
void updatePrimaryVariables(Opm::DeferredLogger& deferred_logger);
|
||||
void updatePrimaryVariables(DeferredLogger& deferred_logger);
|
||||
|
||||
void setupCartesianToCompressed_(const int* global_cell, int local_num__cells);
|
||||
|
||||
@@ -538,7 +538,7 @@ namespace Opm {
|
||||
void updateAverageFormationFactor();
|
||||
|
||||
// Calculating well potentials for each well
|
||||
void computeWellPotentials(std::vector<double>& well_potentials, const int reportStepIdx, Opm::DeferredLogger& deferred_logger);
|
||||
void computeWellPotentials(std::vector<double>& well_potentials, const int reportStepIdx, DeferredLogger& deferred_logger);
|
||||
|
||||
const std::vector<double>& wellPerfEfficiencyFactors() const;
|
||||
|
||||
@@ -558,13 +558,13 @@ namespace Opm {
|
||||
|
||||
int reportStepIndex() const;
|
||||
|
||||
void assembleWellEq(const double dt, Opm::DeferredLogger& deferred_logger);
|
||||
void assembleWellEq(const double dt, DeferredLogger& deferred_logger);
|
||||
|
||||
void maybeDoGasLiftOptimize(Opm::DeferredLogger& deferred_logger);
|
||||
void maybeDoGasLiftOptimize(DeferredLogger& deferred_logger);
|
||||
|
||||
void gliftDebugShowALQ(Opm::DeferredLogger& deferred_logger);
|
||||
void gliftDebugShowALQ(DeferredLogger& deferred_logger);
|
||||
|
||||
void gasLiftOptimizationStage2(Opm::DeferredLogger& deferred_logger,
|
||||
void gasLiftOptimizationStage2(DeferredLogger& deferred_logger,
|
||||
GLiftProdWells &prod_wells, GLiftOptWells &glift_wells,
|
||||
GLiftWellStateMap &map);
|
||||
|
||||
@@ -583,7 +583,7 @@ namespace Opm {
|
||||
/// upate the wellTestState related to economic limits
|
||||
void updateWellTestState(const double& simulationTime, WellTestState& wellTestState) const;
|
||||
|
||||
void wellTesting(const int timeStepIdx, const double simulationTime, Opm::DeferredLogger& deferred_logger);
|
||||
void wellTesting(const int timeStepIdx, const double simulationTime, DeferredLogger& deferred_logger);
|
||||
|
||||
// convert well data from opm-common to well state from opm-core
|
||||
void loadRestartData( const data::Wells& wells,
|
||||
@@ -597,19 +597,19 @@ namespace Opm {
|
||||
|
||||
const Well& getWellEcl(const std::string& well_name) const;
|
||||
|
||||
void updateGroupIndividualControls(Opm::DeferredLogger& deferred_logger, std::set<std::string>& switched_groups);
|
||||
void updateGroupIndividualControl(const Group& group, Opm::DeferredLogger& deferred_logger, std::set<std::string>& switched_groups);
|
||||
bool checkGroupConstraints(const Group& group, Opm::DeferredLogger& deferred_logger) const;
|
||||
Group::ProductionCMode checkGroupProductionConstraints(const Group& group, Opm::DeferredLogger& deferred_logger) const;
|
||||
void updateGroupIndividualControls(DeferredLogger& deferred_logger, std::set<std::string>& switched_groups);
|
||||
void updateGroupIndividualControl(const Group& group, DeferredLogger& deferred_logger, std::set<std::string>& switched_groups);
|
||||
bool checkGroupConstraints(const Group& group, DeferredLogger& deferred_logger) const;
|
||||
Group::ProductionCMode checkGroupProductionConstraints(const Group& group, DeferredLogger& deferred_logger) const;
|
||||
Group::InjectionCMode checkGroupInjectionConstraints(const Group& group, const Phase& phase) const;
|
||||
void checkGconsaleLimits(const Group& group, WellState& well_state, Opm::DeferredLogger& deferred_logger );
|
||||
void checkGconsaleLimits(const Group& group, WellState& well_state, DeferredLogger& deferred_logger );
|
||||
|
||||
void updateGroupHigherControls(Opm::DeferredLogger& deferred_logger, std::set<std::string>& switched_groups);
|
||||
void checkGroupHigherConstraints(const Group& group, Opm::DeferredLogger& deferred_logger, std::set<std::string>& switched_groups);
|
||||
void updateGroupHigherControls(DeferredLogger& deferred_logger, std::set<std::string>& switched_groups);
|
||||
void checkGroupHigherConstraints(const Group& group, DeferredLogger& deferred_logger, std::set<std::string>& switched_groups);
|
||||
|
||||
void actionOnBrokenConstraints(const Group& group, const Group::ExceedAction& exceed_action, const Group::ProductionCMode& newControl, Opm::DeferredLogger& deferred_logger);
|
||||
void actionOnBrokenConstraints(const Group& group, const Group::ExceedAction& exceed_action, const Group::ProductionCMode& newControl, DeferredLogger& deferred_logger);
|
||||
|
||||
void actionOnBrokenConstraints(const Group& group, const Group::InjectionCMode& newControl, const Phase& topUpPhase, Opm::DeferredLogger& deferred_logger);
|
||||
void actionOnBrokenConstraints(const Group& group, const Group::InjectionCMode& newControl, const Phase& topUpPhase, DeferredLogger& deferred_logger);
|
||||
|
||||
void updateWsolvent(const Group& group, const Schedule& schedule, const int reportStepIdx, const WellStateFullyImplicitBlackoil& wellState);
|
||||
|
||||
|
||||
@@ -54,8 +54,8 @@ namespace Opm {
|
||||
// Set up cartesian mapping.
|
||||
{
|
||||
const auto& grid = this->ebosSimulator_.vanguard().grid();
|
||||
const auto& cartDims = Opm::UgGridHelpers::cartDims(grid);
|
||||
setupCartesianToCompressed_(Opm::UgGridHelpers::globalCell(grid),
|
||||
const auto& cartDims = UgGridHelpers::cartDims(grid);
|
||||
setupCartesianToCompressed_(UgGridHelpers::globalCell(grid),
|
||||
cartDims[0] * cartDims[1] * cartDims[2]);
|
||||
|
||||
auto& parallel_wells = ebosSimulator.vanguard().parallelWells();
|
||||
@@ -260,7 +260,7 @@ namespace Opm {
|
||||
BlackoilWellModel<TypeTag>::
|
||||
beginReportStep(const int timeStepIdx)
|
||||
{
|
||||
Opm::DeferredLogger local_deferredLogger;
|
||||
DeferredLogger local_deferredLogger;
|
||||
report_step_starts_ = true;
|
||||
|
||||
const Grid& grid = ebosSimulator_.vanguard().grid();
|
||||
@@ -316,7 +316,7 @@ namespace Opm {
|
||||
updatePerforationIntensiveQuantities();
|
||||
updateAverageFormationFactor();
|
||||
|
||||
Opm::DeferredLogger local_deferredLogger;
|
||||
DeferredLogger local_deferredLogger;
|
||||
|
||||
this->resetWGState();
|
||||
updateAndCommunicateGroupData();
|
||||
@@ -457,7 +457,7 @@ namespace Opm {
|
||||
template<typename TypeTag>
|
||||
void
|
||||
BlackoilWellModel<TypeTag>::gliftDebug(
|
||||
const std::string &msg, Opm::DeferredLogger &deferred_logger) const
|
||||
const std::string &msg, DeferredLogger &deferred_logger) const
|
||||
{
|
||||
if (this->glift_debug) {
|
||||
const std::string message = fmt::format(
|
||||
@@ -470,7 +470,7 @@ namespace Opm {
|
||||
void
|
||||
BlackoilWellModel<TypeTag>::wellTesting(const int timeStepIdx,
|
||||
const double simulationTime,
|
||||
Opm::DeferredLogger& deferred_logger)
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
const auto& wtest_config = schedule()[timeStepIdx].wtest_config();
|
||||
if (wtest_config.size() != 0) { // there is a WTEST request
|
||||
@@ -545,7 +545,7 @@ namespace Opm {
|
||||
report_step_starts_ = false;
|
||||
const int reportStepIdx = ebosSimulator_.episodeIndex();
|
||||
|
||||
Opm::DeferredLogger local_deferredLogger;
|
||||
DeferredLogger local_deferredLogger;
|
||||
for (const auto& well : well_container_) {
|
||||
if (getPropValue<TypeTag, Properties::EnablePolymerMW>() && well->isInjector()) {
|
||||
well->updateWaterThroughput(dt, this->wellState());
|
||||
@@ -574,7 +574,7 @@ namespace Opm {
|
||||
|
||||
this->commitWGState();
|
||||
|
||||
Opm::DeferredLogger global_deferredLogger = gatherDeferredLogger(local_deferredLogger);
|
||||
DeferredLogger global_deferredLogger = gatherDeferredLogger(local_deferredLogger);
|
||||
if (terminal_output_) {
|
||||
global_deferredLogger.logMessages();
|
||||
}
|
||||
@@ -640,7 +640,7 @@ namespace Opm {
|
||||
const int nw = wells_ecl_.size();
|
||||
if (nw > 0) {
|
||||
const auto phaseUsage = phaseUsageFromDeck(eclState());
|
||||
const size_t numCells = Opm::UgGridHelpers::numCells(grid());
|
||||
const size_t numCells = UgGridHelpers::numCells(grid());
|
||||
const bool handle_ms_well = (param_.use_multisegment_well_ && anyMSWellOpenLocal());
|
||||
this->wellState().resize(wells_ecl_, local_parallel_well_info_, schedule(), handle_ms_well, numCells, well_perf_data_, summaryState); // Resize for restart step
|
||||
loadRestartData(restartValues.wells, restartValues.grp_nwrk, phaseUsage, handle_ms_well, this->wellState());
|
||||
@@ -784,7 +784,7 @@ namespace Opm {
|
||||
{
|
||||
std::vector<WellInterfacePtr> well_container;
|
||||
|
||||
Opm::DeferredLogger local_deferredLogger;
|
||||
DeferredLogger local_deferredLogger;
|
||||
|
||||
const int nw = numLocalWells();
|
||||
|
||||
@@ -903,7 +903,7 @@ namespace Opm {
|
||||
}
|
||||
|
||||
// Collect log messages and print.
|
||||
Opm::DeferredLogger global_deferredLogger = gatherDeferredLogger(local_deferredLogger);
|
||||
DeferredLogger global_deferredLogger = gatherDeferredLogger(local_deferredLogger);
|
||||
if (terminal_output_) {
|
||||
global_deferredLogger.logMessages();
|
||||
}
|
||||
@@ -996,7 +996,7 @@ namespace Opm {
|
||||
BlackoilWellModel<TypeTag>::
|
||||
createWellForWellTest(const std::string& well_name,
|
||||
const int report_step,
|
||||
Opm::DeferredLogger& deferred_logger) const
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
// Finding the location of the well in wells_ecl
|
||||
const int nw_wells_ecl = wells_ecl_.size();
|
||||
@@ -1025,7 +1025,7 @@ namespace Opm {
|
||||
const double dt)
|
||||
{
|
||||
|
||||
Opm::DeferredLogger local_deferredLogger;
|
||||
DeferredLogger local_deferredLogger;
|
||||
if (this->glift_debug) {
|
||||
const std::string msg = fmt::format(
|
||||
"assemble() : iteration {}" , iterationIdx);
|
||||
@@ -1084,7 +1084,7 @@ namespace Opm {
|
||||
template<typename TypeTag>
|
||||
void
|
||||
BlackoilWellModel<TypeTag>::
|
||||
maybeDoGasLiftOptimize(Opm::DeferredLogger& deferred_logger)
|
||||
maybeDoGasLiftOptimize(DeferredLogger& deferred_logger)
|
||||
{
|
||||
this->wellState().enableGliftOptimization();
|
||||
GLiftOptWells glift_wells;
|
||||
@@ -1111,7 +1111,7 @@ namespace Opm {
|
||||
template<typename TypeTag>
|
||||
void
|
||||
BlackoilWellModel<TypeTag>::
|
||||
gasLiftOptimizationStage2(Opm::DeferredLogger& deferred_logger,
|
||||
gasLiftOptimizationStage2(DeferredLogger& deferred_logger,
|
||||
GLiftProdWells &prod_wells, GLiftOptWells &glift_wells,
|
||||
GLiftWellStateMap &glift_well_state_map)
|
||||
{
|
||||
@@ -1124,7 +1124,7 @@ namespace Opm {
|
||||
template<typename TypeTag>
|
||||
void
|
||||
BlackoilWellModel<TypeTag>::
|
||||
gliftDebugShowALQ(Opm::DeferredLogger& deferred_logger)
|
||||
gliftDebugShowALQ(DeferredLogger& deferred_logger)
|
||||
{
|
||||
for (auto& well : this->well_container_) {
|
||||
if (well->isProducer()) {
|
||||
@@ -1139,7 +1139,7 @@ namespace Opm {
|
||||
template<typename TypeTag>
|
||||
void
|
||||
BlackoilWellModel<TypeTag>::
|
||||
assembleWellEq(const double dt, Opm::DeferredLogger& deferred_logger)
|
||||
assembleWellEq(const double dt, DeferredLogger& deferred_logger)
|
||||
{
|
||||
for (auto& well : well_container_) {
|
||||
well->assembleWellEq(ebosSimulator_, dt, this->wellState(), this->groupState(), deferred_logger);
|
||||
@@ -1247,7 +1247,7 @@ namespace Opm {
|
||||
BlackoilWellModel<TypeTag>::
|
||||
recoverWellSolutionAndUpdateWellState(const BVector& x)
|
||||
{
|
||||
Opm::DeferredLogger local_deferredLogger;
|
||||
DeferredLogger local_deferredLogger;
|
||||
auto exc_type = ExceptionType::NONE;
|
||||
std::string exc_msg;
|
||||
try {
|
||||
@@ -1332,7 +1332,7 @@ namespace Opm {
|
||||
getWellConvergence(const std::vector<Scalar>& B_avg, bool checkGroupConvergence) const
|
||||
{
|
||||
|
||||
Opm::DeferredLogger local_deferredLogger;
|
||||
DeferredLogger local_deferredLogger;
|
||||
// Get global (from all processes) convergence report.
|
||||
ConvergenceReport local_report;
|
||||
for (const auto& well : well_container_) {
|
||||
@@ -1340,7 +1340,7 @@ namespace Opm {
|
||||
local_report += well->getWellConvergence(this->wellState(), B_avg, local_deferredLogger);
|
||||
}
|
||||
}
|
||||
Opm::DeferredLogger global_deferredLogger = gatherDeferredLogger(local_deferredLogger);
|
||||
DeferredLogger global_deferredLogger = gatherDeferredLogger(local_deferredLogger);
|
||||
if (terminal_output_) {
|
||||
global_deferredLogger.logMessages();
|
||||
}
|
||||
@@ -1374,7 +1374,7 @@ namespace Opm {
|
||||
template<typename TypeTag>
|
||||
void
|
||||
BlackoilWellModel<TypeTag>::
|
||||
calculateExplicitQuantities(Opm::DeferredLogger& deferred_logger) const
|
||||
calculateExplicitQuantities(DeferredLogger& deferred_logger) const
|
||||
{
|
||||
// TODO: checking isOperable() ?
|
||||
for (auto& well : well_container_) {
|
||||
@@ -1389,7 +1389,7 @@ namespace Opm {
|
||||
template<typename TypeTag>
|
||||
void
|
||||
BlackoilWellModel<TypeTag>::
|
||||
updateWellControls(Opm::DeferredLogger& deferred_logger, const bool checkGroupControls)
|
||||
updateWellControls(DeferredLogger& deferred_logger, const bool checkGroupControls)
|
||||
{
|
||||
// Even if there are no wells active locally, we cannot
|
||||
// return as the DeferredLogger uses global communication.
|
||||
@@ -1533,7 +1533,7 @@ namespace Opm {
|
||||
BlackoilWellModel<TypeTag>::
|
||||
updateWellTestState(const double& simulationTime, WellTestState& wellTestState) const
|
||||
{
|
||||
Opm::DeferredLogger local_deferredLogger;
|
||||
DeferredLogger local_deferredLogger;
|
||||
for (const auto& well : well_container_) {
|
||||
const auto wasClosed = wellTestState.hasWellClosed(well->name());
|
||||
|
||||
@@ -1544,7 +1544,7 @@ namespace Opm {
|
||||
}
|
||||
}
|
||||
|
||||
Opm::DeferredLogger global_deferredLogger = gatherDeferredLogger(local_deferredLogger);
|
||||
DeferredLogger global_deferredLogger = gatherDeferredLogger(local_deferredLogger);
|
||||
if (terminal_output_) {
|
||||
global_deferredLogger.logMessages();
|
||||
}
|
||||
@@ -1555,7 +1555,7 @@ namespace Opm {
|
||||
template<typename TypeTag>
|
||||
void
|
||||
BlackoilWellModel<TypeTag>::
|
||||
computeWellPotentials(std::vector<double>& well_potentials, const int reportStepIdx, Opm::DeferredLogger& deferred_logger)
|
||||
computeWellPotentials(std::vector<double>& well_potentials, const int reportStepIdx, DeferredLogger& deferred_logger)
|
||||
{
|
||||
// number of wells and phases
|
||||
const int nw = numLocalWells();
|
||||
@@ -1564,7 +1564,7 @@ namespace Opm {
|
||||
|
||||
auto well_state = this->wellState();
|
||||
|
||||
const Opm::SummaryConfig& summaryConfig = ebosSimulator_.vanguard().summaryConfig();
|
||||
const SummaryConfig& summaryConfig = ebosSimulator_.vanguard().summaryConfig();
|
||||
const bool write_restart_file = ebosSimulator_.vanguard().schedule().write_rst_file(reportStepIdx);
|
||||
auto exc_type = ExceptionType::NONE;
|
||||
std::string exc_msg;
|
||||
@@ -1673,7 +1673,7 @@ namespace Opm {
|
||||
template<typename TypeTag>
|
||||
void
|
||||
BlackoilWellModel<TypeTag>::
|
||||
prepareTimeStep(Opm::DeferredLogger& deferred_logger)
|
||||
prepareTimeStep(DeferredLogger& deferred_logger)
|
||||
{
|
||||
auto exc_type = ExceptionType::NONE;
|
||||
std::string exc_msg;
|
||||
@@ -1833,7 +1833,7 @@ namespace Opm {
|
||||
template<typename TypeTag>
|
||||
void
|
||||
BlackoilWellModel<TypeTag>::
|
||||
updatePrimaryVariables(Opm::DeferredLogger& deferred_logger)
|
||||
updatePrimaryVariables(DeferredLogger& deferred_logger)
|
||||
{
|
||||
for (const auto& well : well_container_) {
|
||||
well->updatePrimaryVariables(this->wellState(), deferred_logger);
|
||||
@@ -1894,7 +1894,7 @@ namespace Opm {
|
||||
|
||||
depth_.resize(numCells);
|
||||
for (unsigned cellIdx = 0; cellIdx < numCells; ++cellIdx) {
|
||||
depth_[cellIdx] = Opm::UgGridHelpers::cellCenterDepth( grid, cellIdx );
|
||||
depth_[cellIdx] = UgGridHelpers::cellCenterDepth( grid, cellIdx );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2009,7 +2009,7 @@ namespace Opm {
|
||||
const int segment_index = segment_set.segmentNumberToIndex(segment.first);
|
||||
|
||||
// recovering segment rates and pressure from the restart values
|
||||
const auto pres_idx = Opm::data::SegmentPressures::Value::Pressure;
|
||||
const auto pres_idx = data::SegmentPressures::Value::Pressure;
|
||||
well_state.segPress()[top_segment_index + segment_index] = segment.second.pressures[pres_idx];
|
||||
|
||||
const auto& segment_rates = segment.second.rates;
|
||||
@@ -2101,7 +2101,7 @@ namespace Opm {
|
||||
template<typename TypeTag>
|
||||
void
|
||||
BlackoilWellModel<TypeTag>::
|
||||
updateGroupIndividualControls(Opm::DeferredLogger& deferred_logger, std::set<std::string>& switched_groups)
|
||||
updateGroupIndividualControls(DeferredLogger& deferred_logger, std::set<std::string>& switched_groups)
|
||||
{
|
||||
const int reportStepIdx = ebosSimulator_.episodeIndex();
|
||||
|
||||
@@ -2121,7 +2121,7 @@ namespace Opm {
|
||||
template<typename TypeTag>
|
||||
void
|
||||
BlackoilWellModel<TypeTag>::
|
||||
updateGroupIndividualControl(const Group& group, Opm::DeferredLogger& deferred_logger, std::set<std::string>& switched_groups) {
|
||||
updateGroupIndividualControl(const Group& group, DeferredLogger& deferred_logger, std::set<std::string>& switched_groups) {
|
||||
|
||||
const int reportStepIdx = ebosSimulator_.episodeIndex();
|
||||
const bool skip = switched_groups.count(group.name());
|
||||
@@ -2160,7 +2160,7 @@ namespace Opm {
|
||||
template<typename TypeTag>
|
||||
bool
|
||||
BlackoilWellModel<TypeTag>::
|
||||
checkGroupConstraints(const Group& group, Opm::DeferredLogger& deferred_logger) const {
|
||||
checkGroupConstraints(const Group& group, DeferredLogger& deferred_logger) const {
|
||||
|
||||
const int reportStepIdx = ebosSimulator_.episodeIndex();
|
||||
if (group.isInjectionGroup()) {
|
||||
@@ -2196,7 +2196,7 @@ namespace Opm {
|
||||
template<typename TypeTag>
|
||||
Group::ProductionCMode
|
||||
BlackoilWellModel<TypeTag>::
|
||||
checkGroupProductionConstraints(const Group& group, Opm::DeferredLogger& deferred_logger) const {
|
||||
checkGroupProductionConstraints(const Group& group, DeferredLogger& deferred_logger) const {
|
||||
|
||||
const int reportStepIdx = ebosSimulator_.episodeIndex();
|
||||
const auto& summaryState = ebosSimulator_.vanguard().summaryState();
|
||||
@@ -2405,7 +2405,7 @@ namespace Opm {
|
||||
template<typename TypeTag>
|
||||
void
|
||||
BlackoilWellModel<TypeTag>::
|
||||
checkGconsaleLimits(const Group& group, WellState& well_state, Opm::DeferredLogger& deferred_logger)
|
||||
checkGconsaleLimits(const Group& group, WellState& well_state, DeferredLogger& deferred_logger)
|
||||
{
|
||||
const int reportStepIdx = ebosSimulator_.episodeIndex();
|
||||
// call recursively down the group hiearchy
|
||||
@@ -2525,7 +2525,7 @@ namespace Opm {
|
||||
template<typename TypeTag>
|
||||
void
|
||||
BlackoilWellModel<TypeTag>::
|
||||
actionOnBrokenConstraints(const Group& group, const Group::ExceedAction& exceed_action, const Group::ProductionCMode& newControl, Opm::DeferredLogger& deferred_logger) {
|
||||
actionOnBrokenConstraints(const Group& group, const Group::ExceedAction& exceed_action, const Group::ProductionCMode& newControl, DeferredLogger& deferred_logger) {
|
||||
|
||||
const Group::ProductionCMode oldControl = this->groupState().production_control(group.name());
|
||||
|
||||
@@ -2578,7 +2578,7 @@ namespace Opm {
|
||||
template<typename TypeTag>
|
||||
void
|
||||
BlackoilWellModel<TypeTag>::
|
||||
actionOnBrokenConstraints(const Group& group, const Group::InjectionCMode& newControl, const Phase& controlPhase, Opm::DeferredLogger& deferred_logger) {
|
||||
actionOnBrokenConstraints(const Group& group, const Group::InjectionCMode& newControl, const Phase& controlPhase, DeferredLogger& deferred_logger) {
|
||||
auto oldControl = this->groupState().injection_control(group.name(), controlPhase);
|
||||
|
||||
std::ostringstream ss;
|
||||
@@ -2601,7 +2601,7 @@ namespace Opm {
|
||||
template<typename TypeTag>
|
||||
void
|
||||
BlackoilWellModel<TypeTag>::
|
||||
updateGroupHigherControls(Opm::DeferredLogger& deferred_logger, std::set<std::string>& switched_groups)
|
||||
updateGroupHigherControls(DeferredLogger& deferred_logger, std::set<std::string>& switched_groups)
|
||||
{
|
||||
const int reportStepIdx = ebosSimulator_.episodeIndex();
|
||||
const Group& fieldGroup = schedule().getGroup("FIELD", reportStepIdx);
|
||||
@@ -2612,7 +2612,7 @@ namespace Opm {
|
||||
template<typename TypeTag>
|
||||
void
|
||||
BlackoilWellModel<TypeTag>::
|
||||
checkGroupHigherConstraints(const Group& group, Opm::DeferredLogger& deferred_logger, std::set<std::string>& switched_groups)
|
||||
checkGroupHigherConstraints(const Group& group, DeferredLogger& deferred_logger, std::set<std::string>& switched_groups)
|
||||
{
|
||||
// Set up coefficients for RESV <-> surface rate conversion.
|
||||
// Use the pvtRegionIdx from the top cell of the first well.
|
||||
@@ -3138,8 +3138,8 @@ namespace Opm {
|
||||
gr[gname].production = this->getGuideRateValues(group);
|
||||
}
|
||||
|
||||
if (this->guideRate_->has(gname, Opm::Phase::WATER)
|
||||
|| this->guideRate_->has(gname, Opm::Phase::GAS)) {
|
||||
if (this->guideRate_->has(gname, Phase::WATER)
|
||||
|| this->guideRate_->has(gname, Phase::GAS)) {
|
||||
gr[gname].injection = this->getGuideRateInjectionGroupValues(group);
|
||||
}
|
||||
|
||||
@@ -3234,13 +3234,13 @@ namespace Opm {
|
||||
assert (this->guideRate_ != nullptr);
|
||||
|
||||
const auto& gname = group.name();
|
||||
if (this->guideRate_->has(gname, Opm::Phase::GAS)) {
|
||||
if (this->guideRate_->has(gname, Phase::GAS)) {
|
||||
grval.set(data::GuideRateValue::Item::Gas,
|
||||
this->guideRate_->get(gname, Opm::Phase::GAS));
|
||||
this->guideRate_->get(gname, Phase::GAS));
|
||||
}
|
||||
if (this->guideRate_->has(gname, Opm::Phase::WATER)) {
|
||||
if (this->guideRate_->has(gname, Phase::WATER)) {
|
||||
grval.set(data::GuideRateValue::Item::Water,
|
||||
this->guideRate_->get(gname, Opm::Phase::WATER));
|
||||
this->guideRate_->get(gname, Phase::WATER));
|
||||
}
|
||||
return grval;
|
||||
}
|
||||
|
||||
@@ -59,9 +59,9 @@ namespace Opm
|
||||
class GasLiftStage2 {
|
||||
using Simulator = GetPropType<TypeTag, Properties::Simulator>;
|
||||
using WellState = WellStateFullyImplicitBlackoil;
|
||||
using BlackoilWellModel = Opm::BlackoilWellModel<TypeTag>;
|
||||
using GasLiftSingleWell = Opm::GasLiftSingleWell<TypeTag>;
|
||||
using GLiftWellState = Opm::GasLiftWellState<TypeTag>;
|
||||
using BlackoilWellModel = ::Opm::BlackoilWellModel<TypeTag>;
|
||||
using GasLiftSingleWell = ::Opm::GasLiftSingleWell<TypeTag>;
|
||||
using GLiftWellState = ::Opm::GasLiftWellState<TypeTag>;
|
||||
using GLiftOptWells = typename BlackoilWellModel::GLiftOptWells;
|
||||
using GLiftProdWells = typename BlackoilWellModel::GLiftProdWells;
|
||||
using GLiftWellStateMap = typename BlackoilWellModel::GLiftWellStateMap;
|
||||
@@ -98,26 +98,26 @@ namespace Opm
|
||||
void displayWarning_(const std::string &msg, const std::string &group_name);
|
||||
void displayWarning_(const std::string &msg);
|
||||
std::tuple<double, double, double> getCurrentGroupRates_(
|
||||
const Opm::Group &group);
|
||||
const Group &group);
|
||||
std::array<double,3> getCurrentGroupRatesRecursive_(
|
||||
const Opm::Group &group);
|
||||
const Group &group);
|
||||
std::tuple<double, double, double> getCurrentWellRates_(
|
||||
const std::string &well_name, const std::string &group_name);
|
||||
std::vector<GasLiftSingleWell *> getGroupGliftWells_(
|
||||
const Opm::Group &group);
|
||||
const Group &group);
|
||||
void getGroupGliftWellsRecursive_(
|
||||
const Opm::Group &group, std::vector<GasLiftSingleWell *> &wells);
|
||||
const Group &group, std::vector<GasLiftSingleWell *> &wells);
|
||||
std::pair<double, double> getStdWellRates_(const WellInterface<TypeTag> &well);
|
||||
void optimizeGroup_(const Opm::Group &group);
|
||||
void optimizeGroupsRecursive_(const Opm::Group &group);
|
||||
void optimizeGroup_(const Group &group);
|
||||
void optimizeGroupsRecursive_(const Group &group);
|
||||
void recalculateGradientAndUpdateData_(
|
||||
GradPairItr &grad_itr, bool increase,
|
||||
std::vector<GradPair> &grads, std::vector<GradPair> &other_grads);
|
||||
void redistributeALQ_(
|
||||
std::vector<GasLiftSingleWell *> &wells, const Opm::Group &group,
|
||||
std::vector<GasLiftSingleWell *> &wells, const Group &group,
|
||||
std::vector<GradPair> &inc_grads, std::vector<GradPair> &dec_grads);
|
||||
void removeSurplusALQ_(
|
||||
const Opm::Group &group,
|
||||
const Group &group,
|
||||
std::vector<GradPair> &inc_grads, std::vector<GradPair> &dec_grads);
|
||||
void saveGrad_(GradMap &map, const std::string &name, GradInfo &grad);
|
||||
void saveDecGrad_(const std::string &name, GradInfo &grad);
|
||||
@@ -152,13 +152,13 @@ namespace Opm
|
||||
int nonlinear_iteration_idx_;
|
||||
|
||||
struct OptimizeState {
|
||||
OptimizeState( GasLiftStage2 &parent_, const Opm::Group &group_ ) :
|
||||
OptimizeState( GasLiftStage2 &parent_, const Group &group_ ) :
|
||||
parent{parent_},
|
||||
group{group_},
|
||||
it{0}
|
||||
{}
|
||||
GasLiftStage2 &parent;
|
||||
const Opm::Group &group;
|
||||
const Group &group;
|
||||
int it;
|
||||
|
||||
using GradInfo = typename GasLiftStage2::GradInfo;
|
||||
@@ -184,7 +184,7 @@ namespace Opm
|
||||
};
|
||||
|
||||
struct SurplusState {
|
||||
SurplusState( GasLiftStage2 &parent_, const Opm::Group &group_,
|
||||
SurplusState( GasLiftStage2 &parent_, const Group &group_,
|
||||
double oil_rate_, double gas_rate_, double alq_, double min_eco_grad_,
|
||||
double oil_target_, double gas_target_,
|
||||
std::optional<double> max_glift_) :
|
||||
@@ -200,7 +200,7 @@ namespace Opm
|
||||
it{0}
|
||||
{}
|
||||
GasLiftStage2 &parent;
|
||||
const Opm::Group &group;
|
||||
const Group &group;
|
||||
double oil_rate;
|
||||
double gas_rate;
|
||||
double alq;
|
||||
|
||||
@@ -283,7 +283,7 @@ displayDebugMessage_(const std::string &msg, const std::string &group_name)
|
||||
template<typename TypeTag>
|
||||
std::tuple<double, double, double>
|
||||
GasLiftStage2<TypeTag>::
|
||||
getCurrentGroupRates_(const Opm::Group &group)
|
||||
getCurrentGroupRates_(const Group &group)
|
||||
{
|
||||
auto rates = getCurrentGroupRatesRecursive_(group);
|
||||
const auto& comm = ebos_simulator_.vanguard().grid().comm();
|
||||
@@ -302,7 +302,7 @@ getCurrentGroupRates_(const Opm::Group &group)
|
||||
|
||||
template<typename TypeTag>
|
||||
std::array <double, 3> GasLiftStage2<TypeTag>::
|
||||
getCurrentGroupRatesRecursive_(const Opm::Group &group)
|
||||
getCurrentGroupRatesRecursive_(const Group &group)
|
||||
{
|
||||
double oil_rate = 0.0;
|
||||
double gas_rate = 0.0;
|
||||
@@ -440,7 +440,7 @@ getStdWellRates_(const WellInterface<TypeTag> &well)
|
||||
template<typename TypeTag>
|
||||
std::vector<GasLiftSingleWell<TypeTag> *>
|
||||
GasLiftStage2<TypeTag>::
|
||||
getGroupGliftWells_(const Opm::Group &group)
|
||||
getGroupGliftWells_(const Group &group)
|
||||
{
|
||||
std::vector<GasLiftSingleWell *> wells;
|
||||
getGroupGliftWellsRecursive_(group, wells);
|
||||
@@ -450,7 +450,7 @@ getGroupGliftWells_(const Opm::Group &group)
|
||||
template<typename TypeTag>
|
||||
void
|
||||
GasLiftStage2<TypeTag>::
|
||||
getGroupGliftWellsRecursive_(const Opm::Group &group,
|
||||
getGroupGliftWellsRecursive_(const Group &group,
|
||||
std::vector<GasLiftSingleWell *> &wells)
|
||||
{
|
||||
for (const std::string& group_name : group.groups()) {
|
||||
@@ -471,7 +471,7 @@ getGroupGliftWellsRecursive_(const Opm::Group &group,
|
||||
template<typename TypeTag>
|
||||
void
|
||||
GasLiftStage2<TypeTag>::
|
||||
optimizeGroup_(const Opm::Group &group)
|
||||
optimizeGroup_(const Group &group)
|
||||
{
|
||||
const auto &gl_group = this->glo_.group(group.name());
|
||||
const auto &max_glift = gl_group.max_lift_gas();
|
||||
@@ -494,7 +494,7 @@ optimizeGroup_(const Opm::Group &group)
|
||||
template<typename TypeTag>
|
||||
void
|
||||
GasLiftStage2<TypeTag>::
|
||||
optimizeGroupsRecursive_(const Opm::Group &group)
|
||||
optimizeGroupsRecursive_(const Group &group)
|
||||
{
|
||||
for (const std::string& group_name : group.groups()) {
|
||||
if(!this->schedule_.back().groups.has(group_name))
|
||||
@@ -597,7 +597,7 @@ recalculateGradientAndUpdateData_(
|
||||
template<typename TypeTag>
|
||||
void
|
||||
GasLiftStage2<TypeTag>::
|
||||
redistributeALQ_(std::vector<GasLiftSingleWell *> &wells, const Opm::Group &group,
|
||||
redistributeALQ_(std::vector<GasLiftSingleWell *> &wells, const Group &group,
|
||||
std::vector<GradPair> &inc_grads, std::vector<GradPair> &dec_grads)
|
||||
{
|
||||
OptimizeState state {*this, group};
|
||||
@@ -652,7 +652,7 @@ redistributeALQ_(std::vector<GasLiftSingleWell *> &wells, const Opm::Group &gro
|
||||
template<typename TypeTag>
|
||||
void
|
||||
GasLiftStage2<TypeTag>::
|
||||
removeSurplusALQ_(const Opm::Group &group,
|
||||
removeSurplusALQ_(const Group &group,
|
||||
std::vector<GradPair> &inc_grads, std::vector<GradPair> &dec_grads)
|
||||
{
|
||||
if (dec_grads.size() == 0) {
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace mswellhelpers
|
||||
if (std::isinf(y[i_block][i_elem]) || std::isnan(y[i_block][i_elem]) ) {
|
||||
const std::string msg{"nan or inf value found after UMFPack solve due to singular matrix"};
|
||||
OpmLog::debug(msg);
|
||||
OPM_THROW_NOLOG(Opm::NumericalIssue, msg);
|
||||
OPM_THROW_NOLOG(NumericalIssue, msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -123,7 +123,7 @@ namespace mswellhelpers
|
||||
// obtain y = D^-1 * x with a BICSSTAB iterative solver
|
||||
template <typename MatrixType, typename VectorType>
|
||||
VectorType
|
||||
invDX(const MatrixType& D, VectorType x, Opm::DeferredLogger& deferred_logger)
|
||||
invDX(const MatrixType& D, VectorType x, DeferredLogger& deferred_logger)
|
||||
{
|
||||
// the function will change the value of x, so we should not use reference of x here.
|
||||
|
||||
@@ -160,7 +160,7 @@ namespace mswellhelpers
|
||||
linsolver.apply(y, x, res);
|
||||
|
||||
if ( !res.converged ) {
|
||||
OPM_DEFLOG_THROW(Opm::NumericalIssue, "the invDX did not converge ", deferred_logger);
|
||||
OPM_DEFLOG_THROW(NumericalIssue, "the invDX did not converge ", deferred_logger);
|
||||
}
|
||||
|
||||
return y;
|
||||
@@ -172,7 +172,7 @@ namespace mswellhelpers
|
||||
template <typename ValueType>
|
||||
inline ValueType haalandFormular(const ValueType& re, const double diameter, const double roughness)
|
||||
{
|
||||
const ValueType value = -3.6 * Opm::log10(6.9 / re + std::pow(roughness / (3.7 * diameter), 10. / 9.) );
|
||||
const ValueType value = -3.6 * log10(6.9 / re + std::pow(roughness / (3.7 * diameter), 10. / 9.) );
|
||||
|
||||
// sqrt(1/f) should be non-positive
|
||||
assert(value >= 0.0);
|
||||
@@ -190,7 +190,7 @@ namespace mswellhelpers
|
||||
|
||||
ValueType f = 0.;
|
||||
// Reynolds number
|
||||
const ValueType re = Opm::abs( diameter * w / (area * mu));
|
||||
const ValueType re = abs( diameter * w / (area * mu));
|
||||
|
||||
if ( re == 0.0 ) {
|
||||
// make sure it is because the mass rate is zero
|
||||
@@ -265,7 +265,7 @@ namespace mswellhelpers
|
||||
const double max_visco_ratio)
|
||||
{
|
||||
const ValueType temp_value = 1. / (1. - (0.8415 / 0.7480 * water_liquid_fraction) );
|
||||
const ValueType viscosity_ratio = Opm::pow(temp_value, 2.5);
|
||||
const ValueType viscosity_ratio = pow(temp_value, 2.5);
|
||||
|
||||
if (viscosity_ratio <= max_visco_ratio) {
|
||||
return oil_viscosity * viscosity_ratio;
|
||||
@@ -284,7 +284,7 @@ namespace mswellhelpers
|
||||
const double max_visco_ratio)
|
||||
{
|
||||
const ValueType temp_value = 1. / (1. - (0.6019 / 0.6410) * (1. - water_liquid_fraction) );
|
||||
const ValueType viscosity_ratio = Opm::pow(temp_value, 2.5);
|
||||
const ValueType viscosity_ratio = pow(temp_value, 2.5);
|
||||
|
||||
if (viscosity_ratio <= max_visco_ratio) {
|
||||
return water_viscosity * viscosity_ratio;
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
class DeferredLogger;
|
||||
|
||||
template<typename TypeTag>
|
||||
class MultisegmentWell: public WellInterface<TypeTag>
|
||||
@@ -139,15 +140,15 @@ namespace Opm
|
||||
const double dt,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
Opm::DeferredLogger& deferred_logger) override;
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
/// updating the well state based the current control mode
|
||||
void updateWellStateWithTarget(const Simulator& ebos_simulator,
|
||||
WellState& well_state,
|
||||
Opm::DeferredLogger& deferred_logger) const;
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
/// check whether the well equations get converged for this well
|
||||
virtual ConvergenceReport getWellConvergence(const WellState& well_state, const std::vector<double>& B_avg, Opm::DeferredLogger& deferred_logger, const bool relax_tolerance = false) const override;
|
||||
virtual ConvergenceReport getWellConvergence(const WellState& well_state, const std::vector<double>& B_avg, DeferredLogger& deferred_logger, const bool relax_tolerance = false) const override;
|
||||
|
||||
/// Ax = Ax - C D^-1 B x
|
||||
virtual void apply(const BVector& x, BVector& Ax) const override;
|
||||
@@ -163,21 +164,21 @@ namespace Opm
|
||||
/// xw to update Well State
|
||||
virtual void recoverWellSolutionAndUpdateWellState(const BVector& x,
|
||||
WellState& well_state,
|
||||
Opm::DeferredLogger& deferred_logger) const override;
|
||||
DeferredLogger& deferred_logger) const override;
|
||||
|
||||
/// computing the well potentials for group control
|
||||
virtual void computeWellPotentials(const Simulator& ebosSimulator,
|
||||
const WellState& well_state,
|
||||
std::vector<double>& well_potentials,
|
||||
Opm::DeferredLogger& deferred_logger) override;
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
virtual void updatePrimaryVariables(const WellState& well_state, Opm::DeferredLogger& deferred_logger) const override;
|
||||
virtual void updatePrimaryVariables(const WellState& well_state, DeferredLogger& deferred_logger) const override;
|
||||
|
||||
virtual void solveEqAndUpdateWellState(WellState& well_state, Opm::DeferredLogger& deferred_logger) override; // const?
|
||||
virtual void solveEqAndUpdateWellState(WellState& well_state, DeferredLogger& deferred_logger) override; // const?
|
||||
|
||||
virtual void calculateExplicitQuantities(const Simulator& ebosSimulator,
|
||||
const WellState& well_state,
|
||||
Opm::DeferredLogger& deferred_logger) override; // should be const?
|
||||
DeferredLogger& deferred_logger) override; // should be const?
|
||||
|
||||
virtual void updateProductivityIndex(const Simulator& ebosSimulator,
|
||||
const WellProdIndexCalculator& wellPICalc,
|
||||
@@ -345,7 +346,7 @@ namespace Opm
|
||||
// updating the well_state based on well solution dwells
|
||||
void updateWellState(const BVectorWell& dwells,
|
||||
WellState& well_state,
|
||||
Opm::DeferredLogger& deferred_logger,
|
||||
DeferredLogger& deferred_logger,
|
||||
const double relaxation_factor=1.0) const;
|
||||
|
||||
|
||||
@@ -380,13 +381,13 @@ namespace Opm
|
||||
EvalWell& perf_press,
|
||||
double& perf_dis_gas_rate,
|
||||
double& perf_vap_oil_rate,
|
||||
Opm::DeferredLogger& deferred_logger) const;
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
// convert a Eval from reservoir to contain the derivative related to wells
|
||||
EvalWell extendEval(const Eval& in) const;
|
||||
|
||||
double calculateThpFromBhp(const std::vector<double>& rates, const double bhp, Opm::DeferredLogger& deferred_logger) const;
|
||||
void updateThp(WellState& well_state, Opm::DeferredLogger& deferred_logger) const;
|
||||
double calculateThpFromBhp(const std::vector<double>& rates, const double bhp, DeferredLogger& deferred_logger) const;
|
||||
void updateThp(WellState& well_state, DeferredLogger& deferred_logger) const;
|
||||
|
||||
// compute the fluid properties, such as densities, viscosities, and so on, in the segments
|
||||
// They will be treated implicitly, so they need to be of Evaluation type
|
||||
@@ -407,24 +408,24 @@ namespace Opm
|
||||
|
||||
void computeWellRatesAtBhpLimit(const Simulator& ebosSimulator,
|
||||
std::vector<double>& well_flux,
|
||||
Opm::DeferredLogger& deferred_logger) const;
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
void computeWellRatesWithBhp(const Simulator& ebosSimulator,
|
||||
const Scalar bhp,
|
||||
std::vector<double>& well_flux,
|
||||
Opm::DeferredLogger& deferred_logger) const;
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
std::vector<double>
|
||||
computeWellPotentialWithTHP(const Simulator& ebos_simulator,
|
||||
Opm::DeferredLogger& deferred_logger) const;
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
void assembleControlEq(const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
const Opm::Schedule& schedule,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
Opm::DeferredLogger& deferred_logger);
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
void assemblePressureEq(const int seg, const UnitSystem& unit_system,
|
||||
WellState& well_state, DeferredLogger& deferred_logger) const;
|
||||
@@ -442,7 +443,7 @@ namespace Opm
|
||||
// handling the overshooting and undershooting of the fractions
|
||||
void processFractions(const int seg) const;
|
||||
|
||||
void updateWellStateFromPrimaryVariables(WellState& well_state, Opm::DeferredLogger& deferred_logger) const;
|
||||
void updateWellStateFromPrimaryVariables(WellState& well_state, DeferredLogger& deferred_logger) const;
|
||||
|
||||
virtual double getRefDensity() const override;
|
||||
|
||||
@@ -456,7 +457,7 @@ namespace Opm
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
Opm::DeferredLogger& deferred_logger) override;
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
virtual void assembleWellEqWithoutIteration(const Simulator& ebosSimulator,
|
||||
const double dt,
|
||||
@@ -464,7 +465,7 @@ namespace Opm
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
Opm::DeferredLogger& deferred_logger) override;
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
virtual void updateWaterThroughput(const double dt, WellState& well_state) const override;
|
||||
|
||||
@@ -524,13 +525,13 @@ namespace Opm
|
||||
WellState& well_state, DeferredLogger& deferred_logger) const;
|
||||
|
||||
// check whether the well is operable under BHP limit with current reservoir condition
|
||||
virtual void checkOperabilityUnderBHPLimitProducer(const WellState& well_state, const Simulator& ebos_simulator, Opm::DeferredLogger& deferred_logger) override;
|
||||
virtual void checkOperabilityUnderBHPLimitProducer(const WellState& well_state, const Simulator& ebos_simulator, DeferredLogger& deferred_logger) override;
|
||||
|
||||
// check whether the well is operable under THP limit with current reservoir condition
|
||||
virtual void checkOperabilityUnderTHPLimitProducer(const Simulator& ebos_simulator, const WellState& well_state, Opm::DeferredLogger& deferred_logger) override;
|
||||
virtual void checkOperabilityUnderTHPLimitProducer(const Simulator& ebos_simulator, const WellState& well_state, DeferredLogger& deferred_logger) override;
|
||||
|
||||
// updating the inflow based on the current reservoir condition
|
||||
virtual void updateIPR(const Simulator& ebos_simulator, Opm::DeferredLogger& deferred_logger) const override;
|
||||
virtual void updateIPR(const Simulator& ebos_simulator, DeferredLogger& deferred_logger) const override;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -264,7 +264,7 @@ namespace Opm
|
||||
const double dt,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
Opm::DeferredLogger& deferred_logger)
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
|
||||
checkWellOperability(ebosSimulator, well_state, deferred_logger);
|
||||
@@ -289,7 +289,7 @@ namespace Opm
|
||||
MultisegmentWell<TypeTag>::
|
||||
updateWellStateWithTarget(const Simulator& ebos_simulator,
|
||||
WellState& well_state,
|
||||
Opm::DeferredLogger& deferred_logger) const
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
Base::updateWellStateWithTarget(ebos_simulator, well_state, deferred_logger);
|
||||
// scale segment rates based on the wellRates
|
||||
@@ -359,7 +359,7 @@ namespace Opm
|
||||
template <typename TypeTag>
|
||||
ConvergenceReport
|
||||
MultisegmentWell<TypeTag>::
|
||||
getWellConvergence(const WellState& well_state, const std::vector<double>& B_avg, Opm::DeferredLogger& deferred_logger, const bool relax_tolerance) const
|
||||
getWellConvergence(const WellState& well_state, const std::vector<double>& B_avg, DeferredLogger& deferred_logger, const bool relax_tolerance) const
|
||||
{
|
||||
assert(int(B_avg.size()) == num_components_);
|
||||
|
||||
@@ -542,7 +542,7 @@ namespace Opm
|
||||
MultisegmentWell<TypeTag>::
|
||||
recoverWellSolutionAndUpdateWellState(const BVector& x,
|
||||
WellState& well_state,
|
||||
Opm::DeferredLogger& deferred_logger) const
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
if (!this->isOperable() && !this->wellIsStopped()) return;
|
||||
|
||||
@@ -561,7 +561,7 @@ namespace Opm
|
||||
computeWellPotentials(const Simulator& ebosSimulator,
|
||||
const WellState& well_state,
|
||||
std::vector<double>& well_potentials,
|
||||
Opm::DeferredLogger& deferred_logger)
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
const int np = number_of_phases_;
|
||||
well_potentials.resize(np, 0.0);
|
||||
@@ -575,12 +575,12 @@ namespace Opm
|
||||
/* {
|
||||
bool pressure_controlled_well = false;
|
||||
if (this->isInjector()) {
|
||||
const Opm::Well::InjectorCMode& current = well_state.currentInjectionControls()[index_of_well_];
|
||||
const Well::InjectorCMode& current = well_state.currentInjectionControls()[index_of_well_];
|
||||
if (current == Well::InjectorCMode::BHP || current == Well::InjectorCMode::THP) {
|
||||
pressure_controlled_well = true;
|
||||
}
|
||||
} else {
|
||||
const Opm::Well::ProducerCMode& current = well_state.currentProductionControls()[index_of_well_];
|
||||
const Well::ProducerCMode& current = well_state.currentProductionControls()[index_of_well_];
|
||||
if (current == Well::ProducerCMode::BHP || current == Well::ProducerCMode::THP) {
|
||||
pressure_controlled_well = true;
|
||||
}
|
||||
@@ -614,7 +614,7 @@ namespace Opm
|
||||
MultisegmentWell<TypeTag>::
|
||||
computeWellRatesAtBhpLimit(const Simulator& ebosSimulator,
|
||||
std::vector<double>& well_flux,
|
||||
Opm::DeferredLogger& deferred_logger) const
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
if (well_ecl_.isInjector()) {
|
||||
const auto controls = well_ecl_.injectionControls(ebosSimulator.vanguard().summaryState());
|
||||
@@ -633,7 +633,7 @@ namespace Opm
|
||||
computeWellRatesWithBhp(const Simulator& ebosSimulator,
|
||||
const Scalar bhp,
|
||||
std::vector<double>& well_flux,
|
||||
Opm::DeferredLogger& deferred_logger) const
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
// creating a copy of the well itself, to avoid messing up the explicit informations
|
||||
// during this copy, the only information not copied properly is the well controls
|
||||
@@ -695,7 +695,7 @@ namespace Opm
|
||||
std::vector<double>
|
||||
MultisegmentWell<TypeTag>::
|
||||
computeWellPotentialWithTHP(const Simulator& ebos_simulator,
|
||||
Opm::DeferredLogger& deferred_logger) const
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
std::vector<double> potentials(number_of_phases_, 0.0);
|
||||
const auto& summary_state = ebos_simulator.vanguard().summaryState();
|
||||
@@ -743,7 +743,7 @@ namespace Opm
|
||||
template <typename TypeTag>
|
||||
void
|
||||
MultisegmentWell<TypeTag>::
|
||||
updatePrimaryVariables(const WellState& well_state, Opm::DeferredLogger& /* deferred_logger */) const
|
||||
updatePrimaryVariables(const WellState& well_state, DeferredLogger& /* deferred_logger */) const
|
||||
{
|
||||
// TODO: to test using rate conversion coefficients to see if it will be better than
|
||||
// this default one
|
||||
@@ -837,7 +837,7 @@ namespace Opm
|
||||
template <typename TypeTag>
|
||||
void
|
||||
MultisegmentWell<TypeTag>::
|
||||
solveEqAndUpdateWellState(WellState& well_state, Opm::DeferredLogger& deferred_logger)
|
||||
solveEqAndUpdateWellState(WellState& well_state, DeferredLogger& deferred_logger)
|
||||
{
|
||||
if (!this->isOperable() && !this->wellIsStopped()) return;
|
||||
|
||||
@@ -930,7 +930,7 @@ namespace Opm
|
||||
MultisegmentWell<TypeTag>::
|
||||
updateWellState(const BVectorWell& dwells,
|
||||
WellState& well_state,
|
||||
Opm::DeferredLogger& deferred_logger,
|
||||
DeferredLogger& deferred_logger,
|
||||
const double relaxation_factor) const
|
||||
{
|
||||
if (!this->isOperable() && !this->wellIsStopped()) return;
|
||||
@@ -991,7 +991,7 @@ namespace Opm
|
||||
MultisegmentWell<TypeTag>::
|
||||
calculateExplicitQuantities(const Simulator& ebosSimulator,
|
||||
const WellState& well_state,
|
||||
Opm::DeferredLogger& deferred_logger)
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
updatePrimaryVariables(well_state, deferred_logger);
|
||||
initPrimaryVariablesEvaluation();
|
||||
@@ -1256,7 +1256,7 @@ namespace Opm
|
||||
EvalWell& perf_press,
|
||||
double& perf_dis_gas_rate,
|
||||
double& perf_vap_oil_rate,
|
||||
Opm::DeferredLogger& deferred_logger) const
|
||||
DeferredLogger& deferred_logger) const
|
||||
|
||||
{
|
||||
std::vector<EvalWell> cmix_s(num_components_, 0.0);
|
||||
@@ -1347,7 +1347,7 @@ namespace Opm
|
||||
const EvalWell d = 1.0 - rv * rs;
|
||||
|
||||
if (d.value() == 0.0) {
|
||||
OPM_DEFLOG_THROW(Opm::NumericalIssue, "Zero d value obtained for well " << name() << " during flux calcuation"
|
||||
OPM_DEFLOG_THROW(NumericalIssue, "Zero d value obtained for well " << name() << " during flux calcuation"
|
||||
<< " with rs " << rs << " and rv " << rv, deferred_logger);
|
||||
}
|
||||
|
||||
@@ -1783,11 +1783,11 @@ namespace Opm
|
||||
MultisegmentWell<TypeTag>::
|
||||
assembleControlEq(const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
const Opm::Schedule& schedule,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
Opm::DeferredLogger& deferred_logger)
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
|
||||
EvalWell control_eq(0.0);
|
||||
@@ -1864,7 +1864,7 @@ namespace Opm
|
||||
template<typename TypeTag>
|
||||
void
|
||||
MultisegmentWell<TypeTag>::
|
||||
updateThp(WellState& well_state, Opm::DeferredLogger& deferred_logger) const
|
||||
updateThp(WellState& well_state, DeferredLogger& deferred_logger) const
|
||||
{
|
||||
// When there is no vaild VFP table provided, we set the thp to be zero.
|
||||
if (!this->isVFPActive(deferred_logger) || this->wellIsStopped()) {
|
||||
@@ -1875,7 +1875,7 @@ namespace Opm
|
||||
// the well is under other control types, we calculate the thp based on bhp and rates
|
||||
std::vector<double> rates(3, 0.0);
|
||||
|
||||
const Opm::PhaseUsage& pu = phaseUsage();
|
||||
const PhaseUsage& pu = phaseUsage();
|
||||
if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) {
|
||||
rates[ Water ] = well_state.wellRates()[index_of_well_ * number_of_phases_ + pu.phase_pos[ Water ] ];
|
||||
}
|
||||
@@ -1899,7 +1899,7 @@ namespace Opm
|
||||
MultisegmentWell<TypeTag>::
|
||||
calculateThpFromBhp(const std::vector<double>& rates,
|
||||
const double bhp,
|
||||
Opm::DeferredLogger& deferred_logger) const
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
assert(int(rates.size()) == 3); // the vfp related only supports three phases now.
|
||||
|
||||
@@ -2163,7 +2163,7 @@ namespace Opm
|
||||
template<typename TypeTag>
|
||||
void
|
||||
MultisegmentWell<TypeTag>::
|
||||
checkOperabilityUnderBHPLimitProducer(const WellState& /*well_state*/, const Simulator& ebos_simulator, Opm::DeferredLogger& deferred_logger)
|
||||
checkOperabilityUnderBHPLimitProducer(const WellState& /*well_state*/, const Simulator& ebos_simulator, DeferredLogger& deferred_logger)
|
||||
{
|
||||
const auto& summaryState = ebos_simulator.vanguard().summaryState();
|
||||
const double bhp_limit = Base::mostStrictBhpFromBhpLimits(summaryState);
|
||||
@@ -2216,7 +2216,7 @@ namespace Opm
|
||||
template<typename TypeTag>
|
||||
void
|
||||
MultisegmentWell<TypeTag>::
|
||||
updateIPR(const Simulator& ebos_simulator, Opm::DeferredLogger& deferred_logger) const
|
||||
updateIPR(const Simulator& ebos_simulator, DeferredLogger& deferred_logger) const
|
||||
{
|
||||
// TODO: not handling solvent related here for now
|
||||
|
||||
@@ -2324,7 +2324,7 @@ namespace Opm
|
||||
template<typename TypeTag>
|
||||
void
|
||||
MultisegmentWell<TypeTag>::
|
||||
checkOperabilityUnderTHPLimitProducer(const Simulator& ebos_simulator, const WellState& /*well_state*/, Opm::DeferredLogger& deferred_logger)
|
||||
checkOperabilityUnderTHPLimitProducer(const Simulator& ebos_simulator, const WellState& /*well_state*/, DeferredLogger& deferred_logger)
|
||||
{
|
||||
const auto& summaryState = ebos_simulator.vanguard().summaryState();
|
||||
const auto obtain_bhp = computeBhpAtThpLimitProd(ebos_simulator, summaryState, deferred_logger);
|
||||
@@ -2364,7 +2364,7 @@ namespace Opm
|
||||
template <typename TypeTag>
|
||||
void
|
||||
MultisegmentWell<TypeTag>::
|
||||
updateWellStateFromPrimaryVariables(WellState& well_state, Opm::DeferredLogger& deferred_logger) const
|
||||
updateWellStateFromPrimaryVariables(WellState& well_state, DeferredLogger& deferred_logger) const
|
||||
{
|
||||
const PhaseUsage& pu = phaseUsage();
|
||||
assert( FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx) );
|
||||
@@ -2455,7 +2455,7 @@ namespace Opm
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
Opm::DeferredLogger& deferred_logger)
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
if (!this->isOperable() && !this->wellIsStopped()) return true;
|
||||
|
||||
@@ -2574,7 +2574,7 @@ namespace Opm
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
Opm::DeferredLogger& deferred_logger)
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
|
||||
if (!this->isOperable() && !this->wellIsStopped()) return;
|
||||
@@ -2726,7 +2726,7 @@ namespace Opm
|
||||
// the fourth dequation, the pressure drop equation
|
||||
if (seg == 0) { // top segment, pressure equation is the control equation
|
||||
const auto& summaryState = ebosSimulator.vanguard().summaryState();
|
||||
const Opm::Schedule& schedule = ebosSimulator.vanguard().schedule();
|
||||
const Schedule& schedule = ebosSimulator.vanguard().schedule();
|
||||
assembleControlEq(well_state, group_state, schedule, summaryState, inj_controls, prod_controls, deferred_logger);
|
||||
} else {
|
||||
const UnitSystem& unit_system = ebosSimulator.vanguard().eclState().getDeckUnitSystem();
|
||||
@@ -2935,7 +2935,7 @@ namespace Opm
|
||||
<< ", rv " << rv << " and pressure " << seg_pressure
|
||||
<< " obtaining d " << d;
|
||||
OpmLog::debug(sstr.str());
|
||||
OPM_THROW_NOLOG(Opm::NumericalIssue, sstr.str());
|
||||
OPM_THROW_NOLOG(NumericalIssue, sstr.str());
|
||||
}
|
||||
|
||||
if (rs > 0.0) { // rs > 0.0?
|
||||
@@ -2981,7 +2981,7 @@ namespace Opm
|
||||
}
|
||||
}
|
||||
if (std::isnan(residual) || std::isinf(residual)) {
|
||||
OPM_DEFLOG_THROW(Opm::NumericalIssue, "nan or inf value for residal get for well " << name()
|
||||
OPM_DEFLOG_THROW(NumericalIssue, "nan or inf value for residal get for well " << name()
|
||||
<< " segment " << seg << " eq_idx " << eq_idx, deferred_logger);
|
||||
}
|
||||
|
||||
@@ -2995,7 +2995,7 @@ namespace Opm
|
||||
{
|
||||
const double control_residual = std::abs(resWell_[0][numWellEq - 1]);
|
||||
if (std::isnan(control_residual) || std::isinf(control_residual)) {
|
||||
OPM_DEFLOG_THROW(Opm::NumericalIssue, "nan or inf value for control residal get for well " << name(), deferred_logger);
|
||||
OPM_DEFLOG_THROW(NumericalIssue, "nan or inf value for control residal get for well " << name(), deferred_logger);
|
||||
}
|
||||
residuals[numWellEq] = control_residual;
|
||||
}
|
||||
@@ -3090,7 +3090,7 @@ namespace Opm
|
||||
const int well_index = index_of_well_;
|
||||
if (this->isInjector() )
|
||||
{
|
||||
const Opm::Well::InjectorCMode& current = well_state.currentInjectionControls()[well_index];
|
||||
const Well::InjectorCMode& current = well_state.currentInjectionControls()[well_index];
|
||||
switch(current) {
|
||||
case Well::InjectorCMode::THP:
|
||||
control_tolerance = param_.tolerance_pressure_ms_wells_;
|
||||
@@ -3157,7 +3157,7 @@ namespace Opm
|
||||
const int well_index = index_of_well_;
|
||||
if (this->isInjector() )
|
||||
{
|
||||
const Opm::Well::InjectorCMode& current = well_state.currentInjectionControls()[well_index];
|
||||
const Well::InjectorCMode& current = well_state.currentInjectionControls()[well_index];
|
||||
switch(current) {
|
||||
case Well::InjectorCMode::THP:
|
||||
ctrltype = CR::WellFailure::Type::ControlTHP;
|
||||
@@ -3892,7 +3892,7 @@ namespace Opm
|
||||
const auto volume_rate_icd = this->segment_mass_rates_[seg] * aicd.scalingFactor() / mixture_density;
|
||||
const double sign = volume_rate_icd <= 0. ? 1.0 : -1.0;
|
||||
// convert 1 unit volume rate
|
||||
using M = Opm::UnitSystem::measure;
|
||||
using M = UnitSystem::measure;
|
||||
const double unit_volume_rate = unit_system.to_si(M::geometric_volume_rate, 1.);
|
||||
|
||||
// TODO: we did not consider the maximum allowed rate here
|
||||
@@ -4049,7 +4049,7 @@ namespace Opm
|
||||
phase_pos = pu.phase_pos[Water];
|
||||
}
|
||||
else {
|
||||
OPM_DEFLOG_THROW(Opm::NotImplemented,
|
||||
OPM_DEFLOG_THROW(NotImplemented,
|
||||
"Unsupported Injector Type ("
|
||||
<< static_cast<int>(preferred_phase)
|
||||
<< ") for well " << this->name()
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Opm
|
||||
{
|
||||
template<class TypeTag>
|
||||
class WellConnectionAuxiliaryModule
|
||||
: public Opm::BaseAuxiliaryModule<TypeTag>
|
||||
: public BaseAuxiliaryModule<TypeTag>
|
||||
{
|
||||
using GlobalEqVector = GetPropType<TypeTag, Properties::GlobalEqVector>;
|
||||
using SparseMatrixAdapter = GetPropType<TypeTag, Properties::SparseMatrixAdapter>;
|
||||
@@ -39,7 +39,7 @@ class WellConnectionAuxiliaryModule
|
||||
public:
|
||||
|
||||
using NeighborSet = typename
|
||||
Opm::BaseAuxiliaryModule<TypeTag>::NeighborSet;
|
||||
::Opm::BaseAuxiliaryModule<TypeTag>::NeighborSet;
|
||||
|
||||
WellConnectionAuxiliaryModule(const Schedule& schedule,
|
||||
const Dune::CpGrid& grid)
|
||||
|
||||
Reference in new issue
Block a user