My Project
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
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 {
77 Scalar referencePressure;
78 Scalar compressibility;
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
276 int numPressurePointsEquil() const
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);
325 void readRockCompactionParameters_();
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
378 bool enableTuning_;
379 Scalar initialTimeStepSize_;
380 Scalar maxTimeStepAfterWellEvent_;
381
382 // equilibration parameters
383 int numPressurePointsEquil_;
384
385 // To lookup origin cell indices
386 using Grid = std::remove_cv_t< typename std::remove_reference<decltype(gridView_.grid())>::type>;
388 const LookUpData lookUpData_;
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...
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:70
void setPorosity(Scalar poro, unsigned elementIdx, unsigned timeIdx=0)
Sets the porosity of an element.
Definition FlowGenericProblem.hpp:164
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
Scalar rockReferencePressure(unsigned globalSpaceIdx) const
Direct access to rock reference pressure.
Definition FlowGenericProblem_impl.hpp:324
static std::string briefDescription()
Definition FlowGenericProblem_impl.hpp:133
Scalar solventRsw(unsigned elemIdx) const
Returns the initial solvent dissolved in water for a given a cell index.
Definition FlowGenericProblem_impl.hpp:622
Scalar overburdenPressure(unsigned elementIdx) const
Get the pressure of the overburden.
Definition FlowGenericProblem_impl.hpp:600
Scalar porosity(unsigned globalSpaceIdx, unsigned timeIdx) const
Direct indexed access to the porosity.
Definition FlowGenericProblem_impl.hpp:339
Scalar rockCompressibility(unsigned globalSpaceIdx) const
Direct access to rock compressibility.
Definition FlowGenericProblem_impl.hpp:309
unsigned miscnumRegionIndex(unsigned elemIdx) const
Returns the index the relevant MISC region given a cell index.
Definition FlowGenericProblem_impl.hpp:745
Scalar referencePorosity(unsigned elementIdx, unsigned timeIdx) const
Returns the porosity of an element.
Definition FlowGenericProblem.hpp:146
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
unsigned plmixnumRegionIndex(unsigned elemIdx) const
Returns the index the relevant PLMIXNUM (for polymer module) region given a cell index.
Definition FlowGenericProblem_impl.hpp:755
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
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
Scalar calciteConcentration(unsigned elemIdx) const
Returns the initial calcite concentration for a given a cell index.
Definition FlowGenericProblem_impl.hpp:714
Scalar ureaConcentration(unsigned elemIdx) const
Returns the initial urea concentration for a given a cell index.
Definition FlowGenericProblem_impl.hpp:690
bool shouldWriteOutput() const
Always returns true.
Definition FlowGenericProblem.hpp:301
static void setBriefDescription(const std::string &msg)
Specifies the string returned by briefDescription()
Definition FlowGenericProblem.hpp:106
static std::string helpPreamble(int, const char **argv)
Definition FlowGenericProblem_impl.hpp:118
bool shouldWriteRestartFile() const
Returns true if an eWoms restart file should be written to disk.
Definition FlowGenericProblem.hpp:310
Scalar drsdtcon(unsigned elemIdx, int episodeIdx) const
Returns the dynamic drsdt convective mixing value.
Definition FlowGenericProblem_impl.hpp:633
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
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition BlackoilPhases.hpp:27
Definition FlowGenericProblem.hpp:76
Struct holding MICP extension data.
Definition SolutionContainers.hpp:57
Struct holding polymer extension data.
Definition SolutionContainers.hpp:37