StandardWellEval: 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 2fb05a4996
commit 9997cde07a
3 changed files with 18 additions and 19 deletions

View File

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

View File

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

@ -43,10 +43,11 @@ class WellContributions;
template<class FluidSystem, class Indices, class Scalar> class WellInterfaceIndices; template<class FluidSystem, class Indices, class Scalar> class WellInterfaceIndices;
class WellState; class WellState;
template<class FluidSystem, class Indices, class Scalar> template<class FluidSystem, class Indices>
class StandardWellEval class StandardWellEval
{ {
protected: protected:
using Scalar = typename FluidSystem::Scalar;
using PrimaryVariables = StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>; using PrimaryVariables = StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>;
using StdWellConnections = StandardWellConnections<FluidSystem,Indices>; using StdWellConnections = StandardWellConnections<FluidSystem,Indices>;
static constexpr int Bhp = PrimaryVariables::Bhp; static constexpr int Bhp = PrimaryVariables::Bhp;