Loading...
Searching...
No Matches
SolventPvt.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_SOLVENT_PVT_HPP
#define OPM_SOLVENT_PVT_HPP
#include <opm/material/common/Tabulated1DFunction.hpp>
#include <cstddef>
#include <vector>
namespace Opm {
#if HAVE_ECL_INPUT
class EclipseState;
class Schedule;
#endif
template <class Scalar>
class SolventPvt
{
using SamplingPoints = std::vector<std::pair<Scalar, Scalar>>;
public:
using TabulatedOneDFunction = Tabulated1DFunction<Scalar>;
#if HAVE_ECL_INPUT
void initFromState(const EclipseState& eclState, const Schedule&);
#endif
void setNumRegions(std::size_t numRegions);
void setVapPars(const Scalar, const Scalar)
{
}
void setReferenceDensity(unsigned regionIdx, Scalar rhoRefSolvent)
{ solventReferenceDensity_[regionIdx] = rhoRefSolvent; }
void setSolventViscosity(unsigned regionIdx, const TabulatedOneDFunction& mug)
{ solventMu_[regionIdx] = mug; }
void setSolventFormationVolumeFactor(unsigned regionIdx,
const SamplingPoints& samplePoints);
void initEnd();
unsigned numRegions() const
{ return solventReferenceDensity_.size(); }
template <class Evaluation>
Evaluation viscosity(unsigned regionIdx,
const Evaluation&,
const Evaluation& pressure) const
{
const Evaluation& invBg = inverseSolventB_[regionIdx].eval(pressure, /*extrapolate=*/true);
const Evaluation& invMugBg = inverseSolventBMu_[regionIdx].eval(pressure, /*extrapolate=*/true);
return invBg / invMugBg;
}
template <class Evaluation>
Evaluation diffusionCoefficient(const Evaluation& /*temperature*/,
const Evaluation& /*pressure*/,
unsigned /*compIdx*/) const
{
throw std::runtime_error("Not implemented: The PVT model does not provide "
"a diffusionCoefficient()");
}
Scalar referenceDensity(unsigned regionIdx) const
{ return solventReferenceDensity_[regionIdx]; }
template <class Evaluation>
Evaluation inverseFormationVolumeFactor(unsigned regionIdx,
const Evaluation&,
const Evaluation& pressure) const
{ return inverseSolventB_[regionIdx].eval(pressure, /*extrapolate=*/true); }
const std::vector<Scalar>& solventReferenceDensity() const
{ return solventReferenceDensity_; }
const std::vector<TabulatedOneDFunction>& inverseSolventB() const
{ return inverseSolventB_; }
const std::vector<TabulatedOneDFunction>& solventMu() const
{ return solventMu_; }
const std::vector<TabulatedOneDFunction>& inverseSolventBMu() const
{ return inverseSolventBMu_; }
private:
std::vector<Scalar> solventReferenceDensity_{};
std::vector<TabulatedOneDFunction> inverseSolventB_{};
std::vector<TabulatedOneDFunction> solventMu_{};
std::vector<TabulatedOneDFunction> inverseSolventBMu_{};
};
} // namespace Opm
#endif
Tabulated1DFunction.hpp
Implements a linearly interpolated scalar function that depends on one variable.
Opm::EclipseState
Definition EclipseState.hpp:63
Opm::Schedule
Definition Schedule.hpp:89
Opm::SolventPvt
This class represents the Pressure-Volume-Temperature relations of the "second" gas phase in the of E...
Definition SolventPvt.hpp:48
Opm::SolventPvt::viscosity
Evaluation viscosity(unsigned regionIdx, const Evaluation &, const Evaluation &pressure) const
Returns the dynamic viscosity [Pa s] of the fluid phase given a set of parameters.
Definition SolventPvt.hpp:106
Opm::SolventPvt::setReferenceDensity
void setReferenceDensity(unsigned regionIdx, Scalar rhoRefSolvent)
Initialize the reference density of the solvent gas for a given PVT region.
Definition SolventPvt.hpp:72
Opm::SolventPvt::setSolventViscosity
void setSolventViscosity(unsigned regionIdx, const TabulatedOneDFunction &mug)
Initialize the viscosity of the solvent gas phase.
Definition SolventPvt.hpp:80
Opm::SolventPvt::referenceDensity
Scalar referenceDensity(unsigned regionIdx) const
Return the reference density the solvent phase for a given PVT region.
Definition SolventPvt.hpp:128
Opm::SolventPvt::initEnd
void initEnd()
Finish initializing the oil phase PVT properties.
Definition SolventPvt.cpp:105
Opm::SolventPvt::numRegions
unsigned numRegions() const
Return the number of PVT regions which are considered by this PVT-object.
Definition SolventPvt.hpp:99
Opm::SolventPvt::setSolventFormationVolumeFactor
void setSolventFormationVolumeFactor(unsigned regionIdx, const SamplingPoints &samplePoints)
Initialize the function for the formation volume factor of solvent gas.
Definition SolventPvt.cpp:91
Opm::SolventPvt::inverseFormationVolumeFactor
Evaluation inverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &, const Evaluation &pressure) const
Returns the formation volume factor [-] of the fluid phase.
Definition SolventPvt.hpp:135
Opm::Tabulated1DFunction
Implements a linearly interpolated scalar function that depends on one variable.
Definition Tabulated1DFunction.hpp:51
Opm
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30