equil init: formating fixes to make it more consistent with the rest of ewoms

in particular, this removes excessive whitespace usage.
This commit is contained in:
Andreas Lauser 2018-01-02 12:43:56 +01:00
parent 79856b3b0a
commit 69b1a5ca5a
3 changed files with 258 additions and 259 deletions

View File

@ -62,13 +62,13 @@
struct PcEq; struct PcEq;
template <class FluidSystem, class MaterialLaw, class MaterialLawManager> template <class FluidSystem, class MaterialLaw, class MaterialLawManager>
inline double satFromPc(const MaterialLawManager& materialLawManager, double satFromPc(const MaterialLawManager& materialLawManager,
const int phase, const int phase,
const int cell, const int cell,
const double targetPc, const double targetPc,
const bool increasing = false) const bool increasing = false)
template <class FluidSystem, class MaterialLaw, class MaterialLawManager> template <class FluidSystem, class MaterialLaw, class MaterialLawManager>
inline double satFromSumOfPcs(const MaterialLawManager& materialLawManager, double satFromSumOfPcs(const MaterialLawManager& materialLawManager,
const int phase1, const int phase1,
const int phase2, const int phase2,
const int cell, const int cell,
@ -78,8 +78,7 @@
---- end of synopsis of EquilibrationHelpers.hpp ---- ---- end of synopsis of EquilibrationHelpers.hpp ----
*/ */
namespace Ewoms namespace Ewoms {
{
/** /**
* Types and routines that collectively implement a basic * Types and routines that collectively implement a basic
* ECLIPSE-style equilibration-based initialisation scheme. * ECLIPSE-style equilibration-based initialisation scheme.
@ -143,7 +142,8 @@ public:
/** /**
* Type that implements "no phase mixing" policy. * Type that implements "no phase mixing" policy.
*/ */
class NoMixing : public RsFunction { class NoMixing : public RsFunction
{
public: public:
/** /**
* Function call. * Function call.
@ -178,7 +178,8 @@ public:
* typically taken from keyword 'RSVD'. * typically taken from keyword 'RSVD'.
*/ */
template <class FluidSystem> template <class FluidSystem>
class RsVD : public RsFunction { class RsVD : public RsFunction
{
public: public:
/** /**
* Constructor. * Constructor.
@ -192,8 +193,7 @@ public:
const std::vector<double>& rs) const std::vector<double>& rs)
: pvtRegionIdx_(pvtRegionIdx) : pvtRegionIdx_(pvtRegionIdx)
, rsVsDepth_(depth, rs) , rsVsDepth_(depth, rs)
{ {}
}
/** /**
* Function call. * Function call.
@ -210,15 +210,15 @@ public:
* \return Dissolved gas-oil ratio (RS) at depth @c * \return Dissolved gas-oil ratio (RS) at depth @c
* depth and pressure @c press. * depth and pressure @c press.
*/ */
double double operator()(const double depth,
operator()(const double depth,
const double press, const double press,
const double temp, const double temp,
const double satGas = 0.0) const const double satGas = 0.0) const
{ {
if (satGas > 0.0) { if (satGas > 0.0) {
return satRs(press, temp); return satRs(press, temp);
} else { }
else {
if (rsVsDepth_.xMin() > depth) if (rsVsDepth_.xMin() > depth)
return rsVsDepth_.valueAt(0); return rsVsDepth_.valueAt(0);
else if (rsVsDepth_.xMax() < depth) else if (rsVsDepth_.xMax() < depth)
@ -246,7 +246,8 @@ private:
* typically taken from keyword 'RVVD'. * typically taken from keyword 'RVVD'.
*/ */
template <class FluidSystem> template <class FluidSystem>
class RvVD : public RsFunction { class RvVD : public RsFunction
{
public: public:
/** /**
* Constructor. * Constructor.
@ -260,8 +261,7 @@ public:
const std::vector<double>& rv) const std::vector<double>& rv)
: pvtRegionIdx_(pvtRegionIdx) : pvtRegionIdx_(pvtRegionIdx)
, rvVsDepth_(depth, rv) , rvVsDepth_(depth, rv)
{ {}
}
/** /**
* Function call. * Function call.
@ -278,15 +278,15 @@ public:
* \return Vaporized oil-gas ratio (RV) at depth @c * \return Vaporized oil-gas ratio (RV) at depth @c
* depth and pressure @c press. * depth and pressure @c press.
*/ */
double double operator()(const double depth,
operator()(const double depth,
const double press, const double press,
const double temp, const double temp,
const double satOil = 0.0) const const double satOil = 0.0) const
{ {
if (std::abs(satOil) > 1e-16) { if (std::abs(satOil) > 1e-16) {
return satRv(press, temp); return satRv(press, temp);
} else { }
else {
if (rvVsDepth_.xMin() > depth) if (rvVsDepth_.xMin() > depth)
return rvVsDepth_.valueAt(0); return rvVsDepth_.valueAt(0);
else if (rvVsDepth_.xMax() < depth) else if (rvVsDepth_.xMax() < depth)
@ -323,7 +323,8 @@ private:
* contact, and decreasing above the contact. * contact, and decreasing above the contact.
*/ */
template <class FluidSystem> template <class FluidSystem>
class RsSatAtContact : public RsFunction { class RsSatAtContact : public RsFunction
{
public: public:
/** /**
* Constructor. * Constructor.
@ -353,15 +354,15 @@ public:
* \return Dissolved gas-oil ratio (RS) at depth @c * \return Dissolved gas-oil ratio (RS) at depth @c
* depth and pressure @c press. * depth and pressure @c press.
*/ */
double double operator()(const double /* depth */,
operator()(const double /* depth */,
const double press, const double press,
const double temp, const double temp,
const double satGas = 0.0) const const double satGas = 0.0) const
{ {
if (satGas > 0.0) { if (satGas > 0.0) {
return satRs(press, temp); return satRs(press, temp);
} else { }
else {
return std::min(satRs(press, temp), rsSatContact_); return std::min(satRs(press, temp), rsSatContact_);
} }
} }
@ -392,7 +393,8 @@ private:
* contact, and decreasing above the contact. * contact, and decreasing above the contact.
*/ */
template <class FluidSystem> template <class FluidSystem>
class RvSatAtContact : public RsFunction { class RvSatAtContact : public RsFunction
{
public: public:
/** /**
* Constructor. * Constructor.
@ -422,15 +424,15 @@ public:
* \return Dissolved oil-gas ratio (RV) at depth @c * \return Dissolved oil-gas ratio (RV) at depth @c
* depth and pressure @c press. * depth and pressure @c press.
*/ */
double double operator()(const double /*depth*/,
operator()(const double /*depth*/,
const double press, const double press,
const double temp, const double temp,
const double satOil = 0.0) const const double satOil = 0.0) const
{ {
if (satOil > 0.0) { if (satOil > 0.0) {
return satRv(press, temp); return satRv(press, temp);
} else { }
else {
return std::min(satRv(press, temp), rvSatContact_); return std::min(satRv(press, temp), rvSatContact_);
} }
} }
@ -466,7 +468,8 @@ private:
* that calculates the phase densities of all phases in @c * that calculates the phase densities of all phases in @c
* svol at fluid pressure @c press. * svol at fluid pressure @c press.
*/ */
class EquilReg { class EquilReg
{
public: public:
/** /**
* Constructor. * Constructor.
@ -484,8 +487,7 @@ public:
, rs_ (rs) , rs_ (rs)
, rv_ (rv) , rv_ (rv)
, pvtIdx_ (pvtIdx) , pvtIdx_ (pvtIdx)
{ {}
}
/** /**
* Type of dissolved gas-oil ratio calculator. * Type of dissolved gas-oil ratio calculator.
@ -575,9 +577,8 @@ struct PcEq
phase_(phase), phase_(phase),
cell_(cell), cell_(cell),
targetPc_(targetPc) targetPc_(targetPc)
{ {}
}
double operator()(double s) const double operator()(double s) const
{ {
const auto& matParams = materialLawManager_.materialLawParams(cell_); const auto& matParams = materialLawManager_.materialLawParams(cell_);
@ -602,53 +603,47 @@ private:
}; };
template <class FluidSystem, class MaterialLawManager> template <class FluidSystem, class MaterialLawManager>
double minSaturations(const MaterialLawManager& materialLawManager, const int phase, const int cell) { double minSaturations(const MaterialLawManager& materialLawManager, const int phase, const int cell)
{
const auto& scaledDrainageInfo = const auto& scaledDrainageInfo =
materialLawManager.oilWaterScaledEpsInfoDrainage(cell); materialLawManager.oilWaterScaledEpsInfoDrainage(cell);
// Find minimum and maximum saturations. // Find minimum and maximum saturations.
switch(phase) { switch(phase) {
case FluidSystem::waterPhaseIdx: case FluidSystem::waterPhaseIdx:
{
return scaledDrainageInfo.Swl; return scaledDrainageInfo.Swl;
}
case FluidSystem::gasPhaseIdx: case FluidSystem::gasPhaseIdx:
{
return scaledDrainageInfo.Sgl; return scaledDrainageInfo.Sgl;
}
case FluidSystem::oilPhaseIdx: case FluidSystem::oilPhaseIdx:
{
OPM_THROW(std::runtime_error, "Min saturation not implemented for oil phase."); OPM_THROW(std::runtime_error, "Min saturation not implemented for oil phase.");
break;
} default:
default: OPM_THROW(std::runtime_error, "Unknown phaseIdx ."); OPM_THROW(std::runtime_error, "Unknown phaseIdx .");
} }
return -1.0; return -1.0;
} }
template <class FluidSystem, class MaterialLawManager> template <class FluidSystem, class MaterialLawManager>
double maxSaturations(const MaterialLawManager& materialLawManager, const int phase, const int cell) { double maxSaturations(const MaterialLawManager& materialLawManager, const int phase, const int cell)
{
const auto& scaledDrainageInfo = const auto& scaledDrainageInfo =
materialLawManager.oilWaterScaledEpsInfoDrainage(cell); materialLawManager.oilWaterScaledEpsInfoDrainage(cell);
// Find minimum and maximum saturations. // Find minimum and maximum saturations.
switch(phase) { switch(phase) {
case FluidSystem::waterPhaseIdx: case FluidSystem::waterPhaseIdx:
{
return scaledDrainageInfo.Swu; return scaledDrainageInfo.Swu;
break;
}
case FluidSystem::gasPhaseIdx: case FluidSystem::gasPhaseIdx:
{
return scaledDrainageInfo.Sgu; return scaledDrainageInfo.Sgu;
break;
}
case FluidSystem::oilPhaseIdx: case FluidSystem::oilPhaseIdx:
{
OPM_THROW(std::runtime_error, "Max saturation not implemented for oil phase."); OPM_THROW(std::runtime_error, "Max saturation not implemented for oil phase.");
break;
} default:
default: OPM_THROW(std::runtime_error, "Unknown phaseIdx ."); OPM_THROW(std::runtime_error, "Unknown phaseIdx .");
} }
return -1.0; return -1.0;
} }
@ -657,7 +652,7 @@ double maxSaturations(const MaterialLawManager& materialLawManager, const int ph
/// Compute saturation of some phase corresponding to a given /// Compute saturation of some phase corresponding to a given
/// capillary pressure. /// capillary pressure.
template <class FluidSystem, class MaterialLaw, class MaterialLawManager> template <class FluidSystem, class MaterialLaw, class MaterialLawManager>
inline double satFromPc(const MaterialLawManager& materialLawManager, double satFromPc(const MaterialLawManager& materialLawManager,
const int phase, const int phase,
const int cell, const int cell,
const double targetPc, const double targetPc,
@ -730,8 +725,8 @@ struct PcEqSum
phase2_(phase2), phase2_(phase2),
cell_(cell), cell_(cell),
targetPc_(targetPc) targetPc_(targetPc)
{ {}
}
double operator()(double s) const double operator()(double s) const
{ {
const auto& matParams = materialLawManager_.materialLawParams(cell_); const auto& matParams = materialLawManager_.materialLawParams(cell_);
@ -767,7 +762,7 @@ private:
/// capillary pressure, where the capillary pressure function /// capillary pressure, where the capillary pressure function
/// is given as a sum of two other functions. /// is given as a sum of two other functions.
template <class FluidSystem, class MaterialLaw, class MaterialLawManager> template <class FluidSystem, class MaterialLaw, class MaterialLawManager>
inline double satFromSumOfPcs(const MaterialLawManager& materialLawManager, double satFromSumOfPcs(const MaterialLawManager& materialLawManager,
const int phase1, const int phase1,
const int phase2, const int phase2,
const int cell, const int cell,
@ -824,7 +819,7 @@ inline double satFromSumOfPcs(const MaterialLawManager& materialLawManager,
/// Compute saturation from depth. Used for constant capillary pressure function /// Compute saturation from depth. Used for constant capillary pressure function
template <class FluidSystem, class MaterialLaw, class MaterialLawManager> template <class FluidSystem, class MaterialLaw, class MaterialLawManager>
inline double satFromDepth(const MaterialLawManager& materialLawManager, double satFromDepth(const MaterialLawManager& materialLawManager,
const double cellDepth, const double cellDepth,
const double contactDepth, const double contactDepth,
const int phase, const int phase,
@ -836,7 +831,8 @@ inline double satFromDepth(const MaterialLawManager& materialLawManager,
if (cellDepth < contactDepth) { if (cellDepth < contactDepth) {
return s0; return s0;
} else { }
else {
return s1; return s1;
} }
@ -844,7 +840,7 @@ inline double satFromDepth(const MaterialLawManager& materialLawManager,
/// Return true if capillary pressure function is constant /// Return true if capillary pressure function is constant
template <class FluidSystem, class MaterialLaw, class MaterialLawManager> template <class FluidSystem, class MaterialLaw, class MaterialLawManager>
inline bool isConstPc(const MaterialLawManager& materialLawManager, bool isConstPc(const MaterialLawManager& materialLawManager,
const int phase, const int phase,
const int cell) const int cell)
{ {

View File

@ -26,8 +26,7 @@
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
namespace Ewoms namespace Ewoms {
{
/** /**
* Forward and reverse mappings between cells and * Forward and reverse mappings between cells and
@ -41,7 +40,8 @@ namespace Ewoms
* 'const_iterator'. * 'const_iterator'.
*/ */
template <class Region = std::vector<int>> template <class Region = std::vector<int>>
class RegionMapping { class RegionMapping
{
public: public:
/** /**
* Constructor. * Constructor.
@ -80,7 +80,8 @@ public:
typedef CellIter iterator; typedef CellIter iterator;
typedef CellIter const_iterator; typedef CellIter const_iterator;
Range() {}; Range()
{};
Range(const CellIter& beg, const CellIter& en) Range(const CellIter& beg, const CellIter& en)
: begin_(beg) : begin_(beg)
@ -116,8 +117,8 @@ public:
* \param[in] c Active cell * \param[in] c Active cell
* \return Region to which @c c belongs. * \return Region to which @c c belongs.
*/ */
RegionId RegionId region(const CellId c) const
region(const CellId c) const { return reg_[c]; } { return reg_[c]; }
const std::vector<RegionId>& const std::vector<RegionId>&
activeRegions() const activeRegions() const
@ -133,8 +134,8 @@ public:
* \return Range of active cells in region @c r. Empty if @c r is * \return Range of active cells in region @c r. Empty if @c r is
* not an active region. * not an active region.
*/ */
Range Range cells(const RegionId r) const
cells(const RegionId r) const { {
const auto id = rev_.binid.find(r); const auto id = rev_.binid.find(r);
if (id == rev_.binid.end()) { if (id == rev_.binid.end()) {

View File

@ -139,7 +139,8 @@ private:
namespace PhasePressODE { namespace PhasePressODE {
template <class FluidSystem> template <class FluidSystem>
class Water { class Water
{
public: public:
Water(const double temp, Water(const double temp,
const int pvtRegionIdx, const int pvtRegionIdx,
@ -147,8 +148,7 @@ public:
: temp_(temp) : temp_(temp)
, pvtRegionIdx_(pvtRegionIdx) , pvtRegionIdx_(pvtRegionIdx)
, g_(normGrav) , g_(normGrav)
{ {}
}
double double
operator()(const double /* depth */, operator()(const double /* depth */,
@ -172,7 +172,8 @@ private:
}; };
template <class FluidSystem, class RS> template <class FluidSystem, class RS>
class Oil { class Oil
{
public: public:
Oil(const double temp, Oil(const double temp,
const RS& rs, const RS& rs,
@ -182,8 +183,7 @@ public:
, rs_(rs) , rs_(rs)
, pvtRegionIdx_(pvtRegionIdx) , pvtRegionIdx_(pvtRegionIdx)
, g_(normGrav) , g_(normGrav)
{ {}
}
double double
operator()(const double depth, operator()(const double depth,
@ -206,7 +206,8 @@ private:
double bOil = 0.0; double bOil = 0.0;
if (!FluidSystem::enableDissolvedGas() || rs >= FluidSystem::oilPvt().saturatedGasDissolutionFactor(pvtRegionIdx_, temp_, press)) { if (!FluidSystem::enableDissolvedGas() || rs >= FluidSystem::oilPvt().saturatedGasDissolutionFactor(pvtRegionIdx_, temp_, press)) {
bOil = FluidSystem::oilPvt().saturatedInverseFormationVolumeFactor(pvtRegionIdx_, temp_, press); bOil = FluidSystem::oilPvt().saturatedInverseFormationVolumeFactor(pvtRegionIdx_, temp_, press);
} else { }
else {
bOil = FluidSystem::oilPvt().inverseFormationVolumeFactor(pvtRegionIdx_, temp_, press, rs); bOil = FluidSystem::oilPvt().inverseFormationVolumeFactor(pvtRegionIdx_, temp_, press, rs);
} }
double rho = bOil * FluidSystem::referenceDensity(FluidSystem::oilPhaseIdx, pvtRegionIdx_); double rho = bOil * FluidSystem::referenceDensity(FluidSystem::oilPhaseIdx, pvtRegionIdx_);
@ -219,7 +220,8 @@ private:
}; };
template <class FluidSystem, class RV> template <class FluidSystem, class RV>
class Gas { class Gas
{
public: public:
Gas(const double temp, Gas(const double temp,
const RV& rv, const RV& rv,
@ -229,8 +231,7 @@ public:
, rv_(rv) , rv_(rv)
, pvtRegionIdx_(pvtRegionIdx) , pvtRegionIdx_(pvtRegionIdx)
, g_(normGrav) , g_(normGrav)
{ {}
}
double double
operator()(const double depth, operator()(const double depth,
@ -253,7 +254,8 @@ private:
double bGas = 0.0; double bGas = 0.0;
if (!FluidSystem::enableVaporizedOil() || rv >= FluidSystem::gasPvt().saturatedOilVaporizationFactor(pvtRegionIdx_, temp_, press)) { if (!FluidSystem::enableVaporizedOil() || rv >= FluidSystem::gasPvt().saturatedOilVaporizationFactor(pvtRegionIdx_, temp_, press)) {
bGas = FluidSystem::gasPvt().saturatedInverseFormationVolumeFactor(pvtRegionIdx_, temp_, press); bGas = FluidSystem::gasPvt().saturatedInverseFormationVolumeFactor(pvtRegionIdx_, temp_, press);
} else { }
else {
bGas = FluidSystem::gasPvt().inverseFormationVolumeFactor(pvtRegionIdx_, temp_, press, rv); bGas = FluidSystem::gasPvt().inverseFormationVolumeFactor(pvtRegionIdx_, temp_, press, rv);
} }
double rho = bGas * FluidSystem::referenceDensity(FluidSystem::gasPhaseIdx, pvtRegionIdx_); double rho = bGas * FluidSystem::referenceDensity(FluidSystem::gasPhaseIdx, pvtRegionIdx_);
@ -271,8 +273,7 @@ namespace PhasePressure {
template <class Grid, template <class Grid,
class PressFunction, class PressFunction,
class CellRange> class CellRange>
void void assign(const Grid& grid,
assign(const Grid& grid ,
const std::array<PressFunction, 2>& f , const std::array<PressFunction, 2>& f ,
const double split, const double split,
const CellRange& cells, const CellRange& cells,
@ -297,8 +298,7 @@ template <class FluidSystem,
class Grid, class Grid,
class Region, class Region,
class CellRange> class CellRange>
void void water(const Grid& grid,
water(const Grid& grid ,
const Region& reg, const Region& reg,
const std::array<double,2>& span , const std::array<double,2>& span ,
const double grav, const double grav,
@ -317,7 +317,8 @@ water(const Grid& grid ,
if (reg.datum() > reg.zwoc()) {//Datum in water zone if (reg.datum() > reg.zwoc()) {//Datum in water zone
z0 = reg.datum(); z0 = reg.datum();
p0 = reg.pressure(); p0 = reg.pressure();
} else { }
else {
z0 = reg.zwoc(); z0 = reg.zwoc();
p0 = poWoc - reg.pcowWoc(); // Water pressure at contact p0 = poWoc - reg.pcowWoc(); // Water pressure at contact
} }
@ -346,8 +347,7 @@ template <class FluidSystem,
class Grid, class Grid,
class Region, class Region,
class CellRange> class CellRange>
void void oil(const Grid& grid,
oil(const Grid& grid ,
const Region& reg, const Region& reg,
const std::array<double,2>& span , const std::array<double,2>& span ,
const double grav, const double grav,
@ -368,10 +368,12 @@ oil(const Grid& grid ,
if (reg.datum() > reg.zwoc()) {//Datum in water zone, poWoc given if (reg.datum() > reg.zwoc()) {//Datum in water zone, poWoc given
z0 = reg.zwoc(); z0 = reg.zwoc();
p0 = poWoc; p0 = poWoc;
} else if (reg.datum() < reg.zgoc()) {//Datum in gas zone, poGoc given }
else if (reg.datum() < reg.zgoc()) {//Datum in gas zone, poGoc given
z0 = reg.zgoc(); z0 = reg.zgoc();
p0 = poGoc; p0 = poGoc;
} else { //Datum in oil zone }
else { //Datum in oil zone
z0 = reg.datum(); z0 = reg.datum();
p0 = reg.pressure(); p0 = reg.pressure();
} }
@ -405,8 +407,7 @@ template <class FluidSystem,
class Grid, class Grid,
class Region, class Region,
class CellRange> class CellRange>
void void gas(const Grid& grid,
gas(const Grid& grid ,
const Region& reg, const Region& reg,
const std::array<double,2>& span , const std::array<double,2>& span ,
const double grav, const double grav,
@ -426,7 +427,8 @@ gas(const Grid& grid ,
if (reg.datum() < reg.zgoc()) {//Datum in gas zone if (reg.datum() < reg.zgoc()) {//Datum in gas zone
z0 = reg.datum(); z0 = reg.datum();
p0 = reg.pressure(); p0 = reg.pressure();
} else { }
else {
z0 = reg.zgoc(); z0 = reg.zgoc();
p0 = poGoc + reg.pcgoGoc(); // Gas pressure at contact p0 = poGoc + reg.pcgoGoc(); // Gas pressure at contact
} }
@ -456,8 +458,7 @@ template <class FluidSystem,
class Grid, class Grid,
class Region, class Region,
class CellRange> class CellRange>
void void equilibrateOWG(const Grid& grid,
equilibrateOWG(const Grid& grid,
const Region& reg, const Region& reg,
const double grav, const double grav,
const std::array<double,2>& span, const std::array<double,2>& span,
@ -489,7 +490,8 @@ equilibrateOWG(const Grid& grid,
PhasePressure::gas<FluidSystem>(grid, reg, span, grav, poGoc, PhasePressure::gas<FluidSystem>(grid, reg, span, grav, poGoc,
cells, press[gaspos]); cells, press[gaspos]);
} }
} else if (reg.datum() < reg.zgoc()) { // Datum in gas zone }
else if (reg.datum() < reg.zgoc()) { // Datum in gas zone
double poWoc = -1; double poWoc = -1;
double poGoc = -1; double poGoc = -1;
@ -507,7 +509,8 @@ equilibrateOWG(const Grid& grid,
PhasePressure::water<FluidSystem>(grid, reg, span, grav, poWoc, PhasePressure::water<FluidSystem>(grid, reg, span, grav, poWoc,
cells, press[waterpos]); cells, press[waterpos]);
} }
} else { // Datum in oil zone }
else { // Datum in oil zone
double poWoc = -1; double poWoc = -1;
double poGoc = -1; double poGoc = -1;
@ -743,7 +746,8 @@ phaseSaturations(const Grid& grid,
if (swatInit.empty()) { // Invert Pc to find sw if (swatInit.empty()) { // Invert Pc to find sw
sw = satFromPc<FluidSystem, MaterialLaw, MaterialLawManager>(materialLawManager, waterpos, cell, pcov); sw = satFromPc<FluidSystem, MaterialLaw, MaterialLawManager>(materialLawManager, waterpos, cell, pcov);
phaseSaturations[waterpos][localIndex] = sw; phaseSaturations[waterpos][localIndex] = sw;
} else { // Scale Pc to reflect imposed sw }
else { // Scale Pc to reflect imposed sw
sw = swatInit[cell]; sw = swatInit[cell];
sw = materialLawManager.applySwatinit(cell, pcov, sw); sw = materialLawManager.applySwatinit(cell, pcov, sw);
phaseSaturations[waterpos][localIndex] = sw; phaseSaturations[waterpos][localIndex] = sw;
@ -820,7 +824,8 @@ phaseSaturations(const Grid& grid,
MaterialLaw::capillaryPressures(pC, matParams, fluidState); MaterialLaw::capillaryPressures(pC, matParams, fluidState);
double pcWat = pC[FluidSystem::oilPhaseIdx] - pC[FluidSystem::waterPhaseIdx]; double pcWat = pC[FluidSystem::oilPhaseIdx] - pC[FluidSystem::waterPhaseIdx];
phasePressures[oilpos][localIndex] = phasePressures[waterpos][localIndex] + pcWat; phasePressures[oilpos][localIndex] = phasePressures[waterpos][localIndex] + pcWat;
} else if (gas && sg > scaledDrainageInfo.Sgu-thresholdSat) { }
else if (gas && sg > scaledDrainageInfo.Sgu-thresholdSat) {
fluidState.setSaturation(FluidSystem::gasPhaseIdx, scaledDrainageInfo.Sgu); fluidState.setSaturation(FluidSystem::gasPhaseIdx, scaledDrainageInfo.Sgu);
MaterialLaw::capillaryPressures(pC, matParams, fluidState); MaterialLaw::capillaryPressures(pC, matParams, fluidState);
double pcGas = pC[FluidSystem::oilPhaseIdx] + pC[FluidSystem::gasPhaseIdx]; double pcGas = pC[FluidSystem::oilPhaseIdx] + pC[FluidSystem::gasPhaseIdx];
@ -879,8 +884,7 @@ std::vector<double> computeRs(const Grid& grid,
} }
namespace DeckDependent { namespace DeckDependent {
inline inline std::vector<Opm::EquilRecord>
std::vector<Opm::EquilRecord>
getEquil(const Opm::EclipseState& state) getEquil(const Opm::EclipseState& state)
{ {
const auto& init = state.getInitConfig(); const auto& init = state.getInitConfig();
@ -894,7 +898,6 @@ getEquil(const Opm::EclipseState& state)
} }
template<class Grid> template<class Grid>
inline
std::vector<int> std::vector<int>
equilnum(const Opm::EclipseState& eclipseState, equilnum(const Opm::EclipseState& eclipseState,
const Grid& grid) const Grid& grid)
@ -933,8 +936,7 @@ public:
const Opm::EclipseState& eclipseState, const Opm::EclipseState& eclipseState,
const Grid& grid, const Grid& grid,
const double grav = Opm::unit::gravity, const double grav = Opm::unit::gravity,
const bool applySwatInit = true const bool applySwatInit = true)
)
: pp_(FluidSystem::numPhases, : pp_(FluidSystem::numPhases,
std::vector<double>(grid.size(/*codim=*/0))), std::vector<double>(grid.size(/*codim=*/0))),
sat_(FluidSystem::numPhases, sat_(FluidSystem::numPhases,
@ -968,8 +970,7 @@ public:
if (FluidSystem::enableDissolvedGas()) { if (FluidSystem::enableDissolvedGas()) {
const Opm::TableContainer& rsvdTables = tables.getRsvdTables(); const Opm::TableContainer& rsvdTables = tables.getRsvdTables();
for (size_t i = 0; i < rec.size(); ++i) { for (size_t i = 0; i < rec.size(); ++i) {
if (eqlmap.cells(i).empty()) if (eqlmap.cells(i).empty()) {
{
rsFunc_.push_back(std::shared_ptr<Miscibility::RsVD<FluidSystem>>()); rsFunc_.push_back(std::shared_ptr<Miscibility::RsVD<FluidSystem>>());
continue; continue;
} }
@ -983,7 +984,8 @@ public:
std::vector<double> rsColumn = rsvdTable.getColumn("RS").vectorCopy(); std::vector<double> rsColumn = rsvdTable.getColumn("RS").vectorCopy();
rsFunc_.push_back(std::make_shared<Miscibility::RsVD<FluidSystem>>(pvtIdx, rsFunc_.push_back(std::make_shared<Miscibility::RsVD<FluidSystem>>(pvtIdx,
depthColumn, rsColumn)); depthColumn, rsColumn));
} else { }
else {
if (rec[i].gasOilContactDepth() != rec[i].datumDepth()) { if (rec[i].gasOilContactDepth() != rec[i].datumDepth()) {
OPM_THROW(std::runtime_error, OPM_THROW(std::runtime_error,
"Cannot initialise: when no explicit RSVD table is given, \n" "Cannot initialise: when no explicit RSVD table is given, \n"
@ -995,7 +997,8 @@ public:
rsFunc_.push_back(std::make_shared<Miscibility::RsSatAtContact<FluidSystem>>(pvtIdx, pContact, TContact)); rsFunc_.push_back(std::make_shared<Miscibility::RsSatAtContact<FluidSystem>>(pvtIdx, pContact, TContact));
} }
} }
} else { }
else {
for (size_t i = 0; i < rec.size(); ++i) { for (size_t i = 0; i < rec.size(); ++i) {
rsFunc_.push_back(std::make_shared<Miscibility::NoMixing>()); rsFunc_.push_back(std::make_shared<Miscibility::NoMixing>());
} }
@ -1005,8 +1008,7 @@ public:
if (FluidSystem::enableVaporizedOil()) { if (FluidSystem::enableVaporizedOil()) {
const Opm::TableContainer& rvvdTables = tables.getRvvdTables(); const Opm::TableContainer& rvvdTables = tables.getRvvdTables();
for (size_t i = 0; i < rec.size(); ++i) { for (size_t i = 0; i < rec.size(); ++i) {
if (eqlmap.cells(i).empty()) if (eqlmap.cells(i).empty()) {
{
rvFunc_.push_back(std::shared_ptr<Miscibility::RvVD<FluidSystem>>()); rvFunc_.push_back(std::shared_ptr<Miscibility::RvVD<FluidSystem>>());
continue; continue;
} }
@ -1022,7 +1024,8 @@ public:
rvFunc_.push_back(std::make_shared<Miscibility::RvVD<FluidSystem>>(pvtIdx, rvFunc_.push_back(std::make_shared<Miscibility::RvVD<FluidSystem>>(pvtIdx,
depthColumn, rvColumn)); depthColumn, rvColumn));
} else { }
else {
if (rec[i].gasOilContactDepth() != rec[i].datumDepth()) { if (rec[i].gasOilContactDepth() != rec[i].datumDepth()) {
OPM_THROW(std::runtime_error, OPM_THROW(std::runtime_error,
"Cannot initialise: when no explicit RVVD table is given, \n" "Cannot initialise: when no explicit RVVD table is given, \n"
@ -1034,7 +1037,8 @@ public:
rvFunc_.push_back(std::make_shared<Miscibility::RvSatAtContact<FluidSystem>>(pvtIdx,pContact, TContact)); rvFunc_.push_back(std::make_shared<Miscibility::RvSatAtContact<FluidSystem>>(pvtIdx,pContact, TContact));
} }
} }
} else { }
else {
for (size_t i = 0; i < rec.size(); ++i) { for (size_t i = 0; i < rec.size(); ++i) {
rvFunc_.push_back(std::make_shared<Miscibility::NoMixing>()); rvFunc_.push_back(std::make_shared<Miscibility::NoMixing>());
} }
@ -1094,8 +1098,7 @@ private:
} }
template <class RMap, class MaterialLawManager> template <class RMap, class MaterialLawManager>
void void calcPressSatRsRv(const RMap& reg,
calcPressSatRsRv(const RMap& reg ,
const std::vector< Opm::EquilRecord >& rec, const std::vector< Opm::EquilRecord >& rec,
MaterialLawManager& materialLawManager, MaterialLawManager& materialLawManager,
const Grid& grid, const Grid& grid,
@ -1103,8 +1106,7 @@ private:
{ {
for (const auto& r : reg.activeRegions()) { for (const auto& r : reg.activeRegions()) {
const auto& cells = reg.cells(r); const auto& cells = reg.cells(r);
if (cells.empty()) if (cells.empty()) {
{
Opm::OpmLog::warning("Equilibration region " + std::to_string(r + 1) Opm::OpmLog::warning("Equilibration region " + std::to_string(r + 1)
+ " has no active cells"); + " has no active cells");
continue; continue;