changed: move Eval and restrictEval to WellInterfaceIndices

This commit is contained in:
Arne Morten Kvarving 2023-05-11 10:40:37 +02:00
parent a31f1cefd5
commit d1a2d27acb
2 changed files with 18 additions and 12 deletions

View File

@ -72,6 +72,9 @@ class WellInterface : public WellInterfaceIndices<GetPropType<TypeTag, Propertie
GetPropType<TypeTag, Properties::Indices>,
GetPropType<TypeTag, Properties::Scalar>>
{
using Base = WellInterfaceIndices<GetPropType<TypeTag, Properties::FluidSystem>,
GetPropType<TypeTag, Properties::Indices>,
GetPropType<TypeTag, Properties::Scalar>>;
public:
using ModelParameters = BlackoilModelParametersEbos<TypeTag>;
@ -94,8 +97,8 @@ public:
using VectorBlockType = Dune::FieldVector<Scalar, Indices::numEq>;
using MatrixBlockType = Dune::FieldMatrix<Scalar, Indices::numEq, Indices::numEq>;
using Eval = typename Base::Eval;
using BVector = Dune::BlockVector<VectorBlockType>;
using Eval = DenseAd::Evaluation<Scalar, /*size=*/Indices::numEq>;
using PressureMatrix = Dune::BCRSMatrix<Opm::MatrixBlock<double, 1, 1>>;
using RateConverterType =
@ -270,17 +273,6 @@ public:
Scalar volumetricSurfaceRateForConnection(int cellIdx, int phaseIdx) const;
template <class EvalWell>
Eval restrictEval(const EvalWell& in) const
{
Eval out = 0.0;
out.setValue(in.value());
for (int eqIdx = 0; eqIdx < Indices::numEq; ++eqIdx) {
out.setDerivative(eqIdx, in.derivative(eqIdx));
}
return out;
}
// TODO: theoretically, it should be a const function
// Simulator is not const is because that assembleWellEq is non-const Simulator
void wellTesting(const Simulator& simulator,

View File

@ -23,6 +23,8 @@
#ifndef OPM_WELLINTERFACE_INDICES_HEADER_INCLUDED
#define OPM_WELLINTERFACE_INDICES_HEADER_INCLUDED
#include <opm/material/densead/Evaluation.hpp>
#include <opm/simulators/wells/WellInterfaceFluidSystem.hpp>
namespace Opm
@ -35,11 +37,23 @@ public:
using WellInterfaceFluidSystem<FluidSystem>::Gas;
using WellInterfaceFluidSystem<FluidSystem>::Oil;
using WellInterfaceFluidSystem<FluidSystem>::Water;
using Eval = DenseAd::Evaluation<Scalar, /*size=*/Indices::numEq>;
int flowPhaseToEbosCompIdx(const int phaseIdx) const;
int ebosCompIdxToFlowCompIdx(const unsigned compIdx) const;
double scalingFactor(const int phaseIdx) const;
template <class EvalWell>
Eval restrictEval(const EvalWell& in) const
{
Eval out = 0.0;
out.setValue(in.value());
for (int eqIdx = 0; eqIdx < Indices::numEq; ++eqIdx) {
out.setDerivative(eqIdx, in.derivative(eqIdx));
}
return out;
}
protected:
WellInterfaceIndices(const Well& well,
const ParallelWellInfo& parallel_well_info,