FlowGenericProblem.hpp
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3/*
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 2 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18
19 Consult the COPYING file in the top-level source directory of this
20 module for the precise wording of the license and the list of
21 copyright holders.
22*/
28#ifndef OPM_FLOW_GENERIC_PROBLEM_HPP
29#define OPM_FLOW_GENERIC_PROBLEM_HPP
30
31
32#include <opm/material/common/UniformXTabulated2DFunction.hpp>
33#include <opm/material/common/Tabulated1DFunction.hpp>
34
37
38#include <array>
39#include <cstddef>
40#include <functional>
41#include <set>
42#include <string>
43#include <vector>
44
45namespace Dune {
46class ParameterTree;
47}
48
49namespace Opm {
50
51class Deck;
52class EclipseState;
53class Schedule;
54template<typename Grid, typename GridView> class LookUpData;
55
56int eclPositionalParameter(Dune::ParameterTree& tree,
57 std::set<std::string>& seenParams,
58 std::string& errorMsg,
59 const char** argv,
60 int paramIdx);
61
68template<class GridView, class FluidSystem>
70{
71public:
72 using Scalar = typename FluidSystem::Scalar;
73 using TabulatedTwoDFunction = UniformXTabulated2DFunction<Scalar>;
74 using TabulatedFunction = Tabulated1DFunction<Scalar>;
75
76 struct RockParams {
79 };
80
81 FlowGenericProblem(const EclipseState& eclState,
82 const Schedule& schedule,
83 const GridView& gridView);
84
85
86 static FlowGenericProblem serializationTestObject(const EclipseState& eclState,
87 const Schedule& schedule,
88 const GridView& gridView);
89
93 static std::string helpPreamble(int,
94 const char **argv);
95
99 static std::string briefDescription();
100
106 static void setBriefDescription(const std::string& msg)
107 { briefDescription_ = msg; }
108
118 Scalar maxWaterSaturation(unsigned globalDofIdx) const;
119
129 Scalar minOilPressure(unsigned globalDofIdx) const;
130
136 Scalar overburdenPressure(unsigned elementIdx) const;
137
146 Scalar referencePorosity(unsigned elementIdx, unsigned timeIdx) const
147 { return referencePorosity_[timeIdx][elementIdx]; }
148
149
158 Scalar rockFraction(unsigned elementIdx, unsigned timeIdx) const;
159
164 void setPorosity(Scalar poro, unsigned elementIdx, unsigned timeIdx = 0)
165 { referencePorosity_[timeIdx][elementIdx] = poro; }
166
170 Scalar solventSaturation(unsigned elemIdx) const;
171
175 Scalar solventRsw(unsigned elemIdx) const;
176
180 Scalar drsdtcon(unsigned elemIdx, int episodeIdx) const;
181
185 Scalar polymerConcentration(unsigned elemIdx) const;
186
190 // TODO: remove this function if not called
191 Scalar polymerMolecularWeight(const unsigned elemIdx) const;
192
196 Scalar microbialConcentration(unsigned elemIdx) const;
197
201 Scalar oxygenConcentration(unsigned elemIdx) const;
202
206 Scalar ureaConcentration(unsigned elemIdx) const;
207
211 Scalar biofilmConcentration(unsigned elemIdx) const;
212
216 Scalar calciteConcentration(unsigned elemIdx) const;
217
221 unsigned pvtRegionIndex(unsigned elemIdx) const;
222
223// const std::vector<int>& pvtRegionArray() const
224// { return pvtnum_; }
225
229 unsigned satnumRegionIndex(unsigned elemIdx) const;
230
234 unsigned miscnumRegionIndex(unsigned elemIdx) const;
235
239 unsigned plmixnumRegionIndex(unsigned elemIdx) const;
240
244 Scalar maxPolymerAdsorption(unsigned elemIdx) const;
245
253 Scalar rockCompressibility(unsigned globalSpaceIdx) const;
254
262 Scalar rockReferencePressure(unsigned globalSpaceIdx) const;
263
272 Scalar porosity(unsigned globalSpaceIdx, unsigned timeIdx) const;
273
274 bool vapparsActive(int episodeIdx) const;
275
277 { return numPressurePointsEquil_; }
278
279 bool operator==(const FlowGenericProblem& rhs) const;
280
281 template<class Serializer>
282 void serializeOp(Serializer& serializer)
283 {
284 serializer(maxOilSaturation_);
285 serializer(polymer_);
286 serializer(maxWaterSaturation_);
287 serializer(minRefPressure_);
288 serializer(overburdenPressure_);
289 serializer(solventSaturation_);
290 serializer(solventRsw_);
291 serializer(micp_);
292 serializer(mixControls_);
293 }
294
295protected:
296 void initFluidSystem_();
297
301 bool shouldWriteOutput() const
302 { return true; }
303
311 { return false; }
312
313 bool beginEpisode_(bool enableExperiments,
314 int episodeIdx);
315 void beginTimeStep_(bool enableExperiments,
316 int episodeIdx,
317 int timeStepIndex,
318 Scalar startTime,
319 Scalar time,
320 Scalar timeStepSize,
321 Scalar endTime);
322
323 void readRockParameters_(const std::vector<Scalar>& cellCenterDepths,
324 std::function<std::array<int,3>(const unsigned)> ijkIndex);
326
327 void readBlackoilExtentionsInitialConditions_(std::size_t numDof,
328 bool enableSolvent,
329 bool enablePolymer,
330 bool enablePolymerMolarWeight,
331 bool enableMICP);
332
333 void updatePvtnum_();
334 void updateSatnum_();
335 void updateMiscnum_();
336 void updatePlmixnum_();
337 void updateKrnum_();
338 void updateImbnum_();
339
340 const EclipseState& eclState_;
341 const Schedule& schedule_;
342 const GridView& gridView_;
343
344 static inline std::string briefDescription_;
345 std::array<std::vector<Scalar>, 2> referencePorosity_;
346
347 std::vector<int> pvtnum_;
348 std::vector<unsigned short> satnum_;
349 std::vector<unsigned short> miscnum_;
350 std::vector<unsigned short> plmixnum_;
351 std::vector<unsigned short> krnumx_;
352 std::vector<unsigned short> krnumy_;
353 std::vector<unsigned short> krnumz_;
354 std::vector<unsigned short> imbnumx_;
355 std::vector<unsigned short> imbnumy_;
356 std::vector<unsigned short> imbnumz_;
357
358 std::vector<RockParams> rockParams_;
359 std::vector<unsigned short> rockTableIdx_;
360 std::vector<TabulatedTwoDFunction> rockCompPoroMultWc_;
361 std::vector<TabulatedTwoDFunction> rockCompTransMultWc_;
362 std::vector<TabulatedFunction> rockCompPoroMult_;
363 std::vector<TabulatedFunction> rockCompTransMult_;
364 std::vector<Scalar> rockCompTransMultVal_;
365
367 std::vector<Scalar> maxOilSaturation_;
368 std::vector<Scalar> maxWaterSaturation_;
369 std::vector<Scalar> minRefPressure_;
370 std::vector<Scalar> overburdenPressure_;
371 std::vector<Scalar> solventSaturation_;
372 std::vector<Scalar> solventRsw_;
374
376
377 // time stepping parameters
381
382 // equilibration parameters
384
385 // To lookup origin cell indices
386 using Grid = std::remove_cv_t< typename std::remove_reference<decltype(gridView_.grid())>::type>;
389
390 // \brief Function to assign the origin cell index on level zero, for a cell on the leaf grid view.
391 //
392 // For CpGrid with local grid refinement, the field property of a cell on the leaf
393 // is inherited from its parent or equivalent (when has no parent) cell on level zero.
394 std::function<unsigned(unsigned)> lookupIdxOnLevelZeroAssigner_()
395 {
396 return [this](unsigned elemIdx) { return lookUpData_.template getFieldPropIdx<Grid>(elemIdx);};
397 }
398
399private:
400 template<class T>
401 void updateNum(const std::string& name, std::vector<T>& numbers, std::size_t num_regions);
402};
403
404} // namespace Opm
405
406#endif // OPM_FLOW_GENERIC_PROBLEM_HPP
This problem simulates an input file given in the data format used by the commercial ECLiPSE simulato...
Definition: FlowGenericProblem.hpp:70
void setPorosity(Scalar poro, unsigned elementIdx, unsigned timeIdx=0)
Sets the porosity of an element.
Definition: FlowGenericProblem.hpp:164
const EclipseState & eclState_
Definition: FlowGenericProblem.hpp:340
UniformXTabulated2DFunction< Scalar > TabulatedTwoDFunction
Definition: FlowGenericProblem.hpp:73
Scalar maxPolymerAdsorption(unsigned elemIdx) const
Returns the max polymer adsorption value.
Definition: FlowGenericProblem_impl.hpp:766
unsigned pvtRegionIndex(unsigned elemIdx) const
Returns the index the relevant PVT region given a cell index.
Definition: FlowGenericProblem_impl.hpp:725
Scalar oxygenConcentration(unsigned elemIdx) const
Returns the initial oxygen concentration for a given a cell index.
Definition: FlowGenericProblem_impl.hpp:678
Scalar microbialConcentration(unsigned elemIdx) const
Returns the initial microbial concentration for a given a cell index.
Definition: FlowGenericProblem_impl.hpp:666
PolymerSolutionContainer< Scalar > polymer_
Definition: FlowGenericProblem.hpp:366
std::vector< Scalar > rockCompTransMultVal_
Definition: FlowGenericProblem.hpp:364
std::function< unsigned(unsigned)> lookupIdxOnLevelZeroAssigner_()
Definition: FlowGenericProblem.hpp:394
Scalar rockReferencePressure(unsigned globalSpaceIdx) const
Definition: FlowGenericProblem_impl.hpp:324
static std::string briefDescription()
Definition: FlowGenericProblem_impl.hpp:133
std::vector< unsigned short > imbnumz_
Definition: FlowGenericProblem.hpp:356
Scalar solventRsw(unsigned elemIdx) const
Returns the initial solvent dissolved in water for a given a cell index.
Definition: FlowGenericProblem_impl.hpp:622
std::vector< TabulatedTwoDFunction > rockCompPoroMultWc_
Definition: FlowGenericProblem.hpp:360
std::vector< unsigned short > miscnum_
Definition: FlowGenericProblem.hpp:349
Scalar overburdenPressure(unsigned elementIdx) const
Get the pressure of the overburden.
Definition: FlowGenericProblem_impl.hpp:600
void updateMiscnum_()
Definition: FlowGenericProblem_impl.hpp:397
Scalar porosity(unsigned globalSpaceIdx, unsigned timeIdx) const
Direct indexed access to the porosity.
Definition: FlowGenericProblem_impl.hpp:339
Scalar rockCompressibility(unsigned globalSpaceIdx) const
Definition: FlowGenericProblem_impl.hpp:309
Scalar initialTimeStepSize_
Definition: FlowGenericProblem.hpp:379
std::vector< unsigned short > imbnumx_
Definition: FlowGenericProblem.hpp:354
unsigned miscnumRegionIndex(unsigned elemIdx) const
Returns the index the relevant MISC region given a cell index.
Definition: FlowGenericProblem_impl.hpp:745
bool vapparsActive(int episodeIdx) const
Definition: FlowGenericProblem_impl.hpp:433
int numPressurePointsEquil() const
Definition: FlowGenericProblem.hpp:276
Scalar referencePorosity(unsigned elementIdx, unsigned timeIdx) const
Returns the porosity of an element.
Definition: FlowGenericProblem.hpp:146
std::vector< int > pvtnum_
Definition: FlowGenericProblem.hpp:347
void updateImbnum_()
Definition: FlowGenericProblem_impl.hpp:423
unsigned satnumRegionIndex(unsigned elemIdx) const
Returns the index the relevant saturation function region given a cell index.
Definition: FlowGenericProblem_impl.hpp:735
Scalar rockFraction(unsigned elementIdx, unsigned timeIdx) const
Returns the rockFraction of an element.
Definition: FlowGenericProblem_impl.hpp:347
Scalar maxWaterSaturation(unsigned globalDofIdx) const
Returns an element's historic maximum water phase saturation that was observed during the simulation.
Definition: FlowGenericProblem_impl.hpp:578
std::vector< Scalar > solventSaturation_
Definition: FlowGenericProblem.hpp:371
void readRockCompactionParameters_()
Definition: FlowGenericProblem_impl.hpp:215
Tabulated1DFunction< Scalar > TabulatedFunction
Definition: FlowGenericProblem.hpp:74
void updateSatnum_()
Definition: FlowGenericProblem_impl.hpp:389
void updatePvtnum_()
Definition: FlowGenericProblem_impl.hpp:381
static FlowGenericProblem serializationTestObject(const EclipseState &eclState, const Schedule &schedule, const GridView &gridView)
Definition: FlowGenericProblem_impl.hpp:97
void beginTimeStep_(bool enableExperiments, int episodeIdx, int timeStepIndex, Scalar startTime, Scalar time, Scalar timeStepSize, Scalar endTime)
Definition: FlowGenericProblem_impl.hpp:478
std::vector< TabulatedFunction > rockCompTransMult_
Definition: FlowGenericProblem.hpp:363
std::vector< unsigned short > plmixnum_
Definition: FlowGenericProblem.hpp:350
std::vector< TabulatedTwoDFunction > rockCompTransMultWc_
Definition: FlowGenericProblem.hpp:361
unsigned plmixnumRegionIndex(unsigned elemIdx) const
Returns the index the relevant PLMIXNUM (for polymer module) region given a cell index.
Definition: FlowGenericProblem_impl.hpp:755
FlowGenericProblem(const EclipseState &eclState, const Schedule &schedule, const GridView &gridView)
Definition: FlowGenericProblem_impl.hpp:83
bool enableTuning_
Definition: FlowGenericProblem.hpp:378
Scalar solventSaturation(unsigned elemIdx) const
Returns the initial solvent saturation for a given a cell index.
Definition: FlowGenericProblem_impl.hpp:611
Scalar polymerMolecularWeight(const unsigned elemIdx) const
Returns the polymer molecule weight for a given cell index.
Definition: FlowGenericProblem_impl.hpp:654
Scalar biofilmConcentration(unsigned elemIdx) const
Returns the initial biofilm concentration for a given a cell index.
Definition: FlowGenericProblem_impl.hpp:702
MICPSolutionContainer< Scalar > micp_
Definition: FlowGenericProblem.hpp:373
MixingRateControls< FluidSystem > mixControls_
Definition: FlowGenericProblem.hpp:375
std::vector< TabulatedFunction > rockCompPoroMult_
Definition: FlowGenericProblem.hpp:362
std::vector< unsigned short > imbnumy_
Definition: FlowGenericProblem.hpp:355
const GridView & gridView_
Definition: FlowGenericProblem.hpp:342
void readRockParameters_(const std::vector< Scalar > &cellCenterDepths, std::function< std::array< int, 3 >(const unsigned)> ijkIndex)
Definition: FlowGenericProblem_impl.hpp:140
std::vector< Scalar > maxOilSaturation_
Definition: FlowGenericProblem.hpp:367
std::vector< RockParams > rockParams_
Definition: FlowGenericProblem.hpp:358
std::array< std::vector< Scalar >, 2 > referencePorosity_
Definition: FlowGenericProblem.hpp:345
const Schedule & schedule_
Definition: FlowGenericProblem.hpp:341
std::vector< unsigned short > satnum_
Definition: FlowGenericProblem.hpp:348
void serializeOp(Serializer &serializer)
Definition: FlowGenericProblem.hpp:282
void readBlackoilExtentionsInitialConditions_(std::size_t numDof, bool enableSolvent, bool enablePolymer, bool enablePolymerMolarWeight, bool enableMICP)
Definition: FlowGenericProblem_impl.hpp:512
static std::string briefDescription_
Definition: FlowGenericProblem.hpp:344
const LookUpData lookUpData_
Definition: FlowGenericProblem.hpp:388
int numPressurePointsEquil_
Definition: FlowGenericProblem.hpp:383
Scalar minOilPressure(unsigned globalDofIdx) const
Returns an element's historic minimum pressure of the oil phase that was observed during the simulati...
Definition: FlowGenericProblem_impl.hpp:589
std::vector< Scalar > maxWaterSaturation_
Definition: FlowGenericProblem.hpp:368
std::vector< unsigned short > krnumx_
Definition: FlowGenericProblem.hpp:351
void initFluidSystem_()
Definition: FlowGenericProblem_impl.hpp:505
bool operator==(const FlowGenericProblem &rhs) const
Definition: FlowGenericProblem_impl.hpp:777
Scalar maxTimeStepAfterWellEvent_
Definition: FlowGenericProblem.hpp:380
Scalar calciteConcentration(unsigned elemIdx) const
Returns the initial calcite concentration for a given a cell index.
Definition: FlowGenericProblem_impl.hpp:714
std::vector< unsigned short > krnumz_
Definition: FlowGenericProblem.hpp:353
Scalar ureaConcentration(unsigned elemIdx) const
Returns the initial urea concentration for a given a cell index.
Definition: FlowGenericProblem_impl.hpp:690
std::vector< Scalar > minRefPressure_
Definition: FlowGenericProblem.hpp:369
bool beginEpisode_(bool enableExperiments, int episodeIdx)
Definition: FlowGenericProblem_impl.hpp:441
bool shouldWriteOutput() const
Always returns true. The ecl output writer takes care of the rest.
Definition: FlowGenericProblem.hpp:301
std::vector< unsigned short > krnumy_
Definition: FlowGenericProblem.hpp:352
static void setBriefDescription(const std::string &msg)
Specifies the string returned by briefDescription()
Definition: FlowGenericProblem.hpp:106
std::vector< Scalar > solventRsw_
Definition: FlowGenericProblem.hpp:372
static std::string helpPreamble(int, const char **argv)
Definition: FlowGenericProblem_impl.hpp:118
std::vector< Scalar > overburdenPressure_
Definition: FlowGenericProblem.hpp:370
bool shouldWriteRestartFile() const
Returns true if an eWoms restart file should be written to disk.
Definition: FlowGenericProblem.hpp:310
void updatePlmixnum_()
Definition: FlowGenericProblem_impl.hpp:405
std::vector< unsigned short > rockTableIdx_
Definition: FlowGenericProblem.hpp:359
typename FluidSystem::Scalar Scalar
Definition: FlowGenericProblem.hpp:72
Scalar drsdtcon(unsigned elemIdx, int episodeIdx) const
Returns the dynamic drsdt convective mixing value.
Definition: FlowGenericProblem_impl.hpp:633
void updateKrnum_()
Definition: FlowGenericProblem_impl.hpp:413
std::remove_cv_t< typename std::remove_reference< decltype(gridView_.grid())>::type > Grid
Definition: FlowGenericProblem.hpp:386
Scalar polymerConcentration(unsigned elemIdx) const
Returns the initial polymer concentration for a given a cell index.
Definition: FlowGenericProblem_impl.hpp:642
Definition: FlowGenericProblem.hpp:54
Class handling mixing rate controls for a FlowProblem.
Definition: MixingRateControls.hpp:46
Definition: SupportsFaceTag.hpp:27
Definition: BlackoilPhases.hpp:27
int eclPositionalParameter(Dune::ParameterTree &tree, std::set< std::string > &seenParams, std::string &errorMsg, const char **argv, int paramIdx)
Definition: FlowGenericProblem_impl.hpp:48
Definition: FlowGenericProblem.hpp:76
Scalar compressibility
Definition: FlowGenericProblem.hpp:78
Scalar referencePressure
Definition: FlowGenericProblem.hpp:77
Struct holding MICP extension data.
Definition: SolutionContainers.hpp:57
Struct holding polymer extension data.
Definition: SolutionContainers.hpp:37