28 #ifndef OPM_GENERIC_TRACER_MODEL_HPP 29 #define OPM_GENERIC_TRACER_MODEL_HPP 31 #include <dune/istl/bcrsmatrix.hh> 33 #include <opm/grid/common/CartesianIndexMapper.hpp> 35 #include <opm/input/eclipse/EclipseState/Phase.hpp> 39 #include <opm/simulators/linalg/matrixblock.hh> 40 #include <opm/simulators/wells/WellTracerRate.hpp> 47 #include <unordered_map> 55 template<
class Gr
id,
class Gr
idView,
class DofMapper,
class Stencil,
class Flu
idSystem,
class Scalar>
58 using TracerVectorSingle = Dune::BlockVector<Dune::FieldVector<Scalar, 1>>;
59 using TracerMatrix = Dune::BCRSMatrix<Opm::MatrixBlock<Scalar, 2, 2>>;
60 using TracerVector = Dune::BlockVector<Dune::FieldVector<Scalar, 2>>;
62 static constexpr
int dimWorld = Grid::dimensionworld;
71 const std::string&
name(
int tracerIdx)
const;
72 std::string fname(
int tracerIdx)
const;
73 std::string sname(
int tracerIdx)
const;
74 std::string wellfname(
int tracerIdx)
const;
75 std::string wellsname(
int tracerIdx)
const;
77 Phase phase(
int tracerIdx)
const;
78 const std::vector<bool>& enableSolTracers()
const;
84 Scalar solTracerConcentration(
int tracerIdx,
int globalDofIdx)
const;
85 void setFreeTracerConcentration(
int tracerIdx,
int globalDofIdx, Scalar value);
86 void setSolTracerConcentration(
int tracerIdx,
int globalDofIdx, Scalar value);
87 void setEnableSolTracers(
int tracerIdx,
bool enableSolTracer);
92 const std::unordered_map<int, std::vector<WellTracerRate<Scalar>>>&
94 {
return wellTracerRate_; }
96 const std::unordered_map<int, std::vector<WellTracerRate<Scalar>>>&
97 getWellFreeTracerRates()
const 98 {
return wellFreeTracerRate_; }
100 const std::unordered_map<int, std::vector<WellTracerRate<Scalar>>>&
101 getWellSolTracerRates()
const 102 {
return wellSolTracerRate_; }
104 const std::unordered_map<int, std::vector<MSWellTracerRate<Scalar>>>&
105 getMswTracerRates()
const {
return mSwTracerRate_;}
107 template<
class Serializer>
108 void serializeOp(Serializer& serializer)
110 serializer(tracerConcentration_);
111 serializer(freeTracerConcentration_);
112 serializer(solTracerConcentration_);
113 serializer(wellTracerRate_);
114 serializer(wellFreeTracerRate_);
115 serializer(wellSolTracerRate_);
116 serializer(mSwTracerRate_);
120 GenericTracerModel(
const GridView& gridView,
121 const EclipseState& eclState,
122 const CartesianIndexMapper& cartMapper,
123 const DofMapper& dofMapper,
124 const std::function<std::array<double,dimWorld>(
int)> centroids);
130 std::size_t numGridDof,
131 std::size_t gasPhaseIdx,
132 std::size_t oilPhaseIdx,
133 std::size_t waterPhaseIdx);
135 bool linearSolve_(
const TracerMatrix& M, TracerVector& x, TracerVector& b);
137 bool linearSolveBatchwise_(
const TracerMatrix& M,
138 std::vector<TracerVector>& x,
139 std::vector<TracerVector>& b);
141 Scalar currentConcentration_(
const Well& eclWell,
142 const std::string& trName,
143 const SummaryState& summaryState)
const;
151 const GridView& gridView_;
152 const EclipseState& eclState_;
153 const CartesianIndexMapper& cartMapper_;
154 const DofMapper& dofMapper_;
156 std::vector<int> tracerPhaseIdx_;
157 std::vector<bool> enableSolTracers_;
158 std::vector<TracerVector> tracerConcentration_;
159 std::unique_ptr<TracerMatrix> tracerMatrix_;
160 std::vector<TracerVectorSingle> freeTracerConcentration_;
161 std::vector<TracerVectorSingle> solTracerConcentration_;
164 std::unordered_map<int, std::vector<WellTracerRate<Scalar>>> wellTracerRate_;
165 std::unordered_map<int, std::vector<WellTracerRate<Scalar>>> wellFreeTracerRate_;
166 std::unordered_map<int, std::vector<WellTracerRate<Scalar>>> wellSolTracerRate_;
168 std::unordered_map<int, std::vector<MSWellTracerRate<Scalar>>> mSwTracerRate_;
176 #endif // OPM_GENERIC_TRACER_MODEL_HPP Opm::GenericTracerModel< GetPropType< TypeTag, Properties::Grid >, GetPropType< TypeTag, Properties::GridView >, GetPropType< TypeTag, Properties::DofMapper >, GetPropType< TypeTag, Properties::Stencil >, GetPropType< TypeTag, Properties::FluidSystem >, GetPropType< TypeTag, Properties::Scalar > >::TracerTypeIdx TracerTypeIdx
Tracer type index.
Definition: GenericTracerModel.hpp:146
void doInit(bool rst, std::size_t numGridDof, std::size_t gasPhaseIdx, std::size_t oilPhaseIdx, std::size_t waterPhaseIdx)
Initialize all internal data structures needed by the tracer module.
Definition: GenericTracerModel_impl.hpp:227
Definition: GenericTracerModel.hpp:56
int numTracers() const
Return the number of tracers considered by the tracerModel.
Definition: GenericTracerModel_impl.hpp:162
Scalar freeTracerConcentration(int tracerIdx, int globalDofIdx) const
Return the tracer concentration for tracer index and global DofIdx.
Definition: GenericTracerModel_impl.hpp:117
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: blackoilbioeffectsmodules.hh:45
A fully-implicit black-oil flow model.
std::function< std::array< double, dimWorld >int)> centroids_
Function returning the cell centers.
Definition: GenericTracerModel.hpp:171
const std::unordered_map< int, std::vector< WellTracerRate< Scalar > > > & getWellTracerRates() const
Return well tracer rates.
Definition: GenericTracerModel.hpp:93
const std::string & name(int tracerIdx) const
Return the tracer name.
Definition: GenericTracerModel_impl.hpp:220
Definition: CollectDataOnIORank.hpp:49