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#include <opm/material/common/UniformXTabulated2DFunction.hpp>
32#include <opm/material/common/Tabulated1DFunction.hpp>
33
35
36#include <array>
37#include <cstddef>
38#include <functional>
39#include <string>
40#include <vector>
41
42namespace Dune {
43class ParameterTree;
44}
45
46namespace Opm {
47
48class Deck;
49class EclipseState;
50class Schedule;
51template<typename Grid, typename GridView> class LookUpData;
52
59template<class GridView, class FluidSystem>
61{
62public:
63 using Scalar = typename FluidSystem::Scalar;
64 using TabulatedTwoDFunction = UniformXTabulated2DFunction<Scalar>;
65 using TabulatedFunction = Tabulated1DFunction<Scalar>;
66
67 struct RockParams {
70 };
71
72 FlowGenericProblem(const EclipseState& eclState,
73 const Schedule& schedule,
74 const GridView& gridView);
75
76
77 static FlowGenericProblem serializationTestObject(const EclipseState& eclState,
78 const Schedule& schedule,
79 const GridView& gridView);
80
84 static std::string helpPreamble(int,
85 const char **argv);
86
90 static std::string briefDescription();
91
97 static void setBriefDescription(const std::string& msg)
98 { briefDescription_ = msg; }
99
109 Scalar maxWaterSaturation(unsigned globalDofIdx) const;
110
120 Scalar minOilPressure(unsigned globalDofIdx) const;
121
127 Scalar overburdenPressure(unsigned elementIdx) const;
128
135 {
136 return rockCompPoroMultWc_.empty() &&
137 rockCompTransMultWc_.empty() &&
138 rockCompPoroMult_.empty() &&
139 rockCompTransMult_.empty() &&
140 rockCompTransMultVal_.empty();
141 }
142
151 Scalar referencePorosity(unsigned elementIdx, unsigned timeIdx) const
152 { return referencePorosity_[timeIdx][elementIdx]; }
153
154
163 Scalar rockFraction(unsigned elementIdx, unsigned timeIdx) const {
164 return rockFraction_[timeIdx][elementIdx];
165 };
166
170 Scalar rockBiotComp(unsigned elementIdx) const;
171
175 Scalar rockBiotTemp(unsigned elementIdx) const;
176
180 Scalar lame(unsigned elementIdx) const;
181
185 Scalar biotCoeff(unsigned elementIdx) const;
186
190 Scalar biotTemp(unsigned elementIdx) const;
191
196 void setPorosity(Scalar poro, unsigned elementIdx, unsigned timeIdx = 0)
197 { referencePorosity_[timeIdx][elementIdx] = poro; }
198
202 Scalar solventSaturation(unsigned elemIdx) const;
203
207 Scalar solventRsw(unsigned elemIdx) const;
208
212 Scalar polymerConcentration(unsigned elemIdx) const;
213
217 // TODO: remove this function if not called
218 Scalar polymerMolecularWeight(const unsigned elemIdx) const;
219
223 Scalar microbialConcentration(unsigned elemIdx) const;
224
228 Scalar oxygenConcentration(unsigned elemIdx) const;
229
233 Scalar ureaConcentration(unsigned elemIdx) const;
234
238 Scalar biofilmVolumeFraction(unsigned elemIdx) const;
239
243 Scalar calciteVolumeFraction(unsigned elemIdx) const;
244
248 unsigned pvtRegionIndex(unsigned elemIdx) const;
249
250// const std::vector<int>& pvtRegionArray() const
251// { return pvtnum_; }
252
256 unsigned satnumRegionIndex(unsigned elemIdx) const;
257
261 unsigned miscnumRegionIndex(unsigned elemIdx) const;
262
266 unsigned plmixnumRegionIndex(unsigned elemIdx) const;
267
271 Scalar maxPolymerAdsorption(unsigned elemIdx) const;
272
280 Scalar rockCompressibility(unsigned globalSpaceIdx) const;
281
290 Scalar porosity(unsigned globalSpaceIdx, unsigned timeIdx) const;
291
292 bool vapparsActive(int episodeIdx) const;
293
295 { return numPressurePointsEquil_; }
296
297 bool operator==(const FlowGenericProblem& rhs) const;
298
299 template<class Serializer>
300 void serializeOp(Serializer& serializer)
301 {
302 serializer(maxOilSaturation_);
303 serializer(polymer_);
304 serializer(maxWaterSaturation_);
305 serializer(minRefPressure_);
306 serializer(overburdenPressure_);
307 serializer(solventSaturation_);
308 serializer(solventRsw_);
309 serializer(bioeffects_);
310 }
311
312protected:
313 void initFluidSystem_();
314
318 bool shouldWriteOutput() const
319 { return true; }
320
328 { return false; }
329
330 bool beginEpisode_(bool enableExperiments,
331 int episodeIdx);
332 void beginTimeStep_(bool enableExperiments,
333 int episodeIdx,
334 int timeStepIndex,
335 Scalar startTime,
336 Scalar time,
337 Scalar timeStepSize,
338 Scalar endTime);
339
340 void readRockParameters_(const std::vector<Scalar>& cellCenterDepths,
341 std::function<std::array<int,3>(const unsigned)> ijkIndex);
343
344 void readBlackoilExtentionsInitialConditions_(std::size_t numDof,
345 bool enableSolvent,
346 bool enablePolymer,
347 bool enablePolymerMolarWeight,
348 bool enableBioeffects,
349 bool enableMICP);
350
351 void updatePvtnum_();
352 void updateSatnum_();
353 void updateMiscnum_();
354 void updatePlmixnum_();
355
356 const EclipseState& eclState_;
357 const Schedule& schedule_;
358 const GridView& gridView_;
359
360 static inline std::string briefDescription_;
361 std::array<std::vector<Scalar>, 2> referencePorosity_;
362 std::array<std::vector<Scalar>, 2> rockFraction_;
363
364 std::vector<int> pvtnum_;
365 std::vector<unsigned short> satnum_;
366 std::vector<unsigned short> miscnum_;
367 std::vector<unsigned short> plmixnum_;
368
369 std::vector<RockParams> rockParams_;
370 std::vector<unsigned short> rockTableIdx_;
371 std::vector<TabulatedTwoDFunction> rockCompPoroMultWc_;
372 std::vector<TabulatedTwoDFunction> rockCompTransMultWc_;
373 std::vector<TabulatedFunction> rockCompPoroMult_;
374 std::vector<TabulatedFunction> rockCompTransMult_;
375 // ROCKCOMP HYSTERESIS=HYSTER only: the reversible "elastic" curves built from
376 // ROCKTABH, indexed by (turning pressure, current pressure). Used instead of
377 // rockCompPoroMult_/rockCompTransMult_ whenever the current pressure is above
378 // the lowest pressure the cell has ever reached (this->minRefPressure_).
379 std::vector<TabulatedTwoDFunction> rockCompPoroMultElastic_;
380 std::vector<TabulatedTwoDFunction> rockCompTransMultElastic_;
381 std::vector<Scalar> rockCompTransMultVal_;
382
384 std::vector<Scalar> maxOilSaturation_;
385 std::vector<Scalar> maxWaterSaturation_;
386 std::vector<Scalar> minRefPressure_;
387 std::vector<Scalar> overburdenPressure_;
388 std::vector<Scalar> solventSaturation_;
389 std::vector<Scalar> solventRsw_;
392
393 // time stepping parameters
397
398 // equilibration parameters
400
404
405 // To lookup origin cell indices
406 using Grid = std::remove_cv_t< typename std::remove_reference<decltype(gridView_.grid())>::type>;
409
410 // \brief Function to assign the origin cell index on level zero, for a cell on the leaf grid view.
411 //
412 // For CpGrid with local grid refinement, the field property of a cell on the leaf
413 // is inherited from its parent or equivalent (when has no parent) cell on level zero.
414 std::function<unsigned(unsigned)> lookupIdxOnLevelZeroAssigner_()
415 {
416 return [this](unsigned elemIdx) { return lookUpData_.template getFieldPropIdx<Grid>(elemIdx);};
417 }
418
419private:
420 template<class T>
421 void updateNum(const std::string& name, std::vector<T>& numbers, std::size_t num_regions);
422};
423
424} // namespace Opm
425
426#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:61
void setPorosity(Scalar poro, unsigned elementIdx, unsigned timeIdx=0)
Sets the porosity of an element.
Definition: FlowGenericProblem.hpp:196
const EclipseState & eclState_
Definition: FlowGenericProblem.hpp:356
UniformXTabulated2DFunction< Scalar > TabulatedTwoDFunction
Definition: FlowGenericProblem.hpp:64
Scalar maxPolymerAdsorption(unsigned elemIdx) const
Returns the max polymer adsorption value.
Definition: FlowGenericProblem_impl.hpp:962
unsigned pvtRegionIndex(unsigned elemIdx) const
Returns the index the relevant PVT region given a cell index.
Definition: FlowGenericProblem_impl.hpp:921
Scalar oxygenConcentration(unsigned elemIdx) const
Returns the initial oxygen concentration for a given a cell index.
Definition: FlowGenericProblem_impl.hpp:874
Scalar microbialConcentration(unsigned elemIdx) const
Returns the initial microbial concentration for a given a cell index.
Definition: FlowGenericProblem_impl.hpp:862
bool usesDefaultRockCompaction() const
Whether all rock compaction multipliers use their default values.
Definition: FlowGenericProblem.hpp:134
PolymerSolutionContainer< Scalar > polymer_
Definition: FlowGenericProblem.hpp:383
Scalar rockBiotTemp(unsigned elementIdx) const
Returns the rock compressibility of an element due to thermoelasticity.
Definition: FlowGenericProblem_impl.hpp:419
std::array< std::vector< Scalar >, 2 > rockFraction_
Definition: FlowGenericProblem.hpp:362
std::vector< Scalar > rockCompTransMultVal_
Definition: FlowGenericProblem.hpp:381
std::function< unsigned(unsigned)> lookupIdxOnLevelZeroAssigner_()
Definition: FlowGenericProblem.hpp:414
static std::string briefDescription()
Returns a human readable description of the problem for the help message.
Definition: FlowGenericProblem_impl.hpp:148
Scalar solventRsw(unsigned elemIdx) const
Returns the initial solvent dissolved in water for a given a cell index.
Definition: FlowGenericProblem_impl.hpp:825
std::vector< TabulatedTwoDFunction > rockCompPoroMultWc_
Definition: FlowGenericProblem.hpp:371
std::vector< unsigned short > miscnum_
Definition: FlowGenericProblem.hpp:366
Scalar overburdenPressure(unsigned elementIdx) const
Get the pressure of the overburden.
Definition: FlowGenericProblem_impl.hpp:803
void updateMiscnum_()
Definition: FlowGenericProblem_impl.hpp:596
Scalar porosity(unsigned globalSpaceIdx, unsigned timeIdx) const
Direct indexed access to the porosity.
Definition: FlowGenericProblem_impl.hpp:400
Scalar rockCompressibility(unsigned globalSpaceIdx) const
Definition: FlowGenericProblem_impl.hpp:385
Scalar initialTimeStepSize_
Definition: FlowGenericProblem.hpp:395
std::vector< TabulatedTwoDFunction > rockCompTransMultElastic_
Definition: FlowGenericProblem.hpp:380
unsigned miscnumRegionIndex(unsigned elemIdx) const
Returns the index the relevant MISC region given a cell index.
Definition: FlowGenericProblem_impl.hpp:941
bool vapparsActive(int episodeIdx) const
Definition: FlowGenericProblem_impl.hpp:612
int numPressurePointsEquil() const
Definition: FlowGenericProblem.hpp:294
Scalar referencePorosity(unsigned elementIdx, unsigned timeIdx) const
Returns the porosity of an element.
Definition: FlowGenericProblem.hpp:151
std::vector< int > pvtnum_
Definition: FlowGenericProblem.hpp:364
unsigned satnumRegionIndex(unsigned elemIdx) const
Returns the index the relevant saturation function region given a cell index.
Definition: FlowGenericProblem_impl.hpp:931
Scalar maxWaterSaturation(unsigned globalDofIdx) const
Returns an element's historic maximum water phase saturation that was observed during the simulation.
Definition: FlowGenericProblem_impl.hpp:781
std::vector< Scalar > solventSaturation_
Definition: FlowGenericProblem.hpp:388
void readRockCompactionParameters_()
Definition: FlowGenericProblem_impl.hpp:245
Tabulated1DFunction< Scalar > TabulatedFunction
Definition: FlowGenericProblem.hpp:65
void updateSatnum_()
Definition: FlowGenericProblem_impl.hpp:588
void updatePvtnum_()
Definition: FlowGenericProblem_impl.hpp:580
bool enableDriftCompensation_
Definition: FlowGenericProblem.hpp:401
bool enableDriftCompensationTemp_
Definition: FlowGenericProblem.hpp:402
Scalar lame(unsigned elementIdx) const
Direct access to Lame's second parameter in an element.
Definition: FlowGenericProblem_impl.hpp:431
static FlowGenericProblem serializationTestObject(const EclipseState &eclState, const Schedule &schedule, const GridView &gridView)
Definition: FlowGenericProblem_impl.hpp:112
void beginTimeStep_(bool enableExperiments, int episodeIdx, int timeStepIndex, Scalar startTime, Scalar time, Scalar timeStepSize, Scalar endTime)
Definition: FlowGenericProblem_impl.hpp:657
std::vector< TabulatedFunction > rockCompTransMult_
Definition: FlowGenericProblem.hpp:374
Scalar rockFraction(unsigned elementIdx, unsigned timeIdx) const
Returns the rockFraction of an element.
Definition: FlowGenericProblem.hpp:163
std::vector< unsigned short > plmixnum_
Definition: FlowGenericProblem.hpp:367
std::vector< TabulatedTwoDFunction > rockCompPoroMultElastic_
Definition: FlowGenericProblem.hpp:379
std::vector< TabulatedTwoDFunction > rockCompTransMultWc_
Definition: FlowGenericProblem.hpp:372
Scalar calciteVolumeFraction(unsigned elemIdx) const
Returns the initial calcite volume fraction for a given a cell index.
Definition: FlowGenericProblem_impl.hpp:910
CO2H2SolutionContainer< Scalar > CO2H2_
Definition: FlowGenericProblem.hpp:391
unsigned plmixnumRegionIndex(unsigned elemIdx) const
Returns the index the relevant PLMIXNUM (for polymer module) region given a cell index.
Definition: FlowGenericProblem_impl.hpp:951
FlowGenericProblem(const EclipseState &eclState, const Schedule &schedule, const GridView &gridView)
Definition: FlowGenericProblem_impl.hpp:62
BioeffectsSolutionContainer< Scalar > bioeffects_
Definition: FlowGenericProblem.hpp:390
bool enableTuning_
Definition: FlowGenericProblem.hpp:394
Scalar solventSaturation(unsigned elemIdx) const
Returns the initial solvent saturation for a given a cell index.
Definition: FlowGenericProblem_impl.hpp:814
Scalar polymerMolecularWeight(const unsigned elemIdx) const
Returns the polymer molecule weight for a given cell index.
Definition: FlowGenericProblem_impl.hpp:850
std::vector< TabulatedFunction > rockCompPoroMult_
Definition: FlowGenericProblem.hpp:373
const GridView & gridView_
Definition: FlowGenericProblem.hpp:358
void readRockParameters_(const std::vector< Scalar > &cellCenterDepths, std::function< std::array< int, 3 >(const unsigned)> ijkIndex)
Definition: FlowGenericProblem_impl.hpp:155
std::vector< Scalar > maxOilSaturation_
Definition: FlowGenericProblem.hpp:384
std::vector< RockParams > rockParams_
Definition: FlowGenericProblem.hpp:369
std::array< std::vector< Scalar >, 2 > referencePorosity_
Definition: FlowGenericProblem.hpp:361
const Schedule & schedule_
Definition: FlowGenericProblem.hpp:357
std::vector< unsigned short > satnum_
Definition: FlowGenericProblem.hpp:365
void serializeOp(Serializer &serializer)
Definition: FlowGenericProblem.hpp:300
Scalar rockBiotComp(unsigned elementIdx) const
Returns the rock compressibility of an element due to poroelasticity.
Definition: FlowGenericProblem_impl.hpp:408
static std::string briefDescription_
Definition: FlowGenericProblem.hpp:360
const LookUpData lookUpData_
Definition: FlowGenericProblem.hpp:408
int numPressurePointsEquil_
Definition: FlowGenericProblem.hpp:399
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:792
std::vector< Scalar > maxWaterSaturation_
Definition: FlowGenericProblem.hpp:385
void initFluidSystem_()
Definition: FlowGenericProblem_impl.hpp:682
bool operator==(const FlowGenericProblem &rhs) const
Definition: FlowGenericProblem_impl.hpp:973
Scalar maxTimeStepAfterWellEvent_
Definition: FlowGenericProblem.hpp:396
Scalar ureaConcentration(unsigned elemIdx) const
Returns the initial urea concentration for a given a cell index.
Definition: FlowGenericProblem_impl.hpp:886
std::vector< Scalar > minRefPressure_
Definition: FlowGenericProblem.hpp:386
bool beginEpisode_(bool enableExperiments, int episodeIdx)
Definition: FlowGenericProblem_impl.hpp:620
bool shouldWriteOutput() const
Always returns true. The ecl output writer takes care of the rest.
Definition: FlowGenericProblem.hpp:318
static void setBriefDescription(const std::string &msg)
Specifies the string returned by briefDescription()
Definition: FlowGenericProblem.hpp:97
Scalar biofilmVolumeFraction(unsigned elemIdx) const
Returns the initial biofilm volume fraction for a given a cell index.
Definition: FlowGenericProblem_impl.hpp:898
std::vector< Scalar > solventRsw_
Definition: FlowGenericProblem.hpp:389
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:133
std::vector< Scalar > overburdenPressure_
Definition: FlowGenericProblem.hpp:387
void readBlackoilExtentionsInitialConditions_(std::size_t numDof, bool enableSolvent, bool enablePolymer, bool enablePolymerMolarWeight, bool enableBioeffects, bool enableMICP)
Definition: FlowGenericProblem_impl.hpp:689
Scalar biotTemp(unsigned elementIdx) const
Direct access to Biot temperature coefficient in an element.
Definition: FlowGenericProblem_impl.hpp:483
bool shouldWriteRestartFile() const
Returns true if an eWoms restart file should be written to disk.
Definition: FlowGenericProblem.hpp:327
Scalar biotCoeff(unsigned elementIdx) const
Direct access to Biot coefficient in an element.
Definition: FlowGenericProblem_impl.hpp:462
void updatePlmixnum_()
Definition: FlowGenericProblem_impl.hpp:604
std::vector< unsigned short > rockTableIdx_
Definition: FlowGenericProblem.hpp:370
bool explicitRockCompaction_
Definition: FlowGenericProblem.hpp:403
typename FluidSystem::Scalar Scalar
Definition: FlowGenericProblem.hpp:63
std::remove_cv_t< typename std::remove_reference< decltype(gridView_.grid())>::type > Grid
Definition: FlowGenericProblem.hpp:406
Scalar polymerConcentration(unsigned elemIdx) const
Returns the initial polymer concentration for a given a cell index.
Definition: FlowGenericProblem_impl.hpp:838
Definition: FlowGenericProblem.hpp:51
Definition: fvbaseprimaryvariables.hh:161
Definition: blackoilbioeffectsmodules.hh:45
Struct holding MICP extension data.
Definition: SolutionContainers.hpp:57
Struct holding CO2 and H2 extension data.
Definition: SolutionContainers.hpp:84
Definition: FlowGenericProblem.hpp:67
Scalar compressibility
Definition: FlowGenericProblem.hpp:69
Scalar referencePressure
Definition: FlowGenericProblem.hpp:68
Struct holding polymer extension data.
Definition: SolutionContainers.hpp:37