Merge pull request #5228 from akva2/simplify_template_params

Simplify template params
This commit is contained in:
Arne Morten Kvarving 2024-03-08 17:03:03 +01:00 committed by GitHub
commit 696f9cd875
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
34 changed files with 535 additions and 509 deletions

View File

@ -41,20 +41,17 @@
namespace Opm {
template class FlowGenericProblem<Dune::GridView<Dune::DefaultLeafGridViewTraits<Dune::CpGrid>>,
BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,
double>;
BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>>;
#if HAVE_DUNE_FEM
template class FlowGenericProblem<Dune::GridView<Dune::Fem::GridPart2GridViewTraits<Dune::Fem::AdaptiveLeafGridPart<Dune::CpGrid, Dune::PartitionIteratorType(4), false>>>,
BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,
double>;
BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>>;
template class FlowGenericProblem<Dune::Fem::GridPart2GridViewImpl<
Dune::Fem::AdaptiveLeafGridPart<
Dune::CpGrid,
Dune::PartitionIteratorType(4),
false> >,
BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,
double>;
BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>>;
#endif // HAVE_DUNE_FEM
} // end namespace Opm

View File

@ -65,10 +65,11 @@ int eclPositionalParameter(Dune::ParameterTree& tree,
* \brief This problem simulates an input file given in the data format used by the
* commercial ECLiPSE simulator.
*/
template<class GridView, class FluidSystem, class Scalar>
template<class GridView, class FluidSystem>
class FlowGenericProblem
{
public:
using Scalar = typename FluidSystem::Scalar;
using TabulatedTwoDFunction = UniformXTabulated2DFunction<Scalar>;
using TabulatedFunction = Tabulated1DFunction<Scalar>;
@ -371,7 +372,7 @@ protected:
std::vector<Scalar> solventRsw_;
MICPSolutionContainer<Scalar> micp_;
MixingRateControls<FluidSystem, Scalar> mixControls_;
MixingRateControls<FluidSystem> mixControls_;
// time stepping parameters
bool enableTuning_;

View File

@ -78,8 +78,8 @@ int eclPositionalParameter(Dune::ParameterTree& tree,
return 1;
}
template<class GridView, class FluidSystem, class Scalar>
FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
FlowGenericProblem<GridView,FluidSystem>::
FlowGenericProblem(const EclipseState& eclState,
const Schedule& schedule,
const GridView& gridView)
@ -91,9 +91,9 @@ FlowGenericProblem(const EclipseState& eclState,
{
}
template<class GridView, class FluidSystem, class Scalar>
FlowGenericProblem<GridView,FluidSystem,Scalar>
FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
FlowGenericProblem<GridView,FluidSystem>
FlowGenericProblem<GridView,FluidSystem>::
serializationTestObject(const EclipseState& eclState,
const Schedule& schedule,
const GridView& gridView)
@ -107,14 +107,14 @@ serializationTestObject(const EclipseState& eclState,
result.solventRsw_ = {18.0};
result.polymer_ = PolymerSolutionContainer<Scalar>::serializationTestObject();
result.micp_ = MICPSolutionContainer<Scalar>::serializationTestObject();
result.mixControls_ = MixingRateControls<FluidSystem,Scalar>::serializationTestObject(schedule);
result.mixControls_ = MixingRateControls<FluidSystem>::serializationTestObject(schedule);
return result;
}
template<class GridView, class FluidSystem, class Scalar>
template<class GridView, class FluidSystem>
std::string
FlowGenericProblem<GridView,FluidSystem,Scalar>::
FlowGenericProblem<GridView,FluidSystem>::
helpPreamble(int,
const char **argv)
{
@ -127,16 +127,16 @@ helpPreamble(int,
+ desc;
}
template<class GridView, class FluidSystem, class Scalar>
template<class GridView, class FluidSystem>
std::string
FlowGenericProblem<GridView,FluidSystem,Scalar>::
FlowGenericProblem<GridView,FluidSystem>::
briefDescription()
{
return briefDescription_;
}
template<class GridView, class FluidSystem, class Scalar>
void FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
void FlowGenericProblem<GridView,FluidSystem>::
readRockParameters_(const std::vector<Scalar>& cellCenterDepths,
std::function<std::array<int,3>(const unsigned)> ijkIndex)
{
@ -210,8 +210,8 @@ readRockParameters_(const std::vector<Scalar>& cellCenterDepths,
}
}
template<class GridView, class FluidSystem, class Scalar>
void FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
void FlowGenericProblem<GridView,FluidSystem>::
readRockCompactionParameters_()
{
const auto& rock_config = eclState_.getSimulationConfig().rock_config();
@ -303,8 +303,9 @@ readRockCompactionParameters_()
}
}
template<class GridView, class FluidSystem, class Scalar>
Scalar FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
typename FlowGenericProblem<GridView,FluidSystem>::Scalar
FlowGenericProblem<GridView,FluidSystem>::
rockCompressibility(unsigned globalSpaceIdx) const
{
if (this->rockParams_.empty())
@ -317,8 +318,9 @@ rockCompressibility(unsigned globalSpaceIdx) const
return this->rockParams_[tableIdx].compressibility;
}
template<class GridView, class FluidSystem, class Scalar>
Scalar FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
typename FlowGenericProblem<GridView,FluidSystem>::Scalar
FlowGenericProblem<GridView,FluidSystem>::
rockReferencePressure(unsigned globalSpaceIdx) const
{
if (this->rockParams_.empty())
@ -331,15 +333,17 @@ rockReferencePressure(unsigned globalSpaceIdx) const
return this->rockParams_[tableIdx].referencePressure;
}
template<class GridView, class FluidSystem, class Scalar>
Scalar FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
typename FlowGenericProblem<GridView,FluidSystem>::Scalar
FlowGenericProblem<GridView,FluidSystem>::
porosity(unsigned globalSpaceIdx, unsigned timeIdx) const
{
return this->referencePorosity_[timeIdx][globalSpaceIdx];
}
template<class GridView, class FluidSystem, class Scalar>
Scalar FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
typename FlowGenericProblem<GridView,FluidSystem>::Scalar
FlowGenericProblem<GridView,FluidSystem>::
rockFraction(unsigned elementIdx, unsigned timeIdx) const
{
// the reference porosity is defined as the accumulated pore volume divided by the
@ -350,9 +354,9 @@ rockFraction(unsigned elementIdx, unsigned timeIdx) const
return referencePorosity(elementIdx, timeIdx) / porosity * (1 - porosity);
}
template<class GridView, class FluidSystem, class Scalar>
template<class GridView, class FluidSystem>
template<class T>
void FlowGenericProblem<GridView,FluidSystem,Scalar>::
void FlowGenericProblem<GridView,FluidSystem>::
updateNum(const std::string& name, std::vector<T>& numbers, std::size_t num_regions)
{
if (!eclState_.fieldProps().has_int(name))
@ -372,40 +376,40 @@ updateNum(const std::string& name, std::vector<T>& numbers, std::size_t num_regi
true /*needsTranslation*/, valueCheck);
}
template<class GridView, class FluidSystem, class Scalar>
void FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
void FlowGenericProblem<GridView,FluidSystem>::
updatePvtnum_()
{
const auto num_regions = eclState_.getTableManager().getTabdims().getNumPVTTables();
updateNum("PVTNUM", pvtnum_, num_regions);
}
template<class GridView, class FluidSystem, class Scalar>
void FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
void FlowGenericProblem<GridView,FluidSystem>::
updateSatnum_()
{
const auto num_regions = eclState_.getTableManager().getTabdims().getNumSatTables();
updateNum("SATNUM", satnum_, num_regions);
}
template<class GridView, class FluidSystem, class Scalar>
void FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
void FlowGenericProblem<GridView,FluidSystem>::
updateMiscnum_()
{
const auto num_regions = 1; // we only support single region
updateNum("MISCNUM", miscnum_, num_regions);
}
template<class GridView, class FluidSystem, class Scalar>
void FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
void FlowGenericProblem<GridView,FluidSystem>::
updatePlmixnum_()
{
const auto num_regions = 1; // we only support single region
updateNum("PLMIXNUM", plmixnum_, num_regions);
}
template<class GridView, class FluidSystem, class Scalar>
void FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
void FlowGenericProblem<GridView,FluidSystem>::
updateKrnum_()
{
const auto num_regions = eclState_.getTableManager().getTabdims().getNumSatTables();
@ -414,8 +418,8 @@ updateKrnum_()
updateNum("KRNUMZ", krnumz_, num_regions);
}
template<class GridView, class FluidSystem, class Scalar>
void FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
void FlowGenericProblem<GridView,FluidSystem>::
updateImbnum_()
{
const auto num_regions = eclState_.getTableManager().getTabdims().getNumSatTables();
@ -424,16 +428,16 @@ updateImbnum_()
updateNum("IMBNUMZ", imbnumz_, num_regions);
}
template<class GridView, class FluidSystem, class Scalar>
bool FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
bool FlowGenericProblem<GridView,FluidSystem>::
vapparsActive(int episodeIdx) const
{
const auto& oilVaporizationControl = schedule_[episodeIdx].oilvap();
return (oilVaporizationControl.getType() == OilVaporizationProperties::OilVaporization::VAPPARS);
}
template<class GridView, class FluidSystem, class Scalar>
bool FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
bool FlowGenericProblem<GridView,FluidSystem>::
beginEpisode_(bool enableExperiments,
int episodeIdx)
{
@ -469,8 +473,8 @@ beginEpisode_(bool enableExperiments,
return false;
}
template<class GridView, class FluidSystem, class Scalar>
void FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
void FlowGenericProblem<GridView,FluidSystem>::
beginTimeStep_(bool enableExperiments,
int episodeIdx,
int timeStepIndex,
@ -496,15 +500,15 @@ beginTimeStep_(bool enableExperiments,
this->mixControls_.updateExplicitQuantities(episodeIdx, timeStepSize);
}
template<class GridView, class FluidSystem, class Scalar>
void FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
void FlowGenericProblem<GridView,FluidSystem>::
initFluidSystem_()
{
FluidSystem::initFromState(eclState_, schedule_);
}
template<class GridView, class FluidSystem, class Scalar>
void FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
void FlowGenericProblem<GridView,FluidSystem>::
readBlackoilExtentionsInitialConditions_(std::size_t numDof,
bool enableSolvent,
bool enablePolymer,
@ -568,8 +572,9 @@ readBlackoilExtentionsInitialConditions_(std::size_t numDof,
}
}
template<class GridView, class FluidSystem, class Scalar>
Scalar FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
typename FlowGenericProblem<GridView,FluidSystem>::Scalar
FlowGenericProblem<GridView,FluidSystem>::
maxWaterSaturation(unsigned globalDofIdx) const
{
if (maxWaterSaturation_.empty())
@ -578,8 +583,9 @@ maxWaterSaturation(unsigned globalDofIdx) const
return maxWaterSaturation_[globalDofIdx];
}
template<class GridView, class FluidSystem, class Scalar>
Scalar FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
typename FlowGenericProblem<GridView,FluidSystem>::Scalar
FlowGenericProblem<GridView,FluidSystem>::
minOilPressure(unsigned globalDofIdx) const
{
if (minRefPressure_.empty())
@ -588,8 +594,9 @@ minOilPressure(unsigned globalDofIdx) const
return minRefPressure_[globalDofIdx];
}
template<class GridView, class FluidSystem, class Scalar>
Scalar FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
typename FlowGenericProblem<GridView,FluidSystem>::Scalar
FlowGenericProblem<GridView,FluidSystem>::
overburdenPressure(unsigned elementIdx) const
{
if (overburdenPressure_.empty())
@ -598,8 +605,9 @@ overburdenPressure(unsigned elementIdx) const
return overburdenPressure_[elementIdx];
}
template<class GridView, class FluidSystem, class Scalar>
Scalar FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
typename FlowGenericProblem<GridView,FluidSystem>::Scalar
FlowGenericProblem<GridView,FluidSystem>::
solventSaturation(unsigned elemIdx) const
{
if (solventSaturation_.empty())
@ -608,8 +616,9 @@ solventSaturation(unsigned elemIdx) const
return solventSaturation_[elemIdx];
}
template<class GridView, class FluidSystem, class Scalar>
Scalar FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
typename FlowGenericProblem<GridView,FluidSystem>::Scalar
FlowGenericProblem<GridView,FluidSystem>::
solventRsw(unsigned elemIdx) const
{
if (solventRsw_.empty())
@ -618,16 +627,18 @@ solventRsw(unsigned elemIdx) const
return solventRsw_[elemIdx];
}
template<class GridView, class FluidSystem, class Scalar>
Scalar FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
typename FlowGenericProblem<GridView,FluidSystem>::Scalar
FlowGenericProblem<GridView,FluidSystem>::
drsdtcon(unsigned elemIdx, int episodeIdx) const
{
return this->mixControls_.drsdtcon(elemIdx, episodeIdx,
this->pvtRegionIndex(elemIdx));
}
template<class GridView, class FluidSystem, class Scalar>
Scalar FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
typename FlowGenericProblem<GridView,FluidSystem>::Scalar
FlowGenericProblem<GridView,FluidSystem>::
polymerConcentration(unsigned elemIdx) const
{
if (polymer_.concentration.empty()) {
@ -637,8 +648,9 @@ polymerConcentration(unsigned elemIdx) const
return polymer_.concentration[elemIdx];
}
template<class GridView, class FluidSystem, class Scalar>
Scalar FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
typename FlowGenericProblem<GridView,FluidSystem>::Scalar
FlowGenericProblem<GridView,FluidSystem>::
polymerMolecularWeight(const unsigned elemIdx) const
{
if (polymer_.moleWeight.empty()) {
@ -648,8 +660,9 @@ polymerMolecularWeight(const unsigned elemIdx) const
return polymer_.moleWeight[elemIdx];
}
template<class GridView, class FluidSystem, class Scalar>
Scalar FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
typename FlowGenericProblem<GridView,FluidSystem>::Scalar
FlowGenericProblem<GridView,FluidSystem>::
microbialConcentration(unsigned elemIdx) const
{
if (micp_.microbialConcentration.empty()) {
@ -659,8 +672,9 @@ microbialConcentration(unsigned elemIdx) const
return micp_.microbialConcentration[elemIdx];
}
template<class GridView, class FluidSystem, class Scalar>
Scalar FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
typename FlowGenericProblem<GridView,FluidSystem>::Scalar
FlowGenericProblem<GridView,FluidSystem>::
oxygenConcentration(unsigned elemIdx) const
{
if (micp_.oxygenConcentration.empty()) {
@ -670,8 +684,9 @@ oxygenConcentration(unsigned elemIdx) const
return micp_.oxygenConcentration[elemIdx];
}
template<class GridView, class FluidSystem, class Scalar>
Scalar FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
typename FlowGenericProblem<GridView,FluidSystem>::Scalar
FlowGenericProblem<GridView,FluidSystem>::
ureaConcentration(unsigned elemIdx) const
{
if (micp_.ureaConcentration.empty()) {
@ -681,8 +696,9 @@ ureaConcentration(unsigned elemIdx) const
return micp_.ureaConcentration[elemIdx];
}
template<class GridView, class FluidSystem, class Scalar>
Scalar FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
typename FlowGenericProblem<GridView,FluidSystem>::Scalar
FlowGenericProblem<GridView,FluidSystem>::
biofilmConcentration(unsigned elemIdx) const
{
if (micp_.biofilmConcentration.empty()) {
@ -692,8 +708,9 @@ biofilmConcentration(unsigned elemIdx) const
return micp_.biofilmConcentration[elemIdx];
}
template<class GridView, class FluidSystem, class Scalar>
Scalar FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
typename FlowGenericProblem<GridView,FluidSystem>::Scalar
FlowGenericProblem<GridView,FluidSystem>::
calciteConcentration(unsigned elemIdx) const
{
if (micp_.calciteConcentration.empty()) {
@ -703,8 +720,8 @@ calciteConcentration(unsigned elemIdx) const
return micp_.calciteConcentration[elemIdx];
}
template<class GridView, class FluidSystem, class Scalar>
unsigned FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
unsigned FlowGenericProblem<GridView,FluidSystem>::
pvtRegionIndex(unsigned elemIdx) const
{
if (pvtnum_.empty())
@ -713,8 +730,8 @@ pvtRegionIndex(unsigned elemIdx) const
return pvtnum_[elemIdx];
}
template<class GridView, class FluidSystem, class Scalar>
unsigned FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
unsigned FlowGenericProblem<GridView,FluidSystem>::
satnumRegionIndex(unsigned elemIdx) const
{
if (satnum_.empty())
@ -723,8 +740,8 @@ satnumRegionIndex(unsigned elemIdx) const
return satnum_[elemIdx];
}
template<class GridView, class FluidSystem, class Scalar>
unsigned FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
unsigned FlowGenericProblem<GridView,FluidSystem>::
miscnumRegionIndex(unsigned elemIdx) const
{
if (miscnum_.empty())
@ -733,8 +750,8 @@ miscnumRegionIndex(unsigned elemIdx) const
return miscnum_[elemIdx];
}
template<class GridView, class FluidSystem, class Scalar>
unsigned FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
unsigned FlowGenericProblem<GridView,FluidSystem>::
plmixnumRegionIndex(unsigned elemIdx) const
{
if (plmixnum_.empty())
@ -743,8 +760,9 @@ plmixnumRegionIndex(unsigned elemIdx) const
return plmixnum_[elemIdx];
}
template<class GridView, class FluidSystem, class Scalar>
Scalar FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
typename FlowGenericProblem<GridView,FluidSystem>::Scalar
FlowGenericProblem<GridView,FluidSystem>::
maxPolymerAdsorption(unsigned elemIdx) const
{
if (polymer_.maxAdsorption.empty()) {
@ -754,8 +772,8 @@ maxPolymerAdsorption(unsigned elemIdx) const
return polymer_.maxAdsorption[elemIdx];
}
template<class GridView, class FluidSystem, class Scalar>
bool FlowGenericProblem<GridView,FluidSystem,Scalar>::
template<class GridView, class FluidSystem>
bool FlowGenericProblem<GridView,FluidSystem>::
operator==(const FlowGenericProblem& rhs) const
{
return this->maxWaterSaturation_ == rhs.maxWaterSaturation_ &&

View File

@ -108,12 +108,10 @@ namespace Opm {
template <class TypeTag>
class FlowProblem : public GetPropType<TypeTag, Properties::BaseProblem>
, public FlowGenericProblem<GetPropType<TypeTag, Properties::GridView>,
GetPropType<TypeTag, Properties::FluidSystem>,
GetPropType<TypeTag, Properties::Scalar>>
GetPropType<TypeTag, Properties::FluidSystem>>
{
using BaseType = FlowGenericProblem<GetPropType<TypeTag, Properties::GridView>,
GetPropType<TypeTag, Properties::FluidSystem>,
GetPropType<TypeTag, Properties::Scalar>>;
GetPropType<TypeTag, Properties::FluidSystem>>;
using ParentType = GetPropType<TypeTag, Properties::BaseProblem>;
using Implementation = GetPropType<TypeTag, Properties::Problem>;
@ -197,13 +195,13 @@ class FlowProblem : public GetPropType<TypeTag, Properties::BaseProblem>
using DirectionalMobilityPtr = Utility::CopyablePtr<DirectionalMobility<TypeTag, Evaluation>>;
public:
using FlowGenericProblem<GridView,FluidSystem,Scalar>::briefDescription;
using FlowGenericProblem<GridView,FluidSystem,Scalar>::helpPreamble;
using FlowGenericProblem<GridView,FluidSystem,Scalar>::shouldWriteOutput;
using FlowGenericProblem<GridView,FluidSystem,Scalar>::shouldWriteRestartFile;
using FlowGenericProblem<GridView,FluidSystem,Scalar>::rockCompressibility;
using FlowGenericProblem<GridView,FluidSystem,Scalar>::rockReferencePressure;
using FlowGenericProblem<GridView,FluidSystem,Scalar>::porosity;
using BaseType::briefDescription;
using BaseType::helpPreamble;
using BaseType::shouldWriteOutput;
using BaseType::shouldWriteRestartFile;
using BaseType::rockCompressibility;
using BaseType::rockReferencePressure;
using BaseType::porosity;
/*!
* \copydoc FvBaseProblem::registerParameters
@ -270,9 +268,9 @@ public:
*/
FlowProblem(Simulator& simulator)
: ParentType(simulator)
, FlowGenericProblem<GridView,FluidSystem,Scalar>(simulator.vanguard().eclState(),
simulator.vanguard().schedule(),
simulator.vanguard().gridView())
, BaseType(simulator.vanguard().eclState(),
simulator.vanguard().schedule(),
simulator.vanguard().gridView())
, transmissibilities_(simulator.vanguard().eclState(),
simulator.vanguard().gridView(),
simulator.vanguard().cartesianIndexMapper(),
@ -1077,7 +1075,7 @@ public:
std::shared_ptr<EclMaterialLawManager> materialLawManager()
{ return materialLawManager_; }
using FlowGenericProblem<GridView,FluidSystem,Scalar>::pvtRegionIndex;
using BaseType::pvtRegionIndex;
/*!
* \brief Returns the index of the relevant region for thermodynmic properties
*/
@ -1085,7 +1083,7 @@ public:
unsigned pvtRegionIndex(const Context& context, unsigned spaceIdx, unsigned timeIdx) const
{ return pvtRegionIndex(context.globalSpaceIndex(spaceIdx, timeIdx)); }
using FlowGenericProblem<GridView,FluidSystem,Scalar>::satnumRegionIndex;
using BaseType::satnumRegionIndex;
/*!
* \brief Returns the index of the relevant region for thermodynmic properties
*/
@ -1093,7 +1091,7 @@ public:
unsigned satnumRegionIndex(const Context& context, unsigned spaceIdx, unsigned timeIdx) const
{ return this->satnumRegionIndex(context.globalSpaceIndex(spaceIdx, timeIdx)); }
using FlowGenericProblem<GridView,FluidSystem,Scalar>::miscnumRegionIndex;
using BaseType::miscnumRegionIndex;
/*!
* \brief Returns the index of the relevant region for thermodynmic properties
*/
@ -1101,7 +1099,7 @@ public:
unsigned miscnumRegionIndex(const Context& context, unsigned spaceIdx, unsigned timeIdx) const
{ return this->miscnumRegionIndex(context.globalSpaceIndex(spaceIdx, timeIdx)); }
using FlowGenericProblem<GridView,FluidSystem,Scalar>::plmixnumRegionIndex;
using BaseType::plmixnumRegionIndex;
/*!
* \brief Returns the index of the relevant region for thermodynmic properties
*/
@ -1109,7 +1107,7 @@ public:
unsigned plmixnumRegionIndex(const Context& context, unsigned spaceIdx, unsigned timeIdx) const
{ return this->plmixnumRegionIndex(context.globalSpaceIndex(spaceIdx, timeIdx)); }
using FlowGenericProblem<GridView,FluidSystem,Scalar>::maxPolymerAdsorption;
using BaseType::maxPolymerAdsorption;
/*!
* \brief Returns the max polymer adsorption value
*/

View File

@ -165,8 +165,8 @@ std::string EclString(const Opm::Inplace::Phase phase)
namespace Opm {
template<class FluidSystem, class Scalar>
GenericOutputBlackoilModule<FluidSystem,Scalar>::
template<class FluidSystem>
GenericOutputBlackoilModule<FluidSystem>::
GenericOutputBlackoilModule(const EclipseState& eclState,
const Schedule& schedule,
const SummaryConfig& summaryConfig,
@ -248,12 +248,12 @@ GenericOutputBlackoilModule(const EclipseState& eclState,
}
}
template<class FluidSystem, class Scalar>
GenericOutputBlackoilModule<FluidSystem,Scalar>::
template<class FluidSystem>
GenericOutputBlackoilModule<FluidSystem>::
~GenericOutputBlackoilModule() = default;
template<class FluidSystem, class Scalar>
void GenericOutputBlackoilModule<FluidSystem,Scalar>::
template<class FluidSystem>
void GenericOutputBlackoilModule<FluidSystem>::
outputTimeStamp(const std::string& lbl,
const double elapsed,
const int rstep,
@ -262,8 +262,8 @@ outputTimeStamp(const std::string& lbl,
logOutput_.timeStamp(lbl, elapsed, rstep, currentDate);
}
template<class FluidSystem, class Scalar>
void GenericOutputBlackoilModule<FluidSystem,Scalar>::
template<class FluidSystem>
void GenericOutputBlackoilModule<FluidSystem>::
prepareDensityAccumulation()
{
if (this->regionAvgDensity_.has_value()) {
@ -271,8 +271,8 @@ prepareDensityAccumulation()
}
}
template<class FluidSystem, class Scalar>
void GenericOutputBlackoilModule<FluidSystem,Scalar>::
template<class FluidSystem>
void GenericOutputBlackoilModule<FluidSystem>::
accumulateDensityParallel()
{
if (this->regionAvgDensity_.has_value()) {
@ -280,29 +280,29 @@ accumulateDensityParallel()
}
}
template<class FluidSystem, class Scalar>
void GenericOutputBlackoilModule<FluidSystem,Scalar>::
template<class FluidSystem>
void GenericOutputBlackoilModule<FluidSystem>::
outputCumLog(std::size_t reportStepNum)
{
this->logOutput_.cumulative(reportStepNum);
}
template<class FluidSystem,class Scalar>
void GenericOutputBlackoilModule<FluidSystem,Scalar>::
template<class FluidSystem>
void GenericOutputBlackoilModule<FluidSystem>::
outputProdLog(std::size_t reportStepNum)
{
this->logOutput_.production(reportStepNum);
}
template<class FluidSystem,class Scalar>
void GenericOutputBlackoilModule<FluidSystem,Scalar>::
template<class FluidSystem>
void GenericOutputBlackoilModule<FluidSystem>::
outputInjLog(std::size_t reportStepNum)
{
this->logOutput_.injection(reportStepNum);
}
template<class FluidSystem,class Scalar>
Inplace GenericOutputBlackoilModule<FluidSystem,Scalar>::
template<class FluidSystem>
Inplace GenericOutputBlackoilModule<FluidSystem>::
calc_inplace(std::map<std::string, double>& miscSummaryData,
std::map<std::string, std::vector<double>>& regionData,
const Parallel::Communication& comm)
@ -320,8 +320,8 @@ calc_inplace(std::map<std::string, double>& miscSummaryData,
return inplace;
}
template<class FluidSystem,class Scalar>
void GenericOutputBlackoilModule<FluidSystem,Scalar>::
template<class FluidSystem>
void GenericOutputBlackoilModule<FluidSystem>::
outputFipAndResvLog(const Inplace& inplace,
const std::size_t reportStepNum,
double elapsed,
@ -329,7 +329,6 @@ outputFipAndResvLog(const Inplace& inplace,
const bool substep,
const Parallel::Communication& comm)
{
if (comm.rank() != 0)
return;
@ -372,8 +371,8 @@ outputFipAndResvLog(const Inplace& inplace,
}
}
template<class FluidSystem,class Scalar>
void GenericOutputBlackoilModule<FluidSystem,Scalar>::
template<class FluidSystem>
void GenericOutputBlackoilModule<FluidSystem>::
addRftDataToWells(data::Wells& wellDatas, std::size_t reportStepNum)
{
const auto& rft_config = schedule_[reportStepNum].rft_config();
@ -422,8 +421,8 @@ addRftDataToWells(data::Wells& wellDatas, std::size_t reportStepNum)
gasConnectionSaturations_.clear();
}
template<class FluidSystem, class Scalar>
void GenericOutputBlackoilModule<FluidSystem,Scalar>::
template<class FluidSystem>
void GenericOutputBlackoilModule<FluidSystem>::
assignToSolution(data::Solution& sol)
{
using DataEntry =
@ -703,8 +702,8 @@ assignToSolution(data::Solution& sol)
}
}
template<class FluidSystem,class Scalar>
void GenericOutputBlackoilModule<FluidSystem,Scalar>::
template<class FluidSystem>
void GenericOutputBlackoilModule<FluidSystem>::
setRestart(const data::Solution& sol,
unsigned elemIdx,
unsigned globalDofIndex)
@ -778,9 +777,9 @@ setRestart(const data::Solution& sol,
{ assign(p.first, *p.second); });
}
template<class FluidSystem,class Scalar>
typename GenericOutputBlackoilModule<FluidSystem,Scalar>::ScalarBuffer
GenericOutputBlackoilModule<FluidSystem,Scalar>::
template<class FluidSystem>
typename GenericOutputBlackoilModule<FluidSystem>::ScalarBuffer
GenericOutputBlackoilModule<FluidSystem>::
regionSum(const ScalarBuffer& property,
const std::vector<int>& regionId,
std::size_t maxNumberOfRegions,
@ -813,8 +812,8 @@ regionSum(const ScalarBuffer& property,
return totals;
}
template<class FluidSystem, class Scalar>
void GenericOutputBlackoilModule<FluidSystem,Scalar>::
template<class FluidSystem>
void GenericOutputBlackoilModule<FluidSystem>::
doAllocBuffers(const unsigned bufferSize,
const unsigned reportStepNum,
const bool substep,
@ -1341,8 +1340,8 @@ doAllocBuffers(const unsigned bufferSize,
}
}
template<class FluidSystem,class Scalar>
bool GenericOutputBlackoilModule<FluidSystem,Scalar>::
template<class FluidSystem>
bool GenericOutputBlackoilModule<FluidSystem>::
isOutputCreationDirective_(const std::string& keyword)
{
return (keyword == "BASIC") || (keyword == "FREQ")
@ -1350,8 +1349,8 @@ isOutputCreationDirective_(const std::string& keyword)
|| (keyword == "SAVE") || (keyword == "SFREQ"); // Not really supported
}
template<class FluidSystem,class Scalar>
void GenericOutputBlackoilModule<FluidSystem,Scalar>::
template<class FluidSystem>
void GenericOutputBlackoilModule<FluidSystem>::
outputErrorLog(const Parallel::Communication& comm) const
{
const auto root = 0;
@ -1368,8 +1367,8 @@ outputErrorLog(const Parallel::Communication& comm) const
std::get<0>(globalFailedCellsPdew));
}
template<class FluidSystem,class Scalar>
int GenericOutputBlackoilModule<FluidSystem,Scalar>::
template<class FluidSystem>
int GenericOutputBlackoilModule<FluidSystem>::
regionMax(const std::vector<int>& region,
const Parallel::Communication& comm)
{
@ -1377,8 +1376,8 @@ regionMax(const std::vector<int>& region,
return comm.max(max_value);
}
template<class FluidSystem,class Scalar>
void GenericOutputBlackoilModule<FluidSystem,Scalar>::
template<class FluidSystem>
void GenericOutputBlackoilModule<FluidSystem>::
update(Inplace& inplace,
const std::string& region_name,
const Inplace::Phase phase,
@ -1394,8 +1393,8 @@ update(Inplace& inplace,
inplace.add(phase, sum);
}
template<class FluidSystem,class Scalar>
void GenericOutputBlackoilModule<FluidSystem,Scalar>::
template<class FluidSystem>
void GenericOutputBlackoilModule<FluidSystem>::
makeRegionSum(Inplace& inplace,
const std::string& region_name,
const Parallel::Communication& comm) const
@ -1432,8 +1431,8 @@ makeRegionSum(Inplace& inplace,
}
}
template<class FluidSystem,class Scalar>
Inplace GenericOutputBlackoilModule<FluidSystem,Scalar>::
template<class FluidSystem>
Inplace GenericOutputBlackoilModule<FluidSystem>::
accumulateRegionSums(const Parallel::Communication& comm)
{
Inplace inplace;
@ -1454,15 +1453,16 @@ accumulateRegionSums(const Parallel::Communication& comm)
return inplace;
}
template<class FluidSystem,class Scalar>
Scalar GenericOutputBlackoilModule<FluidSystem,Scalar>::
template<class FluidSystem>
typename GenericOutputBlackoilModule<FluidSystem>::Scalar
GenericOutputBlackoilModule<FluidSystem>::
sum(const ScalarBuffer& v)
{
return std::accumulate(v.begin(), v.end(), Scalar{0});
}
template<class FluidSystem,class Scalar>
void GenericOutputBlackoilModule<FluidSystem,Scalar>::
template<class FluidSystem>
void GenericOutputBlackoilModule<FluidSystem>::
updateSummaryRegionValues(const Inplace& inplace,
std::map<std::string, double>& miscSummaryData,
std::map<std::string, std::vector<double>>& regionData) const
@ -1544,8 +1544,8 @@ updateSummaryRegionValues(const Inplace& inplace,
}
}
template<class FluidSystem,class Scalar>
void GenericOutputBlackoilModule<FluidSystem,Scalar>::
template<class FluidSystem>
void GenericOutputBlackoilModule<FluidSystem>::
setupBlockData(std::function<bool(int)> isCartIdxOnThisRank)
{
for (const auto& node : summaryConfig_) {
@ -1560,8 +1560,8 @@ setupBlockData(std::function<bool(int)> isCartIdxOnThisRank)
}
}
template<class FluidSystem, class Scalar>
void GenericOutputBlackoilModule<FluidSystem,Scalar>::
template<class FluidSystem>
void GenericOutputBlackoilModule<FluidSystem>::
assignGlobalFieldsToSolution(data::Solution& sol)
{
if (!this->cnvData_.empty()) {
@ -1575,6 +1575,6 @@ assignGlobalFieldsToSolution(data::Solution& sol)
}
}
template class GenericOutputBlackoilModule<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,double>;
template class GenericOutputBlackoilModule<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>>;
} // namespace Opm

View File

@ -53,9 +53,11 @@ class SummaryConfig;
class SummaryConfigNode;
class SummaryState;
template<class FluidSystem, class Scalar>
template<class FluidSystem>
class GenericOutputBlackoilModule {
public:
using Scalar = typename FluidSystem::Scalar;
// Virtual destructor for safer inheritance.
virtual ~GenericOutputBlackoilModule();

View File

@ -36,26 +36,26 @@
namespace Opm {
template<class FluidSystem, class Scalar>
MixingRateControls<FluidSystem,Scalar>::
template<class FluidSystem>
MixingRateControls<FluidSystem>::
MixingRateControls(const Schedule& schedule)
: schedule_(schedule)
{}
template<class FluidSystem, class Scalar>
MixingRateControls<FluidSystem,Scalar>::
template<class FluidSystem>
MixingRateControls<FluidSystem>::
MixingRateControls(const MixingRateControls& rhs)
: schedule_(rhs.schedule_)
{
*this = rhs;
}
template<class FluidSystem, class Scalar>
MixingRateControls<FluidSystem,Scalar>
MixingRateControls<FluidSystem,Scalar>::
template<class FluidSystem>
MixingRateControls<FluidSystem>
MixingRateControls<FluidSystem>::
serializationTestObject(const Schedule& schedule)
{
MixingRateControls<FluidSystem,Scalar> result(schedule);
MixingRateControls<FluidSystem> result(schedule);
result.lastRv_ = {21.0};
result.maxDRv_ = {22.0, 23.0};
result.convectiveDrs_ = {24.0, 25.0, 26.0};
@ -66,8 +66,8 @@ serializationTestObject(const Schedule& schedule)
return result;
}
template<class FluidSystem, class Scalar>
bool MixingRateControls<FluidSystem,Scalar>::
template<class FluidSystem>
bool MixingRateControls<FluidSystem>::
operator==(const MixingRateControls& rhs) const
{
return this->lastRv_ == rhs.lastRv_ &&
@ -78,9 +78,9 @@ operator==(const MixingRateControls& rhs) const
this->dRsDtOnlyFreeGas_ == rhs.dRsDtOnlyFreeGas_;
}
template<class FluidSystem, class Scalar>
MixingRateControls<FluidSystem,Scalar>&
MixingRateControls<FluidSystem,Scalar>::
template<class FluidSystem>
MixingRateControls<FluidSystem>&
MixingRateControls<FluidSystem>::
operator=(const MixingRateControls& rhs)
{
this->lastRv_ = rhs.lastRv_;
@ -93,8 +93,8 @@ operator=(const MixingRateControls& rhs)
return *this;
}
template<class FluidSystem, class Scalar>
void MixingRateControls<FluidSystem,Scalar>::
template<class FluidSystem>
void MixingRateControls<FluidSystem>::
init(std::size_t numDof, int episodeIdx, const unsigned ntpvt)
{
// deal with DRSDT
@ -116,8 +116,8 @@ init(std::size_t numDof, int episodeIdx, const unsigned ntpvt)
}
}
template<class FluidSystem, class Scalar>
bool MixingRateControls<FluidSystem,Scalar>::
template<class FluidSystem>
bool MixingRateControls<FluidSystem>::
drsdtActive(int episodeIdx) const
{
const auto& oilVaporizationControl = schedule_[episodeIdx].oilvap();
@ -126,8 +126,8 @@ drsdtActive(int episodeIdx) const
return (oilVaporizationControl.drsdtActive() && bothOilGasActive);
}
template<class FluidSystem, class Scalar>
bool MixingRateControls<FluidSystem,Scalar>::
template<class FluidSystem>
bool MixingRateControls<FluidSystem>::
drvdtActive(int episodeIdx) const
{
const auto& oilVaporizationControl = schedule_[episodeIdx].oilvap();
@ -136,8 +136,8 @@ drvdtActive(int episodeIdx) const
return (oilVaporizationControl.drvdtActive() && bothOilGasActive);
}
template<class FluidSystem, class Scalar>
bool MixingRateControls<FluidSystem,Scalar>::
template<class FluidSystem>
bool MixingRateControls<FluidSystem>::
drsdtConvective(int episodeIdx) const
{
const auto& oilVaporizationControl = schedule_[episodeIdx].oilvap();
@ -146,8 +146,8 @@ drsdtConvective(int episodeIdx) const
return (oilVaporizationControl.drsdtConvective() && bothOilGasActive);
}
template<class FluidSystem, class Scalar>
void MixingRateControls<FluidSystem,Scalar>::
template<class FluidSystem>
void MixingRateControls<FluidSystem>::
updateExplicitQuantities(const int episodeIdx,
const Scalar timeStepSize)
{
@ -165,8 +165,8 @@ updateExplicitQuantities(const int episodeIdx,
}
}
template<class FluidSystem, class Scalar>
void MixingRateControls<FluidSystem,Scalar>::
template<class FluidSystem>
void MixingRateControls<FluidSystem>::
updateLastValues(const unsigned elemIdx,
const Scalar Rs,
const Scalar Rv)
@ -180,8 +180,8 @@ updateLastValues(const unsigned elemIdx,
}
}
template<class FluidSystem, class Scalar>
void MixingRateControls<FluidSystem,Scalar>::
template<class FluidSystem>
void MixingRateControls<FluidSystem>::
updateMaxValues(const int episodeIdx,
const Scalar timeStepSize)
{
@ -201,8 +201,9 @@ updateMaxValues(const int episodeIdx,
}
}
template<class FluidSystem, class Scalar>
Scalar MixingRateControls<FluidSystem,Scalar>::
template<class FluidSystem>
typename MixingRateControls<FluidSystem>::Scalar
MixingRateControls<FluidSystem>::
drsdtcon(const unsigned elemIdx,
int episodeIdx,
const int pvtRegionIdx) const
@ -218,8 +219,9 @@ drsdtcon(const unsigned elemIdx,
return oilVaporizationControl.getMaxDRSDT(pvtRegionIdx) * convectiveDrs_[elemIdx];
}
template<class FluidSystem, class Scalar>
Scalar MixingRateControls<FluidSystem,Scalar>::
template<class FluidSystem>
typename MixingRateControls<FluidSystem>::Scalar
MixingRateControls<FluidSystem>::
maxGasDissolutionFactor(const unsigned timeIdx,
const unsigned globalDofIdx,
const int episodeIdx,
@ -243,8 +245,9 @@ maxGasDissolutionFactor(const unsigned timeIdx,
}
}
template<class FluidSystem, class Scalar>
Scalar MixingRateControls<FluidSystem,Scalar>::
template<class FluidSystem>
typename MixingRateControls<FluidSystem>::Scalar
MixingRateControls<FluidSystem>::
maxOilVaporizationFactor(const unsigned timeIdx,
const unsigned globalDofIdx,
const int episodeIdx,
@ -262,8 +265,9 @@ maxOilVaporizationFactor(const unsigned timeIdx,
return lastRv_[globalDofIdx];
}
}
template<class FluidSystem, class Scalar>
void MixingRateControls<FluidSystem,Scalar>::
template<class FluidSystem>
void MixingRateControls<FluidSystem>::
updateConvectiveDRsDt_(const unsigned compressedDofIdx,
const Scalar t,
const Scalar p,
@ -294,6 +298,6 @@ updateConvectiveDRsDt_(const unsigned compressedDofIdx,
= permz * rssat * max(0.0, deltaDensity) * gravity / (so * visc * distZ * poro);
}
template class MixingRateControls<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>, double>;
template class MixingRateControls<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>>;
} // namespace Opm

View File

@ -41,9 +41,12 @@ namespace Opm {
class EclipseState;
//! \brief Class handling mixing rate controls for a FlowProblem.
template<class FluidSystem, class Scalar>
class MixingRateControls {
template<class FluidSystem>
class MixingRateControls
{
public:
using Scalar = typename FluidSystem::Scalar;
MixingRateControls(const Schedule& schedule);
MixingRateControls(const MixingRateControls& rhs);

View File

@ -112,8 +112,7 @@ class EcfvDiscretization;
* ECL binary format.
*/
template <class TypeTag>
class OutputBlackOilModule : public GenericOutputBlackoilModule<GetPropType<TypeTag, Properties::FluidSystem>,
GetPropType<TypeTag, Properties::Scalar>>
class OutputBlackOilModule : public GenericOutputBlackoilModule<GetPropType<TypeTag, Properties::FluidSystem>>
{
using Simulator = GetPropType<TypeTag, Properties::Simulator>;
using Discretization = GetPropType<TypeTag, Properties::Discretization>;
@ -127,7 +126,7 @@ class OutputBlackOilModule : public GenericOutputBlackoilModule<GetPropType<Type
using GridView = GetPropType<TypeTag, Properties::GridView>;
using Element = typename GridView::template Codim<0>::Entity;
using ElementIterator = typename GridView::template Codim<0>::Iterator;
using BaseType = GenericOutputBlackoilModule<FluidSystem, Scalar>;
using BaseType = GenericOutputBlackoilModule<FluidSystem>;
using Indices = GetPropType<TypeTag, Properties::Indices>;
using Dir = FaceDir::DirEnum;

View File

@ -32,14 +32,12 @@ namespace Opm
template<typename TypeTag>
class MultisegmentWell : public WellInterface<TypeTag>
, public MultisegmentWellEval<GetPropType<TypeTag, Properties::FluidSystem>,
GetPropType<TypeTag, Properties::Indices>,
GetPropType<TypeTag, Properties::Scalar>>
GetPropType<TypeTag, Properties::Indices>>
{
public:
using Base = WellInterface<TypeTag>;
using MSWEval = MultisegmentWellEval<GetPropType<TypeTag, Properties::FluidSystem>,
GetPropType<TypeTag, Properties::Indices>,
GetPropType<TypeTag, Properties::Scalar>>;
GetPropType<TypeTag, Properties::Indices>>;
using typename Base::Simulator;
using typename Base::IntensiveQuantities;

View File

@ -81,8 +81,8 @@ private:
MultisegmentWellEquations<Scalar,numWellEq,numEq>& eqns_; //!< Reference to equation system
};
template<class FluidSystem, class Indices, class Scalar>
void MultisegmentWellAssemble<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void MultisegmentWellAssemble<FluidSystem,Indices>::
assembleControlEq(const WellState& well_state,
const GroupState& group_state,
const Schedule& schedule,
@ -197,8 +197,8 @@ assembleControlEq(const WellState& well_state,
}
}
template<class FluidSystem, class Indices, class Scalar>
void MultisegmentWellAssemble<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void MultisegmentWellAssemble<FluidSystem,Indices>::
assembleAccelerationTerm(const int seg_target,
const int seg,
const int seg_upwind,
@ -222,8 +222,8 @@ assembleAccelerationTerm(const int seg_target,
}
}
template<class FluidSystem, class Indices, class Scalar>
void MultisegmentWellAssemble<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void MultisegmentWellAssemble<FluidSystem,Indices>::
assembleHydroPressureLoss(const int seg,
const int seg_density,
const EvalWell& hydro_pressure_drop_seg,
@ -237,8 +237,8 @@ assembleHydroPressureLoss(const int seg,
}
template<class FluidSystem, class Indices, class Scalar>
void MultisegmentWellAssemble<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void MultisegmentWellAssemble<FluidSystem,Indices>::
assemblePressureEqExtraDerivatives(const int seg,
const int seg_upwind,
const EvalWell& extra_derivatives,
@ -252,8 +252,8 @@ assemblePressureEqExtraDerivatives(const int seg,
}
template<class FluidSystem, class Indices, class Scalar>
void MultisegmentWellAssemble<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void MultisegmentWellAssemble<FluidSystem,Indices>::
assemblePressureEq(const int seg,
const int seg_upwind,
const int outlet_segment_index,
@ -281,8 +281,8 @@ assemblePressureEq(const int seg,
}
}
template<class FluidSystem, class Indices, class Scalar>
void MultisegmentWellAssemble<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void MultisegmentWellAssemble<FluidSystem,Indices>::
assembleTrivialEq(const int seg,
const Scalar value,
Equations& eqns1) const
@ -292,8 +292,8 @@ assembleTrivialEq(const int seg,
eqns.D()[seg][seg][SPres][WQTotal] = 1.;
}
template<class FluidSystem, class Indices, class Scalar>
void MultisegmentWellAssemble<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void MultisegmentWellAssemble<FluidSystem,Indices>::
assembleAccumulationTerm(const int seg,
const int comp_idx,
const EvalWell& accumulation_term,
@ -306,8 +306,8 @@ assembleAccumulationTerm(const int seg,
}
}
template<class FluidSystem, class Indices, class Scalar>
void MultisegmentWellAssemble<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void MultisegmentWellAssemble<FluidSystem,Indices>::
assembleOutflowTerm(const int seg,
const int seg_upwind,
const int comp_idx,
@ -326,8 +326,8 @@ assembleOutflowTerm(const int seg,
// pressure derivative should be zero
}
template<class FluidSystem, class Indices, class Scalar>
void MultisegmentWellAssemble<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void MultisegmentWellAssemble<FluidSystem,Indices>::
assembleInflowTerm(const int seg,
const int inlet,
const int inlet_upwind,
@ -347,8 +347,8 @@ assembleInflowTerm(const int seg,
// pressure derivative should be zero
}
template<class FluidSystem, class Indices, class Scalar>
void MultisegmentWellAssemble<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void MultisegmentWellAssemble<FluidSystem,Indices>::
assemblePerforationEq(const int seg,
const int cell_idx,
const int comp_idx,
@ -375,7 +375,7 @@ assemblePerforationEq(const int seg,
}
#define INSTANCE(...) \
template class MultisegmentWellAssemble<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,__VA_ARGS__,double>;
template class MultisegmentWellAssemble<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,__VA_ARGS__>;
// One phase
INSTANCE(BlackOilOnePhaseIndices<0u,0u,0u,0u,false,false,0u,1u,0u>)

View File

@ -32,14 +32,14 @@ namespace Opm
class DeferredLogger;
class GroupState;
template<class Scalar, int numWellEq, int numEq> class MultisegmentWellEquations;
template<class FluidSystem, class Indices, class Scalar> class MultisegmentWellPrimaryVariables;
template<class FluidSystem, class Indices> class MultisegmentWellPrimaryVariables;
class Schedule;
class SummaryState;
template<class FluidSystem, class Indices, class Scalar> class WellInterfaceIndices;
template<class FluidSystem, class Indices> class WellInterfaceIndices;
class WellState;
//! \brief Class handling assemble of the equation system for MultisegmentWell.
template<class FluidSystem, class Indices, class Scalar>
template<class FluidSystem, class Indices>
class MultisegmentWellAssemble
{
static constexpr bool has_water = (Indices::waterSwitchIdx >= 0);
@ -59,12 +59,13 @@ class MultisegmentWellAssemble
public:
static constexpr int numWellEq = Indices::numPhases+1;
using Scalar = typename FluidSystem::Scalar;
using Equations = MultisegmentWellEquations<Scalar,numWellEq,Indices::numEq>;
using PrimaryVariables = MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>;
using PrimaryVariables = MultisegmentWellPrimaryVariables<FluidSystem,Indices>;
using EvalWell = DenseAd::Evaluation<Scalar, numWellEq+Indices::numEq>;
//! \brief Constructor initializes reference to well.
MultisegmentWellAssemble(const WellInterfaceIndices<FluidSystem,Indices,Scalar>& well)
MultisegmentWellAssemble(const WellInterfaceIndices<FluidSystem,Indices>& well)
: well_(well)
{}
@ -143,7 +144,7 @@ public:
Equations& eqns) const;
private:
const WellInterfaceIndices<FluidSystem,Indices,Scalar>& well_; //!< Reference to well
const WellInterfaceIndices<FluidSystem,Indices>& well_; //!< Reference to well
};
}

View File

@ -51,9 +51,9 @@
namespace Opm
{
template<typename FluidSystem, typename Indices, typename Scalar>
MultisegmentWellEval<FluidSystem,Indices,Scalar>::
MultisegmentWellEval(WellInterfaceIndices<FluidSystem,Indices,Scalar>& baseif)
template<typename FluidSystem, typename Indices>
MultisegmentWellEval<FluidSystem,Indices>::
MultisegmentWellEval(WellInterfaceIndices<FluidSystem,Indices>& baseif)
: MultisegmentWellGeneric<Scalar>(baseif)
, baseif_(baseif)
, linSys_(*this)
@ -64,9 +64,9 @@ MultisegmentWellEval(WellInterfaceIndices<FluidSystem,Indices,Scalar>& baseif)
{
}
template<typename FluidSystem, typename Indices, typename Scalar>
template<typename FluidSystem, typename Indices>
void
MultisegmentWellEval<FluidSystem,Indices,Scalar>::
MultisegmentWellEval<FluidSystem,Indices>::
initMatrixAndVectors(const int num_cells)
{
linSys_.init(num_cells, baseif_.numPerfs(),
@ -75,9 +75,9 @@ initMatrixAndVectors(const int num_cells)
primary_variables_.resize(this->numberOfSegments());
}
template<typename FluidSystem, typename Indices, typename Scalar>
template<typename FluidSystem, typename Indices>
ConvergenceReport
MultisegmentWellEval<FluidSystem,Indices,Scalar>::
MultisegmentWellEval<FluidSystem,Indices>::
getWellConvergence(const WellState& well_state,
const std::vector<double>& B_avg,
DeferredLogger& deferred_logger,
@ -182,9 +182,9 @@ getWellConvergence(const WellState& well_state,
return report;
}
template<typename FluidSystem, typename Indices, typename Scalar>
typename MultisegmentWellEval<FluidSystem,Indices,Scalar>::EvalWell
MultisegmentWellEval<FluidSystem,Indices,Scalar>::
template<typename FluidSystem, typename Indices>
typename MultisegmentWellEval<FluidSystem,Indices>::EvalWell
MultisegmentWellEval<FluidSystem,Indices>::
extendEval(const Eval& in) const
{
EvalWell out = 0.0;
@ -195,9 +195,9 @@ extendEval(const Eval& in) const
return out;
}
template<typename FluidSystem, typename Indices, typename Scalar>
template<typename FluidSystem, typename Indices>
void
MultisegmentWellEval<FluidSystem,Indices,Scalar>::
MultisegmentWellEval<FluidSystem,Indices>::
assembleAccelerationPressureLoss(const int seg,
WellState& well_state)
{
@ -242,10 +242,9 @@ assembleAccelerationPressureLoss(const int seg,
}
}
template<typename FluidSystem, typename Indices, typename Scalar>
template<typename FluidSystem, typename Indices>
void
MultisegmentWellEval<FluidSystem,Indices,Scalar>::
MultisegmentWellEval<FluidSystem,Indices>::
assembleDefaultPressureEq(const int seg,
WellState& well_state,
const bool use_average_density)
@ -289,9 +288,9 @@ assembleDefaultPressureEq(const int seg,
assembleAccelerationAndHydroPressureLosses(seg, well_state, use_average_density);
}
template<typename FluidSystem, typename Indices, typename Scalar>
template<typename FluidSystem, typename Indices>
void
MultisegmentWellEval<FluidSystem,Indices,Scalar>::
MultisegmentWellEval<FluidSystem,Indices>::
assembleICDPressureEq(const int seg,
const UnitSystem& unit_system,
WellState& well_state,
@ -374,9 +373,9 @@ assembleICDPressureEq(const int seg,
assembleAccelerationAndHydroPressureLosses(seg, well_state, use_average_density);
}
template<typename FluidSystem, typename Indices, typename Scalar>
template<typename FluidSystem, typename Indices>
void
MultisegmentWellEval<FluidSystem,Indices,Scalar>::
MultisegmentWellEval<FluidSystem,Indices>::
assembleAccelerationAndHydroPressureLosses(const int seg,
WellState& well_state,
const bool use_average_density)
@ -405,9 +404,9 @@ assembleAccelerationAndHydroPressureLosses(const int seg,
}
}
template<typename FluidSystem, typename Indices, typename Scalar>
template<typename FluidSystem, typename Indices>
void
MultisegmentWellEval<FluidSystem,Indices,Scalar>::
MultisegmentWellEval<FluidSystem,Indices>::
assemblePressureEq(const int seg,
const UnitSystem& unit_system,
WellState& well_state,
@ -427,9 +426,9 @@ assemblePressureEq(const int seg,
}
}
template<typename FluidSystem, typename Indices, typename Scalar>
std::pair<bool, std::vector<Scalar> >
MultisegmentWellEval<FluidSystem,Indices,Scalar>::
template<typename FluidSystem, typename Indices>
std::pair<bool, std::vector<typename FluidSystem::Scalar> >
MultisegmentWellEval<FluidSystem,Indices>::
getFiniteWellResiduals(const std::vector<Scalar>& B_avg,
DeferredLogger& deferred_logger) const
{
@ -471,9 +470,9 @@ getFiniteWellResiduals(const std::vector<Scalar>& B_avg,
return {true, residuals};
}
template<typename FluidSystem, typename Indices, typename Scalar>
template<typename FluidSystem, typename Indices>
double
MultisegmentWellEval<FluidSystem,Indices,Scalar>::
MultisegmentWellEval<FluidSystem,Indices>::
getControlTolerance(const WellState& well_state,
const double tolerance_wells,
const double tolerance_pressure_ms_wells,
@ -538,9 +537,9 @@ getControlTolerance(const WellState& well_state,
return control_tolerance;
}
template<typename FluidSystem, typename Indices, typename Scalar>
template<typename FluidSystem, typename Indices>
double
MultisegmentWellEval<FluidSystem,Indices,Scalar>::
MultisegmentWellEval<FluidSystem,Indices>::
getResidualMeasureValue(const WellState& well_state,
const std::vector<double>& residuals,
const double tolerance_wells,
@ -578,7 +577,7 @@ getResidualMeasureValue(const WellState& well_state,
}
#define INSTANCE(...) \
template class MultisegmentWellEval<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,__VA_ARGS__,double>;
template class MultisegmentWellEval<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,__VA_ARGS__>;
// One phase
INSTANCE(BlackOilOnePhaseIndices<0u,0u,0u,0u,false,false,0u,1u,0u>)
@ -597,6 +596,7 @@ INSTANCE(BlackOilTwoPhaseIndices<0u,0u,0u,0u,false,true,0u,0u,0u>)
INSTANCE(BlackOilTwoPhaseIndices<0u,0u,0u,1u,false,false,0u,0u,0u>)
INSTANCE(BlackOilTwoPhaseIndices<0u,0u,0u,1u,false,true,0u,0u,0u>)
INSTANCE(BlackOilTwoPhaseIndices<1u,0u,0u,0u,false,false,0u,0u,0u>)
// Blackoil
INSTANCE(BlackOilIndices<0u,0u,0u,0u,false,false,0u,0u>)
INSTANCE(BlackOilIndices<0u,0u,0u,0u,true,false,0u,0u>)
@ -608,6 +608,6 @@ INSTANCE(BlackOilIndices<0u,0u,1u,0u,false,false,0u,0u>)
INSTANCE(BlackOilIndices<0u,0u,0u,1u,false,false,0u,0u>)
INSTANCE(BlackOilIndices<0u,0u,0u,0u,false,false,1u,0u>)
INSTANCE(BlackOilIndices<0u,0u,0u,1u,false,true,0u,0u>)
INSTANCE(BlackOilIndices<1u,0u,0u,0u,true,false,0u,0u>)
} // namespace Opm

View File

@ -43,20 +43,21 @@ class Schedule;
class WellContributions;
class SummaryState;
template<class FluidSystem, class Indices, class Scalar> class WellInterfaceIndices;
template<class FluidSystem, class Indices> class WellInterfaceIndices;
class WellState;
template<typename FluidSystem, typename Indices, typename Scalar>
class MultisegmentWellEval : public MultisegmentWellGeneric<Scalar>
template<typename FluidSystem, typename Indices>
class MultisegmentWellEval : public MultisegmentWellGeneric<typename FluidSystem::Scalar>
{
protected:
using PrimaryVariables = MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>;
using Scalar = typename FluidSystem::Scalar;
using PrimaryVariables = MultisegmentWellPrimaryVariables<FluidSystem,Indices>;
static constexpr int numWellEq = PrimaryVariables::numWellEq;
static constexpr int SPres = PrimaryVariables::SPres;
static constexpr int WQTotal = PrimaryVariables::WQTotal;
using Equations = MultisegmentWellEquations<Scalar,numWellEq,Indices::numEq>;
using MSWSegments = MultisegmentWellSegments<FluidSystem,Indices,Scalar>;
using MSWSegments = MultisegmentWellSegments<FluidSystem,Indices>;
using BVector = typename Equations::BVector;
using BVectorWell = typename Equations::BVectorWell;
@ -73,7 +74,7 @@ public:
{ return linSys_; }
protected:
MultisegmentWellEval(WellInterfaceIndices<FluidSystem,Indices,Scalar>& baseif);
MultisegmentWellEval(WellInterfaceIndices<FluidSystem,Indices>& baseif);
void initMatrixAndVectors(const int num_cells);
@ -137,7 +138,7 @@ protected:
// convert a Eval from reservoir to contain the derivative related to wells
EvalWell extendEval(const Eval& in) const;
const WellInterfaceIndices<FluidSystem,Indices,Scalar>& baseif_;
const WellInterfaceIndices<FluidSystem,Indices>& baseif_;
Equations linSys_; //!< The equation system
PrimaryVariables primary_variables_; //!< The primary variables

View File

@ -44,16 +44,16 @@
namespace Opm {
template<class FluidSystem, class Indices, class Scalar>
void MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void MultisegmentWellPrimaryVariables<FluidSystem,Indices>::
resize(const int numSegments)
{
value_.resize(numSegments);
evaluation_.resize(numSegments);
}
template<class FluidSystem, class Indices, class Scalar>
void MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void MultisegmentWellPrimaryVariables<FluidSystem,Indices>::
init()
{
for (std::size_t seg = 0; seg < value_.size(); ++seg) {
@ -65,8 +65,8 @@ init()
}
}
template<class FluidSystem, class Indices, class Scalar>
void MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void MultisegmentWellPrimaryVariables<FluidSystem,Indices>::
update(const WellState& well_state, const bool stop_or_zero_rate_target)
{
static constexpr int Water = BlackoilPhases::Aqua;
@ -153,8 +153,8 @@ update(const WellState& well_state, const bool stop_or_zero_rate_target)
}
}
template<class FluidSystem, class Indices, class Scalar>
void MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void MultisegmentWellPrimaryVariables<FluidSystem,Indices>::
updateNewton(const BVectorWell& dwells,
const double relaxation_factor,
const double dFLimit,
@ -209,8 +209,8 @@ updateNewton(const BVectorWell& dwells,
}
}
template<class FluidSystem, class Indices, class Scalar>
void MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void MultisegmentWellPrimaryVariables<FluidSystem,Indices>::
copyToWellState(const MultisegmentWellGeneric<Scalar>& mswell,
const double rho,
const bool stop_or_zero_rate_target,
@ -410,8 +410,8 @@ copyToWellState(const MultisegmentWellGeneric<Scalar>& mswell,
well_state, summary_state, deferred_logger);
}
template<class FluidSystem, class Indices, class Scalar>
void MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void MultisegmentWellPrimaryVariables<FluidSystem,Indices>::
processFractions(const int seg)
{
static constexpr int Water = BlackoilPhases::Aqua;
@ -479,9 +479,9 @@ processFractions(const int seg)
}
}
template<typename FluidSystem, typename Indices, typename Scalar>
typename MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::EvalWell
MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::
template<typename FluidSystem, typename Indices>
typename MultisegmentWellPrimaryVariables<FluidSystem,Indices>::EvalWell
MultisegmentWellPrimaryVariables<FluidSystem,Indices>::
volumeFraction(const int seg,
const unsigned compIdx) const
{
@ -514,9 +514,9 @@ volumeFraction(const int seg,
return oil_fraction;
}
template<class FluidSystem, class Indices, class Scalar>
typename MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::EvalWell
MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
typename MultisegmentWellPrimaryVariables<FluidSystem,Indices>::EvalWell
MultisegmentWellPrimaryVariables<FluidSystem,Indices>::
volumeFractionScaled(const int seg,
const int comp_idx) const
{
@ -531,9 +531,9 @@ volumeFractionScaled(const int seg,
return this->volumeFraction(seg, comp_idx);
}
template<class FluidSystem, class Indices, class Scalar>
typename MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::EvalWell
MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
typename MultisegmentWellPrimaryVariables<FluidSystem,Indices>::EvalWell
MultisegmentWellPrimaryVariables<FluidSystem,Indices>::
surfaceVolumeFraction(const int seg,
const int comp_idx) const
{
@ -547,9 +547,9 @@ surfaceVolumeFraction(const int seg,
return this->volumeFractionScaled(seg, comp_idx) / sum_volume_fraction_scaled;
}
template<class FluidSystem, class Indices, class Scalar>
typename MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::EvalWell
MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
typename MultisegmentWellPrimaryVariables<FluidSystem,Indices>::EvalWell
MultisegmentWellPrimaryVariables<FluidSystem,Indices>::
getSegmentRateUpwinding(const int seg,
const int seg_upwind,
const std::size_t comp_idx) const
@ -587,50 +587,50 @@ getSegmentRateUpwinding(const int seg,
return segment_rate;
}
template<class FluidSystem, class Indices, class Scalar>
typename MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::EvalWell
MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
typename MultisegmentWellPrimaryVariables<FluidSystem,Indices>::EvalWell
MultisegmentWellPrimaryVariables<FluidSystem,Indices>::
getSegmentPressure(const int seg) const
{
return evaluation_[seg][SPres];
}
template<class FluidSystem, class Indices, class Scalar>
typename MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::EvalWell
MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
typename MultisegmentWellPrimaryVariables<FluidSystem,Indices>::EvalWell
MultisegmentWellPrimaryVariables<FluidSystem,Indices>::
getBhp() const
{
return this->getSegmentPressure(0);
}
template<class FluidSystem, class Indices, class Scalar>
typename MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::EvalWell
MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
typename MultisegmentWellPrimaryVariables<FluidSystem,Indices>::EvalWell
MultisegmentWellPrimaryVariables<FluidSystem,Indices>::
getSegmentRate(const int seg,
const int comp_idx) const
{
return evaluation_[seg][WQTotal] * this->volumeFractionScaled(seg, comp_idx);
}
template<class FluidSystem, class Indices, class Scalar>
typename MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::EvalWell
MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
typename MultisegmentWellPrimaryVariables<FluidSystem,Indices>::EvalWell
MultisegmentWellPrimaryVariables<FluidSystem,Indices>::
getQs(const int comp_idx) const
{
return this->getSegmentRate(0, comp_idx);
}
template<class FluidSystem, class Indices, class Scalar>
typename MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::EvalWell
MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
typename MultisegmentWellPrimaryVariables<FluidSystem,Indices>::EvalWell
MultisegmentWellPrimaryVariables<FluidSystem,Indices>::
getWQTotal() const
{
return evaluation_[0][WQTotal];
}
template<class FluidSystem, class Indices, class Scalar>
template<class FluidSystem, class Indices>
void
MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::
MultisegmentWellPrimaryVariables<FluidSystem,Indices>::
outputLowLimitPressureSegments(DeferredLogger& deferred_logger) const
{
std::string msg = fmt::format("outputting the segments for well {} with pressures close to the lower limits "
@ -650,7 +650,7 @@ outputLowLimitPressureSegments(DeferredLogger& deferred_logger) const
}
#define INSTANCE(...) \
template class MultisegmentWellPrimaryVariables<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,__VA_ARGS__,double>;
template class MultisegmentWellPrimaryVariables<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,__VA_ARGS__>;
// One phase
INSTANCE(BlackOilOnePhaseIndices<0u,0u,0u,0u,false,false,0u,1u,0u>)

View File

@ -37,10 +37,10 @@ namespace Opm
class DeferredLogger;
template<class Scalar> class MultisegmentWellGeneric;
template<class FluidSystem, class Indices, class Scalar> class WellInterfaceIndices;
template<class FluidSystem, class Indices> class WellInterfaceIndices;
class WellState;
template<class FluidSystem, class Indices, class Scalar>
template<class FluidSystem, class Indices>
class MultisegmentWellPrimaryVariables
{
public:
@ -75,12 +75,13 @@ public:
// the number of well equations TODO: it should have a more general strategy for it
static constexpr int numWellEq = Indices::numPhases + 1;
using Scalar = typename FluidSystem::Scalar;
using EvalWell = DenseAd::Evaluation<double, /*size=*/Indices::numEq + numWellEq>;
using Equations = MultisegmentWellEquations<Scalar,numWellEq,Indices::numEq>;
using BVectorWell = typename Equations::BVectorWell;
MultisegmentWellPrimaryVariables(const WellInterfaceIndices<FluidSystem,Indices,Scalar>& well)
MultisegmentWellPrimaryVariables(const WellInterfaceIndices<FluidSystem,Indices>& well)
: well_(well)
{}
@ -170,7 +171,7 @@ private:
//! \details Contains derivatives and are used in AD calculation
std::vector<std::array<EvalWell, numWellEq>> evaluation_;
const WellInterfaceIndices<FluidSystem,Indices,Scalar>& well_; //!< Reference to well interface
const WellInterfaceIndices<FluidSystem,Indices>& well_; //!< Reference to well interface
static constexpr double bhp_lower_limit = 1. * unit::barsa - 1. * unit::Pascal;
static constexpr double seg_pres_lower_limit = 0.;

View File

@ -58,8 +58,8 @@
namespace Opm
{
template<class FluidSystem, class Indices, class Scalar>
MultisegmentWellSegments<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
MultisegmentWellSegments<FluidSystem,Indices>::
MultisegmentWellSegments(const int numSegments,
WellInterfaceGeneric& well)
: perforations_(numSegments)
@ -129,8 +129,8 @@ MultisegmentWellSegments(const int numSegments,
}
}
template<class FluidSystem, class Indices, class Scalar>
void MultisegmentWellSegments<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void MultisegmentWellSegments<FluidSystem,Indices>::
computeFluidProperties(const EvalWell& temperature,
const EvalWell& saltConcentration,
const PrimaryVariables& primary_variables,
@ -306,8 +306,8 @@ computeFluidProperties(const EvalWell& temperature,
}
}
template<class FluidSystem, class Indices, class Scalar>
void MultisegmentWellSegments<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void MultisegmentWellSegments<FluidSystem,Indices>::
updateUpwindingSegments(const PrimaryVariables& primary_variables)
{
for (std::size_t seg = 0; seg < perforations_.size(); ++seg) {
@ -331,26 +331,27 @@ updateUpwindingSegments(const PrimaryVariables& primary_variables)
}
}
template<class FluidSystem, class Indices, class Scalar>
typename MultisegmentWellSegments<FluidSystem,Indices,Scalar>::EvalWell
MultisegmentWellSegments<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
typename MultisegmentWellSegments<FluidSystem,Indices>::EvalWell
MultisegmentWellSegments<FluidSystem,Indices>::
getHydroPressureLoss(const int seg,
const int seg_density) const
{
return densities_[seg_density] * well_.gravity() * depth_diffs_[seg];
}
template<class FluidSystem, class Indices, class Scalar>
Scalar MultisegmentWellSegments<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
typename MultisegmentWellSegments<FluidSystem,Indices>::Scalar
MultisegmentWellSegments<FluidSystem,Indices>::
getPressureDiffSegPerf(const int seg,
const int perf) const
{
return well_.gravity() * densities_[seg].value() * perforation_depth_diffs_[perf];
}
template<class FluidSystem, class Indices, class Scalar>
typename MultisegmentWellSegments<FluidSystem,Indices,Scalar>::EvalWell
MultisegmentWellSegments<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
typename MultisegmentWellSegments<FluidSystem,Indices>::EvalWell
MultisegmentWellSegments<FluidSystem,Indices>::
getSurfaceVolume(const EvalWell& temperature,
const EvalWell& saltConcentration,
const PrimaryVariables& primary_variables,
@ -495,9 +496,9 @@ getSurfaceVolume(const EvalWell& temperature,
return volume / vol_ratio;
}
template<class FluidSystem, class Indices, class Scalar>
typename MultisegmentWellSegments<FluidSystem,Indices,Scalar>::EvalWell
MultisegmentWellSegments<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
typename MultisegmentWellSegments<FluidSystem,Indices>::EvalWell
MultisegmentWellSegments<FluidSystem,Indices>::
getFrictionPressureLoss(const int seg,
const bool extra_reverse_flow_derivatives /*false*/) const
{
@ -547,9 +548,9 @@ getFrictionPressureLoss(const int seg,
return sign * mswellhelpers::frictionPressureLoss(length, diameter, area, roughness, density, mass_rate, visc);
}
template<class FluidSystem, class Indices, class Scalar>
typename MultisegmentWellSegments<FluidSystem,Indices,Scalar>::EvalWell
MultisegmentWellSegments<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
typename MultisegmentWellSegments<FluidSystem,Indices>::EvalWell
MultisegmentWellSegments<FluidSystem,Indices>::
pressureDropSpiralICD(const int seg,
const bool extra_reverse_flow_derivatives /*false*/) const
{
@ -651,9 +652,9 @@ pressureDropSpiralICD(const int seg,
return sign * temp_value1 * temp_value2 * strength * reservoir_rate_icd * reservoir_rate_icd;
}
template<class FluidSystem, class Indices, class Scalar>
typename MultisegmentWellSegments<FluidSystem,Indices,Scalar>::EvalWell
MultisegmentWellSegments<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
typename MultisegmentWellSegments<FluidSystem,Indices>::EvalWell
MultisegmentWellSegments<FluidSystem,Indices>::
pressureDropAutoICD(const int seg,
const UnitSystem& unit_system,
const bool extra_reverse_flow_derivatives /*false*/) const
@ -765,9 +766,9 @@ pressureDropAutoICD(const int seg,
return result;
}
template<class FluidSystem, class Indices, class Scalar>
typename MultisegmentWellSegments<FluidSystem,Indices,Scalar>::EvalWell
MultisegmentWellSegments<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
typename MultisegmentWellSegments<FluidSystem,Indices>::EvalWell
MultisegmentWellSegments<FluidSystem,Indices>::
pressureDropValve(const int seg,
const SummaryState& summary_state,
const bool extra_reverse_flow_derivatives /*false*/) const
@ -826,9 +827,9 @@ pressureDropValve(const int seg,
return sign * (friction_pressure_loss + constriction_pressure_loss);
}
template<class FluidSystem, class Indices, class Scalar>
typename MultisegmentWellSegments<FluidSystem,Indices,Scalar>::EvalWell
MultisegmentWellSegments<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
typename MultisegmentWellSegments<FluidSystem,Indices>::EvalWell
MultisegmentWellSegments<FluidSystem,Indices>::
accelerationPressureLossContribution(const int seg,
const double area,
const bool extra_reverse_flow_derivatives /*false*/) const
@ -860,9 +861,9 @@ accelerationPressureLossContribution(const int seg,
return sign*mswellhelpers::velocityHead(area, mass_rate, density);
}
template <class FluidSystem, class Indices, class Scalar>
template <class FluidSystem, class Indices>
void
MultisegmentWellSegments<FluidSystem,Indices,Scalar>::
MultisegmentWellSegments<FluidSystem,Indices>::
copyPhaseDensities(const PhaseUsage& pu, SegmentState& segSol) const
{
auto* rho = segSol.phase_density.data();
@ -895,9 +896,9 @@ copyPhaseDensities(const PhaseUsage& pu, SegmentState& segSol) const
}
}
template <class FluidSystem, class Indices, class Scalar>
template <class FluidSystem, class Indices>
void
MultisegmentWellSegments<FluidSystem,Indices,Scalar>::
MultisegmentWellSegments<FluidSystem,Indices>::
copyPhaseDensities(const unsigned phaseIdx,
const std::size_t stride,
double* dens) const
@ -911,9 +912,9 @@ copyPhaseDensities(const unsigned phaseIdx,
}
}
template <class FluidSystem, class Indices, class Scalar>
template <class FluidSystem, class Indices>
double
MultisegmentWellSegments<FluidSystem,Indices,Scalar>::
MultisegmentWellSegments<FluidSystem,Indices>::
mixtureDensity(const int seg) const
{
auto mixDens = 0.0;
@ -940,9 +941,9 @@ mixtureDensity(const int seg) const
return mixDens;
}
template <class FluidSystem, class Indices, class Scalar>
template <class FluidSystem, class Indices>
double
MultisegmentWellSegments<FluidSystem,Indices,Scalar>::
MultisegmentWellSegments<FluidSystem,Indices>::
mixtureDensityWithExponents(const int seg) const
{
if (const auto& segment = this->well_.wellEcl().getSegments()[seg];
@ -956,9 +957,9 @@ mixtureDensityWithExponents(const int seg) const
return this->mixtureDensity(seg);
}
template <class FluidSystem, class Indices, class Scalar>
template <class FluidSystem, class Indices>
double
MultisegmentWellSegments<FluidSystem,Indices,Scalar>::
MultisegmentWellSegments<FluidSystem,Indices>::
mixtureDensityWithExponents(const AutoICD& aicd, const int seg) const
{
auto mixDens = 0.0;
@ -988,7 +989,7 @@ mixtureDensityWithExponents(const AutoICD& aicd, const int seg) const
}
#define INSTANCE(...) \
template class MultisegmentWellSegments<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,__VA_ARGS__,double>;
template class MultisegmentWellSegments<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,__VA_ARGS__>;
// One phase
INSTANCE(BlackOilOnePhaseIndices<0u,0u,0u,0u,false,false,0u,1u,0u>)
@ -1007,6 +1008,7 @@ INSTANCE(BlackOilTwoPhaseIndices<0u,0u,0u,0u,false,true,0u,0u,0u>)
INSTANCE(BlackOilTwoPhaseIndices<0u,0u,0u,1u,false,false,0u,0u,0u>)
INSTANCE(BlackOilTwoPhaseIndices<0u,0u,0u,1u,false,true,0u,0u,0u>)
INSTANCE(BlackOilTwoPhaseIndices<1u,0u,0u,0u,false,false,0u,0u,0u>)
// Blackoil
INSTANCE(BlackOilIndices<0u,0u,0u,0u,false,false,0u,0u>)
INSTANCE(BlackOilIndices<0u,0u,0u,0u,true,false,0u,0u>)

View File

@ -40,10 +40,11 @@ namespace Opm {
namespace Opm {
template<typename FluidSystem, typename Indices, typename Scalar>
template<typename FluidSystem, typename Indices>
class MultisegmentWellSegments
{
using PrimaryVariables = MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>;
using PrimaryVariables = MultisegmentWellPrimaryVariables<FluidSystem,Indices>;
using Scalar = typename FluidSystem::Scalar;
using EvalWell = typename PrimaryVariables::EvalWell;
public:

View File

@ -60,7 +60,7 @@ namespace Opm
const int index_of_well,
const std::vector<PerforationData>& perf_data)
: Base(well, pw_info, time_step, param, rate_converter, pvtRegionIdx, num_components, num_phases, index_of_well, perf_data)
, MSWEval(static_cast<WellInterfaceIndices<FluidSystem,Indices,Scalar>&>(*this))
, MSWEval(static_cast<WellInterfaceIndices<FluidSystem,Indices>&>(*this))
, regularize_(false)
, segment_fluid_initial_(this->numberOfSegments(), std::vector<double>(this->num_components_, 0.0))
{

View File

@ -55,15 +55,13 @@ namespace Opm
template<typename TypeTag>
class StandardWell : public WellInterface<TypeTag>
, public StandardWellEval<GetPropType<TypeTag, Properties::FluidSystem>,
GetPropType<TypeTag, Properties::Indices>,
GetPropType<TypeTag, Properties::Scalar>>
GetPropType<TypeTag, Properties::Indices>>
{
public:
using Base = WellInterface<TypeTag>;
using StdWellEval = StandardWellEval<GetPropType<TypeTag, Properties::FluidSystem>,
GetPropType<TypeTag, Properties::Indices>,
GetPropType<TypeTag, Properties::Scalar>>;
GetPropType<TypeTag, Properties::Indices>>;
// TODO: some functions working with AD variables handles only with values (double) without
// dealing with derivatives. It can be beneficial to make functions can work with either AD or scalar value.

View File

@ -81,9 +81,9 @@ private:
StandardWellEquations<Scalar,numEq>& eqns_; //!< Reference to equation system
};
template<class FluidSystem, class Indices, class Scalar>
template<class FluidSystem, class Indices>
void
StandardWellAssemble<FluidSystem,Indices,Scalar>::
StandardWellAssemble<FluidSystem,Indices>::
assembleControlEq(const WellState& well_state,
const GroupState& group_state,
const Schedule& schedule,
@ -180,8 +180,8 @@ assembleControlEq(const WellState& well_state,
}
}
template<class FluidSystem, class Indices, class Scalar>
void StandardWellAssemble<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void StandardWellAssemble<FluidSystem,Indices>::
assembleInjectivityEq(const EvalWell& eq_pskin,
const EvalWell& eq_wat_vel,
const int pskin_index,
@ -204,8 +204,8 @@ assembleInjectivityEq(const EvalWell& eq_pskin,
}
}
template<class FluidSystem, class Indices, class Scalar>
void StandardWellAssemble<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void StandardWellAssemble<FluidSystem,Indices>::
assemblePerforationEq(const EvalWell& cq_s_effective,
const int componentIdx,
const int cell_idx,
@ -229,8 +229,8 @@ assemblePerforationEq(const EvalWell& cq_s_effective,
}
}
template<class FluidSystem, class Indices, class Scalar>
void StandardWellAssemble<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void StandardWellAssemble<FluidSystem,Indices>::
assembleSourceEq(const EvalWell& resWell_loc,
const int componentIdx,
const int numWellEq,
@ -243,8 +243,8 @@ assembleSourceEq(const EvalWell& resWell_loc,
eqns.residual()[0][componentIdx] += resWell_loc.value();
}
template<class FluidSystem, class Indices, class Scalar>
void StandardWellAssemble<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void StandardWellAssemble<FluidSystem,Indices>::
assembleZFracEq(const EvalWell& cq_s_zfrac_effective,
const int cell_idx,
const int numWellEq,
@ -257,7 +257,7 @@ assembleZFracEq(const EvalWell& cq_s_zfrac_effective,
}
#define INSTANCE(Dim,...) \
template class StandardWellAssemble<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,__VA_ARGS__,double>;
template class StandardWellAssemble<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,__VA_ARGS__>;
// One phase
INSTANCE(4u, BlackOilOnePhaseIndices<0u,0u,0u,0u,false,false,0u,1u,0u>)

View File

@ -32,17 +32,18 @@ class DeferredLogger;
class GroupState;
class Schedule;
template<class Scalar, int numEq> class StandardWellEquations;
template<class FluidSystem, class Indices, class Scalar> class StandardWellPrimaryVariables;
template<class FluidSystem, class Indices> class StandardWellPrimaryVariables;
class SummaryState;
template<class FluidSystem> class WellInterfaceFluidSystem;
class WellState;
//! \brief Class handling assemble of the equation system for StandardWell.
template<class FluidSystem, class Indices, class Scalar>
template<class FluidSystem, class Indices>
class StandardWellAssemble
{
public:
using PrimaryVariables = StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>;
using Scalar = typename FluidSystem::Scalar;
using PrimaryVariables = StandardWellPrimaryVariables<FluidSystem,Indices>;
using EvalWell = typename PrimaryVariables::EvalWell;
//! \brief Constructor initializes reference to well.

View File

@ -43,17 +43,17 @@
namespace Opm
{
template<class FluidSystem, class Indices, class Scalar>
StandardWellConnections<FluidSystem,Indices,Scalar>::
StandardWellConnections(const WellInterfaceIndices<FluidSystem,Indices,Scalar>& well)
template<class FluidSystem, class Indices>
StandardWellConnections<FluidSystem,Indices>::
StandardWellConnections(const WellInterfaceIndices<FluidSystem,Indices>& well)
: well_(well)
, perf_densities_(well.numPerfs())
, perf_pressure_diffs_(well.numPerfs())
{
}
template<class FluidSystem, class Indices, class Scalar>
void StandardWellConnections<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void StandardWellConnections<FluidSystem,Indices>::
computePressureDelta()
{
// Algorithm:
@ -88,8 +88,8 @@ computePressureDelta()
well_.parallelWellInfo().partialSumPerfValues(beg, end);
}
template<class FluidSystem, class Indices, class Scalar>
void StandardWellConnections<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void StandardWellConnections<FluidSystem,Indices>::
computeDensities(const std::vector<Scalar>& perfComponentRates,
const Properties& props,
DeferredLogger& deferred_logger)
@ -285,8 +285,8 @@ computeDensities(const std::vector<Scalar>& perfComponentRates,
}
}
template<class FluidSystem, class Indices, class Scalar>
void StandardWellConnections<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void StandardWellConnections<FluidSystem,Indices>::
computePropertiesForPressures(const WellState& well_state,
const std::function<Scalar(int,int)>& getTemperature,
const std::function<Scalar(int)>& getSaltConcentration,
@ -419,8 +419,8 @@ computePropertiesForPressures(const WellState& well_state,
}
}
template<class FluidSystem, class Indices, class Scalar>
void StandardWellConnections<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void StandardWellConnections<FluidSystem,Indices>::
computeProperties(const WellState& well_state,
const std::function<Scalar(int,int)>& invB,
const std::function<Scalar(int,int)>& mobility,
@ -514,9 +514,9 @@ computeProperties(const WellState& well_state,
this->computePressureDelta();
}
template<class FluidSystem, class Indices, class Scalar>
typename StandardWellConnections<FluidSystem,Indices,Scalar>::Eval
StandardWellConnections<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
typename StandardWellConnections<FluidSystem,Indices>::Eval
StandardWellConnections<FluidSystem,Indices>::
connectionRateBrine(double& rate,
const double vap_wat_rate,
const std::vector<EvalWell>& cq_s,
@ -539,9 +539,9 @@ connectionRateBrine(double& rate,
return well_.restrictEval(cq_s_sm);
}
template<class FluidSystem, class Indices, class Scalar>
typename StandardWellConnections<FluidSystem,Indices,Scalar>::Eval
StandardWellConnections<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
typename StandardWellConnections<FluidSystem,Indices>::Eval
StandardWellConnections<FluidSystem,Indices>::
connectionRateFoam(const std::vector<EvalWell>& cq_s,
const std::variant<Scalar,EvalWell>& foamConcentration,
const Phase transportPhase,
@ -578,11 +578,11 @@ connectionRateFoam(const std::vector<EvalWell>& cq_s,
return well_.restrictEval(cq_s_foam);
}
template<class FluidSystem, class Indices, class Scalar>
std::tuple<typename StandardWellConnections<FluidSystem,Indices,Scalar>::Eval,
typename StandardWellConnections<FluidSystem,Indices,Scalar>::Eval,
typename StandardWellConnections<FluidSystem,Indices,Scalar>::Eval>
StandardWellConnections<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
std::tuple<typename StandardWellConnections<FluidSystem,Indices>::Eval,
typename StandardWellConnections<FluidSystem,Indices>::Eval,
typename StandardWellConnections<FluidSystem,Indices>::Eval>
StandardWellConnections<FluidSystem,Indices>::
connectionRatesMICP(const std::vector<EvalWell>& cq_s,
const std::variant<Scalar,EvalWell>& microbialConcentration,
const std::variant<Scalar,EvalWell>& oxygenConcentration,
@ -615,10 +615,10 @@ connectionRatesMICP(const std::vector<EvalWell>& cq_s,
well_.restrictEval(cq_s_urea)};
}
template<class FluidSystem, class Indices, class Scalar>
std::tuple<typename StandardWellConnections<FluidSystem,Indices,Scalar>::Eval,
typename StandardWellConnections<FluidSystem,Indices,Scalar>::EvalWell>
StandardWellConnections<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
std::tuple<typename StandardWellConnections<FluidSystem,Indices>::Eval,
typename StandardWellConnections<FluidSystem,Indices>::EvalWell>
StandardWellConnections<FluidSystem,Indices>::
connectionRatePolymer(double& rate,
const std::vector<EvalWell>& cq_s,
const std::variant<Scalar,EvalWell>& polymerConcentration) const
@ -639,10 +639,10 @@ connectionRatePolymer(double& rate,
return {well_.restrictEval(cq_s_poly), cq_s_poly};
}
template<class FluidSystem, class Indices, class Scalar>
std::tuple<typename StandardWellConnections<FluidSystem,Indices,Scalar>::Eval,
typename StandardWellConnections<FluidSystem,Indices,Scalar>::EvalWell>
StandardWellConnections<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
std::tuple<typename StandardWellConnections<FluidSystem,Indices>::Eval,
typename StandardWellConnections<FluidSystem,Indices>::EvalWell>
StandardWellConnections<FluidSystem,Indices>::
connectionRatezFraction(double& rate,
const double dis_gas_rate,
const std::vector<EvalWell>& cq_s,
@ -667,7 +667,7 @@ connectionRatezFraction(double& rate,
#define INSTANCE(...) \
template class StandardWellConnections<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>, \
__VA_ARGS__,double>;
__VA_ARGS__>;
// One phase
INSTANCE(BlackOilOnePhaseIndices<0u,0u,0u,0u,false,false,0u,1u,0u>)

View File

@ -34,14 +34,15 @@ namespace Opm
class DeferredLogger;
enum class Phase;
template<class FluidSystem, class Indices, class Scalar> class WellInterfaceIndices;
template<class FluidSystem, class Indices> class WellInterfaceIndices;
class WellState;
template<class FluidSystem, class Indices, class Scalar>
template<class FluidSystem, class Indices>
class StandardWellConnections
{
public:
StandardWellConnections(const WellInterfaceIndices<FluidSystem,Indices,Scalar>& well);
using Scalar = typename FluidSystem::Scalar;
StandardWellConnections(const WellInterfaceIndices<FluidSystem,Indices>& well);
struct Properties
{
@ -92,8 +93,8 @@ public:
Scalar pressure_diff(const unsigned perf) const
{ return perf_pressure_diffs_[perf]; }
using Eval = typename WellInterfaceIndices<FluidSystem,Indices,Scalar>::Eval;
using EvalWell = typename StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::EvalWell;
using Eval = typename WellInterfaceIndices<FluidSystem,Indices>::Eval;
using EvalWell = typename StandardWellPrimaryVariables<FluidSystem,Indices>::EvalWell;
Eval connectionRateBrine(double& rate,
const double vap_wat_rate,
@ -131,7 +132,7 @@ private:
const Properties& props,
DeferredLogger& deferred_logger);
const WellInterfaceIndices<FluidSystem,Indices,Scalar>& well_; //!< Reference to well interface
const WellInterfaceIndices<FluidSystem,Indices>& well_; //!< Reference to well interface
std::vector<Scalar> perf_densities_; //!< densities of the fluid in each perforation
std::vector<Scalar> perf_pressure_diffs_; //!< // pressure drop between different perforations

View File

@ -43,9 +43,9 @@
namespace Opm
{
template<class FluidSystem, class Indices, class Scalar>
StandardWellEval<FluidSystem,Indices,Scalar>::
StandardWellEval(const WellInterfaceIndices<FluidSystem,Indices,Scalar>& baseif)
template<class FluidSystem, class Indices>
StandardWellEval<FluidSystem,Indices>::
StandardWellEval(const WellInterfaceIndices<FluidSystem,Indices>& baseif)
: baseif_(baseif)
, primary_variables_(baseif_)
, F0_(numWellConservationEq)
@ -54,9 +54,9 @@ StandardWellEval(const WellInterfaceIndices<FluidSystem,Indices,Scalar>& baseif)
{
}
template<class FluidSystem, class Indices, class Scalar>
typename StandardWellEval<FluidSystem,Indices,Scalar>::EvalWell
StandardWellEval<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
typename StandardWellEval<FluidSystem,Indices>::EvalWell
StandardWellEval<FluidSystem,Indices>::
extendEval(const Eval& in) const
{
EvalWell out(primary_variables_.numWellEq() + Indices::numEq, in.value());
@ -66,9 +66,9 @@ extendEval(const Eval& in) const
return out;
}
template<class FluidSystem, class Indices, class Scalar>
template<class FluidSystem, class Indices>
void
StandardWellEval<FluidSystem,Indices,Scalar>::
StandardWellEval<FluidSystem,Indices>::
updateWellStateFromPrimaryVariables(const bool stop_or_zero_rate_target,
WellState& well_state,
const SummaryState& summary_state,
@ -86,9 +86,9 @@ updateWellStateFromPrimaryVariables(const bool stop_or_zero_rate_target,
well_state, summary_state, deferred_logger);
}
template<class FluidSystem, class Indices, class Scalar>
template<class FluidSystem, class Indices>
void
StandardWellEval<FluidSystem,Indices,Scalar>::
StandardWellEval<FluidSystem,Indices>::
computeAccumWell()
{
for (std::size_t eq_idx = 0; eq_idx < F0_.size(); ++eq_idx) {
@ -96,9 +96,9 @@ computeAccumWell()
}
}
template<class FluidSystem, class Indices, class Scalar>
template<class FluidSystem, class Indices>
ConvergenceReport
StandardWellEval<FluidSystem,Indices,Scalar>::
StandardWellEval<FluidSystem,Indices>::
getWellConvergence(const WellState& well_state,
const std::vector<double>& B_avg,
const double maxResidualAllowed,
@ -170,9 +170,9 @@ getWellConvergence(const WellState& well_state,
return report;
}
template<class FluidSystem, class Indices, class Scalar>
template<class FluidSystem, class Indices>
void
StandardWellEval<FluidSystem,Indices,Scalar>::
StandardWellEval<FluidSystem,Indices>::
init(std::vector<double>& perf_depth,
const std::vector<double>& depth_arg,
const int num_cells,
@ -203,7 +203,7 @@ init(std::vector<double>& perf_depth,
}
#define INSTANCE(...) \
template class StandardWellEval<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,__VA_ARGS__,double>;
template class StandardWellEval<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,__VA_ARGS__>;
// One phase
INSTANCE(BlackOilOnePhaseIndices<0u,0u,0u,0u,false,false,0u,1u,0u>)

View File

@ -40,15 +40,16 @@ class GroupState;
class Schedule;
class SummaryState;
class WellContributions;
template<class FluidSystem, class Indices, class Scalar> class WellInterfaceIndices;
template<class FluidSystem, class Indices> class WellInterfaceIndices;
class WellState;
template<class FluidSystem, class Indices, class Scalar>
template<class FluidSystem, class Indices>
class StandardWellEval
{
protected:
using PrimaryVariables = StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>;
using StdWellConnections = StandardWellConnections<FluidSystem,Indices,Scalar>;
using Scalar = typename FluidSystem::Scalar;
using PrimaryVariables = StandardWellPrimaryVariables<FluidSystem,Indices>;
using StdWellConnections = StandardWellConnections<FluidSystem,Indices>;
static constexpr int Bhp = PrimaryVariables::Bhp;
static constexpr int WQTotal= PrimaryVariables::WQTotal;
static constexpr int numWellConservationEq = PrimaryVariables::numWellConservationEq;
@ -69,9 +70,9 @@ public:
{ return linSys_; }
protected:
StandardWellEval(const WellInterfaceIndices<FluidSystem,Indices,Scalar>& baseif);
StandardWellEval(const WellInterfaceIndices<FluidSystem,Indices>& baseif);
const WellInterfaceIndices<FluidSystem,Indices,Scalar>& baseif_;
const WellInterfaceIndices<FluidSystem,Indices>& baseif_;
EvalWell extendEval(const Eval& in) const;

View File

@ -95,8 +95,8 @@ Scalar relaxationFactorFraction(const Scalar old_value,
namespace Opm {
template<class FluidSystem, class Indices, class Scalar>
void StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void StandardWellPrimaryVariables<FluidSystem,Indices>::
init()
{
for (int eqIdx = 0; eqIdx < numWellEq_; ++eqIdx) {
@ -108,8 +108,8 @@ init()
}
}
template<class FluidSystem, class Indices, class Scalar>
void StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void StandardWellPrimaryVariables<FluidSystem,Indices>::
resize(const int numWellEq)
{
value_.resize(numWellEq, 0.0);
@ -117,8 +117,8 @@ resize(const int numWellEq)
numWellEq_ = numWellEq;
}
template<class FluidSystem, class Indices, class Scalar>
void StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void StandardWellPrimaryVariables<FluidSystem,Indices>::
update(const WellState& well_state,
const bool stop_or_zero_rate_target,
DeferredLogger& deferred_logger)
@ -225,8 +225,8 @@ update(const WellState& well_state,
value_[Bhp] = ws.bhp;
}
template<class FluidSystem, class Indices, class Scalar>
void StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void StandardWellPrimaryVariables<FluidSystem,Indices>::
updatePolyMW(const WellState& well_state)
{
if (well_.isInjector()) {
@ -241,8 +241,8 @@ updatePolyMW(const WellState& well_state)
}
}
template<class FluidSystem, class Indices, class Scalar>
void StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void StandardWellPrimaryVariables<FluidSystem,Indices>::
updateNewton(const BVectorWell& dwells,
const bool stop_or_zero_rate_target,
const double dFLimit,
@ -303,8 +303,8 @@ updateNewton(const BVectorWell& dwells,
value_[Bhp] = std::max(value_[Bhp] - dx1_limited, bhp_lower_limit);
}
template<class FluidSystem, class Indices, class Scalar>
void StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void StandardWellPrimaryVariables<FluidSystem,Indices>::
updateNewtonPolyMW(const BVectorWell& dwells)
{
if (well_.isInjector()) {
@ -322,8 +322,8 @@ updateNewtonPolyMW(const BVectorWell& dwells)
}
}
template<class FluidSystem, class Indices, class Scalar>
void StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void StandardWellPrimaryVariables<FluidSystem,Indices>::
copyToWellState(WellState& well_state,
DeferredLogger& deferred_logger) const
{
@ -427,8 +427,8 @@ copyToWellState(WellState& well_state,
}
}
template<class FluidSystem, class Indices, class Scalar>
void StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void StandardWellPrimaryVariables<FluidSystem,Indices>::
copyToWellStatePolyMW(WellState& well_state) const
{
if (well_.isInjector()) {
@ -443,9 +443,9 @@ copyToWellStatePolyMW(WellState& well_state) const
}
}
template<class FluidSystem, class Indices, class Scalar>
typename StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::EvalWell
StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
typename StandardWellPrimaryVariables<FluidSystem,Indices>::EvalWell
StandardWellPrimaryVariables<FluidSystem,Indices>::
volumeFraction(const unsigned compIdx) const
{
if (FluidSystem::numActivePhases() == 1) {
@ -480,9 +480,9 @@ volumeFraction(const unsigned compIdx) const
return well_fraction;
}
template<class FluidSystem, class Indices, class Scalar>
typename StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::EvalWell
StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
typename StandardWellPrimaryVariables<FluidSystem,Indices>::EvalWell
StandardWellPrimaryVariables<FluidSystem,Indices>::
volumeFractionScaled(const int compIdx) const
{
const int legacyCompIdx = well_.modelCompIdxToFlowCompIdx(compIdx);
@ -494,9 +494,9 @@ volumeFractionScaled(const int compIdx) const
return this->volumeFraction(compIdx);
}
template<class FluidSystem, class Indices, class Scalar>
typename StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::EvalWell
StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
typename StandardWellPrimaryVariables<FluidSystem,Indices>::EvalWell
StandardWellPrimaryVariables<FluidSystem,Indices>::
surfaceVolumeFraction(const int compIdx) const
{
EvalWell sum_volume_fraction_scaled(numWellEq_ + Indices::numEq, 0.);
@ -509,9 +509,9 @@ surfaceVolumeFraction(const int compIdx) const
return this->volumeFractionScaled(compIdx) / sum_volume_fraction_scaled;
}
template<class FluidSystem, class Indices, class Scalar>
typename StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::EvalWell
StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
typename StandardWellPrimaryVariables<FluidSystem,Indices>::EvalWell
StandardWellPrimaryVariables<FluidSystem,Indices>::
getQs(const int comp_idx) const
{
// Note: currently, the WQTotal definition is still depends on Injector/Producer.
@ -556,8 +556,8 @@ getQs(const int comp_idx) const
}
}
template<class FluidSystem, class Indices, class Scalar>
void StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void StandardWellPrimaryVariables<FluidSystem,Indices>::
processFractions()
{
static constexpr int Water = BlackoilPhases::Aqua;
@ -659,8 +659,8 @@ processFractions()
}
}
template<class FluidSystem, class Indices, class Scalar>
double StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
double StandardWellPrimaryVariables<FluidSystem,Indices>::
relaxationFactorFractionsProducer(const BVectorWell& dwells, DeferredLogger& deferred_logger) const
{
// TODO: not considering solvent yet
@ -713,8 +713,8 @@ relaxationFactorFractionsProducer(const BVectorWell& dwells, DeferredLogger& def
return relaxation_factor;
}
template<class FluidSystem, class Indices, class Scalar>
void StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
void StandardWellPrimaryVariables<FluidSystem,Indices>::
checkFinite(DeferredLogger& deferred_logger) const
{
for (const Scalar v : value_) {
@ -726,7 +726,7 @@ checkFinite(DeferredLogger& deferred_logger) const
}
#define INSTANCE(...) \
template class StandardWellPrimaryVariables<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,__VA_ARGS__,double>;
template class StandardWellPrimaryVariables<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,__VA_ARGS__>;
// One phase
INSTANCE(BlackOilOnePhaseIndices<0u,0u,0u,0u,false,false,0u,1u,0u>)

View File

@ -33,11 +33,11 @@ namespace Opm
{
class DeferredLogger;
template<class FluidSystem, class Indices, class Scalar> class WellInterfaceIndices;
template<class FluidSystem, class Indices> class WellInterfaceIndices;
class WellState;
//! \brief Class holding primary variables for StandardWell.
template<class FluidSystem, class Indices, class Scalar>
template<class FluidSystem, class Indices>
class StandardWellPrimaryVariables {
protected:
// the positions of the primary variables for StandardWell
@ -82,12 +82,13 @@ public:
static constexpr int GFrac = has_gfrac_variable ? has_wfrac_variable + 1 : -1000;
static constexpr int SFrac = !Indices::enableSolvent ? -1000 : has_wfrac_variable+has_gfrac_variable+1;
using Scalar = typename FluidSystem::Scalar;
//! \brief Evaluation for the well equations.
using EvalWell = DenseAd::DynamicEvaluation<Scalar, numStaticWellEq + Indices::numEq + 1>;
using BVectorWell = typename StandardWellEquations<Scalar,Indices::numEq>::BVectorWell;
//! \brief Constructor initializes reference to well interface.
StandardWellPrimaryVariables(const WellInterfaceIndices<FluidSystem,Indices,Scalar>& well)
StandardWellPrimaryVariables(const WellInterfaceIndices<FluidSystem,Indices>& well)
: well_(well)
{}
@ -167,7 +168,7 @@ private:
//! \details Contain derivatives and are used in AD calculation
std::vector<EvalWell> evaluation_;
const WellInterfaceIndices<FluidSystem,Indices,Scalar>& well_; //!< Reference to well interface
const WellInterfaceIndices<FluidSystem,Indices>& well_; //!< Reference to well interface
//! \brief Total number of the well equations and primary variables.
//! \details There might be extra equations be used, numWellEq will be updated during the initialization

View File

@ -73,7 +73,7 @@ namespace Opm
const int index_of_well,
const std::vector<PerforationData>& perf_data)
: Base(well, pw_info, time_step, param, rate_converter, pvtRegionIdx, num_components, num_phases, index_of_well, perf_data)
, StdWellEval(static_cast<const WellInterfaceIndices<FluidSystem,Indices,Scalar>&>(*this))
, StdWellEval(static_cast<const WellInterfaceIndices<FluidSystem,Indices>&>(*this))
, regularize_(false)
{
assert(this->num_components_ == numWellConservationEq);
@ -398,7 +398,7 @@ namespace Opm
connectionRates[perf][componentIdx] = Base::restrictEval(cq_s_effective);
StandardWellAssemble<FluidSystem,Indices,Scalar>(*this).
StandardWellAssemble<FluidSystem,Indices>(*this).
assemblePerforationEq(cq_s_effective,
componentIdx,
cell_idx,
@ -415,7 +415,7 @@ namespace Opm
}
if constexpr (has_zFraction) {
StandardWellAssemble<FluidSystem,Indices,Scalar>(*this).
StandardWellAssemble<FluidSystem,Indices>(*this).
assembleZFracEq(cq_s_zfrac_effective,
cell_idx,
this->primary_variables_.numWellEq(),
@ -446,7 +446,7 @@ namespace Opm
this->F0_[componentIdx]) * volume / dt;
}
resWell_loc -= this->primary_variables_.getQs(componentIdx) * this->well_efficiency_factor_;
StandardWellAssemble<FluidSystem,Indices,Scalar>(*this).
StandardWellAssemble<FluidSystem,Indices>(*this).
assembleSourceEq(resWell_loc,
componentIdx,
this->primary_variables_.numWellEq(),
@ -455,7 +455,7 @@ namespace Opm
const auto& summaryState = simulator.vanguard().summaryState();
const Schedule& schedule = simulator.vanguard().schedule();
StandardWellAssemble<FluidSystem,Indices,Scalar>(*this).
StandardWellAssemble<FluidSystem,Indices>(*this).
assembleControlEq(well_state, group_state,
schedule, summaryState,
inj_controls, prod_controls,
@ -2075,7 +2075,7 @@ namespace Opm
const EvalWell eq_pskin = this->primary_variables_.eval(pskin_index)
- pskin(throughput, this->primary_variables_.eval(wat_vel_index), poly_conc, deferred_logger);
StandardWellAssemble<FluidSystem,Indices,Scalar>(*this).
StandardWellAssemble<FluidSystem,Indices>(*this).
assembleInjectivityEq(eq_pskin,
eq_wat_vel,
pskin_index,

View File

@ -71,12 +71,10 @@ class WellProductionProperties;
template<typename TypeTag>
class WellInterface : public WellInterfaceIndices<GetPropType<TypeTag, Properties::FluidSystem>,
GetPropType<TypeTag, Properties::Indices>,
GetPropType<TypeTag, Properties::Scalar>>
GetPropType<TypeTag, Properties::Indices>>
{
using Base = WellInterfaceIndices<GetPropType<TypeTag, Properties::FluidSystem>,
GetPropType<TypeTag, Properties::Indices>,
GetPropType<TypeTag, Properties::Scalar>>;
GetPropType<TypeTag, Properties::Indices>>;
public:
using ModelParameters = BlackoilModelParameters<TypeTag>;

View File

@ -33,8 +33,8 @@
namespace Opm
{
template<class FluidSystem, class Indices, class Scalar>
WellInterfaceIndices<FluidSystem,Indices,Scalar>::
template<class FluidSystem, class Indices>
WellInterfaceIndices<FluidSystem,Indices>::
WellInterfaceIndices(const Well& well,
const ParallelWellInfo& parallel_well_info,
const int time_step,
@ -56,9 +56,9 @@ WellInterfaceIndices(const Well& well,
{
}
template<class FluidSystem, class Indices, class Scalar>
template<class FluidSystem, class Indices>
int
WellInterfaceIndices<FluidSystem,Indices,Scalar>::
WellInterfaceIndices<FluidSystem,Indices>::
flowPhaseToModelCompIdx(const int phaseIdx) const
{
const auto& pu = this->phaseUsage();
@ -73,9 +73,9 @@ flowPhaseToModelCompIdx(const int phaseIdx) const
return phaseIdx;
}
template<class FluidSystem, class Indices, class Scalar>
template<class FluidSystem, class Indices>
int
WellInterfaceIndices<FluidSystem,Indices,Scalar>::
WellInterfaceIndices<FluidSystem,Indices>::
modelCompIdxToFlowCompIdx(const unsigned compIdx) const
{
const auto& pu = this->phaseUsage();
@ -90,9 +90,9 @@ modelCompIdxToFlowCompIdx(const unsigned compIdx) const
return compIdx;
}
template<class FluidSystem, class Indices, class Scalar>
template<class FluidSystem, class Indices>
double
WellInterfaceIndices<FluidSystem,Indices,Scalar>::
WellInterfaceIndices<FluidSystem,Indices>::
scalingFactor(const int phaseIdx) const
{
const auto& pu = this->phaseUsage();
@ -112,8 +112,7 @@ scalingFactor(const int phaseIdx) const
#define INSTANCE( ...) \
template class WellInterfaceIndices<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>, \
__VA_ARGS__, \
double>;
__VA_ARGS__>;
// One phase
INSTANCE(BlackOilOnePhaseIndices<0u,0u,0u,0u,false,false,0u,1u,0u>)

View File

@ -30,13 +30,14 @@
namespace Opm
{
template<class FluidSystem, class Indices, class Scalar>
template<class FluidSystem, class Indices>
class WellInterfaceIndices : public WellInterfaceFluidSystem<FluidSystem>
{
public:
using WellInterfaceFluidSystem<FluidSystem>::Gas;
using WellInterfaceFluidSystem<FluidSystem>::Oil;
using WellInterfaceFluidSystem<FluidSystem>::Water;
using Scalar = typename FluidSystem::Scalar;
using Eval = DenseAd::Evaluation<Scalar, /*size=*/Indices::numEq>;
int flowPhaseToModelCompIdx(const int phaseIdx) const;

View File

@ -54,15 +54,15 @@ namespace Opm
const int num_phases,
const int index_of_well,
const std::vector<PerforationData>& perf_data)
: WellInterfaceIndices<FluidSystem,Indices,Scalar>(well,
pw_info,
time_step,
rate_converter,
pvtRegionIdx,
num_components,
num_phases,
index_of_well,
perf_data)
: WellInterfaceIndices<FluidSystem,Indices>(well,
pw_info,
time_step,
rate_converter,
pvtRegionIdx,
num_components,
num_phases,
index_of_well,
perf_data)
, param_(param)
{
connectionRates_.resize(this->number_of_perforations_);

View File

@ -239,7 +239,7 @@ BOOST_AUTO_TEST_CASE(EclGenericProblem)
auto gridView = grid.leafGridView();
#endif // HAVE_DUNE_FEM
auto data_out
= Opm::FlowGenericProblem<GridView, Opm::BlackOilFluidSystem<double, Opm::BlackOilDefaultIndexTraits>, double>::
= Opm::FlowGenericProblem<GridView, Opm::BlackOilFluidSystem<double, Opm::BlackOilDefaultIndexTraits>>::
serializationTestObject(eclState, schedule, gridView);
Opm::Serialization::MemPacker packer;
Opm::Serializer ser(packer);