Switch condition interface to phase presence facility
Commita5a4d7b
introduced density and viscosity evaluators into the SinglePvtInterface that accepted an externally assignable condition to distinguish saturated from unsaturated cases. As a result of a few low-level technical problems with that approach, this commit changes those affected interfaces to use the black-oil specific 'PhasePresence' facility of commita033329
instead. Update tests and callers accordingly. Suggested by: @andlaus Approved by: @atgeirr
This commit is contained in:
parent
a033329b14
commit
9e1e50d159
@ -111,7 +111,7 @@ namespace Opm
|
||||
virtual void mu(const int n,
|
||||
const double* p,
|
||||
const double* /*r*/,
|
||||
const bool* /*isSat*/,
|
||||
const PhasePresence* /*cond*/,
|
||||
double* output_mu,
|
||||
double* output_dmudp,
|
||||
double* output_dmudr) const
|
||||
@ -199,7 +199,7 @@ namespace Opm
|
||||
virtual void b(const int n,
|
||||
const double* p,
|
||||
const double* /*r*/,
|
||||
const bool* /*isSat*/,
|
||||
const PhasePresence* /*cond*/,
|
||||
double* output_b,
|
||||
double* output_dbdp,
|
||||
double* output_dbdr) const
|
||||
|
@ -99,7 +99,7 @@ namespace Opm
|
||||
void SinglePvtDead::mu(const int n,
|
||||
const double* p,
|
||||
const double* /*r*/,
|
||||
const bool* /*isSat*/,
|
||||
const PhasePresence* /*cond*/,
|
||||
double* output_mu,
|
||||
double* output_dmudp,
|
||||
double* output_dmudr) const
|
||||
@ -160,7 +160,7 @@ namespace Opm
|
||||
void SinglePvtDead::b(const int n,
|
||||
const double* p,
|
||||
const double* /*r*/,
|
||||
const bool* /*isSat*/,
|
||||
const PhasePresence* /*cond*/,
|
||||
double* output_b,
|
||||
double* output_dbdp,
|
||||
double* output_dbdr) const
|
||||
|
@ -58,11 +58,11 @@ namespace Opm
|
||||
double* output_dmudr) const;
|
||||
|
||||
/// Viscosity as a function of p and r.
|
||||
/// Whether the fluid is saturated or not is given explicitly by isSat.
|
||||
/// State condition determined by 'cond'.
|
||||
virtual void mu(const int n,
|
||||
const double* p,
|
||||
const double* r,
|
||||
const bool* isSat,
|
||||
const PhasePresence* cond,
|
||||
double* output_mu,
|
||||
double* output_dmudp,
|
||||
double* output_dmudr) const;
|
||||
@ -90,11 +90,11 @@ namespace Opm
|
||||
double* output_dbdr) const;
|
||||
|
||||
/// The inverse of the formation volume factor b = 1 / B, and its derivatives as a function of p and r.
|
||||
/// Whether the fluid is saturated or not is given explicitly by isSat.
|
||||
/// State condition determined by 'cond'.
|
||||
virtual void b(const int n,
|
||||
const double* p,
|
||||
const double* r,
|
||||
const bool* isSat,
|
||||
const PhasePresence* cond,
|
||||
double* output_b,
|
||||
double* output_dbdp,
|
||||
double* output_dbdr) const;
|
||||
|
@ -101,7 +101,7 @@ namespace Opm
|
||||
void SinglePvtDeadSpline::mu(const int n,
|
||||
const double* p,
|
||||
const double* /*r*/,
|
||||
const bool* /*isSat*/,
|
||||
const PhasePresence* /*cond*/,
|
||||
double* output_mu,
|
||||
double* output_dmudp,
|
||||
double* output_dmudr) const
|
||||
@ -162,7 +162,7 @@ namespace Opm
|
||||
void SinglePvtDeadSpline::b(const int n,
|
||||
const double* p,
|
||||
const double* /*r*/,
|
||||
const bool* /*isSat*/,
|
||||
const PhasePresence* /*cond*/,
|
||||
double* output_b,
|
||||
double* output_dbdp,
|
||||
double* output_dbdr) const
|
||||
|
@ -59,11 +59,11 @@ namespace Opm
|
||||
double* output_dmudr) const;
|
||||
|
||||
/// Viscosity as a function of p and r.
|
||||
/// Whether the fluid is saturated or not is given explicitly by isSat.
|
||||
/// State condition determined by 'cond'.
|
||||
virtual void mu(const int n,
|
||||
const double* p,
|
||||
const double* r,
|
||||
const bool* isSat,
|
||||
const PhasePresence* cond,
|
||||
double* output_mu,
|
||||
double* output_dmudp,
|
||||
double* output_dmudr) const;
|
||||
@ -91,11 +91,11 @@ namespace Opm
|
||||
double* output_dbdr) const;
|
||||
|
||||
/// The inverse of the formation volume factor b = 1 / B, and its derivatives as a function of p and r.
|
||||
/// Whether the fluid is saturated or not is given explicitly by isSat.
|
||||
/// State condition determined by 'cond'.
|
||||
virtual void b(const int n,
|
||||
const double* p,
|
||||
const double* r,
|
||||
const bool* isSat,
|
||||
const PhasePresence* cond,
|
||||
double* output_b,
|
||||
double* output_dbdp,
|
||||
double* output_dbdr) const;
|
||||
|
@ -65,11 +65,11 @@ namespace Opm
|
||||
double* output_dmudr) const = 0;
|
||||
|
||||
/// Viscosity as a function of p and r.
|
||||
/// Whether the fluid is saturated or not is given explicitly by isSat.
|
||||
/// State condition determined by 'cond'.
|
||||
virtual void mu(const int n,
|
||||
const double* p,
|
||||
const double* r,
|
||||
const bool* isSat,
|
||||
const PhasePresence* cond,
|
||||
double* output_mu,
|
||||
double* output_dmudp,
|
||||
double* output_dmudr) const = 0;
|
||||
@ -97,11 +97,11 @@ namespace Opm
|
||||
double* output_dpdr) const = 0;
|
||||
|
||||
/// The inverse of the volume factor b = 1 / B as a function of p and r.
|
||||
/// Whether the fluid is saturated or not is given explicitly by isSat.
|
||||
/// State condition determined by 'cond'.
|
||||
virtual void b(const int n,
|
||||
const double* p,
|
||||
const double* r,
|
||||
const bool* isSat,
|
||||
const PhasePresence* cond,
|
||||
double* output_b,
|
||||
double* output_dbdp,
|
||||
double* output_dpdr) const = 0;
|
||||
|
@ -113,7 +113,7 @@ namespace Opm
|
||||
void SinglePvtLiveGas::mu(const int n,
|
||||
const double* p,
|
||||
const double* r,
|
||||
const bool* isSat,
|
||||
const PhasePresence* cond,
|
||||
double* output_mu,
|
||||
double* output_dmudp,
|
||||
double* output_dmudr) const
|
||||
@ -165,7 +165,7 @@ namespace Opm
|
||||
void SinglePvtLiveGas::b(const int n,
|
||||
const double* p,
|
||||
const double* r,
|
||||
const bool* isSat,
|
||||
const PhasePresence* cond,
|
||||
double* output_b,
|
||||
double* output_dbdp,
|
||||
double* output_dbdr) const
|
||||
|
@ -56,11 +56,11 @@ namespace Opm
|
||||
double* output_dmudr) const;
|
||||
|
||||
/// Viscosity as a function of p and r.
|
||||
/// Whether the fluid is saturated or not is given explicitly by isSat.
|
||||
/// State condition determined by 'cond'.
|
||||
virtual void mu(const int n,
|
||||
const double* p,
|
||||
const double* r,
|
||||
const bool* isSat,
|
||||
const PhasePresence* cond,
|
||||
double* output_mu,
|
||||
double* output_dmudp,
|
||||
double* output_dmudr) const;
|
||||
@ -88,11 +88,11 @@ namespace Opm
|
||||
double* output_dbdr) const;
|
||||
|
||||
/// The inverse of the formation volume factor b = 1 / B, and its derivatives as a function of p and r.
|
||||
/// Whether the fluid is saturated or not is given explicitly by isSat.
|
||||
/// State condition determined by 'cond'.
|
||||
virtual void b(const int n,
|
||||
const double* p,
|
||||
const double* r,
|
||||
const bool* isSat,
|
||||
const PhasePresence* cond,
|
||||
double* output_b,
|
||||
double* output_dbdp,
|
||||
double* output_dbdr) const;
|
||||
|
@ -144,16 +144,18 @@ namespace Opm
|
||||
void SinglePvtLiveOil::mu(const int n,
|
||||
const double* p,
|
||||
const double* r,
|
||||
const bool* isSat,
|
||||
const PhasePresence* cond,
|
||||
double* output_mu,
|
||||
double* output_dmudp,
|
||||
double* output_dmudr) const
|
||||
{
|
||||
// #pragma omp parallel for
|
||||
for (int i = 0; i < n; ++i) {
|
||||
output_mu[i] = miscible_oil(p[i], r[i],isSat[i], 2, 0);
|
||||
output_dmudp[i] = miscible_oil(p[i], r[i],isSat[i], 2, 1);
|
||||
output_dmudr[i] = miscible_oil(p[i], r[i],isSat[i], 2, 2);
|
||||
const PhasePresence& cnd = cond[i];
|
||||
|
||||
output_mu[i] = miscible_oil(p[i], r[i], cnd, 2, 0);
|
||||
output_dmudp[i] = miscible_oil(p[i], r[i], cnd, 2, 1);
|
||||
output_dmudr[i] = miscible_oil(p[i], r[i], cnd, 2, 2);
|
||||
|
||||
}
|
||||
}
|
||||
@ -206,7 +208,7 @@ namespace Opm
|
||||
void SinglePvtLiveOil::b(const int n,
|
||||
const double* p,
|
||||
const double* r,
|
||||
const bool* isSat,
|
||||
const PhasePresence* cond,
|
||||
double* output_b,
|
||||
double* output_dbdp,
|
||||
double* output_dbdr) const
|
||||
@ -214,9 +216,11 @@ namespace Opm
|
||||
{
|
||||
// #pragma omp parallel for
|
||||
for (int i = 0; i < n; ++i) {
|
||||
output_b[i] = miscible_oil(p[i], r[i], isSat[i],1, 0);
|
||||
output_dbdp[i] = miscible_oil(p[i], r[i], isSat[i], 1, 1);
|
||||
output_dbdr[i] = miscible_oil(p[i], r[i], isSat[i],1, 2);
|
||||
const PhasePresence& cnd = cond[i];
|
||||
|
||||
output_b[i] = miscible_oil(p[i], r[i], cnd, 1, 0);
|
||||
output_dbdp[i] = miscible_oil(p[i], r[i], cnd, 1, 1);
|
||||
output_dbdr[i] = miscible_oil(p[i], r[i], cnd, 1, 2);
|
||||
|
||||
}
|
||||
}
|
||||
@ -461,10 +465,12 @@ namespace Opm
|
||||
|
||||
double SinglePvtLiveOil::miscible_oil(const double press,
|
||||
const double r,
|
||||
const bool isSat,
|
||||
const PhasePresence& cond,
|
||||
const int item,
|
||||
const int deriv) const
|
||||
{
|
||||
const bool isSat = cond.hasFreeGas();
|
||||
|
||||
// derivative with respect to frist component (pressure)
|
||||
if (deriv == 1) {
|
||||
if (isSat) { // Saturated case
|
||||
|
@ -57,11 +57,11 @@ namespace Opm
|
||||
double* output_dmudr) const;
|
||||
|
||||
/// Viscosity as a function of p and r.
|
||||
/// Whether the fluid is saturated or not is given explicitly by isSat.
|
||||
/// State condition determined by 'cond'.
|
||||
virtual void mu(const int n,
|
||||
const double* p,
|
||||
const double* r,
|
||||
const bool* isSat,
|
||||
const PhasePresence* cond,
|
||||
double* output_mu,
|
||||
double* output_dmudp,
|
||||
double* output_dmudr) const;
|
||||
@ -89,11 +89,11 @@ namespace Opm
|
||||
double* output_dbdr) const;
|
||||
|
||||
/// The inverse of the formation volume factor b = 1 / B, and its derivatives as a function of p and r.
|
||||
/// Whether the fluid is saturated or not is given explicitly by isSat.
|
||||
/// State condition determined by 'cond'.
|
||||
virtual void b(const int n,
|
||||
const double* p,
|
||||
const double* r,
|
||||
const bool* isSat,
|
||||
const PhasePresence* cond,
|
||||
double* output_b,
|
||||
double* output_dbdp,
|
||||
double* output_dbdr) const;
|
||||
@ -136,7 +136,7 @@ namespace Opm
|
||||
|
||||
double miscible_oil(const double press,
|
||||
const double r,
|
||||
const bool isSat,
|
||||
const PhasePresence& cond,
|
||||
const int item,
|
||||
const int deriv = 0) const;
|
||||
|
||||
|
@ -97,7 +97,7 @@ BOOST_AUTO_TEST_CASE(test_blackoilfluid)
|
||||
|
||||
std::vector<double> p(n);
|
||||
std::vector<double> r(n);
|
||||
bool isSat[n];
|
||||
std::vector<Opm::PhasePresence> condition(n);
|
||||
std::vector<double> z(n * np);
|
||||
|
||||
std::vector<double> mu(n);
|
||||
@ -123,9 +123,9 @@ BOOST_AUTO_TEST_CASE(test_blackoilfluid)
|
||||
r[1] = 200;
|
||||
r[2] = 200 + h_r;
|
||||
|
||||
isSat[0] = true;
|
||||
isSat[1] = true;
|
||||
isSat[2] = true;
|
||||
condition[0].setFreeGas();
|
||||
condition[1].setFreeGas();
|
||||
condition[2].setFreeGas();
|
||||
|
||||
|
||||
// undersaturated
|
||||
@ -137,10 +137,6 @@ BOOST_AUTO_TEST_CASE(test_blackoilfluid)
|
||||
r[4] = 50;
|
||||
r[5] = 50 +h_r;
|
||||
|
||||
isSat[3] = false;
|
||||
isSat[4] = false;
|
||||
isSat[5] = false;
|
||||
|
||||
// Corresponing z factors, used to compare with the [p,z] interface
|
||||
for (int i = 0; i < n; ++i) {
|
||||
z[0+i*np] = 0; z[1+i*np] = 1;
|
||||
@ -150,7 +146,7 @@ BOOST_AUTO_TEST_CASE(test_blackoilfluid)
|
||||
|
||||
// test mu
|
||||
for (int phase = 1; phase < 2; ++phase) {
|
||||
props_[phase]->mu(n, &p[0], &r[0], &isSat[0], &mu_new[0], &dmudp[0], &dmudr[0]);
|
||||
props_[phase]->mu(n, &p[0], &r[0], &condition[0], &mu_new[0], &dmudp[0], &dmudr[0]);
|
||||
props_[phase]->mu(n, &p[0], &z[0], &mu[0]);
|
||||
dmudp_diff = (mu_new[1]-mu_new[0])/h_p;
|
||||
dmudr_diff = (mu_new[2]-mu_new[0])/h_r;
|
||||
@ -184,7 +180,7 @@ BOOST_AUTO_TEST_CASE(test_blackoilfluid)
|
||||
double dbdr_diff_u;
|
||||
|
||||
for (int phase = 1; phase < 2; ++phase) {
|
||||
props_[phase]->b(n, &p[0], &r[0], &isSat[0], &b[0], &dbdp[0], &dbdr[0]);
|
||||
props_[phase]->b(n, &p[0], &r[0], &condition[0], &b[0], &dbdp[0], &dbdr[0]);
|
||||
//props_[phase]->B(n, p, z, B);
|
||||
props_[phase]->dBdp(n, &p[0], &z[0], &B[0], &dBdp[0]);
|
||||
dbdp_diff = (b[1]-b[0])/h_p;
|
||||
|
Loading…
Reference in New Issue
Block a user