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
137 Scalar referencePorosity(unsigned elementIdx, unsigned timeIdx) const
138 { return referencePorosity_[timeIdx][elementIdx]; }
139
140
149 Scalar rockFraction(unsigned elementIdx, unsigned timeIdx) const;
150
155 void setPorosity(Scalar poro, unsigned elementIdx, unsigned timeIdx = 0)
156 { referencePorosity_[timeIdx][elementIdx] = poro; }
157
161 Scalar solventSaturation(unsigned elemIdx) const;
162
166 Scalar solventRsw(unsigned elemIdx) const;
167
171 Scalar polymerConcentration(unsigned elemIdx) const;
172
176 // TODO: remove this function if not called
177 Scalar polymerMolecularWeight(const unsigned elemIdx) const;
178
182 Scalar microbialConcentration(unsigned elemIdx) const;
183
187 Scalar oxygenConcentration(unsigned elemIdx) const;
188
192 Scalar ureaConcentration(unsigned elemIdx) const;
193
197 Scalar biofilmConcentration(unsigned elemIdx) const;
198
202 Scalar calciteConcentration(unsigned elemIdx) const;
203
207 unsigned pvtRegionIndex(unsigned elemIdx) const;
208
209// const std::vector<int>& pvtRegionArray() const
210// { return pvtnum_; }
211
215 unsigned satnumRegionIndex(unsigned elemIdx) const;
216
220 unsigned miscnumRegionIndex(unsigned elemIdx) const;
221
225 unsigned plmixnumRegionIndex(unsigned elemIdx) const;
226
230 Scalar maxPolymerAdsorption(unsigned elemIdx) const;
231
239 Scalar rockCompressibility(unsigned globalSpaceIdx) const;
240
249 Scalar porosity(unsigned globalSpaceIdx, unsigned timeIdx) const;
250
251 bool vapparsActive(int episodeIdx) const;
252
254 { return numPressurePointsEquil_; }
255
256 bool operator==(const FlowGenericProblem& rhs) const;
257
258 template<class Serializer>
259 void serializeOp(Serializer& serializer)
260 {
261 serializer(maxOilSaturation_);
262 serializer(polymer_);
263 serializer(maxWaterSaturation_);
264 serializer(minRefPressure_);
265 serializer(overburdenPressure_);
266 serializer(solventSaturation_);
267 serializer(solventRsw_);
268 serializer(micp_);
269 }
270
271protected:
272 void initFluidSystem_();
273
277 bool shouldWriteOutput() const
278 { return true; }
279
287 { return false; }
288
289 bool beginEpisode_(bool enableExperiments,
290 int episodeIdx);
291 void beginTimeStep_(bool enableExperiments,
292 int episodeIdx,
293 int timeStepIndex,
294 Scalar startTime,
295 Scalar time,
296 Scalar timeStepSize,
297 Scalar endTime);
298
299 void readRockParameters_(const std::vector<Scalar>& cellCenterDepths,
300 std::function<std::array<int,3>(const unsigned)> ijkIndex);
302
303 void readBlackoilExtentionsInitialConditions_(std::size_t numDof,
304 bool enableSolvent,
305 bool enablePolymer,
306 bool enablePolymerMolarWeight,
307 bool enableMICP);
308
309 void updatePvtnum_();
310 void updateSatnum_();
311 void updateMiscnum_();
312 void updatePlmixnum_();
313
314 const EclipseState& eclState_;
315 const Schedule& schedule_;
316 const GridView& gridView_;
317
318 static inline std::string briefDescription_;
319 std::array<std::vector<Scalar>, 2> referencePorosity_;
320
321 std::vector<int> pvtnum_;
322 std::vector<unsigned short> satnum_;
323 std::vector<unsigned short> miscnum_;
324 std::vector<unsigned short> plmixnum_;
325
326 std::vector<RockParams> rockParams_;
327 std::vector<unsigned short> rockTableIdx_;
328 std::vector<TabulatedTwoDFunction> rockCompPoroMultWc_;
329 std::vector<TabulatedTwoDFunction> rockCompTransMultWc_;
330 std::vector<TabulatedFunction> rockCompPoroMult_;
331 std::vector<TabulatedFunction> rockCompTransMult_;
332 std::vector<Scalar> rockCompTransMultVal_;
333
335 std::vector<Scalar> maxOilSaturation_;
336 std::vector<Scalar> maxWaterSaturation_;
337 std::vector<Scalar> minRefPressure_;
338 std::vector<Scalar> overburdenPressure_;
339 std::vector<Scalar> solventSaturation_;
340 std::vector<Scalar> solventRsw_;
342
343 // time stepping parameters
347
348 // equilibration parameters
350
353
354 // To lookup origin cell indices
355 using Grid = std::remove_cv_t< typename std::remove_reference<decltype(gridView_.grid())>::type>;
358
359 // \brief Function to assign the origin cell index on level zero, for a cell on the leaf grid view.
360 //
361 // For CpGrid with local grid refinement, the field property of a cell on the leaf
362 // is inherited from its parent or equivalent (when has no parent) cell on level zero.
363 std::function<unsigned(unsigned)> lookupIdxOnLevelZeroAssigner_()
364 {
365 return [this](unsigned elemIdx) { return lookUpData_.template getFieldPropIdx<Grid>(elemIdx);};
366 }
367
368private:
369 template<class T>
370 void updateNum(const std::string& name, std::vector<T>& numbers, std::size_t num_regions);
371};
372
373} // namespace Opm
374
375#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:155
const EclipseState & eclState_
Definition: FlowGenericProblem.hpp:314
UniformXTabulated2DFunction< Scalar > TabulatedTwoDFunction
Definition: FlowGenericProblem.hpp:64
Scalar maxPolymerAdsorption(unsigned elemIdx) const
Returns the max polymer adsorption value.
Definition: FlowGenericProblem_impl.hpp:733
unsigned pvtRegionIndex(unsigned elemIdx) const
Returns the index the relevant PVT region given a cell index.
Definition: FlowGenericProblem_impl.hpp:692
Scalar oxygenConcentration(unsigned elemIdx) const
Returns the initial oxygen concentration for a given a cell index.
Definition: FlowGenericProblem_impl.hpp:645
Scalar microbialConcentration(unsigned elemIdx) const
Returns the initial microbial concentration for a given a cell index.
Definition: FlowGenericProblem_impl.hpp:633
PolymerSolutionContainer< Scalar > polymer_
Definition: FlowGenericProblem.hpp:334
std::vector< Scalar > rockCompTransMultVal_
Definition: FlowGenericProblem.hpp:332
std::function< unsigned(unsigned)> lookupIdxOnLevelZeroAssigner_()
Definition: FlowGenericProblem.hpp:363
static std::string briefDescription()
Returns a human readable description of the problem for the help message.
Definition: FlowGenericProblem_impl.hpp:126
Scalar solventRsw(unsigned elemIdx) const
Returns the initial solvent dissolved in water for a given a cell index.
Definition: FlowGenericProblem_impl.hpp:596
std::vector< TabulatedTwoDFunction > rockCompPoroMultWc_
Definition: FlowGenericProblem.hpp:328
std::vector< unsigned short > miscnum_
Definition: FlowGenericProblem.hpp:323
Scalar overburdenPressure(unsigned elementIdx) const
Get the pressure of the overburden.
Definition: FlowGenericProblem_impl.hpp:574
void updateMiscnum_()
Definition: FlowGenericProblem_impl.hpp:387
Scalar porosity(unsigned globalSpaceIdx, unsigned timeIdx) const
Direct indexed access to the porosity.
Definition: FlowGenericProblem_impl.hpp:329
Scalar rockCompressibility(unsigned globalSpaceIdx) const
Definition: FlowGenericProblem_impl.hpp:314
Scalar initialTimeStepSize_
Definition: FlowGenericProblem.hpp:345
unsigned miscnumRegionIndex(unsigned elemIdx) const
Returns the index the relevant MISC region given a cell index.
Definition: FlowGenericProblem_impl.hpp:712
bool vapparsActive(int episodeIdx) const
Definition: FlowGenericProblem_impl.hpp:403
int numPressurePointsEquil() const
Definition: FlowGenericProblem.hpp:253
Scalar referencePorosity(unsigned elementIdx, unsigned timeIdx) const
Returns the porosity of an element.
Definition: FlowGenericProblem.hpp:137
std::vector< int > pvtnum_
Definition: FlowGenericProblem.hpp:321
unsigned satnumRegionIndex(unsigned elemIdx) const
Returns the index the relevant saturation function region given a cell index.
Definition: FlowGenericProblem_impl.hpp:702
Scalar rockFraction(unsigned elementIdx, unsigned timeIdx) const
Returns the rockFraction of an element.
Definition: FlowGenericProblem_impl.hpp:337
Scalar maxWaterSaturation(unsigned globalDofIdx) const
Returns an element's historic maximum water phase saturation that was observed during the simulation.
Definition: FlowGenericProblem_impl.hpp:552
std::vector< Scalar > solventSaturation_
Definition: FlowGenericProblem.hpp:339
void readRockCompactionParameters_()
Definition: FlowGenericProblem_impl.hpp:220
Tabulated1DFunction< Scalar > TabulatedFunction
Definition: FlowGenericProblem.hpp:65
void updateSatnum_()
Definition: FlowGenericProblem_impl.hpp:379
void updatePvtnum_()
Definition: FlowGenericProblem_impl.hpp:371
bool enableDriftCompensation_
Definition: FlowGenericProblem.hpp:351
static FlowGenericProblem serializationTestObject(const EclipseState &eclState, const Schedule &schedule, const GridView &gridView)
Definition: FlowGenericProblem_impl.hpp:91
void beginTimeStep_(bool enableExperiments, int episodeIdx, int timeStepIndex, Scalar startTime, Scalar time, Scalar timeStepSize, Scalar endTime)
Definition: FlowGenericProblem_impl.hpp:448
std::vector< TabulatedFunction > rockCompTransMult_
Definition: FlowGenericProblem.hpp:331
std::vector< unsigned short > plmixnum_
Definition: FlowGenericProblem.hpp:324
std::vector< TabulatedTwoDFunction > rockCompTransMultWc_
Definition: FlowGenericProblem.hpp:329
unsigned plmixnumRegionIndex(unsigned elemIdx) const
Returns the index the relevant PLMIXNUM (for polymer module) region given a cell index.
Definition: FlowGenericProblem_impl.hpp:722
FlowGenericProblem(const EclipseState &eclState, const Schedule &schedule, const GridView &gridView)
Definition: FlowGenericProblem_impl.hpp:60
bool enableTuning_
Definition: FlowGenericProblem.hpp:344
Scalar solventSaturation(unsigned elemIdx) const
Returns the initial solvent saturation for a given a cell index.
Definition: FlowGenericProblem_impl.hpp:585
Scalar polymerMolecularWeight(const unsigned elemIdx) const
Returns the polymer molecule weight for a given cell index.
Definition: FlowGenericProblem_impl.hpp:621
Scalar biofilmConcentration(unsigned elemIdx) const
Returns the initial biofilm concentration for a given a cell index.
Definition: FlowGenericProblem_impl.hpp:669
MICPSolutionContainer< Scalar > micp_
Definition: FlowGenericProblem.hpp:341
std::vector< TabulatedFunction > rockCompPoroMult_
Definition: FlowGenericProblem.hpp:330
const GridView & gridView_
Definition: FlowGenericProblem.hpp:316
void readRockParameters_(const std::vector< Scalar > &cellCenterDepths, std::function< std::array< int, 3 >(const unsigned)> ijkIndex)
Definition: FlowGenericProblem_impl.hpp:133
std::vector< Scalar > maxOilSaturation_
Definition: FlowGenericProblem.hpp:335
std::vector< RockParams > rockParams_
Definition: FlowGenericProblem.hpp:326
std::array< std::vector< Scalar >, 2 > referencePorosity_
Definition: FlowGenericProblem.hpp:319
const Schedule & schedule_
Definition: FlowGenericProblem.hpp:315
std::vector< unsigned short > satnum_
Definition: FlowGenericProblem.hpp:322
void serializeOp(Serializer &serializer)
Definition: FlowGenericProblem.hpp:259
void readBlackoilExtentionsInitialConditions_(std::size_t numDof, bool enableSolvent, bool enablePolymer, bool enablePolymerMolarWeight, bool enableMICP)
Definition: FlowGenericProblem_impl.hpp:479
static std::string briefDescription_
Definition: FlowGenericProblem.hpp:318
const LookUpData lookUpData_
Definition: FlowGenericProblem.hpp:357
int numPressurePointsEquil_
Definition: FlowGenericProblem.hpp:349
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:563
std::vector< Scalar > maxWaterSaturation_
Definition: FlowGenericProblem.hpp:336
void initFluidSystem_()
Definition: FlowGenericProblem_impl.hpp:472
bool operator==(const FlowGenericProblem &rhs) const
Definition: FlowGenericProblem_impl.hpp:744
Scalar maxTimeStepAfterWellEvent_
Definition: FlowGenericProblem.hpp:346
Scalar calciteConcentration(unsigned elemIdx) const
Returns the initial calcite concentration for a given a cell index.
Definition: FlowGenericProblem_impl.hpp:681
Scalar ureaConcentration(unsigned elemIdx) const
Returns the initial urea concentration for a given a cell index.
Definition: FlowGenericProblem_impl.hpp:657
std::vector< Scalar > minRefPressure_
Definition: FlowGenericProblem.hpp:337
bool beginEpisode_(bool enableExperiments, int episodeIdx)
Definition: FlowGenericProblem_impl.hpp:411
bool shouldWriteOutput() const
Always returns true. The ecl output writer takes care of the rest.
Definition: FlowGenericProblem.hpp:277
static void setBriefDescription(const std::string &msg)
Specifies the string returned by briefDescription()
Definition: FlowGenericProblem.hpp:97
std::vector< Scalar > solventRsw_
Definition: FlowGenericProblem.hpp:340
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:111
std::vector< Scalar > overburdenPressure_
Definition: FlowGenericProblem.hpp:338
bool shouldWriteRestartFile() const
Returns true if an eWoms restart file should be written to disk.
Definition: FlowGenericProblem.hpp:286
void updatePlmixnum_()
Definition: FlowGenericProblem_impl.hpp:395
std::vector< unsigned short > rockTableIdx_
Definition: FlowGenericProblem.hpp:327
bool explicitRockCompaction_
Definition: FlowGenericProblem.hpp:352
typename FluidSystem::Scalar Scalar
Definition: FlowGenericProblem.hpp:63
std::remove_cv_t< typename std::remove_reference< decltype(gridView_.grid())>::type > Grid
Definition: FlowGenericProblem.hpp:355
Scalar polymerConcentration(unsigned elemIdx) const
Returns the initial polymer concentration for a given a cell index.
Definition: FlowGenericProblem_impl.hpp:609
Definition: FlowGenericProblem.hpp:51
Definition: fvbaseprimaryvariables.hh:141
Definition: blackoilboundaryratevector.hh:39
Definition: FlowGenericProblem.hpp:67
Scalar compressibility
Definition: FlowGenericProblem.hpp:69
Scalar referencePressure
Definition: FlowGenericProblem.hpp:68
Struct holding MICP extension data.
Definition: SolutionContainers.hpp:57
Struct holding polymer extension data.
Definition: SolutionContainers.hpp:37