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
36
37#include <array>
38#include <cstddef>
39#include <functional>
40#include <set>
41#include <string>
42#include <vector>
43
44namespace Dune {
45class ParameterTree;
46}
47
48namespace Opm {
49
50class Deck;
51class EclipseState;
52class Schedule;
53template<typename Grid, typename GridView> class LookUpData;
54
55int eclPositionalParameter(std::function<void(const std::string&,
56 const std::string&)> addKey,
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 }
293
294protected:
295 void initFluidSystem_();
296
300 bool shouldWriteOutput() const
301 { return true; }
302
310 { return false; }
311
312 bool beginEpisode_(bool enableExperiments,
313 int episodeIdx);
314 void beginTimeStep_(bool enableExperiments,
315 int episodeIdx,
316 int timeStepIndex,
317 Scalar startTime,
318 Scalar time,
319 Scalar timeStepSize,
320 Scalar endTime);
321
322 void readRockParameters_(const std::vector<Scalar>& cellCenterDepths,
323 std::function<std::array<int,3>(const unsigned)> ijkIndex);
325
326 void readBlackoilExtentionsInitialConditions_(std::size_t numDof,
327 bool enableSolvent,
328 bool enablePolymer,
329 bool enablePolymerMolarWeight,
330 bool enableMICP);
331
332 void updatePvtnum_();
333 void updateSatnum_();
334 void updateMiscnum_();
335 void updatePlmixnum_();
336
337 const EclipseState& eclState_;
338 const Schedule& schedule_;
339 const GridView& gridView_;
340
341 static inline std::string briefDescription_;
342 std::array<std::vector<Scalar>, 2> referencePorosity_;
343
344 std::vector<int> pvtnum_;
345 std::vector<unsigned short> satnum_;
346 std::vector<unsigned short> miscnum_;
347 std::vector<unsigned short> plmixnum_;
348
349 std::vector<RockParams> rockParams_;
350 std::vector<unsigned short> rockTableIdx_;
351 std::vector<TabulatedTwoDFunction> rockCompPoroMultWc_;
352 std::vector<TabulatedTwoDFunction> rockCompTransMultWc_;
353 std::vector<TabulatedFunction> rockCompPoroMult_;
354 std::vector<TabulatedFunction> rockCompTransMult_;
355 std::vector<Scalar> rockCompTransMultVal_;
356
358 std::vector<Scalar> maxOilSaturation_;
359 std::vector<Scalar> maxWaterSaturation_;
360 std::vector<Scalar> minRefPressure_;
361 std::vector<Scalar> overburdenPressure_;
362 std::vector<Scalar> solventSaturation_;
363 std::vector<Scalar> solventRsw_;
365
366 // time stepping parameters
370
371 // equilibration parameters
373
374 // To lookup origin cell indices
375 using Grid = std::remove_cv_t< typename std::remove_reference<decltype(gridView_.grid())>::type>;
378
379 // \brief Function to assign the origin cell index on level zero, for a cell on the leaf grid view.
380 //
381 // For CpGrid with local grid refinement, the field property of a cell on the leaf
382 // is inherited from its parent or equivalent (when has no parent) cell on level zero.
383 std::function<unsigned(unsigned)> lookupIdxOnLevelZeroAssigner_()
384 {
385 return [this](unsigned elemIdx) { return lookUpData_.template getFieldPropIdx<Grid>(elemIdx);};
386 }
387
388private:
389 template<class T>
390 void updateNum(const std::string& name, std::vector<T>& numbers, std::size_t num_regions);
391};
392
393} // namespace Opm
394
395#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:337
UniformXTabulated2DFunction< Scalar > TabulatedTwoDFunction
Definition: FlowGenericProblem.hpp:73
Scalar maxPolymerAdsorption(unsigned elemIdx) const
Returns the max polymer adsorption value.
Definition: FlowGenericProblem_impl.hpp:743
unsigned pvtRegionIndex(unsigned elemIdx) const
Returns the index the relevant PVT region given a cell index.
Definition: FlowGenericProblem_impl.hpp:702
Scalar oxygenConcentration(unsigned elemIdx) const
Returns the initial oxygen concentration for a given a cell index.
Definition: FlowGenericProblem_impl.hpp:655
Scalar microbialConcentration(unsigned elemIdx) const
Returns the initial microbial concentration for a given a cell index.
Definition: FlowGenericProblem_impl.hpp:643
PolymerSolutionContainer< Scalar > polymer_
Definition: FlowGenericProblem.hpp:357
std::vector< Scalar > rockCompTransMultVal_
Definition: FlowGenericProblem.hpp:355
std::function< unsigned(unsigned)> lookupIdxOnLevelZeroAssigner_()
Definition: FlowGenericProblem.hpp:383
Scalar rockReferencePressure(unsigned globalSpaceIdx) const
Definition: FlowGenericProblem_impl.hpp:324
static std::string briefDescription()
Returns a human readable description of the problem for the help message.
Definition: FlowGenericProblem_impl.hpp:131
Scalar solventRsw(unsigned elemIdx) const
Returns the initial solvent dissolved in water for a given a cell index.
Definition: FlowGenericProblem_impl.hpp:606
std::vector< TabulatedTwoDFunction > rockCompPoroMultWc_
Definition: FlowGenericProblem.hpp:351
std::vector< unsigned short > miscnum_
Definition: FlowGenericProblem.hpp:346
Scalar overburdenPressure(unsigned elementIdx) const
Get the pressure of the overburden.
Definition: FlowGenericProblem_impl.hpp:584
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:368
unsigned miscnumRegionIndex(unsigned elemIdx) const
Returns the index the relevant MISC region given a cell index.
Definition: FlowGenericProblem_impl.hpp:722
bool vapparsActive(int episodeIdx) const
Definition: FlowGenericProblem_impl.hpp:413
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:344
unsigned satnumRegionIndex(unsigned elemIdx) const
Returns the index the relevant saturation function region given a cell index.
Definition: FlowGenericProblem_impl.hpp:712
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:562
std::vector< Scalar > solventSaturation_
Definition: FlowGenericProblem.hpp:362
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:96
void beginTimeStep_(bool enableExperiments, int episodeIdx, int timeStepIndex, Scalar startTime, Scalar time, Scalar timeStepSize, Scalar endTime)
Definition: FlowGenericProblem_impl.hpp:458
std::vector< TabulatedFunction > rockCompTransMult_
Definition: FlowGenericProblem.hpp:354
std::vector< unsigned short > plmixnum_
Definition: FlowGenericProblem.hpp:347
std::vector< TabulatedTwoDFunction > rockCompTransMultWc_
Definition: FlowGenericProblem.hpp:352
unsigned plmixnumRegionIndex(unsigned elemIdx) const
Returns the index the relevant PLMIXNUM (for polymer module) region given a cell index.
Definition: FlowGenericProblem_impl.hpp:732
FlowGenericProblem(const EclipseState &eclState, const Schedule &schedule, const GridView &gridView)
Definition: FlowGenericProblem_impl.hpp:83
bool enableTuning_
Definition: FlowGenericProblem.hpp:367
Scalar solventSaturation(unsigned elemIdx) const
Returns the initial solvent saturation for a given a cell index.
Definition: FlowGenericProblem_impl.hpp:595
Scalar polymerMolecularWeight(const unsigned elemIdx) const
Returns the polymer molecule weight for a given cell index.
Definition: FlowGenericProblem_impl.hpp:631
Scalar biofilmConcentration(unsigned elemIdx) const
Returns the initial biofilm concentration for a given a cell index.
Definition: FlowGenericProblem_impl.hpp:679
MICPSolutionContainer< Scalar > micp_
Definition: FlowGenericProblem.hpp:364
std::vector< TabulatedFunction > rockCompPoroMult_
Definition: FlowGenericProblem.hpp:353
const GridView & gridView_
Definition: FlowGenericProblem.hpp:339
void readRockParameters_(const std::vector< Scalar > &cellCenterDepths, std::function< std::array< int, 3 >(const unsigned)> ijkIndex)
Definition: FlowGenericProblem_impl.hpp:138
std::vector< Scalar > maxOilSaturation_
Definition: FlowGenericProblem.hpp:358
Scalar drsdtcon(unsigned elemIdx, int episodeIdx) const
Returns the dynamic drsdt convective mixing value.
std::vector< RockParams > rockParams_
Definition: FlowGenericProblem.hpp:349
std::array< std::vector< Scalar >, 2 > referencePorosity_
Definition: FlowGenericProblem.hpp:342
const Schedule & schedule_
Definition: FlowGenericProblem.hpp:338
std::vector< unsigned short > satnum_
Definition: FlowGenericProblem.hpp:345
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:489
static std::string briefDescription_
Definition: FlowGenericProblem.hpp:341
const LookUpData lookUpData_
Definition: FlowGenericProblem.hpp:377
int numPressurePointsEquil_
Definition: FlowGenericProblem.hpp:372
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:573
std::vector< Scalar > maxWaterSaturation_
Definition: FlowGenericProblem.hpp:359
void initFluidSystem_()
Definition: FlowGenericProblem_impl.hpp:482
bool operator==(const FlowGenericProblem &rhs) const
Definition: FlowGenericProblem_impl.hpp:754
Scalar maxTimeStepAfterWellEvent_
Definition: FlowGenericProblem.hpp:369
Scalar calciteConcentration(unsigned elemIdx) const
Returns the initial calcite concentration for a given a cell index.
Definition: FlowGenericProblem_impl.hpp:691
Scalar ureaConcentration(unsigned elemIdx) const
Returns the initial urea concentration for a given a cell index.
Definition: FlowGenericProblem_impl.hpp:667
std::vector< Scalar > minRefPressure_
Definition: FlowGenericProblem.hpp:360
bool beginEpisode_(bool enableExperiments, int episodeIdx)
Definition: FlowGenericProblem_impl.hpp:421
bool shouldWriteOutput() const
Always returns true. The ecl output writer takes care of the rest.
Definition: FlowGenericProblem.hpp:300
static void setBriefDescription(const std::string &msg)
Specifies the string returned by briefDescription()
Definition: FlowGenericProblem.hpp:106
std::vector< Scalar > solventRsw_
Definition: FlowGenericProblem.hpp:363
static std::string helpPreamble(int, const char **argv)
Returns the string that is printed before the list of command line parameters in the help message.
Definition: FlowGenericProblem_impl.hpp:116
std::vector< Scalar > overburdenPressure_
Definition: FlowGenericProblem.hpp:361
bool shouldWriteRestartFile() const
Returns true if an eWoms restart file should be written to disk.
Definition: FlowGenericProblem.hpp:309
void updatePlmixnum_()
Definition: FlowGenericProblem_impl.hpp:405
std::vector< unsigned short > rockTableIdx_
Definition: FlowGenericProblem.hpp:350
typename FluidSystem::Scalar Scalar
Definition: FlowGenericProblem.hpp:72
std::remove_cv_t< typename std::remove_reference< decltype(gridView_.grid())>::type > Grid
Definition: FlowGenericProblem.hpp:375
Scalar polymerConcentration(unsigned elemIdx) const
Returns the initial polymer concentration for a given a cell index.
Definition: FlowGenericProblem_impl.hpp:619
Definition: FlowGenericProblem.hpp:53
Definition: fvbaseprimaryvariables.hh:141
Definition: blackoilboundaryratevector.hh:37
int eclPositionalParameter(std::function< void(const std::string &, const std::string &)> addKey, 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