Some more cleanup adressing PR comments.

This commit is contained in:
Tor Harald Sandve
2016-02-12 11:02:03 +01:00
parent dee96db6b2
commit 0a30d912e8
4 changed files with 45 additions and 37 deletions

View File

@@ -232,10 +232,10 @@ namespace Opm {
phaseCondition() const {return this->phaseCondition_;}
// compute effective viscosities (mu_eff_) and effective b factors (b_eff_) using the ToddLongstaff model
void calculateEffectiveProperties(const SolutionState& state);
void computeEffectiveProperties(const SolutionState& state);
// compute density and viscosity using the ToddLongstaff mixing model
void ToddLongstaffModel(std::vector<ADB>& viscosity, std::vector<ADB>& density, const std::vector<ADB>& saturations, const Opm::PhaseUsage pu);
void computeToddLongstaffMixing(std::vector<ADB>& viscosity, std::vector<ADB>& density, const std::vector<ADB>& saturations, const Opm::PhaseUsage pu);
};

View File

@@ -712,7 +712,7 @@ namespace Opm {
template <class Grid>
void
BlackoilSolventModel<Grid>::calculateEffectiveProperties(const SolutionState& state)
BlackoilSolventModel<Grid>::computeEffectiveProperties(const SolutionState& state)
{
// Viscosity
const Opm::PhaseUsage& pu = fluid_.phaseUsage();
@@ -767,7 +767,7 @@ namespace Opm {
effective_saturations[solvent_pos_] = ss - sgcwmis;
// Compute effective viscosities and densities
ToddLongstaffModel(viscosity, density, effective_saturations, pu);
computeToddLongstaffMixing(viscosity, density, effective_saturations, pu);
// Store the computed volume factors and viscosities
b_eff_[pu.phase_pos[ Water ]] = bw;
@@ -783,7 +783,7 @@ namespace Opm {
template <class Grid>
void
BlackoilSolventModel<Grid>::ToddLongstaffModel(std::vector<ADB>& viscosity, std::vector<ADB>& density, const std::vector<ADB>& saturations, const Opm::PhaseUsage pu)
BlackoilSolventModel<Grid>::computeToddLongstaffMixing(std::vector<ADB>& viscosity, std::vector<ADB>& density, const std::vector<ADB>& saturations, const Opm::PhaseUsage pu)
{
const int nc = cells_.size();
const V ones = V::Constant(nc, 1.0);
@@ -904,14 +904,14 @@ namespace Opm {
// Compute initial accumulation contributions
// and well connection pressures.
if (is_miscible_) {
calculateEffectiveProperties(state0);
computeEffectiveProperties(state0);
}
computeAccum(state0, 0);
computeWellConnectionPressures(state0, well_state);
}
if (is_miscible_) {
calculateEffectiveProperties(state);
computeEffectiveProperties(state);
}
// -------- Mass balance equations --------

View File

@@ -300,34 +300,34 @@ ADB SolventPropsAdFromDeck::muSolvent(const ADB& pg,
}
ADB SolventPropsAdFromDeck::bSolvent(const ADB& pg,
const Cells& cells) const
const Cells& cells) const
{
return SolventPropsAdFromDeck::makeADBfromTables(pg, cells, b_);
}
ADB SolventPropsAdFromDeck::gasRelPermMultiplier(const ADB& solventFraction,
const Cells& cells) const
const Cells& cells) const
{
return SolventPropsAdFromDeck::makeADBfromTables(solventFraction, cells, krg_);
}
ADB SolventPropsAdFromDeck::solventRelPermMultiplier(const ADB& solventFraction,
const Cells& cells) const
const Cells& cells) const
{
return SolventPropsAdFromDeck::makeADBfromTables(solventFraction, cells, krs_);
}
ADB SolventPropsAdFromDeck::misicibleHydrocarbonWaterRelPerm(const ADB& Sn,
const Cells& cells) const
const Cells& cells) const
{
return SolventPropsAdFromDeck::makeADBfromTables(Sn, cells, krn_);
}
ADB SolventPropsAdFromDeck::miscibleSolventGasRelPermMultiplier(const ADB& Ssg,
const Cells& cells) const
const Cells& cells) const
{
if (mkrsg_.size() > 0) {
return SolventPropsAdFromDeck::makeADBfromTables(Ssg, cells, mkrsg_);
@@ -337,7 +337,7 @@ ADB SolventPropsAdFromDeck::miscibleSolventGasRelPermMultiplier(const ADB& Ssg,
}
ADB SolventPropsAdFromDeck::miscibleOilRelPermMultiplier(const ADB& So,
const Cells& cells) const
const Cells& cells) const
{
if (mkro_.size() > 0) {
return SolventPropsAdFromDeck::makeADBfromTables(So, cells, mkro_);
@@ -347,7 +347,7 @@ ADB SolventPropsAdFromDeck::miscibleOilRelPermMultiplier(const ADB& So,
}
ADB SolventPropsAdFromDeck::miscibilityFunction(const ADB& solventFraction,
const Cells& cells) const
const Cells& cells) const
{
return SolventPropsAdFromDeck::makeADBfromTables(solventFraction, cells, misc_);
@@ -355,7 +355,7 @@ ADB SolventPropsAdFromDeck::miscibilityFunction(const ADB& solventFraction,
ADB SolventPropsAdFromDeck::miscibleCriticalGasSaturationFunction (const ADB& Sw,
const Cells& cells) const {
const Cells& cells) const {
if (sgcwmis_.size()>0) {
return SolventPropsAdFromDeck::makeADBfromTables(Sw, cells, sgcwmis_);
}
@@ -365,7 +365,7 @@ ADB SolventPropsAdFromDeck::miscibleCriticalGasSaturationFunction (const ADB& Sw
ADB SolventPropsAdFromDeck::miscibleResidualOilSaturationFunction (const ADB& Sw,
const Cells& cells) const {
const Cells& cells) const {
if (sorwmis_.size()>0) {
return SolventPropsAdFromDeck::makeADBfromTables(Sw, cells, sorwmis_);
}
@@ -373,7 +373,9 @@ ADB SolventPropsAdFromDeck::miscibleResidualOilSaturationFunction (const ADB& Sw
return ADB::constant(V::Zero(Sw.size()));
}
ADB SolventPropsAdFromDeck::makeADBfromTables(const ADB& X_AD, const Cells& cells, std::vector<NonuniformTableLinear<double>> table) const {
ADB SolventPropsAdFromDeck::makeADBfromTables(const ADB& X_AD,
const Cells& cells,
const std::vector<NonuniformTableLinear<double>>& tables) const {
const int n = cells.size();
assert(X_AD.value().size() == n);
V x(n);
@@ -381,8 +383,8 @@ ADB SolventPropsAdFromDeck::makeADBfromTables(const ADB& X_AD, const Cells& cell
for (int i = 0; i < n; ++i) {
const double& X_i = X_AD.value()[i];
int regionIdx = 0; // TODO add mapping from cells to sat function table
x[i] = table[regionIdx](X_i);
dx[i] = table[regionIdx].derivative(X_i);
x[i] = tables[regionIdx](X_i);
dx[i] = tables[regionIdx].derivative(X_i);
}
ADB::M dx_diag(dx.matrix().asDiagonal());

View File

@@ -56,71 +56,71 @@ public:
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
/// \return Array of n formation volume factor values.
ADB bSolvent(const ADB& pg,
const Cells& cells) const;
const Cells& cells) const;
/// Solvent viscosity.
/// \param[in] pg Array of n gas pressure values.
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
/// \return Array of n viscosity values.
ADB muSolvent(const ADB& pg,
const Cells& cells) const;
const Cells& cells) const;
/// Gas relPerm multipliers
/// \param[in] gasFraction Array of n gas fraction Sg / (sg + Ss) values.
/// \param[in] cells Array of n cell indices to be associated with the fraction values.
/// \return Array of n gas relPerm multiplier values.
ADB gasRelPermMultiplier(const ADB& solventFraction,
const Cells& cells) const;
const Cells& cells) const;
/// Solvent relPerm multipliers
/// \param[in] solventFraction Array of n solvent fraction Ss / (Sg + Ss) values.
/// \param[in] cells Array of n cell indices to be associated with the fraction values.
/// \return Array of n solvent relPerm multiplier values.
ADB solventRelPermMultiplier(const ADB& solventFraction,
const Cells& cells) const;
const Cells& cells) const;
/// Miscible hydrocrabon relPerm wrt water
/// \param[in] Sn Array of n total hyrdrocarbon saturation values.
/// \param[in] cells Array of n cell indices to be associated with the fraction values.
/// \return Array of n miscible hyrdrocabon wrt water relPerm values.
ADB misicibleHydrocarbonWaterRelPerm(const ADB& Sn,
const Cells& cells) const;
const Cells& cells) const;
/// Miscible Solvent + Gas relPerm multipleier
/// Miscible Solvent + Gas relPerm multiplier
/// \param[in] Ssg Array of n total gas fraction (Sgas + Ssolvent) / Sn values, where
/// Sn = Sgas + Ssolvent + Soil.
/// \param[in] cells Array of n cell indices to be associated with the fraction values.
/// \return Array of n solvent gas relperm multiplier.
ADB miscibleSolventGasRelPermMultiplier (const ADB& Ssg,
const Cells& cells) const;
ADB miscibleSolventGasRelPermMultiplier(const ADB& Ssg,
const Cells& cells) const;
/// Miscible Oil relPerm multipleier
/// Miscible Oil relPerm multiplier
/// \param[in] So Array of n oil fraction values. Soil / Sn values, where Sn = Sgas + Ssolvent + Soil.
/// \param[in] cells Array of n cell indices to be associated with the fraction values.
/// \return Array of n oil relperm multiplier.
ADB miscibleOilRelPermMultiplier (const ADB& So,
const Cells& cells) const;
ADB miscibleOilRelPermMultiplier(const ADB& So,
const Cells& cells) const;
/// Miscible function
/// \param[in] solventFraction Array of n solvent fraction Ss / (Sg + Ss) values.
/// \param[in] cells Array of n cell indices to be associated with the fraction values.
/// \return Array of n miscibility values
ADB miscibilityFunction (const ADB& solventFraction,
const Cells& cells) const;
ADB miscibilityFunction(const ADB& solventFraction,
const Cells& cells) const;
/// Miscible critical gas saturation function
/// \param[in] Sw Array of n water saturation values.
/// \param[in] cells Array of n cell indices to be associated with the saturation values.
/// \return Array of n miscible critical gas saturation values
ADB miscibleCriticalGasSaturationFunction (const ADB& Sw,
const Cells& cells) const;
ADB miscibleCriticalGasSaturationFunction(const ADB& Sw,
const Cells& cells) const;
/// Miscible residual oil saturation function
/// \param[in] Sw Array of n water saturation values.
/// \param[in] cells Array of n cell indices to be associated with the saturation values.
/// \return Array of n miscible residual oil saturation values
ADB miscibleResidualOilSaturationFunction (const ADB& Sw,
const Cells& cells) const;
ADB miscibleResidualOilSaturationFunction(const ADB& Sw,
const Cells& cells) const;
/// Solvent surface density
/// \param[in] cells Array of n cell indices to be associated with the fraction values.
@@ -137,7 +137,13 @@ public:
private:
/// Makes ADB from table values
ADB makeADBfromTables(const ADB& X, const Cells& cells, std::vector<NonuniformTableLinear<double> > table) const;
/// \param[in] X Array of n table lookup values.
/// \param[in] cells Array of n cell indices to be associated with the fraction values.
/// \param[in] tables Vector of tables, one for each PVT region.
/// \return Array of n solvent density values.
ADB makeADBfromTables(const ADB& X,
const Cells& cells,
const std::vector<NonuniformTableLinear<double>>& tables) const;
// The PVT region which is to be used for each cell
std::vector<int> cellPvtRegionIdx_;