Merge pull request #3298 from akva2/no_opm_in_opm

fixed: do not use Opm:: prefix when inside namespace Opm
This commit is contained in:
Joakim Hove
2021-05-26 10:15:46 +02:00
committed by GitHub
11 changed files with 250 additions and 249 deletions

View File

@@ -269,15 +269,15 @@ private:
class PackUnPackCellData : public P2PCommunicatorType::DataHandleInterface class PackUnPackCellData : public P2PCommunicatorType::DataHandleInterface
{ {
const Opm::data::Solution& localCellData_; const data::Solution& localCellData_;
Opm::data::Solution& globalCellData_; data::Solution& globalCellData_;
const IndexMapType& localIndexMap_; const IndexMapType& localIndexMap_;
const IndexMapStorageType& indexMaps_; const IndexMapStorageType& indexMaps_;
public: public:
PackUnPackCellData(const Opm::data::Solution& localCellData, PackUnPackCellData(const data::Solution& localCellData,
Opm::data::Solution& globalCellData, data::Solution& globalCellData,
const IndexMapType& localIndexMap, const IndexMapType& localIndexMap,
const IndexMapStorageType& indexMaps, const IndexMapStorageType& indexMaps,
size_t globalSize, size_t globalSize,
@@ -378,12 +378,12 @@ protected:
class PackUnPackWellData : public P2PCommunicatorType::DataHandleInterface class PackUnPackWellData : public P2PCommunicatorType::DataHandleInterface
{ {
const Opm::data::Wells& localWellData_; const data::Wells& localWellData_;
Opm::data::Wells& globalWellData_; data::Wells& globalWellData_;
public: public:
PackUnPackWellData(const Opm::data::Wells& localWellData, PackUnPackWellData(const data::Wells& localWellData,
Opm::data::Wells& globalWellData, data::Wells& globalWellData,
bool isIORank) bool isIORank)
: localWellData_(localWellData) : localWellData_(localWellData)
, globalWellData_(globalWellData) , globalWellData_(globalWellData)
@@ -416,12 +416,12 @@ public:
class PackUnPackGroupAndNetworkValues : public P2PCommunicatorType::DataHandleInterface class PackUnPackGroupAndNetworkValues : public P2PCommunicatorType::DataHandleInterface
{ {
const Opm::data::GroupAndNetworkValues& localGroupAndNetworkData_; const data::GroupAndNetworkValues& localGroupAndNetworkData_;
Opm::data::GroupAndNetworkValues& globalGroupAndNetworkData_; data::GroupAndNetworkValues& globalGroupAndNetworkData_;
public: public:
PackUnPackGroupAndNetworkValues(const Opm::data::GroupAndNetworkValues& localGroupAndNetworkData, PackUnPackGroupAndNetworkValues(const data::GroupAndNetworkValues& localGroupAndNetworkData,
Opm::data::GroupAndNetworkValues& globalGroupAndNetworkData, data::GroupAndNetworkValues& globalGroupAndNetworkData,
const bool isIORank) const bool isIORank)
: localGroupAndNetworkData_ (localGroupAndNetworkData) : localGroupAndNetworkData_ (localGroupAndNetworkData)
, globalGroupAndNetworkData_(globalGroupAndNetworkData) , globalGroupAndNetworkData_(globalGroupAndNetworkData)
@@ -568,12 +568,12 @@ public:
class PackUnPackAquiferData : public P2PCommunicatorType::DataHandleInterface class PackUnPackAquiferData : public P2PCommunicatorType::DataHandleInterface
{ {
const Opm::data::Aquifers& localAquiferData_; const data::Aquifers& localAquiferData_;
data::Aquifers& globalAquiferData_; data::Aquifers& globalAquiferData_;
public: public:
PackUnPackAquiferData(const Opm::data::Aquifers& localAquiferData, PackUnPackAquiferData(const data::Aquifers& localAquiferData,
Opm::data::Aquifers& globalAquiferData, data::Aquifers& globalAquiferData,
bool isIORank) bool isIORank)
: localAquiferData_(localAquiferData) : localAquiferData_(localAquiferData)
, globalAquiferData_(globalAquiferData) , globalAquiferData_(globalAquiferData)
@@ -791,12 +791,12 @@ CollectDataToIORank(const Grid& grid, const EquilGrid* equilGrid,
template <class Grid, class EquilGrid, class GridView> template <class Grid, class EquilGrid, class GridView>
void CollectDataToIORank<Grid,EquilGrid,GridView>:: void CollectDataToIORank<Grid,EquilGrid,GridView>::
collect(const Opm::data::Solution& localCellData, collect(const data::Solution& localCellData,
const std::map<std::pair<std::string, int>, double>& localBlockData, const std::map<std::pair<std::string, int>, double>& localBlockData,
const std::map<std::size_t, double>& localWBPData, const std::map<std::size_t, double>& localWBPData,
const Opm::data::Wells& localWellData, const data::Wells& localWellData,
const Opm::data::GroupAndNetworkValues& localGroupAndNetworkData, const data::GroupAndNetworkValues& localGroupAndNetworkData,
const Opm::data::Aquifers& localAquiferData) const data::Aquifers& localAquiferData)
{ {
globalCellData_ = {}; globalCellData_ = {};
globalBlockData_.clear(); globalBlockData_.clear();

View File

@@ -64,12 +64,12 @@ public:
const Dune::CartesianIndexMapper<EquilGrid>* equilCartMapper); const Dune::CartesianIndexMapper<EquilGrid>* equilCartMapper);
// gather solution to rank 0 for EclipseWriter // gather solution to rank 0 for EclipseWriter
void collect(const Opm::data::Solution& localCellData, void collect(const data::Solution& localCellData,
const std::map<std::pair<std::string, int>, double>& localBlockData, const std::map<std::pair<std::string, int>, double>& localBlockData,
const std::map<std::size_t, double>& localWBPData, const std::map<std::size_t, double>& localWBPData,
const Opm::data::Wells& localWellData, const data::Wells& localWellData,
const Opm::data::GroupAndNetworkValues& localGroupAndNetworkData, const data::GroupAndNetworkValues& localGroupAndNetworkData,
const Opm::data::Aquifers& localAquiferData); const data::Aquifers& localAquiferData);
const std::map<std::size_t, double>& globalWBPData() const const std::map<std::size_t, double>& globalWBPData() const
{ return this->globalWBPData_; } { return this->globalWBPData_; }
@@ -77,16 +77,16 @@ public:
const std::map<std::pair<std::string, int>, double>& globalBlockData() const const std::map<std::pair<std::string, int>, double>& globalBlockData() const
{ return globalBlockData_; } { return globalBlockData_; }
const Opm::data::Solution& globalCellData() const const data::Solution& globalCellData() const
{ return globalCellData_; } { return globalCellData_; }
const Opm::data::Wells& globalWellData() const const data::Wells& globalWellData() const
{ return globalWellData_; } { return globalWellData_; }
const Opm::data::GroupAndNetworkValues& globalGroupAndNetworkData() const const data::GroupAndNetworkValues& globalGroupAndNetworkData() const
{ return globalGroupAndNetworkData_; } { return globalGroupAndNetworkData_; }
const Opm::data::Aquifers& globalAquiferData() const const data::Aquifers& globalAquiferData() const
{ return globalAquiferData_; } { return globalAquiferData_; }
bool isIORank() const bool isIORank() const
@@ -111,12 +111,12 @@ protected:
IndexMapType localIndexMap_; IndexMapType localIndexMap_;
IndexMapStorageType indexMaps_; IndexMapStorageType indexMaps_;
std::vector<int> globalRanks_; std::vector<int> globalRanks_;
Opm::data::Solution globalCellData_; data::Solution globalCellData_;
std::map<std::pair<std::string, int>, double> globalBlockData_; std::map<std::pair<std::string, int>, double> globalBlockData_;
std::map<std::size_t, double> globalWBPData_; std::map<std::size_t, double> globalWBPData_;
Opm::data::Wells globalWellData_; data::Wells globalWellData_;
Opm::data::GroupAndNetworkValues globalGroupAndNetworkData_; data::GroupAndNetworkValues globalGroupAndNetworkData_;
Opm::data::Aquifers globalAquiferData_; data::Aquifers globalAquiferData_;
std::vector<int> localIdxToGlobalIdx_; std::vector<int> localIdxToGlobalIdx_;
/// \brief sorted list of cartesian indices present- /// \brief sorted list of cartesian indices present-
/// ///

View File

@@ -78,14 +78,13 @@ class EclEquilInitializer
public: public:
// NB: setting the enableEnergy argument to true enables storage of enthalpy and // NB: setting the enableEnergy argument to true enables storage of enthalpy and
// internal energy! // internal energy!
typedef Opm::BlackOilFluidState<Scalar, using ScalarFluidState = BlackOilFluidState<Scalar,
FluidSystem, FluidSystem,
enableTemperature, enableTemperature,
enableEnergy, enableEnergy,
Indices::gasEnabled, Indices::gasEnabled,
enableBrine, enableBrine,
Indices::numPhases Indices::numPhases>;
> ScalarFluidState;
template <class EclMaterialLawManager> template <class EclMaterialLawManager>

View File

@@ -93,7 +93,7 @@ class EclPeacemanWell : public BaseAuxiliaryModule<TypeTag>
using RateVector = GetPropType<TypeTag, Properties::RateVector>; using RateVector = GetPropType<TypeTag, Properties::RateVector>;
using GridView = GetPropType<TypeTag, Properties::GridView>; using GridView = GetPropType<TypeTag, Properties::GridView>;
typedef Opm::MathToolbox<Evaluation> Toolbox; typedef MathToolbox<Evaluation> Toolbox;
typedef typename GridView::template Codim<0>::Entity Element; typedef typename GridView::template Codim<0>::Entity Element;
typedef Element ElementStorage; typedef Element ElementStorage;
@@ -125,7 +125,7 @@ class EclPeacemanWell : public BaseAuxiliaryModule<TypeTag>
static constexpr bool enableEnergy = getPropValue<TypeTag, Properties::EnableEnergy>(); static constexpr bool enableEnergy = getPropValue<TypeTag, Properties::EnableEnergy>();
typedef Opm::CompositionalFluidState<Scalar, FluidSystem, /*storeEnthalpy=*/true> FluidState; typedef CompositionalFluidState<Scalar, FluidSystem, /*storeEnthalpy=*/true> FluidState;
typedef Dune::FieldMatrix<Scalar, dimWorld, dimWorld> DimMatrix; typedef Dune::FieldMatrix<Scalar, dimWorld, dimWorld> DimMatrix;
// all quantities that need to be stored per degree of freedom that intersects the // all quantities that need to be stored per degree of freedom that intersects the
@@ -329,7 +329,7 @@ public:
// make valgrind shut up about the DOFs for the well even if the PrimaryVariables // make valgrind shut up about the DOFs for the well even if the PrimaryVariables
// class contains some "holes" due to alignment // class contains some "holes" due to alignment
Opm::Valgrind::SetDefined(sol[wellGlobalDof]); Valgrind::SetDefined(sol[wellGlobalDof]);
// also apply the initial solution of the well to the "old" time steps // also apply the initial solution of the well to the "old" time steps
for (unsigned timeIdx = 1; timeIdx < historySize; ++timeIdx) { for (unsigned timeIdx = 1; timeIdx < historySize; ++timeIdx) {
@@ -468,10 +468,10 @@ public:
// rate for each component as its first conservation equation, but we require // rate for each component as its first conservation equation, but we require
// the black-oil model for now anyway, so this should not be too much of a // the black-oil model for now anyway, so this should not be too much of a
// problem... // problem...
Opm::Valgrind::CheckDefined(q); Valgrind::CheckDefined(q);
block = 0.0; block = 0.0;
for (unsigned eqIdx = 0; eqIdx < numModelEq; ++ eqIdx) for (unsigned eqIdx = 0; eqIdx < numModelEq; ++ eqIdx)
block[eqIdx][0] = - Opm::getValue(q[eqIdx])/dofVars.totalVolume; block[eqIdx][0] = - getValue(q[eqIdx])/dofVars.totalVolume;
matrix.setBlock(gridDofIdx, wellGlobalDofIdx, block); matrix.setBlock(gridDofIdx, wellGlobalDofIdx, block);
@@ -1220,7 +1220,7 @@ public:
q[conti0EqIdx + eqIdx] += modelRate[conti0EqIdx + eqIdx]; q[conti0EqIdx + eqIdx] += modelRate[conti0EqIdx + eqIdx];
} }
Opm::Valgrind::CheckDefined(q); Valgrind::CheckDefined(q);
} }
protected: protected:
@@ -1259,7 +1259,7 @@ protected:
const BhpEval& bottomHolePressure, const BhpEval& bottomHolePressure,
const DofVariables& dofVars) const const DofVariables& dofVars) const
{ {
typedef Opm::MathToolbox<Evaluation> DofVarsToolbox; typedef MathToolbox<Evaluation> DofVarsToolbox;
typedef typename std::conditional<std::is_same<BhpEval, Scalar>::value, typedef typename std::conditional<std::is_same<BhpEval, Scalar>::value,
ResultEval, ResultEval,
Scalar>::type DofEval; Scalar>::type DofEval;
@@ -1312,13 +1312,13 @@ protected:
else else
throw std::logic_error("Type of well \""+name()+"\" is undefined"); throw std::logic_error("Type of well \""+name()+"\" is undefined");
Opm::Valgrind::CheckDefined(pbh); Valgrind::CheckDefined(pbh);
Opm::Valgrind::CheckDefined(p); Valgrind::CheckDefined(p);
Opm::Valgrind::CheckDefined(g); Valgrind::CheckDefined(g);
Opm::Valgrind::CheckDefined(rho); Valgrind::CheckDefined(rho);
Opm::Valgrind::CheckDefined(lambda); Valgrind::CheckDefined(lambda);
Opm::Valgrind::CheckDefined(depth); Valgrind::CheckDefined(depth);
Opm::Valgrind::CheckDefined(refDepth_); Valgrind::CheckDefined(refDepth_);
// pressure in the borehole ("hole pressure") at the given location // pressure in the borehole ("hole pressure") at the given location
ResultEval ph = pbh + rho*g*(depth - refDepth_); ResultEval ph = pbh + rho*g*(depth - refDepth_);
@@ -1326,9 +1326,9 @@ protected:
// volumetric reservoir rate for the phase // volumetric reservoir rate for the phase
volRates[phaseIdx] = Twj*lambda*(ph - p); volRates[phaseIdx] = Twj*lambda*(ph - p);
Opm::Valgrind::CheckDefined(g); Valgrind::CheckDefined(g);
Opm::Valgrind::CheckDefined(ph); Valgrind::CheckDefined(ph);
Opm::Valgrind::CheckDefined(volRates[phaseIdx]); Valgrind::CheckDefined(volRates[phaseIdx]);
} }
} }
@@ -1577,7 +1577,7 @@ protected:
bool onBail = false; bool onBail = false;
// Newton-Raphson method // Newton-Raphson method
typedef Opm::DenseAd::Evaluation<Scalar, 1> BhpEval; typedef DenseAd::Evaluation<Scalar, 1> BhpEval;
BhpEval bhpEval(bhpScalar); BhpEval bhpEval(bhpScalar);
bhpEval.setDerivative(0, 1.0); bhpEval.setDerivative(0, 1.0);
@@ -1587,8 +1587,8 @@ protected:
const auto& f = wellResidual_<BhpEval>(bhpEval); const auto& f = wellResidual_<BhpEval>(bhpEval);
if (std::abs(f.derivative(0)) < 1e-20) if (std::abs(f.derivative(0)) < 1e-20)
throw Opm::NumericalIssue("Cannot determine the bottom hole pressure for well "+name() throw NumericalIssue("Cannot determine the bottom hole pressure for well "+name()
+": Derivative of the well residual is too small"); +": Derivative of the well residual is too small");
Scalar delta = f.value()/f.derivative(0); Scalar delta = f.value()/f.derivative(0);
bhpEval.setValue(bhpEval.value() - delta); bhpEval.setValue(bhpEval.value() - delta);
@@ -1606,8 +1606,8 @@ protected:
return bhpEval.value(); return bhpEval.value();
} }
throw Opm::NumericalIssue("Could not determine the bottom hole pressure of well '"+name() throw NumericalIssue("Could not determine the bottom hole pressure of well '"+name()
+"' within " + std::to_string(maxIter) + " iterations."); +"' within " + std::to_string(maxIter) + " iterations.");
} }
template <class BhpEval> template <class BhpEval>
@@ -1615,7 +1615,7 @@ protected:
const DofVariables *replacementDofVars = 0, const DofVariables *replacementDofVars = 0,
int replacedGridIdx = -1) const int replacedGridIdx = -1) const
{ {
typedef Opm::MathToolbox<BhpEval> BhpEvalToolbox; typedef MathToolbox<BhpEval> BhpEvalToolbox;
// compute the volumetric reservoir and surface rates for the complete well // compute the volumetric reservoir and surface rates for the complete well
BhpEval resvRate = 0.0; BhpEval resvRate = 0.0;
@@ -1652,10 +1652,10 @@ protected:
// injectors. (i.e., the target bottom hole pressure is an upper limit for // injectors. (i.e., the target bottom hole pressure is an upper limit for
// injectors and a lower limit for producers.) Note that with this approach, one // injectors and a lower limit for producers.) Note that with this approach, one
// of the limits must always be reached to get the well equation to zero... // of the limits must always be reached to get the well equation to zero...
Opm::Valgrind::CheckDefined(maximumSurfaceRate_); Valgrind::CheckDefined(maximumSurfaceRate_);
Opm::Valgrind::CheckDefined(maximumReservoirRate_); Valgrind::CheckDefined(maximumReservoirRate_);
Opm::Valgrind::CheckDefined(surfaceRate); Valgrind::CheckDefined(surfaceRate);
Opm::Valgrind::CheckDefined(resvRate); Valgrind::CheckDefined(resvRate);
BhpEval result = 1e30; BhpEval result = 1e30;
@@ -1701,7 +1701,7 @@ protected:
std::string name_; std::string name_;
std::vector<DofVariables, Opm::aligned_allocator<DofVariables, alignof(DofVariables)> > dofVarsStore_; std::vector<DofVariables, aligned_allocator<DofVariables, alignof(DofVariables)> > dofVarsStore_;
std::map<int, DofVariables*> dofVariables_; std::map<int, DofVariables*> dofVariables_;
// the number of times beginIteration*() was called for the current time step // the number of times beginIteration*() was called for the current time step

View File

@@ -84,9 +84,9 @@ class EclWellManager
typedef typename GridView::template Codim<0>::Entity Element; typedef typename GridView::template Codim<0>::Entity Element;
typedef Opm::EclPeacemanWell<TypeTag> Well; using Well = EclPeacemanWell<TypeTag>;
typedef std::map<int, std::pair<const Opm::Connection*, std::shared_ptr<Well> > > WellConnectionsMap; typedef std::map<int, std::pair<const Connection*, std::shared_ptr<Well> > > WellConnectionsMap;
typedef Dune::FieldVector<Evaluation, numEq> EvalEqVector; typedef Dune::FieldVector<Evaluation, numEq> EvalEqVector;
@@ -102,12 +102,12 @@ public:
*/ */
void init() void init()
{ {
const Opm::Schedule& deckSchedule = simulator_.vanguard().schedule(); const Schedule& deckSchedule = simulator_.vanguard().schedule();
const auto& summaryState = simulator_.vanguard().summaryState(); const auto& summaryState = simulator_.vanguard().summaryState();
// create the wells which intersect with the current process' grid // create the wells which intersect with the current process' grid
for (size_t deckWellIdx = 0; deckWellIdx < deckSchedule.numWells(); ++deckWellIdx) for (size_t deckWellIdx = 0; deckWellIdx < deckSchedule.numWells(); ++deckWellIdx)
{ {
const Opm::Well deckWell = deckSchedule.getWellsatEnd()[deckWellIdx]; const auto& deckWell = deckSchedule.getWellsatEnd()[deckWellIdx];
const std::string& wellName = deckWell.name(); const std::string& wellName = deckWell.name();
Scalar wellTemperature = 273.15 + 15.56; // [K] Scalar wellTemperature = 273.15 + 15.56; // [K]
if (deckWell.isInjector()) if (deckWell.isInjector())
@@ -132,8 +132,8 @@ public:
*/ */
void beginEpisode(bool wasRestarted=false) void beginEpisode(bool wasRestarted=false)
{ {
const Opm::EclipseState& eclState = simulator_.vanguard().eclState(); const EclipseState& eclState = simulator_.vanguard().eclState();
const Opm::Schedule& deckSchedule = simulator_.vanguard().schedule(); const Schedule& deckSchedule = simulator_.vanguard().schedule();
const auto& summaryState = simulator_.vanguard().summaryState(); const auto& summaryState = simulator_.vanguard().summaryState();
unsigned episodeIdx = simulator_.episodeIndex(); unsigned episodeIdx = simulator_.episodeIndex();
WellConnectionsMap wellCompMap; WellConnectionsMap wellCompMap;
@@ -146,7 +146,7 @@ public:
// linearized system of equations // linearized system of equations
updateWellParameters_(episodeIdx, wellCompMap); updateWellParameters_(episodeIdx, wellCompMap);
const std::vector<Opm::Well>& deckWells = deckSchedule.getWells(episodeIdx); const auto& deckWells = deckSchedule.getWells(episodeIdx);
// set the injection data for the respective wells. // set the injection data for the respective wells.
for (const auto& deckWell : deckWells) { for (const auto& deckWell : deckWells) {
if (!hasWell(deckWell.name())) if (!hasWell(deckWell.name()))
@@ -159,15 +159,15 @@ public:
auto deckWellStatus = deckWell.getStatus( ); auto deckWellStatus = deckWell.getStatus( );
switch (deckWellStatus) { switch (deckWellStatus) {
case Opm::Well::Status::AUTO: case ::Opm::Well::Status::AUTO:
// TODO: for now, auto means open... // TODO: for now, auto means open...
case Opm::Well::Status::OPEN: case ::Opm::Well::Status::OPEN:
well->setWellStatus(Well::Open); well->setWellStatus(Well::Open);
break; break;
case Opm::Well::Status::STOP: case ::Opm::Well::Status::STOP:
well->setWellStatus(Well::Closed); well->setWellStatus(Well::Closed);
break; break;
case Opm::Well::Status::SHUT: case ::Opm::Well::Status::SHUT:
well->setWellStatus(Well::Shut); well->setWellStatus(Well::Shut);
break; break;
} }
@@ -182,40 +182,41 @@ public:
well->setWellType(Well::Injector); well->setWellType(Well::Injector);
const auto controls = deckWell.injectionControls(summaryState); const auto controls = deckWell.injectionControls(summaryState);
switch (controls.injector_type) { switch (controls.injector_type) {
case Opm::InjectorType::WATER: case InjectorType::WATER:
well->setInjectedPhaseIndex(FluidSystem::waterPhaseIdx); well->setInjectedPhaseIndex(FluidSystem::waterPhaseIdx);
break; break;
case Opm::InjectorType::GAS: case InjectorType::GAS:
well->setInjectedPhaseIndex(FluidSystem::gasPhaseIdx); well->setInjectedPhaseIndex(FluidSystem::gasPhaseIdx);
break; break;
case Opm::InjectorType::OIL: case InjectorType::OIL:
well->setInjectedPhaseIndex(FluidSystem::oilPhaseIdx); well->setInjectedPhaseIndex(FluidSystem::oilPhaseIdx);
break; break;
case Opm::InjectorType::MULTI: case InjectorType::MULTI:
throw std::runtime_error("Not implemented: Multi-phase injector wells"); throw std::runtime_error("Not implemented: Multi-phase injector wells");
} }
using InjectorCMode = ::Opm::Well::InjectorCMode;
switch (controls.cmode) { switch (controls.cmode) {
case Opm::Well::InjectorCMode::RATE: case InjectorCMode::RATE:
well->setControlMode(Well::ControlMode::VolumetricSurfaceRate); well->setControlMode(Well::ControlMode::VolumetricSurfaceRate);
break; break;
case Opm::Well::InjectorCMode::RESV: case InjectorCMode::RESV:
well->setControlMode(Well::ControlMode::VolumetricReservoirRate); well->setControlMode(Well::ControlMode::VolumetricReservoirRate);
break; break;
case Opm::Well::InjectorCMode::BHP: case InjectorCMode::BHP:
well->setControlMode(Well::ControlMode::BottomHolePressure); well->setControlMode(Well::ControlMode::BottomHolePressure);
break; break;
case Opm::Well::InjectorCMode::THP: case InjectorCMode::THP:
well->setControlMode(Well::ControlMode::TubingHeadPressure); well->setControlMode(Well::ControlMode::TubingHeadPressure);
break; break;
case Opm::Well::InjectorCMode::GRUP: case InjectorCMode::GRUP:
throw std::runtime_error("Not implemented: Well groups"); throw std::runtime_error("Not implemented: Well groups");
case Opm::Well::InjectorCMode::CMODE_UNDEFINED: case InjectorCMode::CMODE_UNDEFINED:
std::cout << "Warning: Control mode of injection well " << well->name() std::cout << "Warning: Control mode of injection well " << well->name()
<< " is undefined. Assuming well to be shut.\n"; << " is undefined. Assuming well to be shut.\n";
well->setWellStatus(Well::WellStatus::Shut); well->setWellStatus(Well::WellStatus::Shut);
@@ -223,19 +224,19 @@ public:
} }
switch (controls.injector_type) { switch (controls.injector_type) {
case Opm::InjectorType::WATER: case InjectorType::WATER:
well->setVolumetricPhaseWeights(/*oil=*/0.0, /*gas=*/0.0, /*water=*/1.0); well->setVolumetricPhaseWeights(/*oil=*/0.0, /*gas=*/0.0, /*water=*/1.0);
break; break;
case Opm::InjectorType::OIL: case InjectorType::OIL:
well->setVolumetricPhaseWeights(/*oil=*/1.0, /*gas=*/0.0, /*water=*/0.0); well->setVolumetricPhaseWeights(/*oil=*/1.0, /*gas=*/0.0, /*water=*/0.0);
break; break;
case Opm::InjectorType::GAS: case InjectorType::GAS:
well->setVolumetricPhaseWeights(/*oil=*/0.0, /*gas=*/1.0, /*water=*/0.0); well->setVolumetricPhaseWeights(/*oil=*/0.0, /*gas=*/1.0, /*water=*/0.0);
break; break;
case Opm::InjectorType::MULTI: case InjectorType::MULTI:
throw std::runtime_error("Not implemented: Multi-phase injection wells"); throw std::runtime_error("Not implemented: Multi-phase injection wells");
} }
@@ -252,54 +253,55 @@ public:
well->setWellType(Well::Producer); well->setWellType(Well::Producer);
const auto controls = deckWell.productionControls(summaryState); const auto controls = deckWell.productionControls(summaryState);
using ProducerCMode = ::Opm::Well::ProducerCMode;
switch (controls.cmode) { switch (controls.cmode) {
case Opm::Well::ProducerCMode::ORAT: case ProducerCMode::ORAT:
well->setControlMode(Well::ControlMode::VolumetricSurfaceRate); well->setControlMode(Well::ControlMode::VolumetricSurfaceRate);
well->setVolumetricPhaseWeights(/*oil=*/1.0, /*gas=*/0.0, /*water=*/0.0); well->setVolumetricPhaseWeights(/*oil=*/1.0, /*gas=*/0.0, /*water=*/0.0);
well->setMaximumSurfaceRate(controls.oil_rate); well->setMaximumSurfaceRate(controls.oil_rate);
break; break;
case Opm::Well::ProducerCMode::GRAT: case ProducerCMode::GRAT:
well->setControlMode(Well::ControlMode::VolumetricSurfaceRate); well->setControlMode(Well::ControlMode::VolumetricSurfaceRate);
well->setVolumetricPhaseWeights(/*oil=*/0.0, /*gas=*/1.0, /*water=*/0.0); well->setVolumetricPhaseWeights(/*oil=*/0.0, /*gas=*/1.0, /*water=*/0.0);
well->setMaximumSurfaceRate(controls.gas_rate); well->setMaximumSurfaceRate(controls.gas_rate);
break; break;
case Opm::Well::ProducerCMode::WRAT: case ProducerCMode::WRAT:
well->setControlMode(Well::ControlMode::VolumetricSurfaceRate); well->setControlMode(Well::ControlMode::VolumetricSurfaceRate);
well->setVolumetricPhaseWeights(/*oil=*/0.0, /*gas=*/0.0, /*water=*/1.0); well->setVolumetricPhaseWeights(/*oil=*/0.0, /*gas=*/0.0, /*water=*/1.0);
well->setMaximumSurfaceRate(controls.water_rate); well->setMaximumSurfaceRate(controls.water_rate);
break; break;
case Opm::Well::ProducerCMode::LRAT: case ProducerCMode::LRAT:
well->setControlMode(Well::ControlMode::VolumetricSurfaceRate); well->setControlMode(Well::ControlMode::VolumetricSurfaceRate);
well->setVolumetricPhaseWeights(/*oil=*/1.0, /*gas=*/0.0, /*water=*/1.0); well->setVolumetricPhaseWeights(/*oil=*/1.0, /*gas=*/0.0, /*water=*/1.0);
well->setMaximumSurfaceRate(controls.liquid_rate); well->setMaximumSurfaceRate(controls.liquid_rate);
break; break;
case Opm::Well::ProducerCMode::CRAT: case ProducerCMode::CRAT:
throw std::runtime_error("Not implemented: Linearly combined rates"); throw std::runtime_error("Not implemented: Linearly combined rates");
case Opm::Well::ProducerCMode::RESV: case ProducerCMode::RESV:
well->setControlMode(Well::ControlMode::VolumetricReservoirRate); well->setControlMode(Well::ControlMode::VolumetricReservoirRate);
well->setVolumetricPhaseWeights(/*oil=*/1.0, /*gas=*/1.0, /*water=*/1.0); well->setVolumetricPhaseWeights(/*oil=*/1.0, /*gas=*/1.0, /*water=*/1.0);
well->setMaximumSurfaceRate(controls.resv_rate); well->setMaximumSurfaceRate(controls.resv_rate);
break; break;
case Opm::Well::ProducerCMode::BHP: case ProducerCMode::BHP:
well->setControlMode(Well::ControlMode::BottomHolePressure); well->setControlMode(Well::ControlMode::BottomHolePressure);
break; break;
case Opm::Well::ProducerCMode::THP: case ProducerCMode::THP:
well->setControlMode(Well::ControlMode::TubingHeadPressure); well->setControlMode(Well::ControlMode::TubingHeadPressure);
break; break;
case Opm::Well::ProducerCMode::GRUP: case ProducerCMode::GRUP:
throw std::runtime_error("Not implemented: Well groups"); throw std::runtime_error("Not implemented: Well groups");
case Opm::Well::ProducerCMode::NONE: case ProducerCMode::NONE:
// fall-through // fall-through
case Opm::Well::ProducerCMode::CMODE_UNDEFINED: case ProducerCMode::CMODE_UNDEFINED:
std::cout << "Warning: Control mode of production well " << well->name() std::cout << "Warning: Control mode of production well " << well->name()
<< " is undefined. Assuming well to be shut."; << " is undefined. Assuming well to be shut.";
well->setWellStatus(Well::WellStatus::Shut); well->setWellStatus(Well::WellStatus::Shut);
@@ -531,11 +533,11 @@ public:
} }
} }
Opm::data::Wells wellData() const data::Wells wellData() const
{ {
Opm::data::Wells wellDat; data::Wells wellDat;
using rt = Opm::data::Rates::opt; using rt = data::Rates::opt;
for (unsigned wellIdx = 0; wellIdx < numWells(); ++wellIdx) { for (unsigned wellIdx = 0; wellIdx < numWells(); ++wellIdx) {
const auto& ebosWell = well(wellIdx); const auto& ebosWell = well(wellIdx);
auto& wellOut = wellDat[ebosWell->name()]; auto& wellOut = wellDat[ebosWell->name()];
@@ -564,9 +566,9 @@ public:
return wellDat; return wellDat;
} }
Opm::data::GroupAndNetworkValues data::GroupAndNetworkValues
groupAndNetworkData(const int /* reportStepIdx */, groupAndNetworkData(const int /* reportStepIdx */,
const Opm::Schedule& /* sched */) const const Schedule& /* sched */) const
{ {
return {}; return {};
} }
@@ -601,8 +603,8 @@ public:
* "Something" can either be the well topology (i.e., which grid blocks are contained * "Something" can either be the well topology (i.e., which grid blocks are contained
* in which well) or it can be a well parameter like the bottom hole pressure... * in which well) or it can be a well parameter like the bottom hole pressure...
*/ */
bool wellsChanged(const Opm::EclipseState& eclState, bool wellsChanged(const EclipseState& eclState,
const Opm::Schedule& schedule, const Schedule& schedule,
unsigned reportStepIdx) const unsigned reportStepIdx) const
{ {
if (wellTopologyChanged_(eclState, reportStepIdx)) if (wellTopologyChanged_(eclState, reportStepIdx))
@@ -612,10 +614,10 @@ public:
// for the "until the universe dies" episode, the wells don't change // for the "until the universe dies" episode, the wells don't change
return false; return false;
const Opm::Events& events = schedule[reportStepIdx].events(); const Events& events = schedule[reportStepIdx].events();
return events.hasEvent(Opm::ScheduleEvents::PRODUCTION_UPDATE | return events.hasEvent(ScheduleEvents::PRODUCTION_UPDATE |
Opm::ScheduleEvents::INJECTION_UPDATE | ScheduleEvents::INJECTION_UPDATE |
Opm::ScheduleEvents::WELL_STATUS_CHANGE ); ScheduleEvents::WELL_STATUS_CHANGE );
} }
void initFromRestartFile(const RestartValue& restartValues OPM_UNUSED){ void initFromRestartFile(const RestartValue& restartValues OPM_UNUSED){
@@ -682,8 +684,8 @@ public:
protected: protected:
bool wellTopologyChanged_(const Opm::EclipseState& eclState OPM_UNUSED, bool wellTopologyChanged_(const EclipseState& eclState OPM_UNUSED,
const Opm::Schedule& schedule, const Schedule& schedule,
unsigned reportStepIdx) const unsigned reportStepIdx) const
{ {
if (reportStepIdx == 0) { if (reportStepIdx == 0) {
@@ -696,9 +698,9 @@ protected:
// for the "until the universe dies" episode, the wells don't change // for the "until the universe dies" episode, the wells don't change
return false; return false;
const Opm::Events& events = schedule[reportStepIdx].events(); const Events& events = schedule[reportStepIdx].events();
return events.hasEvent(Opm::ScheduleEvents::NEW_WELL | return events.hasEvent(ScheduleEvents::NEW_WELL |
Opm::ScheduleEvents::COMPLETION_CHANGE); ScheduleEvents::COMPLETION_CHANGE);
} }
void updateWellTopology_(unsigned reportStepIdx OPM_UNUSED, void updateWellTopology_(unsigned reportStepIdx OPM_UNUSED,
@@ -856,7 +858,7 @@ protected:
continue; continue;
const auto& connInfo = wellConnections.at(cartesianDofIdx); const auto& connInfo = wellConnections.at(cartesianDofIdx);
const Opm::Connection* connection = connInfo.first; const Connection* connection = connInfo.first;
std::shared_ptr<Well> eclWell = connInfo.second; std::shared_ptr<Well> eclWell = connInfo.second;
eclWell->addDof(elemCtx, dofIdx); eclWell->addDof(elemCtx, dofIdx);
eclWell->setConnectionTransmissibilityFactor(elemCtx, dofIdx, connection->CF()); eclWell->setConnectionTransmissibilityFactor(elemCtx, dofIdx, connection->CF());

View File

@@ -91,21 +91,21 @@ namespace Opm {
namespace EQUIL { namespace EQUIL {
typedef Opm::BlackOilFluidSystem<double> FluidSystemSimple; using FluidSystemSimple = BlackOilFluidSystem<double>;
// Adjust oil pressure according to gas saturation and cap pressure // Adjust oil pressure according to gas saturation and cap pressure
typedef Opm::SimpleModularFluidState<double, using SatOnlyFluidState = SimpleModularFluidState<double,
/*numPhases=*/3, /*numPhases=*/3,
/*numComponents=*/3, /*numComponents=*/3,
FluidSystemSimple, FluidSystemSimple,
/*storePressure=*/false, /*storePressure=*/false,
/*storeTemperature=*/false, /*storeTemperature=*/false,
/*storeComposition=*/false, /*storeComposition=*/false,
/*storeFugacity=*/false, /*storeFugacity=*/false,
/*storeSaturation=*/true, /*storeSaturation=*/true,
/*storeDensity=*/false, /*storeDensity=*/false,
/*storeViscosity=*/false, /*storeViscosity=*/false,
/*storeEnthalpy=*/false> SatOnlyFluidState; /*storeEnthalpy=*/false>;
/** /**
* Types and routines relating to phase mixing in * Types and routines relating to phase mixing in
@@ -236,7 +236,7 @@ public:
} }
private: private:
typedef Opm::Tabulated1DFunction<double> RsVsDepthFunc; using RsVsDepthFunc = Tabulated1DFunction<double>;
const int pvtRegionIdx_; const int pvtRegionIdx_;
RsVsDepthFunc rsVsDepth_; RsVsDepthFunc rsVsDepth_;
@@ -304,7 +304,7 @@ public:
} }
private: private:
typedef Opm::Tabulated1DFunction<double> PbubVsDepthFunc; using PbubVsDepthFunc = Tabulated1DFunction<double>;
const int pvtRegionIdx_; const int pvtRegionIdx_;
PbubVsDepthFunc pbubVsDepth_; PbubVsDepthFunc pbubVsDepth_;
@@ -372,7 +372,7 @@ public:
} }
private: private:
typedef Opm::Tabulated1DFunction<double> PdewVsDepthFunc; using PdewVsDepthFunc = Tabulated1DFunction<double>;
const int pvtRegionIdx_; const int pvtRegionIdx_;
PdewVsDepthFunc pdewVsDepth_; PdewVsDepthFunc pdewVsDepth_;
@@ -440,7 +440,7 @@ public:
} }
private: private:
typedef Opm::Tabulated1DFunction<double> RvVsDepthFunc; using RvVsDepthFunc = Tabulated1DFunction<double>;
const int pvtRegionIdx_; const int pvtRegionIdx_;
RvVsDepthFunc rvVsDepth_; RvVsDepthFunc rvVsDepth_;
@@ -614,7 +614,7 @@ private:
*/ */
class EquilReg class EquilReg
{ {
using TabulatedFunction = Opm::Tabulated1DFunction<double>; using TabulatedFunction = Tabulated1DFunction<double>;
public: public:
/** /**
@@ -625,7 +625,7 @@ public:
* \param[in] rv Calculator of vapourised oil-gas ratio. * \param[in] rv Calculator of vapourised oil-gas ratio.
* \param[in] pvtRegionIdx The pvt region index * \param[in] pvtRegionIdx The pvt region index
*/ */
EquilReg(const Opm::EquilRecord& rec, EquilReg(const EquilRecord& rec,
std::shared_ptr<Miscibility::RsFunction> rs, std::shared_ptr<Miscibility::RsFunction> rs,
std::shared_ptr<Miscibility::RsFunction> rv, std::shared_ptr<Miscibility::RsFunction> rv,
const TabulatedFunction& saltVdTable, const TabulatedFunction& saltVdTable,
@@ -715,7 +715,7 @@ public:
int pvtIdx() const { return this->pvtIdx_; } int pvtIdx() const { return this->pvtIdx_; }
private: private:
Opm::EquilRecord rec_; /**< Equilibration data */ EquilRecord rec_; /**< Equilibration data */
std::shared_ptr<Miscibility::RsFunction> rs_; /**< RS calculator */ std::shared_ptr<Miscibility::RsFunction> rs_; /**< RS calculator */
std::shared_ptr<Miscibility::RsFunction> rv_; /**< RV calculator */ std::shared_ptr<Miscibility::RsFunction> rv_; /**< RV calculator */
const TabulatedFunction& saltVdTable_; const TabulatedFunction& saltVdTable_;

View File

@@ -150,7 +150,7 @@ namespace PhasePressODE {
template <class FluidSystem> template <class FluidSystem>
class Water class Water
{ {
using TabulatedFunction = Opm::Tabulated1DFunction<double>; using TabulatedFunction = Tabulated1DFunction<double>;
public: public:
Water(const double temp, Water(const double temp,
const TabulatedFunction& saltVdTable, const TabulatedFunction& saltVdTable,
@@ -1532,8 +1532,8 @@ std::pair<double,double> cellZMinMax(const Element& element)
} // namespace Details } // namespace Details
namespace DeckDependent { namespace DeckDependent {
inline std::vector<Opm::EquilRecord> inline std::vector<EquilRecord>
getEquil(const Opm::EclipseState& state) getEquil(const EclipseState& state)
{ {
const auto& init = state.getInitConfig(); const auto& init = state.getInitConfig();
@@ -1547,7 +1547,7 @@ getEquil(const Opm::EclipseState& state)
template<class GridView> template<class GridView>
std::vector<int> std::vector<int>
equilnum(const Opm::EclipseState& eclipseState, equilnum(const EclipseState& eclipseState,
const GridView& gridview) const GridView& gridview)
{ {
std::vector<int> eqlnum(gridview.size(0), 0); std::vector<int> eqlnum(gridview.size(0), 0);
@@ -1573,10 +1573,10 @@ class InitialStateComputer
public: public:
template<class MaterialLawManager> template<class MaterialLawManager>
InitialStateComputer(MaterialLawManager& materialLawManager, InitialStateComputer(MaterialLawManager& materialLawManager,
const Opm::EclipseState& eclipseState, const EclipseState& eclipseState,
const GridView& gridView, const GridView& gridView,
const CartesianIndexMapper& cartMapper, const CartesianIndexMapper& cartMapper,
const double grav = Opm::unit::gravity, const double grav = unit::gravity,
const bool applySwatInit = true) const bool applySwatInit = true)
: temperature_(gridView.size(/*codim=*/0)), : temperature_(gridView.size(/*codim=*/0)),
saltConcentration_(gridView.size(/*codim=*/0)), saltConcentration_(gridView.size(/*codim=*/0)),
@@ -1601,10 +1601,10 @@ public:
updateCellProps_(gridView, num_aquifers); updateCellProps_(gridView, num_aquifers);
// Get the equilibration records. // Get the equilibration records.
const std::vector<Opm::EquilRecord> rec = getEquil(eclipseState); const std::vector<EquilRecord> rec = getEquil(eclipseState);
const auto& tables = eclipseState.getTableManager(); const auto& tables = eclipseState.getTableManager();
// Create (inverse) region mapping. // Create (inverse) region mapping.
const Opm::RegionMapping<> eqlmap(equilnum(eclipseState, gridView)); const RegionMapping<> eqlmap(equilnum(eclipseState, gridView));
const int invalidRegion = -1; const int invalidRegion = -1;
regionPvtIdx_.resize(rec.size(), invalidRegion); regionPvtIdx_.resize(rec.size(), invalidRegion);
setRegionPvtIdx(eclipseState, eqlmap); setRegionPvtIdx(eclipseState, eqlmap);
@@ -1619,17 +1619,17 @@ public:
} }
const int pvtIdx = regionPvtIdx_[i]; const int pvtIdx = regionPvtIdx_[i];
if (!rec[i].liveOilInitConstantRs()) { if (!rec[i].liveOilInitConstantRs()) {
const Opm::TableContainer& rsvdTables = tables.getRsvdTables(); const TableContainer& rsvdTables = tables.getRsvdTables();
const Opm::TableContainer& pbvdTables = tables.getPbvdTables(); const TableContainer& pbvdTables = tables.getPbvdTables();
if (rsvdTables.size() > 0) { if (rsvdTables.size() > 0) {
const Opm::RsvdTable& rsvdTable = rsvdTables.getTable<Opm::RsvdTable>(i); const RsvdTable& rsvdTable = rsvdTables.getTable<RsvdTable>(i);
std::vector<double> depthColumn = rsvdTable.getColumn("DEPTH").vectorCopy(); std::vector<double> depthColumn = rsvdTable.getColumn("DEPTH").vectorCopy();
std::vector<double> rsColumn = rsvdTable.getColumn("RS").vectorCopy(); std::vector<double> rsColumn = rsvdTable.getColumn("RS").vectorCopy();
rsFunc_.push_back(std::make_shared<Miscibility::RsVD<FluidSystem>>(pvtIdx, rsFunc_.push_back(std::make_shared<Miscibility::RsVD<FluidSystem>>(pvtIdx,
depthColumn, rsColumn)); depthColumn, rsColumn));
} else if (pbvdTables.size() > 0) { } else if (pbvdTables.size() > 0) {
const Opm::PbvdTable& pbvdTable = pbvdTables.getTable<Opm::PbvdTable>(i); const PbvdTable& pbvdTable = pbvdTables.getTable<PbvdTable>(i);
std::vector<double> depthColumn = pbvdTable.getColumn("DEPTH").vectorCopy(); std::vector<double> depthColumn = pbvdTable.getColumn("DEPTH").vectorCopy();
std::vector<double> pbubColumn = pbvdTable.getColumn("PBUB").vectorCopy(); std::vector<double> pbubColumn = pbvdTable.getColumn("PBUB").vectorCopy();
rsFunc_.push_back(std::make_shared<Miscibility::PBVD<FluidSystem>>(pvtIdx, rsFunc_.push_back(std::make_shared<Miscibility::PBVD<FluidSystem>>(pvtIdx,
@@ -1667,17 +1667,17 @@ public:
} }
const int pvtIdx = regionPvtIdx_[i]; const int pvtIdx = regionPvtIdx_[i];
if (!rec[i].wetGasInitConstantRv()) { if (!rec[i].wetGasInitConstantRv()) {
const Opm::TableContainer& rvvdTables = tables.getRvvdTables(); const TableContainer& rvvdTables = tables.getRvvdTables();
const Opm::TableContainer& pdvdTables = tables.getPdvdTables(); const TableContainer& pdvdTables = tables.getPdvdTables();
if (rvvdTables.size() > 0) { if (rvvdTables.size() > 0) {
const Opm::RvvdTable& rvvdTable = rvvdTables.getTable<Opm::RvvdTable>(i); const RvvdTable& rvvdTable = rvvdTables.getTable<RvvdTable>(i);
std::vector<double> depthColumn = rvvdTable.getColumn("DEPTH").vectorCopy(); std::vector<double> depthColumn = rvvdTable.getColumn("DEPTH").vectorCopy();
std::vector<double> rvColumn = rvvdTable.getColumn("RV").vectorCopy(); std::vector<double> rvColumn = rvvdTable.getColumn("RV").vectorCopy();
rvFunc_.push_back(std::make_shared<Miscibility::RvVD<FluidSystem>>(pvtIdx, rvFunc_.push_back(std::make_shared<Miscibility::RvVD<FluidSystem>>(pvtIdx,
depthColumn, rvColumn)); depthColumn, rvColumn));
} else if (pdvdTables.size() > 0) { } else if (pdvdTables.size() > 0) {
const Opm::PdvdTable& pdvdTable = pdvdTables.getTable<Opm::PdvdTable>(i); const PdvdTable& pdvdTable = pdvdTables.getTable<PdvdTable>(i);
std::vector<double> depthColumn = pdvdTable.getColumn("DEPTH").vectorCopy(); std::vector<double> depthColumn = pdvdTable.getColumn("DEPTH").vectorCopy();
std::vector<double> pdewColumn = pdvdTable.getColumn("PDEW").vectorCopy(); std::vector<double> pdewColumn = pdvdTable.getColumn("PDEW").vectorCopy();
rvFunc_.push_back(std::make_shared<Miscibility::PDVD<FluidSystem>>(pvtIdx, rvFunc_.push_back(std::make_shared<Miscibility::PDVD<FluidSystem>>(pvtIdx,
@@ -1734,18 +1734,18 @@ public:
private: private:
void updateInitialTemperature_(const Opm::EclipseState& eclState) void updateInitialTemperature_(const EclipseState& eclState)
{ {
this->temperature_ = eclState.fieldProps().get_double("TEMPI"); this->temperature_ = eclState.fieldProps().get_double("TEMPI");
} }
template <class RMap> template <class RMap>
void updateInitialSaltConcentration_(const Opm::EclipseState& eclState, const RMap& reg) void updateInitialSaltConcentration_(const EclipseState& eclState, const RMap& reg)
{ {
const int numEquilReg = rsFunc_.size(); const int numEquilReg = rsFunc_.size();
saltVdTable_.resize(numEquilReg); saltVdTable_.resize(numEquilReg);
const auto& tables = eclState.getTableManager(); const auto& tables = eclState.getTableManager();
const Opm::TableContainer& saltvdTables = tables.getSaltvdTables(); const TableContainer& saltvdTables = tables.getSaltvdTables();
// If no saltvd table is given, we create a trivial table for the density calculations // If no saltvd table is given, we create a trivial table for the density calculations
if (saltvdTables.empty()) { if (saltvdTables.empty()) {
@@ -1756,7 +1756,7 @@ private:
} }
} else { } else {
for (size_t i = 0; i < saltvdTables.size(); ++i) { for (size_t i = 0; i < saltvdTables.size(); ++i) {
const Opm::SaltvdTable& saltvdTable = saltvdTables.getTable<Opm::SaltvdTable>(i); const SaltvdTable& saltvdTable = saltvdTables.getTable<SaltvdTable>(i);
saltVdTable_[i].setXYContainers(saltvdTable.getDepthColumn(), saltvdTable.getSaltColumn()); saltVdTable_[i].setXYContainers(saltvdTable.getDepthColumn(), saltvdTable.getSaltColumn());
const auto& cells = reg.cells(i); const auto& cells = reg.cells(i);
@@ -1770,7 +1770,7 @@ private:
std::vector< std::shared_ptr<Miscibility::RsFunction> > rsFunc_; std::vector< std::shared_ptr<Miscibility::RsFunction> > rsFunc_;
std::vector< std::shared_ptr<Miscibility::RsFunction> > rvFunc_; std::vector< std::shared_ptr<Miscibility::RsFunction> > rvFunc_;
using TabulatedFunction = Opm::Tabulated1DFunction<double>; using TabulatedFunction = Tabulated1DFunction<double>;
std::vector<TabulatedFunction> saltVdTable_; std::vector<TabulatedFunction> saltVdTable_;
std::vector<int> regionPvtIdx_; std::vector<int> regionPvtIdx_;
Vec temperature_; Vec temperature_;
@@ -1868,7 +1868,7 @@ private:
} }
} }
template<class RMap> template<class RMap>
void setRegionPvtIdx(const Opm::EclipseState& eclState, const RMap& reg) void setRegionPvtIdx(const EclipseState& eclState, const RMap& reg)
{ {
const auto& pvtnumData = eclState.fieldProps().get_int("PVTNUM"); const auto& pvtnumData = eclState.fieldProps().get_int("PVTNUM");
@@ -1880,7 +1880,7 @@ private:
template <class RMap, class MaterialLawManager, class Comm> template <class RMap, class MaterialLawManager, class Comm>
void calcPressSatRsRv(const RMap& reg, void calcPressSatRsRv(const RMap& reg,
const std::vector<Opm::EquilRecord>& rec, const std::vector<EquilRecord>& rec,
MaterialLawManager& materialLawManager, MaterialLawManager& materialLawManager,
const Comm& comm, const Comm& comm,
const double grav) const double grav)
@@ -1942,8 +1942,8 @@ private:
if (comm.rank() == 0) { if (comm.rank() == 0) {
for (size_t r = 0; r < rec.size(); ++r) { for (size_t r = 0; r < rec.size(); ++r) {
if (regionIsEmpty[r]) //region is empty on all partitions if (regionIsEmpty[r]) //region is empty on all partitions
Opm::OpmLog::warning("Equilibration region " + std::to_string(r + 1) OpmLog::warning("Equilibration region " + std::to_string(r + 1)
+ " has no active cells"); + " has no active cells");
} }
} }
} }

View File

@@ -46,7 +46,7 @@ namespace detail {
std::vector<bool> std::vector<bool>
activePhases(const PU& pu) activePhases(const PU& pu)
{ {
const int maxnp = Opm::BlackoilPhases::MaxNumPhases; const int maxnp = BlackoilPhases::MaxNumPhases;
std::vector<bool> active(maxnp, false); std::vector<bool> active(maxnp, false);
for (int p = 0; p < pu.MaxNumPhases; ++p) { for (int p = 0; p < pu.MaxNumPhases; ++p) {
@@ -62,7 +62,7 @@ namespace detail {
std::vector<int> std::vector<int>
active2Canonical(const PU& pu) active2Canonical(const PU& pu)
{ {
const int maxnp = Opm::BlackoilPhases::MaxNumPhases; const int maxnp = BlackoilPhases::MaxNumPhases;
std::vector<int> act2can(maxnp, -1); std::vector<int> act2can(maxnp, -1);
for (int phase = 0; phase < maxnp; ++phase) { for (int phase = 0; phase < maxnp; ++phase) {
@@ -110,7 +110,7 @@ namespace detail {
auto component_container = auto component_container =
boost::make_iterator_range(it, end); boost::make_iterator_range(it, end);
info.computeReduction(component_container, info.computeReduction(component_container,
Opm::Reduction::makeInnerProductFunctor<double>(), Reduction::makeInnerProductFunctor<double>(),
product); product);
} }
else else

View File

@@ -88,7 +88,7 @@ enum ExcEnum {
private: private:
std::vector<Message> messages_; std::vector<Message> messages_;
friend Opm::DeferredLogger gatherDeferredLogger(const Opm::DeferredLogger& local_deferredlogger); friend DeferredLogger gatherDeferredLogger(const DeferredLogger& local_deferredlogger);
}; };
} // namespace Opm } // namespace Opm

View File

@@ -91,9 +91,9 @@ namespace Opm
using Base::has_brine; using Base::has_brine;
using Base::has_energy; using Base::has_energy;
using PolymerModule = Opm::BlackOilPolymerModule<TypeTag>; using PolymerModule = BlackOilPolymerModule<TypeTag>;
using FoamModule = Opm::BlackOilFoamModule<TypeTag>; using FoamModule = BlackOilFoamModule<TypeTag>;
using BrineModule = Opm::BlackOilBrineModule<TypeTag>; using BrineModule = BlackOilBrineModule<TypeTag>;
static const int numSolventEq = Indices::numSolvents; static const int numSolventEq = Indices::numSolvents;
@@ -183,12 +183,12 @@ namespace Opm
void updateWellStateWithTarget(const Simulator& ebos_simulator, void updateWellStateWithTarget(const Simulator& ebos_simulator,
WellState& well_state, WellState& well_state,
Opm::DeferredLogger& deferred_logger) const; DeferredLogger& deferred_logger) const;
/// check whether the well equations get converged for this well /// check whether the well equations get converged for this well
virtual ConvergenceReport getWellConvergence(const WellState& well_state, virtual ConvergenceReport getWellConvergence(const WellState& well_state,
const std::vector<double>& B_avg, const std::vector<double>& B_avg,
Opm::DeferredLogger& deferred_logger, DeferredLogger& deferred_logger,
const bool relax_tolerance = false) const override; const bool relax_tolerance = false) const override;
/// Ax = Ax - C D^-1 B x /// Ax = Ax - C D^-1 B x
@@ -208,21 +208,21 @@ namespace Opm
/// xw to update Well State /// xw to update Well State
virtual void recoverWellSolutionAndUpdateWellState(const BVector& x, virtual void recoverWellSolutionAndUpdateWellState(const BVector& x,
WellState& well_state, WellState& well_state,
Opm::DeferredLogger& deferred_logger) const override; DeferredLogger& deferred_logger) const override;
/// computing the well potentials for group control /// computing the well potentials for group control
virtual void computeWellPotentials(const Simulator& ebosSimulator, virtual void computeWellPotentials(const Simulator& ebosSimulator,
const WellState& well_state, const WellState& well_state,
std::vector<double>& well_potentials, std::vector<double>& well_potentials,
Opm::DeferredLogger& deferred_logger) /* const */ override; DeferredLogger& deferred_logger) /* const */ 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; virtual void solveEqAndUpdateWellState(WellState& well_state, DeferredLogger& deferred_logger) override;
virtual void calculateExplicitQuantities(const Simulator& ebosSimulator, virtual void calculateExplicitQuantities(const Simulator& ebosSimulator,
const WellState& well_state, 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, virtual void updateProductivityIndex(const Simulator& ebosSimulator,
const WellProdIndexCalculator& wellPICalc, const WellProdIndexCalculator& wellPICalc,
@@ -238,7 +238,7 @@ namespace Opm
const Well::ProductionControls& prod_controls, const Well::ProductionControls& prod_controls,
WellState& well_state, WellState& well_state,
const GroupState& group_state, const GroupState& group_state,
Opm::DeferredLogger& deferred_logger) override; DeferredLogger& deferred_logger) override;
/// \brief Wether the Jacobian will also have well contributions in it. /// \brief Wether the Jacobian will also have well contributions in it.
virtual bool jacobianContainsWellContributions() const override virtual bool jacobianContainsWellContributions() const override
@@ -268,7 +268,7 @@ namespace Opm
void gliftDebug( void gliftDebug(
const std::string &msg, const std::string &msg,
Opm::DeferredLogger& deferred_logger) const; DeferredLogger& deferred_logger) const;
void gasLiftOptimizeProduction( void gasLiftOptimizeProduction(
const Simulator& ebosSimulator, const Simulator& ebosSimulator,
@@ -303,7 +303,7 @@ namespace Opm
const Simulator& ebosSimulator, const Simulator& ebosSimulator,
const double& bhp, const double& bhp,
std::vector<double>& well_flux, std::vector<double>& well_flux,
Opm::DeferredLogger& deferred_logger) const; DeferredLogger& deferred_logger) const;
// NOTE: These cannot be protected since they are used by GasLiftRuntime // NOTE: These cannot be protected since they are used by GasLiftRuntime
using Base::phaseUsage; using Base::phaseUsage;
@@ -435,7 +435,7 @@ namespace Opm
// updating the well_state based on well solution dwells // updating the well_state based on well solution dwells
void updateWellState(const BVectorWell& dwells, void updateWellState(const BVectorWell& dwells,
WellState& well_state, WellState& well_state,
Opm::DeferredLogger& deferred_logger) const; DeferredLogger& deferred_logger) const;
// calculate the properties for the well connections // calculate the properties for the well connections
// to calulate the pressure difference between well connections. // to calulate the pressure difference between well connections.
@@ -478,20 +478,20 @@ namespace Opm
std::vector<EvalWell>& cq_s, std::vector<EvalWell>& cq_s,
double& perf_dis_gas_rate, double& perf_dis_gas_rate,
double& perf_vap_oil_rate, double& perf_vap_oil_rate,
Opm::DeferredLogger& deferred_logger) const; DeferredLogger& deferred_logger) const;
void computeWellRatesWithBhpPotential(const Simulator& ebosSimulator, void computeWellRatesWithBhpPotential(const Simulator& ebosSimulator,
const double& bhp, const double& bhp,
std::vector<double>& well_flux, std::vector<double>& well_flux,
Opm::DeferredLogger& deferred_logger); DeferredLogger& deferred_logger);
std::vector<double> computeWellPotentialWithTHP( std::vector<double> computeWellPotentialWithTHP(
const Simulator& ebosSimulator, const Simulator& ebosSimulator,
Opm::DeferredLogger& deferred_logger, DeferredLogger& deferred_logger,
const WellState &well_state) const; const WellState &well_state) const;
double calculateThpFromBhp(const WellState &well_state, const std::vector<double>& rates, const double bhp, Opm::DeferredLogger& deferred_logger) const; double calculateThpFromBhp(const WellState &well_state, const std::vector<double>& rates, const double bhp, DeferredLogger& deferred_logger) const;
virtual double getRefDensity() const override; virtual double getRefDensity() const override;
@@ -499,12 +499,12 @@ namespace Opm
void getMobility(const Simulator& ebosSimulator, void getMobility(const Simulator& ebosSimulator,
const int perf, const int perf,
std::vector<EvalWell>& mob, std::vector<EvalWell>& mob,
Opm::DeferredLogger& deferred_logger) const; DeferredLogger& deferred_logger) const;
void updateWaterMobilityWithPolymer(const Simulator& ebos_simulator, void updateWaterMobilityWithPolymer(const Simulator& ebos_simulator,
const int perf, const int perf,
std::vector<EvalWell>& mob_water, std::vector<EvalWell>& mob_water,
Opm::DeferredLogger& deferred_logger) const; DeferredLogger& deferred_logger) const;
void updatePrimaryVariablesNewton(const BVectorWell& dwells, void updatePrimaryVariablesNewton(const BVectorWell& dwells,
const WellState& well_state) const; const WellState& well_state) const;
@@ -513,16 +513,16 @@ namespace Opm
void updateExtraPrimaryVariables(const BVectorWell& dwells) const; void updateExtraPrimaryVariables(const BVectorWell& dwells) const;
void updateWellStateFromPrimaryVariables(WellState& well_state, Opm::DeferredLogger& deferred_logger) const; void updateWellStateFromPrimaryVariables(WellState& well_state, DeferredLogger& deferred_logger) const;
void updateThp(WellState& well_state, Opm::DeferredLogger& deferred_logger) const; void updateThp(WellState& well_state, DeferredLogger& deferred_logger) const;
void assembleControlEq(const WellState& well_state, void assembleControlEq(const WellState& well_state,
const GroupState& group_state, const GroupState& group_state,
const Opm::Schedule& schedule, const Schedule& schedule,
const SummaryState& summaryState, const SummaryState& summaryState,
Opm::DeferredLogger& deferred_logger); DeferredLogger& deferred_logger);
// handle the non reasonable fractions due to numerical overshoot // handle the non reasonable fractions due to numerical overshoot
void processFractions() const; void processFractions() const;
@@ -534,13 +534,13 @@ namespace Opm
const Well::ProductionControls& prod_controls, const Well::ProductionControls& prod_controls,
WellState& well_state, WellState& well_state,
const GroupState& group_state, const GroupState& group_state,
Opm::DeferredLogger& deferred_logger) override; DeferredLogger& deferred_logger) override;
void assembleWellEqWithoutIterationImpl(const Simulator& ebosSimulator, void assembleWellEqWithoutIterationImpl(const Simulator& ebosSimulator,
const double dt, const double dt,
WellState& well_state, WellState& well_state,
const GroupState& group_state, const GroupState& group_state,
Opm::DeferredLogger& deferred_logger); DeferredLogger& deferred_logger);
void calculateSinglePerf(const Simulator& ebosSimulator, void calculateSinglePerf(const Simulator& ebosSimulator,
const int perf, const int perf,
@@ -549,16 +549,16 @@ namespace Opm
std::vector<EvalWell>& cq_s, std::vector<EvalWell>& cq_s,
EvalWell& water_flux_s, EvalWell& water_flux_s,
EvalWell& cq_s_zfrac_effective, EvalWell& cq_s_zfrac_effective,
Opm::DeferredLogger& deferred_logger) const; DeferredLogger& deferred_logger) const;
// check whether the well is operable under BHP limit with current reservoir condition // 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 // 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 // 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;
// for a well, when all drawdown are in the wrong direction, then this well will not // for a well, when all drawdown are in the wrong direction, then this well will not
// be able to produce/inject . // be able to produce/inject .
@@ -567,7 +567,7 @@ namespace Opm
// whether the well can produce / inject based on the current well state (bhp) // whether the well can produce / inject based on the current well state (bhp)
bool canProduceInjectWithCurrentBhp(const Simulator& ebos_simulator, bool canProduceInjectWithCurrentBhp(const Simulator& ebos_simulator,
const WellState& well_state, const WellState& well_state,
Opm::DeferredLogger& deferred_logger); DeferredLogger& deferred_logger);
// turn on crossflow to avoid singular well equations // turn on crossflow to avoid singular well equations
// when the well is banned from cross-flow and the BHP is not properly initialized, // when the well is banned from cross-flow and the BHP is not properly initialized,
@@ -596,17 +596,17 @@ namespace Opm
EvalWell pskin(const double throuhgput, EvalWell pskin(const double throuhgput,
const EvalWell& water_velocity, const EvalWell& water_velocity,
const EvalWell& poly_inj_conc, const EvalWell& poly_inj_conc,
Opm::DeferredLogger& deferred_logger) const; DeferredLogger& deferred_logger) const;
// calculate the skin pressure based on water velocity, throughput during water injection. // calculate the skin pressure based on water velocity, throughput during water injection.
EvalWell pskinwater(const double throughput, EvalWell pskinwater(const double throughput,
const EvalWell& water_velocity, const EvalWell& water_velocity,
Opm::DeferredLogger& deferred_logger) const; DeferredLogger& deferred_logger) const;
// calculate the injecting polymer molecular weight based on the througput and water velocity // calculate the injecting polymer molecular weight based on the througput and water velocity
EvalWell wpolymermw(const double throughput, EvalWell wpolymermw(const double throughput,
const EvalWell& water_velocity, const EvalWell& water_velocity,
Opm::DeferredLogger& deferred_logger) const; DeferredLogger& deferred_logger) const;
// modify the water rate for polymer injectivity study // modify the water rate for polymer injectivity study
void handleInjectivityRate(const Simulator& ebosSimulator, void handleInjectivityRate(const Simulator& ebosSimulator,
@@ -618,7 +618,7 @@ namespace Opm
const WellState& well_state, const WellState& well_state,
const int perf, const int perf,
const EvalWell& water_flux_s, const EvalWell& water_flux_s,
Opm::DeferredLogger& deferred_logger); DeferredLogger& deferred_logger);
virtual void updateWaterThroughput(const double dt, WellState& well_state) const override; virtual void updateWaterThroughput(const double dt, WellState& well_state) const override;

View File

@@ -376,7 +376,7 @@ namespace Opm
std::vector<EvalWell>& cq_s, std::vector<EvalWell>& cq_s,
double& perf_dis_gas_rate, double& perf_dis_gas_rate,
double& perf_vap_oil_rate, double& perf_vap_oil_rate,
Opm::DeferredLogger& deferred_logger) const DeferredLogger& deferred_logger) const
{ {
const auto& fs = intQuants.fluidState(); const auto& fs = intQuants.fluidState();
@@ -486,7 +486,7 @@ namespace Opm
const EvalWell d = EvalWell(numWellEq_ + numEq, 1.0) - rv * rs; const EvalWell d = EvalWell(numWellEq_ + numEq, 1.0) - rv * rs;
if (d.value() == 0.0) { 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); << " with rs " << rs << " and rv " << rv, deferred_logger);
} }
@@ -552,7 +552,7 @@ namespace Opm
const Well::ProductionControls& /*prod_controls*/, const Well::ProductionControls& /*prod_controls*/,
WellState& well_state, WellState& well_state,
const GroupState& group_state, const GroupState& group_state,
Opm::DeferredLogger& deferred_logger) DeferredLogger& deferred_logger)
{ {
// TODO: only_wells should be put back to save some computation // TODO: only_wells should be put back to save some computation
// for example, the matrices B C does not need to update if only_wells // for example, the matrices B C does not need to update if only_wells
@@ -577,7 +577,7 @@ namespace Opm
const double dt, const double dt,
WellState& well_state, WellState& well_state,
const GroupState& group_state, const GroupState& group_state,
Opm::DeferredLogger& deferred_logger) DeferredLogger& deferred_logger)
{ {
// TODO: it probably can be static member for StandardWell // TODO: it probably can be static member for StandardWell
@@ -664,7 +664,7 @@ namespace Opm
} }
const auto& summaryState = ebosSimulator.vanguard().summaryState(); 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, deferred_logger); assembleControlEq(well_state, group_state, schedule, summaryState, deferred_logger);
@@ -672,7 +672,7 @@ namespace Opm
try { try {
Dune::ISTLUtility::invertMatrix(invDuneD_[0][0]); Dune::ISTLUtility::invertMatrix(invDuneD_[0][0]);
} catch( ... ) { } catch( ... ) {
OPM_DEFLOG_THROW(Opm::NumericalIssue,"Error when inverting local well equations for well " + name(), deferred_logger); OPM_DEFLOG_THROW(NumericalIssue,"Error when inverting local well equations for well " + name(), deferred_logger);
} }
} }
@@ -689,7 +689,7 @@ namespace Opm
std::vector<EvalWell>& cq_s, std::vector<EvalWell>& cq_s,
EvalWell& water_flux_s, EvalWell& water_flux_s,
EvalWell& cq_s_zfrac_effective, EvalWell& cq_s_zfrac_effective,
Opm::DeferredLogger& deferred_logger) const DeferredLogger& deferred_logger) const
{ {
const bool allow_cf = getAllowCrossFlow() || openCrossFlowAvoidSingularity(ebosSimulator); const bool allow_cf = getAllowCrossFlow() || openCrossFlowAvoidSingularity(ebosSimulator);
const EvalWell& bhp = getBhp(); const EvalWell& bhp = getBhp();
@@ -863,9 +863,9 @@ namespace Opm
void void
StandardWell<TypeTag>::assembleControlEq(const WellState& well_state, StandardWell<TypeTag>::assembleControlEq(const WellState& well_state,
const GroupState& group_state, const GroupState& group_state,
const Opm::Schedule& schedule, const Schedule& schedule,
const SummaryState& summaryState, const SummaryState& summaryState,
Opm::DeferredLogger& deferred_logger) DeferredLogger& deferred_logger)
{ {
EvalWell control_eq(numWellEq_ + numEq, 0.0); EvalWell control_eq(numWellEq_ + numEq, 0.0);
@@ -927,7 +927,7 @@ namespace Opm
getMobility(const Simulator& ebosSimulator, getMobility(const Simulator& ebosSimulator,
const int perf, const int perf,
std::vector<EvalWell>& mob, std::vector<EvalWell>& mob,
Opm::DeferredLogger& deferred_logger) const DeferredLogger& deferred_logger) const
{ {
const int cell_idx = well_cells_[perf]; const int cell_idx = well_cells_[perf];
assert (int(mob.size()) == num_components_); assert (int(mob.size()) == num_components_);
@@ -999,7 +999,7 @@ namespace Opm
StandardWell<TypeTag>:: StandardWell<TypeTag>::
updateWellState(const BVectorWell& dwells, updateWellState(const BVectorWell& dwells,
WellState& well_state, WellState& well_state,
Opm::DeferredLogger& deferred_logger) const DeferredLogger& deferred_logger) const
{ {
if (!this->isOperable() && !this->wellIsStopped()) return; if (!this->isOperable() && !this->wellIsStopped()) return;
@@ -1068,7 +1068,7 @@ namespace Opm
#ifndef NDEBUG #ifndef NDEBUG
for (double v : primary_variables_) { for (double v : primary_variables_) {
assert(Opm::isfinite(v)); assert(isfinite(v));
} }
#endif #endif
@@ -1207,7 +1207,7 @@ namespace Opm
template<typename TypeTag> template<typename TypeTag>
void void
StandardWell<TypeTag>:: StandardWell<TypeTag>::
updateWellStateFromPrimaryVariables(WellState& well_state, Opm::DeferredLogger& deferred_logger) const updateWellStateFromPrimaryVariables(WellState& well_state, DeferredLogger& deferred_logger) const
{ {
const PhaseUsage& pu = phaseUsage(); const PhaseUsage& pu = phaseUsage();
std::vector<double> F(number_of_phases_, 0.0); std::vector<double> F(number_of_phases_, 0.0);
@@ -1321,7 +1321,7 @@ namespace Opm
template<typename TypeTag> template<typename TypeTag>
void void
StandardWell<TypeTag>:: StandardWell<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. // When there is no vaild VFP table provided, we set the thp to be zero.
if (!this->isVFPActive(deferred_logger) || this->wellIsStopped()) { if (!this->isVFPActive(deferred_logger) || this->wellIsStopped()) {
@@ -1332,7 +1332,7 @@ namespace Opm
// the well is under other control types, we calculate the thp based on bhp and rates // the well is under other control types, we calculate the thp based on bhp and rates
std::vector<double> rates(3, 0.0); std::vector<double> rates(3, 0.0);
const Opm::PhaseUsage& pu = phaseUsage(); const PhaseUsage& pu = phaseUsage();
if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) { if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) {
rates[ Water ] = well_state.wellRates(index_of_well_)[pu.phase_pos[ Water ] ]; rates[ Water ] = well_state.wellRates(index_of_well_)[pu.phase_pos[ Water ] ];
} }
@@ -1358,7 +1358,7 @@ namespace Opm
StandardWell<TypeTag>:: StandardWell<TypeTag>::
updateWellStateWithTarget(const Simulator& ebos_simulator, updateWellStateWithTarget(const Simulator& ebos_simulator,
WellState& well_state, WellState& well_state,
Opm::DeferredLogger& deferred_logger) const DeferredLogger& deferred_logger) const
{ {
Base::updateWellStateWithTarget(ebos_simulator, well_state, deferred_logger); Base::updateWellStateWithTarget(ebos_simulator, well_state, deferred_logger);
} }
@@ -1370,7 +1370,7 @@ namespace Opm
template<typename TypeTag> template<typename TypeTag>
void void
StandardWell<TypeTag>:: StandardWell<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 // TODO: not handling solvent related here for now
@@ -1466,7 +1466,7 @@ namespace Opm
template<typename TypeTag> template<typename TypeTag>
void void
StandardWell<TypeTag>:: StandardWell<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 auto& summaryState = ebos_simulator.vanguard().summaryState();
const double bhp_limit = mostStrictBhpFromBhpLimits(summaryState); const double bhp_limit = mostStrictBhpFromBhpLimits(summaryState);
@@ -1520,7 +1520,7 @@ namespace Opm
template<typename TypeTag> template<typename TypeTag>
void void
StandardWell<TypeTag>:: StandardWell<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& summaryState = ebos_simulator.vanguard().summaryState();
const auto obtain_bhp = computeBhpAtThpLimitProd(well_state, ebos_simulator, summaryState, deferred_logger); const auto obtain_bhp = computeBhpAtThpLimitProd(well_state, ebos_simulator, summaryState, deferred_logger);
@@ -1602,7 +1602,7 @@ namespace Opm
StandardWell<TypeTag>:: StandardWell<TypeTag>::
canProduceInjectWithCurrentBhp(const Simulator& ebos_simulator, canProduceInjectWithCurrentBhp(const Simulator& ebos_simulator,
const WellState& well_state, const WellState& well_state,
Opm::DeferredLogger& deferred_logger) DeferredLogger& deferred_logger)
{ {
const double bhp = well_state.bhp(index_of_well_); const double bhp = well_state.bhp(index_of_well_);
std::vector<double> well_rates; std::vector<double> well_rates;
@@ -1960,7 +1960,7 @@ namespace Opm
StandardWell<TypeTag>:: StandardWell<TypeTag>::
getWellConvergence(const WellState& well_state, getWellConvergence(const WellState& well_state,
const std::vector<double>& B_avg, const std::vector<double>& B_avg,
Opm::DeferredLogger& deferred_logger, DeferredLogger& deferred_logger,
const bool /*relax_tolerance*/) const const bool /*relax_tolerance*/) const
{ {
// the following implementation assume that the polymer is always after the w-o-g phases // the following implementation assume that the polymer is always after the w-o-g phases
@@ -2185,7 +2185,7 @@ namespace Opm
template<typename TypeTag> template<typename TypeTag>
void void
StandardWell<TypeTag>:: StandardWell<TypeTag>::
solveEqAndUpdateWellState(WellState& well_state, Opm::DeferredLogger& deferred_logger) solveEqAndUpdateWellState(WellState& well_state, DeferredLogger& deferred_logger)
{ {
if (!this->isOperable() && !this->wellIsStopped()) return; if (!this->isOperable() && !this->wellIsStopped()) return;
@@ -2207,7 +2207,7 @@ namespace Opm
StandardWell<TypeTag>:: StandardWell<TypeTag>::
calculateExplicitQuantities(const Simulator& ebosSimulator, calculateExplicitQuantities(const Simulator& ebosSimulator,
const WellState& well_state, const WellState& well_state,
Opm::DeferredLogger& deferred_logger) DeferredLogger& deferred_logger)
{ {
updatePrimaryVariables(well_state, deferred_logger); updatePrimaryVariables(well_state, deferred_logger);
initPrimaryVariablesEvaluation(); initPrimaryVariablesEvaluation();
@@ -2361,7 +2361,7 @@ namespace Opm
StandardWell<TypeTag>:: StandardWell<TypeTag>::
recoverWellSolutionAndUpdateWellState(const BVector& x, recoverWellSolutionAndUpdateWellState(const BVector& x,
WellState& well_state, WellState& well_state,
Opm::DeferredLogger& deferred_logger) const DeferredLogger& deferred_logger) const
{ {
if (!this->isOperable() && !this->wellIsStopped()) return; if (!this->isOperable() && !this->wellIsStopped()) return;
@@ -2381,7 +2381,7 @@ namespace Opm
computeWellRatesWithBhp(const Simulator& ebosSimulator, computeWellRatesWithBhp(const Simulator& ebosSimulator,
const double& bhp, const double& bhp,
std::vector<double>& well_flux, std::vector<double>& well_flux,
Opm::DeferredLogger& deferred_logger) const DeferredLogger& deferred_logger) const
{ {
const int np = number_of_phases_; const int np = number_of_phases_;
@@ -2419,7 +2419,7 @@ namespace Opm
computeWellRatesWithBhpPotential(const Simulator& ebosSimulator, computeWellRatesWithBhpPotential(const Simulator& ebosSimulator,
const double& bhp, const double& bhp,
std::vector<double>& well_flux, std::vector<double>& well_flux,
Opm::DeferredLogger& deferred_logger) DeferredLogger& deferred_logger)
{ {
// iterate to get a more accurate well density // iterate to get a more accurate well density
@@ -2459,7 +2459,7 @@ namespace Opm
std::vector<double> std::vector<double>
StandardWell<TypeTag>:: StandardWell<TypeTag>::
computeWellPotentialWithTHP(const Simulator& ebos_simulator, computeWellPotentialWithTHP(const Simulator& ebos_simulator,
Opm::DeferredLogger& deferred_logger, DeferredLogger& deferred_logger,
const WellState &well_state) const const WellState &well_state) const
{ {
std::vector<double> potentials(number_of_phases_, 0.0); std::vector<double> potentials(number_of_phases_, 0.0);
@@ -2499,7 +2499,7 @@ namespace Opm
bool bool
StandardWell<TypeTag>:: StandardWell<TypeTag>::
doGasLiftOptimize(const WellState &well_state, const Simulator &ebos_simulator, doGasLiftOptimize(const WellState &well_state, const Simulator &ebos_simulator,
Opm::DeferredLogger& deferred_logger) const DeferredLogger& deferred_logger) const
{ {
gliftDebug("checking if GLIFT should be done..", deferred_logger); gliftDebug("checking if GLIFT should be done..", deferred_logger);
@@ -2524,7 +2524,7 @@ namespace Opm
return false; return false;
} }
const int report_step_idx = ebos_simulator.episodeIndex(); const int report_step_idx = ebos_simulator.episodeIndex();
const Opm::Schedule& schedule = ebos_simulator.vanguard().schedule(); const Schedule& schedule = ebos_simulator.vanguard().schedule();
const GasLiftOpt& glo = schedule.glo(report_step_idx); const GasLiftOpt& glo = schedule.glo(report_step_idx);
if (!glo.has_well(name())) { if (!glo.has_well(name())) {
gliftDebug("Gas Lift not activated: WLIFTOPT is probably missing", gliftDebug("Gas Lift not activated: WLIFTOPT is probably missing",
@@ -2559,7 +2559,7 @@ namespace Opm
DeferredLogger& deferred_logger ) const DeferredLogger& deferred_logger ) const
{ {
const int report_step_idx = ebos_simulator.episodeIndex(); const int report_step_idx = ebos_simulator.episodeIndex();
const Opm::Schedule& schedule = ebos_simulator.vanguard().schedule(); const Schedule& schedule = ebos_simulator.vanguard().schedule();
const GasLiftOpt& glo = schedule.glo(report_step_idx); const GasLiftOpt& glo = schedule.glo(report_step_idx);
const int iteration_idx = ebos_simulator.model().newtonMethod().numIterations(); const int iteration_idx = ebos_simulator.model().newtonMethod().numIterations();
if (glo.all_newton()) { if (glo.all_newton()) {
@@ -2647,7 +2647,7 @@ namespace Opm
gasLiftOptimizationStage1( gasLiftOptimizationStage1(
WellState& well_state, WellState& well_state,
const Simulator& ebos_simulator, const Simulator& ebos_simulator,
Opm::DeferredLogger& deferred_logger, DeferredLogger& deferred_logger,
GLiftProdWells &prod_wells, GLiftProdWells &prod_wells,
GLiftOptWells &glift_wells, GLiftOptWells &glift_wells,
GLiftWellStateMap &glift_state_map GLiftWellStateMap &glift_state_map
@@ -2681,7 +2681,7 @@ namespace Opm
computeWellPotentials(const Simulator& ebosSimulator, computeWellPotentials(const Simulator& ebosSimulator,
const WellState& well_state, const WellState& well_state,
std::vector<double>& well_potentials, std::vector<double>& well_potentials,
Opm::DeferredLogger& deferred_logger) // const DeferredLogger& deferred_logger) // const
{ {
const int np = number_of_phases_; const int np = number_of_phases_;
well_potentials.resize(np, 0.0); well_potentials.resize(np, 0.0);
@@ -2716,7 +2716,7 @@ namespace Opm
template<typename TypeTag> template<typename TypeTag>
void void
StandardWell<TypeTag>:: StandardWell<TypeTag>::
updatePrimaryVariables(const WellState& well_state, Opm::DeferredLogger& deferred_logger) const updatePrimaryVariables(const WellState& well_state, DeferredLogger& deferred_logger) const
{ {
if (!this->isOperable() && !this->wellIsStopped()) return; if (!this->isOperable() && !this->wellIsStopped()) return;
@@ -2821,7 +2821,7 @@ namespace Opm
} }
#ifndef NDEBUG #ifndef NDEBUG
for (double v : primary_variables_) { for (double v : primary_variables_) {
assert(Opm::isfinite(v)); assert(isfinite(v));
} }
#endif #endif
} }
@@ -2834,7 +2834,7 @@ namespace Opm
StandardWell<TypeTag>:: StandardWell<TypeTag>::
calculateThpFromBhp(const WellState &well_state, const std::vector<double>& rates, calculateThpFromBhp(const WellState &well_state, const std::vector<double>& rates,
const double bhp, 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. assert(int(rates.size()) == 3); // the vfp related only supports three phases now.
@@ -2886,7 +2886,7 @@ namespace Opm
updateWaterMobilityWithPolymer(const Simulator& ebos_simulator, updateWaterMobilityWithPolymer(const Simulator& ebos_simulator,
const int perf, const int perf,
std::vector<EvalWell>& mob, std::vector<EvalWell>& mob,
Opm::DeferredLogger& deferred_logger) const DeferredLogger& deferred_logger) const
{ {
const int cell_idx = well_cells_[perf]; const int cell_idx = well_cells_[perf];
const auto& int_quant = *(ebos_simulator.model().cachedIntensiveQuantities(cell_idx, /*timeIdx=*/ 0)); const auto& int_quant = *(ebos_simulator.model().cachedIntensiveQuantities(cell_idx, /*timeIdx=*/ 0));
@@ -2928,7 +2928,7 @@ namespace Opm
const EvalWell poro = extendEval(int_quant.porosity()); const EvalWell poro = extendEval(int_quant.porosity());
const EvalWell sw = extendEval(int_quant.fluidState().saturation(FluidSystem::waterPhaseIdx)); const EvalWell sw = extendEval(int_quant.fluidState().saturation(FluidSystem::waterPhaseIdx));
// guard against zero porosity and no water // guard against zero porosity and no water
const EvalWell denom = Opm::max( (area * poro * (sw - swcr)), 1e-12); const EvalWell denom = max( (area * poro * (sw - swcr)), 1e-12);
const unsigned waterCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx); const unsigned waterCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx);
EvalWell water_velocity = cq_s[waterCompIdx] / denom * extendEval(int_quant.fluidState().invB(FluidSystem::waterPhaseIdx)); EvalWell water_velocity = cq_s[waterCompIdx] / denom * extendEval(int_quant.fluidState().invB(FluidSystem::waterPhaseIdx));
@@ -3082,7 +3082,7 @@ namespace Opm
StandardWell<TypeTag>:: StandardWell<TypeTag>::
pskinwater(const double throughput, pskinwater(const double throughput,
const EvalWell& water_velocity, const EvalWell& water_velocity,
Opm::DeferredLogger& deferred_logger) const DeferredLogger& deferred_logger) const
{ {
if constexpr (Base::has_polymermw) { if constexpr (Base::has_polymermw) {
const int water_table_id = well_ecl_.getPolymerProperties().m_skprwattable; const int water_table_id = well_ecl_.getPolymerProperties().m_skprwattable;
@@ -3111,11 +3111,11 @@ namespace Opm
pskin(const double throughput, pskin(const double throughput,
const EvalWell& water_velocity, const EvalWell& water_velocity,
const EvalWell& poly_inj_conc, const EvalWell& poly_inj_conc,
Opm::DeferredLogger& deferred_logger) const DeferredLogger& deferred_logger) const
{ {
if constexpr (Base::has_polymermw) { if constexpr (Base::has_polymermw) {
const double sign = water_velocity >= 0. ? 1.0 : -1.0; const double sign = water_velocity >= 0. ? 1.0 : -1.0;
const EvalWell water_velocity_abs = Opm::abs(water_velocity); const EvalWell water_velocity_abs = abs(water_velocity);
if (poly_inj_conc == 0.) { if (poly_inj_conc == 0.) {
return sign * pskinwater(throughput, water_velocity_abs, deferred_logger); return sign * pskinwater(throughput, water_velocity_abs, deferred_logger);
} }
@@ -3151,7 +3151,7 @@ namespace Opm
StandardWell<TypeTag>:: StandardWell<TypeTag>::
wpolymermw(const double throughput, wpolymermw(const double throughput,
const EvalWell& water_velocity, const EvalWell& water_velocity,
Opm::DeferredLogger& deferred_logger) const DeferredLogger& deferred_logger) const
{ {
if constexpr (Base::has_polymermw) { if constexpr (Base::has_polymermw) {
const int table_id = well_ecl_.getPolymerProperties().m_plymwinjtable; const int table_id = well_ecl_.getPolymerProperties().m_plymwinjtable;
@@ -3161,7 +3161,7 @@ namespace Opm
if (wpolymer() == 0.) { // not injecting polymer if (wpolymer() == 0.) { // not injecting polymer
return molecular_weight; return molecular_weight;
} }
molecular_weight = table_func.eval(throughput_eval, Opm::abs(water_velocity)); molecular_weight = table_func.eval(throughput_eval, abs(water_velocity));
return molecular_weight; return molecular_weight;
} else { } else {
OPM_DEFLOG_THROW(std::runtime_error, "Polymermw is not activated, " OPM_DEFLOG_THROW(std::runtime_error, "Polymermw is not activated, "
@@ -3226,7 +3226,7 @@ namespace Opm
const WellState& well_state, const WellState& well_state,
const int perf, const int perf,
const EvalWell& water_flux_s, const EvalWell& water_flux_s,
Opm::DeferredLogger& deferred_logger) DeferredLogger& deferred_logger)
{ {
const int cell_idx = well_cells_[perf]; const int cell_idx = well_cells_[perf];
const auto& int_quants = *(ebosSimulator.model().cachedIntensiveQuantities(cell_idx, /*timeIdx=*/ 0)); const auto& int_quants = *(ebosSimulator.model().cachedIntensiveQuantities(cell_idx, /*timeIdx=*/ 0));
@@ -3875,7 +3875,7 @@ namespace Opm
const Well::ProductionControls& prod_controls, const Well::ProductionControls& prod_controls,
WellState& well_state, WellState& well_state,
const GroupState& group_state, const GroupState& group_state,
Opm::DeferredLogger& deferred_logger) DeferredLogger& deferred_logger)
{ {
const int max_iter = param_.max_inner_iter_wells_; const int max_iter = param_.max_inner_iter_wells_;
int it = 0; int it = 0;
@@ -4009,7 +4009,7 @@ namespace Opm
phase_pos = pu.phase_pos[Water]; phase_pos = pu.phase_pos[Water];
} }
else { else {
OPM_DEFLOG_THROW(Opm::NotImplemented, OPM_DEFLOG_THROW(NotImplemented,
"Unsupported Injector Type (" "Unsupported Injector Type ("
<< static_cast<int>(preferred_phase) << static_cast<int>(preferred_phase)
<< ") for well " << this->name() << ") for well " << this->name()