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
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
61template<class GridView, class FluidSystem>
63{
64public:
65 using Scalar = typename FluidSystem::Scalar;
66 using TabulatedTwoDFunction = UniformXTabulated2DFunction<Scalar>;
67 using TabulatedFunction = Tabulated1DFunction<Scalar>;
68
69 struct RockParams {
70 Scalar referencePressure;
71 Scalar compressibility;
72 };
73
74 FlowGenericProblem(const EclipseState& eclState,
75 const Schedule& schedule,
76 const GridView& gridView);
77
78
79 static FlowGenericProblem serializationTestObject(const EclipseState& eclState,
80 const Schedule& schedule,
81 const GridView& gridView);
82
86 static std::string helpPreamble(int,
87 const char **argv);
88
92 static std::string briefDescription();
93
99 static void setBriefDescription(const std::string& msg)
100 { briefDescription_ = msg; }
101
111 Scalar maxWaterSaturation(unsigned globalDofIdx) const;
112
122 Scalar minOilPressure(unsigned globalDofIdx) const;
123
129 Scalar overburdenPressure(unsigned elementIdx) const;
130
139 Scalar referencePorosity(unsigned elementIdx, unsigned timeIdx) const
140 { return referencePorosity_[timeIdx][elementIdx]; }
141
142
151 Scalar rockFraction(unsigned elementIdx, unsigned timeIdx) const;
152
157 void setPorosity(Scalar poro, unsigned elementIdx, unsigned timeIdx = 0)
158 { referencePorosity_[timeIdx][elementIdx] = poro; }
159
163 Scalar solventSaturation(unsigned elemIdx) const;
164
168 Scalar solventRsw(unsigned elemIdx) const;
169
173 Scalar drsdtcon(unsigned elemIdx, int episodeIdx) const;
174
178 Scalar polymerConcentration(unsigned elemIdx) const;
179
183 // TODO: remove this function if not called
184 Scalar polymerMolecularWeight(const unsigned elemIdx) const;
185
189 Scalar microbialConcentration(unsigned elemIdx) const;
190
194 Scalar oxygenConcentration(unsigned elemIdx) const;
195
199 Scalar ureaConcentration(unsigned elemIdx) const;
200
204 Scalar biofilmConcentration(unsigned elemIdx) const;
205
209 Scalar calciteConcentration(unsigned elemIdx) const;
210
214 unsigned pvtRegionIndex(unsigned elemIdx) const;
215
216// const std::vector<int>& pvtRegionArray() const
217// { return pvtnum_; }
218
222 unsigned satnumRegionIndex(unsigned elemIdx) const;
223
227 unsigned miscnumRegionIndex(unsigned elemIdx) const;
228
232 unsigned plmixnumRegionIndex(unsigned elemIdx) const;
233
237 Scalar maxPolymerAdsorption(unsigned elemIdx) const;
238
246 Scalar rockCompressibility(unsigned globalSpaceIdx) const;
247
255 Scalar rockReferencePressure(unsigned globalSpaceIdx) const;
256
265 Scalar porosity(unsigned globalSpaceIdx, unsigned timeIdx) const;
266
267 bool vapparsActive(int episodeIdx) const;
268
269 int numPressurePointsEquil() const
270 { return numPressurePointsEquil_; }
271
272 bool operator==(const FlowGenericProblem& rhs) const;
273
274 template<class Serializer>
275 void serializeOp(Serializer& serializer)
276 {
277 serializer(maxOilSaturation_);
278 serializer(polymer_);
279 serializer(maxWaterSaturation_);
280 serializer(minRefPressure_);
281 serializer(overburdenPressure_);
282 serializer(solventSaturation_);
283 serializer(solventRsw_);
284 serializer(micp_);
285 }
286
287protected:
288 void initFluidSystem_();
289
293 bool shouldWriteOutput() const
294 { return true; }
295
303 { return false; }
304
305 bool beginEpisode_(bool enableExperiments,
306 int episodeIdx);
307 void beginTimeStep_(bool enableExperiments,
308 int episodeIdx,
309 int timeStepIndex,
310 Scalar startTime,
311 Scalar time,
312 Scalar timeStepSize,
313 Scalar endTime);
314
315 void readRockParameters_(const std::vector<Scalar>& cellCenterDepths,
316 std::function<std::array<int,3>(const unsigned)> ijkIndex);
317 void readRockCompactionParameters_();
318
319 void readBlackoilExtentionsInitialConditions_(std::size_t numDof,
320 bool enableSolvent,
321 bool enablePolymer,
322 bool enablePolymerMolarWeight,
323 bool enableMICP);
324
325 void updatePvtnum_();
326 void updateSatnum_();
327 void updateMiscnum_();
328 void updatePlmixnum_();
329
330 const EclipseState& eclState_;
331 const Schedule& schedule_;
332 const GridView& gridView_;
333
334 static inline std::string briefDescription_;
335 std::array<std::vector<Scalar>, 2> referencePorosity_;
336
337 std::vector<int> pvtnum_;
338 std::vector<unsigned short> satnum_;
339 std::vector<unsigned short> miscnum_;
340 std::vector<unsigned short> plmixnum_;
341
342 std::vector<RockParams> rockParams_;
343 std::vector<unsigned short> rockTableIdx_;
344 std::vector<TabulatedTwoDFunction> rockCompPoroMultWc_;
345 std::vector<TabulatedTwoDFunction> rockCompTransMultWc_;
346 std::vector<TabulatedFunction> rockCompPoroMult_;
347 std::vector<TabulatedFunction> rockCompTransMult_;
348 std::vector<Scalar> rockCompTransMultVal_;
349
351 std::vector<Scalar> maxOilSaturation_;
352 std::vector<Scalar> maxWaterSaturation_;
353 std::vector<Scalar> minRefPressure_;
354 std::vector<Scalar> overburdenPressure_;
355 std::vector<Scalar> solventSaturation_;
356 std::vector<Scalar> solventRsw_;
358
359 // time stepping parameters
360 bool enableTuning_;
361 Scalar initialTimeStepSize_;
362 Scalar maxTimeStepAfterWellEvent_;
363
364 // equilibration parameters
365 int numPressurePointsEquil_;
366
367 // To lookup origin cell indices
368 using Grid = std::remove_cv_t< typename std::remove_reference<decltype(gridView_.grid())>::type>;
370 const LookUpData lookUpData_;
371
372 // \brief Function to assign the origin cell index on level zero, for a cell on the leaf grid view.
373 //
374 // For CpGrid with local grid refinement, the field property of a cell on the leaf
375 // is inherited from its parent or equivalent (when has no parent) cell on level zero.
376 std::function<unsigned(unsigned)> lookupIdxOnLevelZeroAssigner_()
377 {
378 return [this](unsigned elemIdx) { return lookUpData_.template getFieldPropIdx<Grid>(elemIdx);};
379 }
380
381private:
382 template<class T>
383 void updateNum(const std::string& name, std::vector<T>& numbers, std::size_t num_regions);
384};
385
386} // namespace Opm
387
388#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:63
void setPorosity(Scalar poro, unsigned elementIdx, unsigned timeIdx=0)
Sets the porosity of an element.
Definition FlowGenericProblem.hpp:157
Scalar maxPolymerAdsorption(unsigned elemIdx) const
Returns the max polymer adsorption value.
Definition FlowGenericProblem_impl.hpp:709
unsigned pvtRegionIndex(unsigned elemIdx) const
Returns the index the relevant PVT region given a cell index.
Definition FlowGenericProblem_impl.hpp:668
Scalar oxygenConcentration(unsigned elemIdx) const
Returns the initial oxygen concentration for a given a cell index.
Definition FlowGenericProblem_impl.hpp:621
Scalar microbialConcentration(unsigned elemIdx) const
Returns the initial microbial concentration for a given a cell index.
Definition FlowGenericProblem_impl.hpp:609
Scalar rockReferencePressure(unsigned globalSpaceIdx) const
Direct access to rock reference pressure.
Definition FlowGenericProblem_impl.hpp:290
static std::string briefDescription()
Returns a human readable description of the problem for the help message.
Definition FlowGenericProblem_impl.hpp:97
Scalar solventRsw(unsigned elemIdx) const
Returns the initial solvent dissolved in water for a given a cell index.
Definition FlowGenericProblem_impl.hpp:572
Scalar overburdenPressure(unsigned elementIdx) const
Get the pressure of the overburden.
Definition FlowGenericProblem_impl.hpp:550
Scalar porosity(unsigned globalSpaceIdx, unsigned timeIdx) const
Direct indexed access to the porosity.
Definition FlowGenericProblem_impl.hpp:305
Scalar rockCompressibility(unsigned globalSpaceIdx) const
Direct access to rock compressibility.
Definition FlowGenericProblem_impl.hpp:275
unsigned miscnumRegionIndex(unsigned elemIdx) const
Returns the index the relevant MISC region given a cell index.
Definition FlowGenericProblem_impl.hpp:688
Scalar referencePorosity(unsigned elementIdx, unsigned timeIdx) const
Returns the porosity of an element.
Definition FlowGenericProblem.hpp:139
unsigned satnumRegionIndex(unsigned elemIdx) const
Returns the index the relevant saturation function region given a cell index.
Definition FlowGenericProblem_impl.hpp:678
Scalar rockFraction(unsigned elementIdx, unsigned timeIdx) const
Returns the rockFraction of an element.
Definition FlowGenericProblem_impl.hpp:313
Scalar maxWaterSaturation(unsigned globalDofIdx) const
Returns an element's historic maximum water phase saturation that was observed during the simulation.
Definition FlowGenericProblem_impl.hpp:528
unsigned plmixnumRegionIndex(unsigned elemIdx) const
Returns the index the relevant PLMIXNUM (for polymer module) region given a cell index.
Definition FlowGenericProblem_impl.hpp:698
Scalar solventSaturation(unsigned elemIdx) const
Returns the initial solvent saturation for a given a cell index.
Definition FlowGenericProblem_impl.hpp:561
Scalar polymerMolecularWeight(const unsigned elemIdx) const
Returns the polymer molecule weight for a given cell index.
Definition FlowGenericProblem_impl.hpp:597
Scalar biofilmConcentration(unsigned elemIdx) const
Returns the initial biofilm concentration for a given a cell index.
Definition FlowGenericProblem_impl.hpp:645
Scalar drsdtcon(unsigned elemIdx, int episodeIdx) const
Returns the dynamic drsdt convective mixing value.
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:539
Scalar calciteConcentration(unsigned elemIdx) const
Returns the initial calcite concentration for a given a cell index.
Definition FlowGenericProblem_impl.hpp:657
Scalar ureaConcentration(unsigned elemIdx) const
Returns the initial urea concentration for a given a cell index.
Definition FlowGenericProblem_impl.hpp:633
bool shouldWriteOutput() const
Always returns true.
Definition FlowGenericProblem.hpp:293
static void setBriefDescription(const std::string &msg)
Specifies the string returned by briefDescription()
Definition FlowGenericProblem.hpp:99
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:82
bool shouldWriteRestartFile() const
Returns true if an eWoms restart file should be written to disk.
Definition FlowGenericProblem.hpp:302
Scalar polymerConcentration(unsigned elemIdx) const
Returns the initial polymer concentration for a given a cell index.
Definition FlowGenericProblem_impl.hpp:585
Definition FlowGenericProblem.hpp:53
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilboundaryratevector.hh:37
constexpr auto getPropValue()
get the value data member of a property
Definition propertysystem.hh:242
Definition FlowGenericProblem.hpp:69
Struct holding MICP extension data.
Definition SolutionContainers.hpp:57
Struct holding polymer extension data.
Definition SolutionContainers.hpp:37