WellInterfaceIndices: remove unnecessary Scalar template parameter

use the Scalar type from the FluidSystem
This commit is contained in:
Arne Morten Kvarving 2024-02-22 15:17:09 +01:00
parent 215d22730b
commit 1f4b248564
15 changed files with 46 additions and 48 deletions

View File

@ -35,7 +35,7 @@ template<class Scalar, int numWellEq, int numEq> class MultisegmentWellEquations
template<class FluidSystem, class Indices> class MultisegmentWellPrimaryVariables; template<class FluidSystem, class Indices> class MultisegmentWellPrimaryVariables;
class Schedule; class Schedule;
class SummaryState; class SummaryState;
template<class FluidSystem, class Indices, class Scalar> class WellInterfaceIndices; template<class FluidSystem, class Indices> class WellInterfaceIndices;
class WellState; class WellState;
//! \brief Class handling assemble of the equation system for MultisegmentWell. //! \brief Class handling assemble of the equation system for MultisegmentWell.
@ -65,7 +65,7 @@ public:
using EvalWell = DenseAd::Evaluation<Scalar, numWellEq+Indices::numEq>; using EvalWell = DenseAd::Evaluation<Scalar, numWellEq+Indices::numEq>;
//! \brief Constructor initializes reference to well. //! \brief Constructor initializes reference to well.
MultisegmentWellAssemble(const WellInterfaceIndices<FluidSystem,Indices,Scalar>& well) MultisegmentWellAssemble(const WellInterfaceIndices<FluidSystem,Indices>& well)
: well_(well) : well_(well)
{} {}
@ -144,7 +144,7 @@ public:
Equations& eqns) const; Equations& eqns) const;
private: private:
const WellInterfaceIndices<FluidSystem,Indices,Scalar>& well_; //!< Reference to well const WellInterfaceIndices<FluidSystem,Indices>& well_; //!< Reference to well
}; };
} }

View File

@ -53,7 +53,7 @@ namespace Opm
template<typename FluidSystem, typename Indices> template<typename FluidSystem, typename Indices>
MultisegmentWellEval<FluidSystem,Indices>:: MultisegmentWellEval<FluidSystem,Indices>::
MultisegmentWellEval(WellInterfaceIndices<FluidSystem,Indices,Scalar>& baseif) MultisegmentWellEval(WellInterfaceIndices<FluidSystem,Indices>& baseif)
: MultisegmentWellGeneric<Scalar>(baseif) : MultisegmentWellGeneric<Scalar>(baseif)
, baseif_(baseif) , baseif_(baseif)
, linSys_(*this) , linSys_(*this)

View File

@ -43,7 +43,7 @@ class Schedule;
class WellContributions; class WellContributions;
class SummaryState; class SummaryState;
template<class FluidSystem, class Indices, class Scalar> class WellInterfaceIndices; template<class FluidSystem, class Indices> class WellInterfaceIndices;
class WellState; class WellState;
template<typename FluidSystem, typename Indices> template<typename FluidSystem, typename Indices>
@ -74,7 +74,7 @@ public:
{ return linSys_; } { return linSys_; }
protected: protected:
MultisegmentWellEval(WellInterfaceIndices<FluidSystem,Indices,Scalar>& baseif); MultisegmentWellEval(WellInterfaceIndices<FluidSystem,Indices>& baseif);
void initMatrixAndVectors(const int num_cells); void initMatrixAndVectors(const int num_cells);
@ -138,7 +138,7 @@ protected:
// convert a Eval from reservoir to contain the derivative related to wells // convert a Eval from reservoir to contain the derivative related to wells
EvalWell extendEval(const Eval& in) const; EvalWell extendEval(const Eval& in) const;
const WellInterfaceIndices<FluidSystem,Indices,Scalar>& baseif_; const WellInterfaceIndices<FluidSystem,Indices>& baseif_;
Equations linSys_; //!< The equation system Equations linSys_; //!< The equation system
PrimaryVariables primary_variables_; //!< The primary variables PrimaryVariables primary_variables_; //!< The primary variables

View File

@ -37,7 +37,7 @@ namespace Opm
class DeferredLogger; class DeferredLogger;
template<class Scalar> class MultisegmentWellGeneric; template<class Scalar> class MultisegmentWellGeneric;
template<class FluidSystem, class Indices, class Scalar> class WellInterfaceIndices; template<class FluidSystem, class Indices> class WellInterfaceIndices;
class WellState; class WellState;
template<class FluidSystem, class Indices> template<class FluidSystem, class Indices>
@ -81,7 +81,7 @@ public:
using Equations = MultisegmentWellEquations<Scalar,numWellEq,Indices::numEq>; using Equations = MultisegmentWellEquations<Scalar,numWellEq,Indices::numEq>;
using BVectorWell = typename Equations::BVectorWell; using BVectorWell = typename Equations::BVectorWell;
MultisegmentWellPrimaryVariables(const WellInterfaceIndices<FluidSystem,Indices,Scalar>& well) MultisegmentWellPrimaryVariables(const WellInterfaceIndices<FluidSystem,Indices>& well)
: well_(well) : well_(well)
{} {}
@ -171,7 +171,7 @@ private:
//! \details Contains derivatives and are used in AD calculation //! \details Contains derivatives and are used in AD calculation
std::vector<std::array<EvalWell, numWellEq>> evaluation_; 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 bhp_lower_limit = 1. * unit::barsa - 1. * unit::Pascal;
static constexpr double seg_pres_lower_limit = 0.; static constexpr double seg_pres_lower_limit = 0.;

View File

@ -60,7 +60,7 @@ namespace Opm
const int index_of_well, const int index_of_well,
const std::vector<PerforationData>& perf_data) 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) : 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) , regularize_(false)
, segment_fluid_initial_(this->numberOfSegments(), std::vector<double>(this->num_components_, 0.0)) , segment_fluid_initial_(this->numberOfSegments(), std::vector<double>(this->num_components_, 0.0))
{ {

View File

@ -45,7 +45,7 @@ namespace Opm
template<class FluidSystem, class Indices> template<class FluidSystem, class Indices>
StandardWellConnections<FluidSystem,Indices>:: StandardWellConnections<FluidSystem,Indices>::
StandardWellConnections(const WellInterfaceIndices<FluidSystem,Indices,Scalar>& well) StandardWellConnections(const WellInterfaceIndices<FluidSystem,Indices>& well)
: well_(well) : well_(well)
, perf_densities_(well.numPerfs()) , perf_densities_(well.numPerfs())
, perf_pressure_diffs_(well.numPerfs()) , perf_pressure_diffs_(well.numPerfs())

View File

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

View File

@ -45,7 +45,7 @@ namespace Opm
template<class FluidSystem, class Indices> template<class FluidSystem, class Indices>
StandardWellEval<FluidSystem,Indices>:: StandardWellEval<FluidSystem,Indices>::
StandardWellEval(const WellInterfaceIndices<FluidSystem,Indices,Scalar>& baseif) StandardWellEval(const WellInterfaceIndices<FluidSystem,Indices>& baseif)
: baseif_(baseif) : baseif_(baseif)
, primary_variables_(baseif_) , primary_variables_(baseif_)
, F0_(numWellConservationEq) , F0_(numWellConservationEq)

View File

@ -40,7 +40,7 @@ class GroupState;
class Schedule; class Schedule;
class SummaryState; class SummaryState;
class WellContributions; class WellContributions;
template<class FluidSystem, class Indices, class Scalar> class WellInterfaceIndices; template<class FluidSystem, class Indices> class WellInterfaceIndices;
class WellState; class WellState;
template<class FluidSystem, class Indices> template<class FluidSystem, class Indices>
@ -70,9 +70,9 @@ public:
{ return linSys_; } { return linSys_; }
protected: 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; EvalWell extendEval(const Eval& in) const;

View File

@ -33,7 +33,7 @@ namespace Opm
{ {
class DeferredLogger; class DeferredLogger;
template<class FluidSystem, class Indices, class Scalar> class WellInterfaceIndices; template<class FluidSystem, class Indices> class WellInterfaceIndices;
class WellState; class WellState;
//! \brief Class holding primary variables for StandardWell. //! \brief Class holding primary variables for StandardWell.
@ -88,7 +88,7 @@ public:
using BVectorWell = typename StandardWellEquations<Scalar,Indices::numEq>::BVectorWell; using BVectorWell = typename StandardWellEquations<Scalar,Indices::numEq>::BVectorWell;
//! \brief Constructor initializes reference to well interface. //! \brief Constructor initializes reference to well interface.
StandardWellPrimaryVariables(const WellInterfaceIndices<FluidSystem,Indices,Scalar>& well) StandardWellPrimaryVariables(const WellInterfaceIndices<FluidSystem,Indices>& well)
: well_(well) : well_(well)
{} {}
@ -168,7 +168,7 @@ private:
//! \details Contain derivatives and are used in AD calculation //! \details Contain derivatives and are used in AD calculation
std::vector<EvalWell> evaluation_; 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. //! \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 //! \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 int index_of_well,
const std::vector<PerforationData>& perf_data) 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) : 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) , regularize_(false)
{ {
assert(this->num_components_ == numWellConservationEq); assert(this->num_components_ == numWellConservationEq);

View File

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

View File

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

View File

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

View File

@ -54,7 +54,7 @@ namespace Opm
const int num_phases, const int num_phases,
const int index_of_well, const int index_of_well,
const std::vector<PerforationData>& perf_data) const std::vector<PerforationData>& perf_data)
: WellInterfaceIndices<FluidSystem,Indices,Scalar>(well, : WellInterfaceIndices<FluidSystem,Indices>(well,
pw_info, pw_info,
time_step, time_step,
rate_converter, rate_converter,