opm-simulators
Loading...
Searching...
No Matches
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>
60class FlowGenericProblem
61{
62public:
63 using Scalar = typename FluidSystem::Scalar;
64 using TabulatedTwoDFunction = UniformXTabulated2DFunction<Scalar>;
65 using TabulatedFunction = Tabulated1DFunction<Scalar>;
66
67 struct RockParams {
68 Scalar referencePressure;
69 Scalar compressibility;
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 return rockFraction_[timeIdx][elementIdx];
151 };
152
156 Scalar rockBiotComp(unsigned elementIdx) const;
157
161 Scalar lame(unsigned elementIdx) const;
162
166 Scalar biotCoeff(unsigned elementIdx) const;
167
172 void setPorosity(Scalar poro, unsigned elementIdx, unsigned timeIdx = 0)
173 { referencePorosity_[timeIdx][elementIdx] = poro; }
174
178 Scalar solventSaturation(unsigned elemIdx) const;
179
183 Scalar solventRsw(unsigned elemIdx) const;
184
188 Scalar polymerConcentration(unsigned elemIdx) const;
189
193 // TODO: remove this function if not called
194 Scalar polymerMolecularWeight(const unsigned elemIdx) const;
195
199 Scalar microbialConcentration(unsigned elemIdx) const;
200
204 Scalar oxygenConcentration(unsigned elemIdx) const;
205
209 Scalar ureaConcentration(unsigned elemIdx) const;
210
214 Scalar biofilmVolumeFraction(unsigned elemIdx) const;
215
219 Scalar calciteVolumeFraction(unsigned elemIdx) const;
220
224 unsigned pvtRegionIndex(unsigned elemIdx) const;
225
226// const std::vector<int>& pvtRegionArray() const
227// { return pvtnum_; }
228
232 unsigned satnumRegionIndex(unsigned elemIdx) const;
233
237 unsigned miscnumRegionIndex(unsigned elemIdx) const;
238
242 unsigned plmixnumRegionIndex(unsigned elemIdx) const;
243
247 Scalar maxPolymerAdsorption(unsigned elemIdx) const;
248
256 Scalar rockCompressibility(unsigned globalSpaceIdx) const;
257
266 Scalar porosity(unsigned globalSpaceIdx, unsigned timeIdx) const;
267
268 bool vapparsActive(int episodeIdx) const;
269
270 int numPressurePointsEquil() const
271 { return numPressurePointsEquil_; }
272
273 bool operator==(const FlowGenericProblem& rhs) const;
274
275 template<class Serializer>
276 void serializeOp(Serializer& serializer)
277 {
278 serializer(maxOilSaturation_);
279 serializer(polymer_);
280 serializer(maxWaterSaturation_);
281 serializer(minRefPressure_);
282 serializer(overburdenPressure_);
283 serializer(solventSaturation_);
284 serializer(solventRsw_);
285 serializer(bioeffects_);
286 }
287
288protected:
289 void initFluidSystem_();
290
294 bool shouldWriteOutput() const
295 { return true; }
296
304 { return false; }
305
306 bool beginEpisode_(bool enableExperiments,
307 int episodeIdx);
308 void beginTimeStep_(bool enableExperiments,
309 int episodeIdx,
310 int timeStepIndex,
311 Scalar startTime,
312 Scalar time,
313 Scalar timeStepSize,
314 Scalar endTime);
315
316 void readRockParameters_(const std::vector<Scalar>& cellCenterDepths,
317 std::function<std::array<int,3>(const unsigned)> ijkIndex);
318 void readRockCompactionParameters_();
319
320 void readBlackoilExtentionsInitialConditions_(std::size_t numDof,
321 bool enableSolvent,
322 bool enablePolymer,
323 bool enablePolymerMolarWeight,
324 bool enableBioeffects,
325 bool enableMICP);
326
327 void updatePvtnum_();
328 void updateSatnum_();
329 void updateMiscnum_();
330 void updatePlmixnum_();
331
332 const EclipseState& eclState_;
333 const Schedule& schedule_;
334 const GridView& gridView_;
335
336 static inline std::string briefDescription_;
337 std::array<std::vector<Scalar>, 2> referencePorosity_;
338 std::array<std::vector<Scalar>, 2> rockFraction_;
339
340 std::vector<int> pvtnum_;
341 std::vector<unsigned short> satnum_;
342 std::vector<unsigned short> miscnum_;
343 std::vector<unsigned short> plmixnum_;
344
345 std::vector<RockParams> rockParams_;
346 std::vector<unsigned short> rockTableIdx_;
347 std::vector<TabulatedTwoDFunction> rockCompPoroMultWc_;
348 std::vector<TabulatedTwoDFunction> rockCompTransMultWc_;
349 std::vector<TabulatedFunction> rockCompPoroMult_;
350 std::vector<TabulatedFunction> rockCompTransMult_;
351 std::vector<Scalar> rockCompTransMultVal_;
352
354 std::vector<Scalar> maxOilSaturation_;
355 std::vector<Scalar> maxWaterSaturation_;
356 std::vector<Scalar> minRefPressure_;
357 std::vector<Scalar> overburdenPressure_;
358 std::vector<Scalar> solventSaturation_;
359 std::vector<Scalar> solventRsw_;
362
363 // time stepping parameters
364 bool enableTuning_;
365 Scalar initialTimeStepSize_;
366 Scalar maxTimeStepAfterWellEvent_;
367
368 // equilibration parameters
369 int numPressurePointsEquil_;
370
371 bool enableDriftCompensation_;
372 bool enableDriftCompensationTemp_{false};
373 bool explicitRockCompaction_;
374
375 // To lookup origin cell indices
376 using Grid = std::remove_cv_t< typename std::remove_reference<decltype(gridView_.grid())>::type>;
377 using LookUpData = Opm::LookUpData<Grid,GridView>;
378 const LookUpData lookUpData_;
379
380 // \brief Function to assign the origin cell index on level zero, for a cell on the leaf grid view.
381 //
382 // For CpGrid with local grid refinement, the field property of a cell on the leaf
383 // is inherited from its parent or equivalent (when has no parent) cell on level zero.
384 std::function<unsigned(unsigned)> lookupIdxOnLevelZeroAssigner_()
385 {
386 return [this](unsigned elemIdx) { return lookUpData_.template getFieldPropIdx<Grid>(elemIdx);};
387 }
388
389private:
390 template<class T>
391 void updateNum(const std::string& name, std::vector<T>& numbers, std::size_t num_regions);
392};
393
394} // namespace Opm
395
396#endif // OPM_FLOW_GENERIC_PROBLEM_HPP
This problem simulates an input file given in the data format used by the commercial ECLiPSE simulato...
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:172
Scalar maxPolymerAdsorption(unsigned elemIdx) const
Returns the max polymer adsorption value.
Definition FlowGenericProblem_impl.hpp:797
unsigned pvtRegionIndex(unsigned elemIdx) const
Returns the index the relevant PVT region given a cell index.
Definition FlowGenericProblem_impl.hpp:756
Scalar oxygenConcentration(unsigned elemIdx) const
Returns the initial oxygen concentration for a given a cell index.
Definition FlowGenericProblem_impl.hpp:709
Scalar microbialConcentration(unsigned elemIdx) const
Returns the initial microbial concentration for a given a cell index.
Definition FlowGenericProblem_impl.hpp:697
static std::string briefDescription()
Returns a human readable description of the problem for the help message.
Definition FlowGenericProblem_impl.hpp:130
Scalar solventRsw(unsigned elemIdx) const
Returns the initial solvent dissolved in water for a given a cell index.
Definition FlowGenericProblem_impl.hpp:660
Scalar overburdenPressure(unsigned elementIdx) const
Get the pressure of the overburden.
Definition FlowGenericProblem_impl.hpp:638
Scalar porosity(unsigned globalSpaceIdx, unsigned timeIdx) const
Direct indexed access to the porosity.
Definition FlowGenericProblem_impl.hpp:338
Scalar rockCompressibility(unsigned globalSpaceIdx) const
Direct access to rock compressibility.
Definition FlowGenericProblem_impl.hpp:323
unsigned miscnumRegionIndex(unsigned elemIdx) const
Returns the index the relevant MISC region given a cell index.
Definition FlowGenericProblem_impl.hpp:776
Scalar referencePorosity(unsigned elementIdx, unsigned timeIdx) const
Returns the porosity of an element.
Definition FlowGenericProblem.hpp:137
unsigned satnumRegionIndex(unsigned elemIdx) const
Returns the index the relevant saturation function region given a cell index.
Definition FlowGenericProblem_impl.hpp:766
Scalar maxWaterSaturation(unsigned globalDofIdx) const
Returns an element's historic maximum water phase saturation that was observed during the simulation.
Definition FlowGenericProblem_impl.hpp:616
Scalar lame(unsigned elementIdx) const
Direct access to Lame's second parameter in an element.
Definition FlowGenericProblem_impl.hpp:357
Scalar rockFraction(unsigned elementIdx, unsigned timeIdx) const
Returns the rockFraction of an element.
Definition FlowGenericProblem.hpp:149
Scalar calciteVolumeFraction(unsigned elemIdx) const
Returns the initial calcite volume fraction for a given a cell index.
Definition FlowGenericProblem_impl.hpp:745
unsigned plmixnumRegionIndex(unsigned elemIdx) const
Returns the index the relevant PLMIXNUM (for polymer module) region given a cell index.
Definition FlowGenericProblem_impl.hpp:786
Scalar solventSaturation(unsigned elemIdx) const
Returns the initial solvent saturation for a given a cell index.
Definition FlowGenericProblem_impl.hpp:649
Scalar polymerMolecularWeight(const unsigned elemIdx) const
Returns the polymer molecule weight for a given cell index.
Definition FlowGenericProblem_impl.hpp:685
Scalar rockBiotComp(unsigned elementIdx) const
Returns the rock compressibility of an element due to poroelasticity.
Definition FlowGenericProblem_impl.hpp:346
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:627
Scalar ureaConcentration(unsigned elemIdx) const
Returns the initial urea concentration for a given a cell index.
Definition FlowGenericProblem_impl.hpp:721
bool shouldWriteOutput() const
Always returns true.
Definition FlowGenericProblem.hpp:294
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:733
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:115
bool shouldWriteRestartFile() const
Returns true if an eWoms restart file should be written to disk.
Definition FlowGenericProblem.hpp:303
Scalar biotCoeff(unsigned elementIdx) const
Direct access to Biot coefficient in an element.
Definition FlowGenericProblem_impl.hpp:388
Scalar polymerConcentration(unsigned elemIdx) const
Returns the initial polymer concentration for a given a cell index.
Definition FlowGenericProblem_impl.hpp:673
Definition FlowGenericProblem.hpp:51
This file contains a set of helper functions used by VFPProd / VFPInj.
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
Struct holding polymer extension data.
Definition SolutionContainers.hpp:37