Loading...
Searching...
No Matches
ConstantCompressibilityWaterPvt.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_CONSTANT_COMPRESSIBILITY_WATER_PVT_HPP
#define OPM_CONSTANT_COMPRESSIBILITY_WATER_PVT_HPP
#include <opm/material/common/MathToolbox.hpp>
#include <cstddef>
#include <stdexcept>
#include <vector>
namespace Opm {
#if HAVE_ECL_INPUT
class EclipseState;
class Schedule;
#endif
template <class Scalar>
class ConstantCompressibilityWaterPvt
{
public:
#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 setReferenceDensities(unsigned regionIdx,
Scalar /*rhoRefOil*/,
Scalar /*rhoRefGas*/,
Scalar rhoRefWater)
{ waterReferenceDensity_[regionIdx] = rhoRefWater; }
void setReferencePressure(unsigned regionIdx, Scalar p)
{ waterReferencePressure_[regionIdx] = p; }
void setViscosity(unsigned regionIdx, Scalar muw, Scalar waterViscosibility = 0.0)
{
waterViscosity_[regionIdx] = muw;
waterViscosibility_[regionIdx] = waterViscosibility;
}
void setCompressibility(unsigned regionIdx, Scalar waterCompressibility)
{ waterCompressibility_[regionIdx] = waterCompressibility; }
void setReferenceFormationVolumeFactor(unsigned regionIdx, Scalar BwRef)
{ waterReferenceFormationVolumeFactor_[regionIdx] = BwRef; }
void setViscosibility(unsigned regionIdx, Scalar muComp)
{ waterViscosibility_[regionIdx] = muComp; }
void initEnd()
{ }
unsigned numRegions() const
{ return waterReferenceDensity_.size(); }
template <class Evaluation>
Evaluation internalEnergy(unsigned,
const Evaluation&,
const Evaluation&,
const Evaluation&,
const Evaluation&) const
{
throw std::runtime_error("Requested the enthalpy of water but the thermal "
"option is not enabled");
}
Scalar hVap(unsigned) const
{
throw std::runtime_error("Requested the hvap of oil but the thermal "
"option is not enabled");
}
template <class Evaluation>
Evaluation saturatedViscosity(unsigned regionIdx,
const Evaluation& temperature,
const Evaluation& pressure,
const Evaluation& saltconcentration) const
{
Scalar BwMuwRef = waterViscosity_[regionIdx]*waterReferenceFormationVolumeFactor_[regionIdx];
const Evaluation& bw = saturatedInverseFormationVolumeFactor(regionIdx, temperature, pressure, saltconcentration);
Scalar pRef = waterReferencePressure_[regionIdx];
const Evaluation& Y =
(waterCompressibility_[regionIdx] - waterViscosibility_[regionIdx])
* (pressure - pRef);
return BwMuwRef * bw / (1 + Y * (1 + Y / 2));
}
template <class Evaluation>
Evaluation viscosity(unsigned regionIdx,
const Evaluation& temperature,
const Evaluation& pressure,
const Evaluation& Rsw,
const Evaluation& saltconcentration) const
{
Scalar BwMuwRef = waterViscosity_[regionIdx]*waterReferenceFormationVolumeFactor_[regionIdx];
const Evaluation& bw = inverseFormationVolumeFactor(regionIdx, temperature, pressure, Rsw, saltconcentration);
Scalar pRef = waterReferencePressure_[regionIdx];
const Evaluation& Y =
(waterCompressibility_[regionIdx] - waterViscosibility_[regionIdx])
* (pressure - pRef);
return BwMuwRef * bw / (1 + Y * (1 + Y / 2));
}
template <class Evaluation>
Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx,
const Evaluation& temperature,
const Evaluation& pressure,
const Evaluation& saltconcentration) const
{
Evaluation Rsw = 0.0;
return inverseFormationVolumeFactor(regionIdx, temperature, pressure,
Rsw, saltconcentration);
}
template <class Evaluation>
Evaluation inverseFormationVolumeFactor(unsigned regionIdx,
const Evaluation& /*temperature*/,
const Evaluation& pressure,
const Evaluation& /*Rsw*/,
const Evaluation& /*saltconcentration*/) const
{
Scalar pRef = waterReferencePressure_[regionIdx];
const Evaluation& X = waterCompressibility_[regionIdx]*(pressure - pRef);
Scalar BwRef = waterReferenceFormationVolumeFactor_[regionIdx];
// TODO (?): consider the salt concentration of the brine
return (1.0 + X * (1.0 + X / 2.0)) / BwRef;
}
template <class FluidState, class LhsEval = typename FluidState::Scalar>
std::pair<LhsEval, LhsEval>
inverseFormationVolumeFactorAndViscosity(const FluidState& fluidState, unsigned regionIdx)
{
const auto& pressure = decay<LhsEval>(fluidState.pressure(FluidState::waterPhaseIdx));
Scalar pRef = waterReferencePressure_[regionIdx];
const LhsEval& X = waterCompressibility_[regionIdx]*(pressure - pRef);
Scalar BwRef = waterReferenceFormationVolumeFactor_[regionIdx];
LhsEval bw = (1.0 + X * (1.0 + X / 2.0)) / BwRef;
Scalar BwMuwRef = waterViscosity_[regionIdx]*BwRef;
const LhsEval& Y =
(waterCompressibility_[regionIdx] - waterViscosibility_[regionIdx])
* (pressure - pRef);
LhsEval muw = BwMuwRef * bw / (1 + Y * (1 + Y / 2));
return { bw, muw };
}
template <class Evaluation>
void inverseBAndMu(Evaluation& bw, Evaluation& muW, unsigned regionIdx,
const Evaluation& /*temperature*/,
const Evaluation& pressure,
const Evaluation& /*Rsw*/,
const Evaluation& /*saltconcentration*/) const
{
inverseBAndMu(bw, muW, regionIdx,pressure);
}
template <class Evaluation>
void inverseBAndMu(Evaluation& bw, Evaluation& muW, unsigned regionIdx,
const Evaluation& pressure) const
{
Scalar pRef = waterReferencePressure_[regionIdx];
const Evaluation& X = waterCompressibility_[regionIdx]*(pressure - pRef);
Scalar BwRef = waterReferenceFormationVolumeFactor_[regionIdx];
// TODO (?): consider the salt concentration of the brine
bw = (1.0 + X * (1.0 + X / 2.0)) / BwRef;
Scalar BwMuwRef = waterViscosity_[regionIdx]*BwRef;
const Evaluation& Y =
(waterCompressibility_[regionIdx] - waterViscosibility_[regionIdx])
* (pressure - pRef);
muW = BwMuwRef * bw / (1 + Y * (1 + Y / 2));
}
template <class Evaluation>
Evaluation saturationPressure(unsigned /*regionIdx*/,
const Evaluation& /*temperature*/,
const Evaluation& /*Rs*/,
const Evaluation& /*saltconcentration*/) const
{ return 0.0; /* this is dead water, so there isn't any meaningful saturation pressure! */ }
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()");
}
template <class Evaluation>
Evaluation saturatedGasDissolutionFactor(unsigned /*regionIdx*/,
const Evaluation& /*temperature*/,
const Evaluation& /*pressure*/,
const Evaluation& /*saltconcentration*/) const
{ return 0.0; /* this is dead water! */ }
Scalar waterReferenceDensity(unsigned regionIdx) const
{ return waterReferenceDensity_[regionIdx]; }
const std::vector<Scalar>& waterReferencePressure() const
{ return waterReferencePressure_; }
const std::vector<Scalar>& waterReferenceFormationVolumeFactor() const
{ return waterReferenceFormationVolumeFactor_; }
const std::vector<Scalar>& waterCompressibility() const
{ return waterCompressibility_; }
const std::vector<Scalar>& waterViscosity() const
{ return waterViscosity_; }
const std::vector<Scalar>& waterViscosibility() const
{ return waterViscosibility_; }
private:
std::vector<Scalar> waterReferenceDensity_{};
std::vector<Scalar> waterReferencePressure_{};
std::vector<Scalar> waterReferenceFormationVolumeFactor_{};
std::vector<Scalar> waterCompressibility_{};
std::vector<Scalar> waterViscosity_{};
std::vector<Scalar> waterViscosibility_{};
};
} // namespace Opm
#endif
MathToolbox.hpp
A traits class which provides basic mathematical functions for arbitrary scalar floating point values...
Opm::ConstantCompressibilityWaterPvt
This class represents the Pressure-Volume-Temperature relations of the gas phase without vaporized oi...
Definition ConstantCompressibilityWaterPvt.hpp:49
Opm::ConstantCompressibilityWaterPvt::setReferenceFormationVolumeFactor
void setReferenceFormationVolumeFactor(unsigned regionIdx, Scalar BwRef)
Set the water reference formation volume factor [-].
Definition ConstantCompressibilityWaterPvt.hpp:98
Opm::ConstantCompressibilityWaterPvt::setViscosibility
void setViscosibility(unsigned regionIdx, Scalar muComp)
Set the water "viscosibility" [1/ (Pa s)].
Definition ConstantCompressibilityWaterPvt.hpp:104
Opm::ConstantCompressibilityWaterPvt::inverseFormationVolumeFactorAndViscosity
std::pair< LhsEval, LhsEval > inverseFormationVolumeFactorAndViscosity(const FluidState &fluidState, unsigned regionIdx)
Returns the formation volume factor [-] and viscosity [Pa s] of the fluid phase.
Definition ConstantCompressibilityWaterPvt.hpp:216
Opm::ConstantCompressibilityWaterPvt::saturationPressure
Evaluation saturationPressure(unsigned, const Evaluation &, const Evaluation &, const Evaluation &) const
Returns the saturation pressure of the water phase [Pa] depending on its mass fraction of the gas com...
Definition ConstantCompressibilityWaterPvt.hpp:270
Opm::ConstantCompressibilityWaterPvt::inverseFormationVolumeFactor
Evaluation inverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &, const Evaluation &pressure, const Evaluation &, const Evaluation &) const
Returns the formation volume factor [-] of the fluid phase.
Definition ConstantCompressibilityWaterPvt.hpp:196
Opm::ConstantCompressibilityWaterPvt::setCompressibility
void setCompressibility(unsigned regionIdx, Scalar waterCompressibility)
Set the compressibility of the water phase.
Definition ConstantCompressibilityWaterPvt.hpp:92
Opm::ConstantCompressibilityWaterPvt::setReferenceDensities
void setReferenceDensities(unsigned regionIdx, Scalar, Scalar, Scalar rhoRefWater)
Set the water reference density [kg / m^3].
Definition ConstantCompressibilityWaterPvt.hpp:68
Opm::ConstantCompressibilityWaterPvt::numRegions
unsigned numRegions() const
Return the number of PVT regions which are considered by this PVT-object.
Definition ConstantCompressibilityWaterPvt.hpp:116
Opm::ConstantCompressibilityWaterPvt::setReferencePressure
void setReferencePressure(unsigned regionIdx, Scalar p)
Set the water reference pressure [Pa].
Definition ConstantCompressibilityWaterPvt.hpp:77
Opm::ConstantCompressibilityWaterPvt::initEnd
void initEnd()
Finish initializing the water phase PVT properties.
Definition ConstantCompressibilityWaterPvt.hpp:110
Opm::ConstantCompressibilityWaterPvt::viscosity
Evaluation viscosity(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &Rsw, const Evaluation &saltconcentration) const
Returns the dynamic viscosity [Pa s] of the fluid phase given a set of parameters.
Definition ConstantCompressibilityWaterPvt.hpp:162
Opm::ConstantCompressibilityWaterPvt::setViscosity
void setViscosity(unsigned regionIdx, Scalar muw, Scalar waterViscosibility=0.0)
Set the viscosity and "viscosibility" of the water phase.
Definition ConstantCompressibilityWaterPvt.hpp:83
Opm::ConstantCompressibilityWaterPvt::saturatedInverseFormationVolumeFactor
Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &saltconcentration) const
Returns the formation volume factor [-] of the fluid phase.
Definition ConstantCompressibilityWaterPvt.hpp:182
Opm::ConstantCompressibilityWaterPvt::saturatedViscosity
Evaluation saturatedViscosity(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &saltconcentration) const
Returns the dynamic viscosity [Pa s] of the fluid phase given a set of parameters.
Definition ConstantCompressibilityWaterPvt.hpp:143
Opm::ConstantCompressibilityWaterPvt::internalEnergy
Evaluation internalEnergy(unsigned, const Evaluation &, const Evaluation &, const Evaluation &, const Evaluation &) const
Returns the specific enthalpy [J/kg] of water given a set of parameters.
Definition ConstantCompressibilityWaterPvt.hpp:123
Opm::ConstantCompressibilityWaterPvt::saturatedGasDissolutionFactor
Evaluation saturatedGasDissolutionFactor(unsigned, const Evaluation &, const Evaluation &, const Evaluation &) const
Returns the gas dissolution factor [m^3/m^3] of the water phase.
Definition ConstantCompressibilityWaterPvt.hpp:289
Opm::EclipseState
Definition EclipseState.hpp:62
Opm::Schedule
Definition Schedule.hpp:101
Opm
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30