Loading...
Searching...
No Matches
FlowGenericProblem.hpp
Go to the documentation of this file.
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
Consult the COPYING file in the top-level source directory of this
module for the precise wording of the license and the list of
copyright holders.
*/
#ifndef OPM_FLOW_GENERIC_PROBLEM_HPP
#define OPM_FLOW_GENERIC_PROBLEM_HPP
#include <opm/material/common/UniformXTabulated2DFunction.hpp>
#include <opm/material/common/Tabulated1DFunction.hpp>
#include <opm/simulators/flow/SolutionContainers.hpp>
#include <array>
#include <cstddef>
#include <functional>
#include <string>
#include <vector>
namespace Dune {
class ParameterTree;
}
namespace Opm {
class Deck;
class EclipseState;
class Schedule;
template<typename Grid, typename GridView> class LookUpData;
template<class GridView, class FluidSystem>
class FlowGenericProblem
{
public:
using Scalar = typename FluidSystem::Scalar;
using TabulatedTwoDFunction = UniformXTabulated2DFunction<Scalar>;
using TabulatedFunction = Tabulated1DFunction<Scalar>;
struct RockParams {
Scalar referencePressure;
Scalar compressibility;
};
FlowGenericProblem(const EclipseState& eclState,
const Schedule& schedule,
const GridView& gridView);
static FlowGenericProblem serializationTestObject(const EclipseState& eclState,
const Schedule& schedule,
const GridView& gridView);
static std::string helpPreamble(int,
const char **argv);
static std::string briefDescription();
static void setBriefDescription(const std::string& msg)
{ briefDescription_ = msg; }
Scalar maxWaterSaturation(unsigned globalDofIdx) const;
Scalar minOilPressure(unsigned globalDofIdx) const;
Scalar overburdenPressure(unsigned elementIdx) const;
Scalar referencePorosity(unsigned elementIdx, unsigned timeIdx) const
{ return referencePorosity_[timeIdx][elementIdx]; }
Scalar rockFraction(unsigned elementIdx, unsigned timeIdx) const;
void setPorosity(Scalar poro, unsigned elementIdx, unsigned timeIdx = 0)
{ referencePorosity_[timeIdx][elementIdx] = poro; }
Scalar solventSaturation(unsigned elemIdx) const;
Scalar solventRsw(unsigned elemIdx) const;
Scalar polymerConcentration(unsigned elemIdx) const;
// TODO: remove this function if not called
Scalar polymerMolecularWeight(const unsigned elemIdx) const;
Scalar microbialConcentration(unsigned elemIdx) const;
Scalar oxygenConcentration(unsigned elemIdx) const;
Scalar ureaConcentration(unsigned elemIdx) const;
Scalar biofilmVolumeFraction(unsigned elemIdx) const;
Scalar calciteVolumeFraction(unsigned elemIdx) const;
unsigned pvtRegionIndex(unsigned elemIdx) const;
// const std::vector<int>& pvtRegionArray() const
// { return pvtnum_; }
unsigned satnumRegionIndex(unsigned elemIdx) const;
unsigned miscnumRegionIndex(unsigned elemIdx) const;
unsigned plmixnumRegionIndex(unsigned elemIdx) const;
Scalar maxPolymerAdsorption(unsigned elemIdx) const;
Scalar rockCompressibility(unsigned globalSpaceIdx) const;
Scalar porosity(unsigned globalSpaceIdx, unsigned timeIdx) const;
bool vapparsActive(int episodeIdx) const;
int numPressurePointsEquil() const
{ return numPressurePointsEquil_; }
bool operator==(const FlowGenericProblem& rhs) const;
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(maxOilSaturation_);
serializer(polymer_);
serializer(maxWaterSaturation_);
serializer(minRefPressure_);
serializer(overburdenPressure_);
serializer(solventSaturation_);
serializer(solventRsw_);
serializer(bioeffects_);
}
protected:
void initFluidSystem_();
bool shouldWriteOutput() const
{ return true; }
bool shouldWriteRestartFile() const
{ return false; }
bool beginEpisode_(bool enableExperiments,
int episodeIdx);
void beginTimeStep_(bool enableExperiments,
int episodeIdx,
int timeStepIndex,
Scalar startTime,
Scalar time,
Scalar timeStepSize,
Scalar endTime);
void readRockParameters_(const std::vector<Scalar>& cellCenterDepths,
std::function<std::array<int,3>(const unsigned)> ijkIndex);
void readRockCompactionParameters_();
void readBlackoilExtentionsInitialConditions_(std::size_t numDof,
bool enableSolvent,
bool enablePolymer,
bool enablePolymerMolarWeight,
bool enableBioeffects,
bool enableMICP);
void updatePvtnum_();
void updateSatnum_();
void updateMiscnum_();
void updatePlmixnum_();
const EclipseState& eclState_;
const Schedule& schedule_;
const GridView& gridView_;
static inline std::string briefDescription_;
std::array<std::vector<Scalar>, 2> referencePorosity_;
std::vector<int> pvtnum_;
std::vector<unsigned short> satnum_;
std::vector<unsigned short> miscnum_;
std::vector<unsigned short> plmixnum_;
std::vector<RockParams> rockParams_;
std::vector<unsigned short> rockTableIdx_;
std::vector<TabulatedTwoDFunction> rockCompPoroMultWc_;
std::vector<TabulatedTwoDFunction> rockCompTransMultWc_;
std::vector<TabulatedFunction> rockCompPoroMult_;
std::vector<TabulatedFunction> rockCompTransMult_;
std::vector<Scalar> rockCompTransMultVal_;
PolymerSolutionContainer<Scalar> polymer_;
std::vector<Scalar> maxOilSaturation_;
std::vector<Scalar> maxWaterSaturation_;
std::vector<Scalar> minRefPressure_;
std::vector<Scalar> overburdenPressure_;
std::vector<Scalar> solventSaturation_;
std::vector<Scalar> solventRsw_;
BioeffectsSolutionContainer<Scalar> bioeffects_;
// time stepping parameters
bool enableTuning_;
Scalar initialTimeStepSize_;
Scalar maxTimeStepAfterWellEvent_;
// equilibration parameters
int numPressurePointsEquil_;
bool enableDriftCompensation_;
bool explicitRockCompaction_;
// To lookup origin cell indices
using Grid = std::remove_cv_t< typename std::remove_reference<decltype(gridView_.grid())>::type>;
using LookUpData = Opm::LookUpData<Grid,GridView>;
const LookUpData lookUpData_;
// \brief Function to assign the origin cell index on level zero, for a cell on the leaf grid view.
//
// For CpGrid with local grid refinement, the field property of a cell on the leaf
// is inherited from its parent or equivalent (when has no parent) cell on level zero.
std::function<unsigned(unsigned)> lookupIdxOnLevelZeroAssigner_()
{
return [this](unsigned elemIdx) { return lookUpData_.template getFieldPropIdx<Grid>(elemIdx);};
}
private:
template<class T>
void updateNum(const std::string& name, std::vector<T>& numbers, std::size_t num_regions);
};
} // namespace Opm
#endif // OPM_FLOW_GENERIC_PROBLEM_HPP
SolutionContainers.hpp
This problem simulates an input file given in the data format used by the commercial ECLiPSE simulato...
Opm::FlowGenericProblem
This problem simulates an input file given in the data format used by the commercial ECLiPSE simulato...
Definition FlowGenericProblem.hpp:61
Opm::FlowGenericProblem::setPorosity
void setPorosity(Scalar poro, unsigned elementIdx, unsigned timeIdx=0)
Sets the porosity of an element.
Definition FlowGenericProblem.hpp:155
Opm::FlowGenericProblem::maxPolymerAdsorption
Scalar maxPolymerAdsorption(unsigned elemIdx) const
Returns the max polymer adsorption value.
Definition FlowGenericProblem_impl.hpp:744
Opm::FlowGenericProblem::pvtRegionIndex
unsigned pvtRegionIndex(unsigned elemIdx) const
Returns the index the relevant PVT region given a cell index.
Definition FlowGenericProblem_impl.hpp:703
Opm::FlowGenericProblem::oxygenConcentration
Scalar oxygenConcentration(unsigned elemIdx) const
Returns the initial oxygen concentration for a given a cell index.
Definition FlowGenericProblem_impl.hpp:656
Opm::FlowGenericProblem::microbialConcentration
Scalar microbialConcentration(unsigned elemIdx) const
Returns the initial microbial concentration for a given a cell index.
Definition FlowGenericProblem_impl.hpp:644
Opm::FlowGenericProblem::briefDescription
static std::string briefDescription()
Returns a human readable description of the problem for the help message.
Definition FlowGenericProblem_impl.hpp:129
Opm::FlowGenericProblem::solventRsw
Scalar solventRsw(unsigned elemIdx) const
Returns the initial solvent dissolved in water for a given a cell index.
Definition FlowGenericProblem_impl.hpp:607
Opm::FlowGenericProblem::overburdenPressure
Scalar overburdenPressure(unsigned elementIdx) const
Get the pressure of the overburden.
Definition FlowGenericProblem_impl.hpp:585
Opm::FlowGenericProblem::porosity
Scalar porosity(unsigned globalSpaceIdx, unsigned timeIdx) const
Direct indexed access to the porosity.
Definition FlowGenericProblem_impl.hpp:332
Opm::FlowGenericProblem::rockCompressibility
Scalar rockCompressibility(unsigned globalSpaceIdx) const
Direct access to rock compressibility.
Definition FlowGenericProblem_impl.hpp:317
Opm::FlowGenericProblem::miscnumRegionIndex
unsigned miscnumRegionIndex(unsigned elemIdx) const
Returns the index the relevant MISC region given a cell index.
Definition FlowGenericProblem_impl.hpp:723
Opm::FlowGenericProblem::referencePorosity
Scalar referencePorosity(unsigned elementIdx, unsigned timeIdx) const
Returns the porosity of an element.
Definition FlowGenericProblem.hpp:137
Opm::FlowGenericProblem::satnumRegionIndex
unsigned satnumRegionIndex(unsigned elemIdx) const
Returns the index the relevant saturation function region given a cell index.
Definition FlowGenericProblem_impl.hpp:713
Opm::FlowGenericProblem::rockFraction
Scalar rockFraction(unsigned elementIdx, unsigned timeIdx) const
Returns the rockFraction of an element.
Definition FlowGenericProblem_impl.hpp:340
Opm::FlowGenericProblem::maxWaterSaturation
Scalar maxWaterSaturation(unsigned globalDofIdx) const
Returns an element's historic maximum water phase saturation that was observed during the simulation.
Definition FlowGenericProblem_impl.hpp:563
Opm::FlowGenericProblem::calciteVolumeFraction
Scalar calciteVolumeFraction(unsigned elemIdx) const
Returns the initial calcite volume fraction for a given a cell index.
Definition FlowGenericProblem_impl.hpp:692
Opm::FlowGenericProblem::plmixnumRegionIndex
unsigned plmixnumRegionIndex(unsigned elemIdx) const
Returns the index the relevant PLMIXNUM (for polymer module) region given a cell index.
Definition FlowGenericProblem_impl.hpp:733
Opm::FlowGenericProblem::solventSaturation
Scalar solventSaturation(unsigned elemIdx) const
Returns the initial solvent saturation for a given a cell index.
Definition FlowGenericProblem_impl.hpp:596
Opm::FlowGenericProblem::polymerMolecularWeight
Scalar polymerMolecularWeight(const unsigned elemIdx) const
Returns the polymer molecule weight for a given cell index.
Definition FlowGenericProblem_impl.hpp:632
Opm::FlowGenericProblem::minOilPressure
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:574
Opm::FlowGenericProblem::ureaConcentration
Scalar ureaConcentration(unsigned elemIdx) const
Returns the initial urea concentration for a given a cell index.
Definition FlowGenericProblem_impl.hpp:668
Opm::FlowGenericProblem::shouldWriteOutput
bool shouldWriteOutput() const
Always returns true.
Definition FlowGenericProblem.hpp:277
Opm::FlowGenericProblem::setBriefDescription
static void setBriefDescription(const std::string &msg)
Specifies the string returned by briefDescription().
Definition FlowGenericProblem.hpp:97
Opm::FlowGenericProblem::biofilmVolumeFraction
Scalar biofilmVolumeFraction(unsigned elemIdx) const
Returns the initial biofilm volume fraction for a given a cell index.
Definition FlowGenericProblem_impl.hpp:680
Opm::FlowGenericProblem::helpPreamble
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:114
Opm::FlowGenericProblem::shouldWriteRestartFile
bool shouldWriteRestartFile() const
Returns true if an eWoms restart file should be written to disk.
Definition FlowGenericProblem.hpp:286
Opm::FlowGenericProblem::polymerConcentration
Scalar polymerConcentration(unsigned elemIdx) const
Returns the initial polymer concentration for a given a cell index.
Definition FlowGenericProblem_impl.hpp:620
Opm::LookUpData
Definition FlowGenericProblem.hpp:51
Opm
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilbioeffectsmodules.hh:43
Opm::BioeffectsSolutionContainer
Struct holding MICP extension data.
Definition SolutionContainers.hpp:57
Opm::FlowGenericProblem::RockParams
Definition FlowGenericProblem.hpp:67
Opm::PolymerSolutionContainer
Struct holding polymer extension data.
Definition SolutionContainers.hpp:37