Loading...
Searching...
No Matches
ConstantCompressibilityBrinePvt.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_BRINE_PVT_HPP
#define OPM_CONSTANT_COMPRESSIBILITY_BRINE_PVT_HPP
#include <opm/material/common/Tabulated1DFunction.hpp>
#include <opm/material/fluidsystems/BlackOilFunctions.hpp>
#include <cstddef>
#include <vector>
namespace Opm {
template <class Scalar, bool enableThermal, bool enableBrine>
class WaterPvtMultiplexer;
#if HAVE_ECL_INPUT
class EclipseState;
class Schedule;
#endif
template <class Scalar>
class ConstantCompressibilityBrinePvt
{
public:
using TabulatedFunction = 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 setReferenceDensities(unsigned regionIdx,
Scalar /*rhoRefOil*/,
Scalar /*rhoRefGas*/,
Scalar rhoRefWater)
{ waterReferenceDensity_[regionIdx] = rhoRefWater; }
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 viscosity(unsigned regionIdx,
const Evaluation& temperature,
const Evaluation& pressure,
const Evaluation& Rsw,
const Evaluation& saltconcentration) const
{
// cf. ECLiPSE 2013.2 technical description, p. 114
Scalar pRef = referencePressure_[regionIdx];
const Evaluation C = compressibilityTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
const Evaluation Cv = viscosibilityTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
const Evaluation BwRef = formationVolumeTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
const Evaluation Y = (C-Cv)* (pressure - pRef);
Evaluation MuwRef = viscosityTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
const Evaluation& bw = inverseFormationVolumeFactor(regionIdx, temperature, pressure, Rsw, saltconcentration);
return MuwRef * BwRef * bw / (1 + Y * (1 + Y/2));
}
template <class Evaluation>
Evaluation saturatedViscosity(unsigned regionIdx,
const Evaluation& temperature,
const Evaluation& pressure,
const Evaluation& saltconcentration) const
{
Scalar pRef = referencePressure_[regionIdx];
const Evaluation C = compressibilityTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
const Evaluation Cv = viscosibilityTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
const Evaluation BwRef = formationVolumeTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
const Evaluation Y = (C-Cv)* (pressure - pRef);
Evaluation MuwRef = viscosityTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
const Evaluation& bw = saturatedInverseFormationVolumeFactor(regionIdx, temperature, pressure, saltconcentration);
return MuwRef * BwRef * 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 = referencePressure_[regionIdx];
const Evaluation BwRef = formationVolumeTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
const Evaluation C = compressibilityTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
const Evaluation X = C * (pressure - pRef);
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 LhsEval& pressure = decay<LhsEval>(fluidState.pressure(FluidState::waterPhaseIdx));
const LhsEval& saltConcentration
= BlackOil::template getSaltConcentration_<FluidState, LhsEval>(fluidState, regionIdx);
const auto segIdx = this->formationVolumeTables_[regionIdx]
.findSegmentIndex(saltConcentration, /*extrapolate=*/ true);
// Calculate bw.
const Scalar pRef = referencePressure_[regionIdx];
const LhsEval BwRef = formationVolumeTables_[regionIdx].eval(saltConcentration, SegmentIndex{segIdx});
const LhsEval C = compressibilityTables_[regionIdx].eval(saltConcentration, SegmentIndex{segIdx});
const LhsEval X = C * (pressure - pRef);
const LhsEval bw = (1.0 + X * (1.0 + X / 2.0)) / BwRef;
// Calculate muw.
const LhsEval Cv = viscosibilityTables_[regionIdx].eval(saltConcentration, SegmentIndex{segIdx});
const LhsEval Y = (C - Cv) * (pressure - pRef);
const LhsEval MuwRef = viscosityTables_[regionIdx].eval(saltConcentration, SegmentIndex{segIdx});
const LhsEval muw = MuwRef * BwRef * bw / (1.0 + Y * (1.0 + Y / 2.0));
return { bw, muw };
}
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 saturatedGasDissolutionFactor(unsigned /*regionIdx*/,
const Evaluation& /*temperature*/,
const Evaluation& /*pressure*/,
const Evaluation& /*saltconcentration*/) const
{ return 0.0; /* this is dead water! */ }
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 waterReferenceDensity(unsigned regionIdx) const
{ return waterReferenceDensity_[regionIdx]; }
const std::vector<Scalar>& referencePressure() const
{ return referencePressure_; }
const std::vector<TabulatedFunction>& formationVolumeTables() const
{ return formationVolumeTables_; }
const std::vector<TabulatedFunction>& compressibilityTables() const
{ return compressibilityTables_; }
const std::vector<TabulatedFunction>& viscosityTables() const
{ return viscosityTables_; }
const std::vector<TabulatedFunction>& viscosibilityTables() const
{ return viscosibilityTables_; }
private:
std::vector<Scalar> waterReferenceDensity_{};
std::vector<Scalar> referencePressure_{};
std::vector<TabulatedFunction> formationVolumeTables_{};
std::vector<TabulatedFunction> compressibilityTables_{};
std::vector<TabulatedFunction> viscosityTables_{};
std::vector<TabulatedFunction> viscosibilityTables_{};
};
} // namespace Opm
#endif
BlackOilFunctions.hpp
Tabulated1DFunction.hpp
Implements a linearly interpolated scalar function that depends on one variable.
Opm::ConstantCompressibilityBrinePvt
This class represents the Pressure-Volume-Temperature relations of the gas phase without vaporized oi...
Definition ConstantCompressibilityBrinePvt.hpp:52
Opm::ConstantCompressibilityBrinePvt::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 ConstantCompressibilityBrinePvt.hpp:137
Opm::ConstantCompressibilityBrinePvt::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 ConstantCompressibilityBrinePvt.hpp:113
Opm::ConstantCompressibilityBrinePvt::numRegions
unsigned numRegions() const
Return the number of PVT regions which are considered by this PVT-object.
Definition ConstantCompressibilityBrinePvt.hpp:88
Opm::ConstantCompressibilityBrinePvt::inverseFormationVolumeFactor
Evaluation inverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &, const Evaluation &pressure, const Evaluation &, const Evaluation &saltconcentration) const
Returns the formation volume factor [-] of the fluid phase.
Definition ConstantCompressibilityBrinePvt.hpp:171
Opm::ConstantCompressibilityBrinePvt::setReferenceDensities
void setReferenceDensities(unsigned regionIdx, Scalar, Scalar, Scalar rhoRefWater)
Set the water reference density [kg / m^3].
Definition ConstantCompressibilityBrinePvt.hpp:73
Opm::ConstantCompressibilityBrinePvt::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 ConstantCompressibilityBrinePvt.hpp:223
Opm::ConstantCompressibilityBrinePvt::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 ConstantCompressibilityBrinePvt.hpp:192
Opm::ConstantCompressibilityBrinePvt::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 ConstantCompressibilityBrinePvt.hpp:233
Opm::ConstantCompressibilityBrinePvt::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 ConstantCompressibilityBrinePvt.hpp:158
Opm::ConstantCompressibilityBrinePvt::initEnd
void initEnd()
Finish initializing the water phase PVT properties.
Definition ConstantCompressibilityBrinePvt.hpp:82
Opm::ConstantCompressibilityBrinePvt::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 ConstantCompressibilityBrinePvt.hpp:95
Opm::EclipseState
Definition EclipseState.hpp:62
Opm::Schedule
Definition Schedule.hpp:101
Opm::Tabulated1DFunction
Implements a linearly interpolated scalar function that depends on one variable.
Definition Tabulated1DFunction.hpp:51
Opm::WaterPvtMultiplexer
This class represents the Pressure-Volume-Temperature relations of the water phase in the black-oil m...
Definition WaterPvtMultiplexer.hpp:90
Opm
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30
Opm::SegmentIndex
Definition Tabulated1DFunction.hpp:41