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;
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.
@ -65,7 +65,7 @@ public:
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)
{}
@ -144,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

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

View File

@ -43,7 +43,7 @@ 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>
@ -74,7 +74,7 @@ public:
{ return linSys_; }
protected:
MultisegmentWellEval(WellInterfaceIndices<FluidSystem,Indices,Scalar>& baseif);
MultisegmentWellEval(WellInterfaceIndices<FluidSystem,Indices>& baseif);
void initMatrixAndVectors(const int num_cells);
@ -138,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

@ -37,7 +37,7 @@ 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>
@ -81,7 +81,7 @@ public:
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)
{}
@ -171,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

@ -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

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

View File

@ -34,7 +34,7 @@ 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>
@ -42,7 +42,7 @@ class StandardWellConnections
{
public:
using Scalar = typename FluidSystem::Scalar;
StandardWellConnections(const WellInterfaceIndices<FluidSystem,Indices,Scalar>& well);
StandardWellConnections(const WellInterfaceIndices<FluidSystem,Indices>& well);
struct Properties
{
@ -93,7 +93,7 @@ public:
Scalar pressure_diff(const unsigned perf) const
{ 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;
Eval connectionRateBrine(double& rate,
@ -132,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

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

View File

@ -40,7 +40,7 @@ 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>
@ -70,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

@ -33,7 +33,7 @@ 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.
@ -88,7 +88,7 @@ public:
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)
{}
@ -168,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);

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_);