mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-07-29 18:57:56 -05:00
Switch condition interface to phase presence facility
Commit 4aa0eaf introduced density and viscosity evaluators into the
BlackoilPropsAdInterface 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 opm-core's commit a033329.
Update callers accordingly.
This commit is contained in:
@@ -121,12 +121,12 @@ namespace Opm
|
|||||||
/// Oil viscosity.
|
/// Oil viscosity.
|
||||||
/// \param[in] po Array of n oil pressure values.
|
/// \param[in] po Array of n oil pressure values.
|
||||||
/// \param[in] rs Array of n gas solution factor values.
|
/// \param[in] rs Array of n gas solution factor values.
|
||||||
/// \param[in] isSat Array of n booleans telling whether the fluid is saturated or not.
|
/// \param[in] cond Array of n taxonomies classifying fluid condition.
|
||||||
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
||||||
/// \return Array of n viscosity values.
|
/// \return Array of n viscosity values.
|
||||||
V BlackoilPropsAd::muOil(const V& po,
|
V BlackoilPropsAd::muOil(const V& po,
|
||||||
const V& rs,
|
const V& rs,
|
||||||
const bool* /*isSat*/,
|
const std::vector<PhasePresence>& /*cond*/,
|
||||||
const Cells& cells) const
|
const Cells& cells) const
|
||||||
{
|
{
|
||||||
if (!pu_.phase_used[Oil]) {
|
if (!pu_.phase_used[Oil]) {
|
||||||
@@ -199,16 +199,16 @@ namespace Opm
|
|||||||
/// Oil viscosity.
|
/// Oil viscosity.
|
||||||
/// \param[in] po Array of n oil pressure values.
|
/// \param[in] po Array of n oil pressure values.
|
||||||
/// \param[in] rs Array of n gas solution factor values.
|
/// \param[in] rs Array of n gas solution factor values.
|
||||||
/// \param[in] isSat Array of n booleans telling whether the fluid is saturated or not.
|
/// \param[in] cond Array of n taxonomies classifying fluid condition.
|
||||||
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
||||||
/// \return Array of n viscosity values.
|
/// \return Array of n viscosity values.
|
||||||
ADB BlackoilPropsAd::muOil(const ADB& po,
|
ADB BlackoilPropsAd::muOil(const ADB& po,
|
||||||
const ADB& rs,
|
const ADB& rs,
|
||||||
const bool* isSat,
|
const std::vector<PhasePresence>& cond,
|
||||||
const Cells& cells) const
|
const Cells& cells) const
|
||||||
{
|
{
|
||||||
#if 1
|
#if 1
|
||||||
return ADB::constant(muOil(po.value(), rs.value(), isSat,cells), po.blockPattern());
|
return ADB::constant(muOil(po.value(), rs.value(), cond, cells), po.blockPattern());
|
||||||
#else
|
#else
|
||||||
if (!pu_.phase_used[Oil]) {
|
if (!pu_.phase_used[Oil]) {
|
||||||
OPM_THROW(std::runtime_error, "Cannot call muOil(): oil phase not present.");
|
OPM_THROW(std::runtime_error, "Cannot call muOil(): oil phase not present.");
|
||||||
@@ -310,12 +310,12 @@ namespace Opm
|
|||||||
/// Oil formation volume factor.
|
/// Oil formation volume factor.
|
||||||
/// \param[in] po Array of n oil pressure values.
|
/// \param[in] po Array of n oil pressure values.
|
||||||
/// \param[in] rs Array of n gas solution factor values.
|
/// \param[in] rs Array of n gas solution factor values.
|
||||||
/// \param[in] isSat Array of n booleans telling whether the fluid is saturated or not.
|
/// \param[in] cond Array of n taxonomies classifying fluid condition.
|
||||||
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
||||||
/// \return Array of n formation volume factor values.
|
/// \return Array of n formation volume factor values.
|
||||||
V BlackoilPropsAd::bOil(const V& po,
|
V BlackoilPropsAd::bOil(const V& po,
|
||||||
const V& rs,
|
const V& rs,
|
||||||
const bool* /*isSat*/,
|
const std::vector<PhasePresence>& /*cond*/,
|
||||||
const Cells& cells) const
|
const Cells& cells) const
|
||||||
{
|
{
|
||||||
if (!pu_.phase_used[Oil]) {
|
if (!pu_.phase_used[Oil]) {
|
||||||
@@ -388,12 +388,12 @@ namespace Opm
|
|||||||
/// Oil formation volume factor.
|
/// Oil formation volume factor.
|
||||||
/// \param[in] po Array of n oil pressure values.
|
/// \param[in] po Array of n oil pressure values.
|
||||||
/// \param[in] rs Array of n gas solution factor values.
|
/// \param[in] rs Array of n gas solution factor values.
|
||||||
/// \param[in] isSat Array of n booleans telling whether the fluid is saturated or not.
|
/// \param[in] cond Array of n taxonomies classifying fluid condition.
|
||||||
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
||||||
/// \return Array of n formation volume factor values.
|
/// \return Array of n formation volume factor values.
|
||||||
ADB BlackoilPropsAd::bOil(const ADB& po,
|
ADB BlackoilPropsAd::bOil(const ADB& po,
|
||||||
const ADB& rs,
|
const ADB& rs,
|
||||||
const bool* /*isSat*/,
|
const std::vector<PhasePresence>& /*cond*/,
|
||||||
const Cells& cells) const
|
const Cells& cells) const
|
||||||
{
|
{
|
||||||
if (!pu_.phase_used[Oil]) {
|
if (!pu_.phase_used[Oil]) {
|
||||||
|
|||||||
@@ -109,12 +109,12 @@ namespace Opm
|
|||||||
/// Oil viscosity.
|
/// Oil viscosity.
|
||||||
/// \param[in] po Array of n oil pressure values.
|
/// \param[in] po Array of n oil pressure values.
|
||||||
/// \param[in] rs Array of n gas solution factor values.
|
/// \param[in] rs Array of n gas solution factor values.
|
||||||
/// \param[in] isSat Array of n booleans telling whether the fluid is saturated or not.
|
/// \param[in] cond Array of n taxonomies classifying fluid condition.
|
||||||
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
||||||
/// \return Array of n viscosity values.
|
/// \return Array of n viscosity values.
|
||||||
V muOil(const V& po,
|
V muOil(const V& po,
|
||||||
const V& rs,
|
const V& rs,
|
||||||
const bool* isSat,
|
const std::vector<PhasePresence>& cond,
|
||||||
const Cells& cells) const;
|
const Cells& cells) const;
|
||||||
|
|
||||||
/// Gas viscosity.
|
/// Gas viscosity.
|
||||||
@@ -134,12 +134,12 @@ namespace Opm
|
|||||||
/// Oil viscosity.
|
/// Oil viscosity.
|
||||||
/// \param[in] po Array of n oil pressure values.
|
/// \param[in] po Array of n oil pressure values.
|
||||||
/// \param[in] rs Array of n gas solution factor values.
|
/// \param[in] rs Array of n gas solution factor values.
|
||||||
/// \param[in] isSat Array of n booleans telling whether the fluid is saturated or not.
|
/// \param[in] cond Array of n taxonomies classifying fluid condition.
|
||||||
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
||||||
/// \return Array of n viscosity values.
|
/// \return Array of n viscosity values.
|
||||||
ADB muOil(const ADB& po,
|
ADB muOil(const ADB& po,
|
||||||
const ADB& rs,
|
const ADB& rs,
|
||||||
const bool* isSat,
|
const std::vector<PhasePresence>& cond,
|
||||||
const Cells& cells) const;
|
const Cells& cells) const;
|
||||||
|
|
||||||
/// Gas viscosity.
|
/// Gas viscosity.
|
||||||
@@ -162,12 +162,12 @@ namespace Opm
|
|||||||
/// Oil formation volume factor.
|
/// Oil formation volume factor.
|
||||||
/// \param[in] po Array of n oil pressure values.
|
/// \param[in] po Array of n oil pressure values.
|
||||||
/// \param[in] rs Array of n gas solution factor values.
|
/// \param[in] rs Array of n gas solution factor values.
|
||||||
/// \param[in] isSat Array of n booleans telling whether the fluid is saturated or not.
|
/// \param[in] cond Array of n taxonomies classifying fluid condition.
|
||||||
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
||||||
/// \return Array of n formation volume factor values.
|
/// \return Array of n formation volume factor values.
|
||||||
V bOil(const V& po,
|
V bOil(const V& po,
|
||||||
const V& rs,
|
const V& rs,
|
||||||
const bool* isSat,
|
const std::vector<PhasePresence>& cond,
|
||||||
const Cells& cells) const;
|
const Cells& cells) const;
|
||||||
|
|
||||||
/// Gas formation volume factor.
|
/// Gas formation volume factor.
|
||||||
@@ -187,12 +187,12 @@ namespace Opm
|
|||||||
/// Oil formation volume factor.
|
/// Oil formation volume factor.
|
||||||
/// \param[in] po Array of n oil pressure values.
|
/// \param[in] po Array of n oil pressure values.
|
||||||
/// \param[in] rs Array of n gas solution factor values.
|
/// \param[in] rs Array of n gas solution factor values.
|
||||||
/// \param[in] isSat Array of n booleans telling whether the fluid is saturated or not.
|
/// \param[in] cond Array of n taxonomies classifying fluid condition.
|
||||||
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
||||||
/// \return Array of n formation volume factor values.
|
/// \return Array of n formation volume factor values.
|
||||||
ADB bOil(const ADB& po,
|
ADB bOil(const ADB& po,
|
||||||
const ADB& rs,
|
const ADB& rs,
|
||||||
const bool* isSat,
|
const std::vector<PhasePresence>& cond,
|
||||||
const Cells& cells) const;
|
const Cells& cells) const;
|
||||||
|
|
||||||
/// Gas formation volume factor.
|
/// Gas formation volume factor.
|
||||||
|
|||||||
@@ -212,12 +212,12 @@ namespace Opm
|
|||||||
/// Oil viscosity.
|
/// Oil viscosity.
|
||||||
/// \param[in] po Array of n oil pressure values.
|
/// \param[in] po Array of n oil pressure values.
|
||||||
/// \param[in] rs Array of n gas solution factor values.
|
/// \param[in] rs Array of n gas solution factor values.
|
||||||
/// \param[in] isSat Array of n booleans telling whether the fluid is saturated or not.
|
/// \param[in] cond Array of n taxonomies classifying fluid condition.
|
||||||
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
||||||
/// \return Array of n viscosity values.
|
/// \return Array of n viscosity values.
|
||||||
V BlackoilPropsAdFromDeck::muOil(const V& po,
|
V BlackoilPropsAdFromDeck::muOil(const V& po,
|
||||||
const V& rs,
|
const V& rs,
|
||||||
const bool* isSat,
|
const std::vector<PhasePresence>& cond,
|
||||||
const Cells& cells) const
|
const Cells& cells) const
|
||||||
{
|
{
|
||||||
if (!phase_usage_.phase_used[Oil]) {
|
if (!phase_usage_.phase_used[Oil]) {
|
||||||
@@ -229,7 +229,7 @@ namespace Opm
|
|||||||
V dmudp(n);
|
V dmudp(n);
|
||||||
V dmudr(n);
|
V dmudr(n);
|
||||||
|
|
||||||
props_[phase_usage_.phase_pos[Oil]]->mu(n, po.data(), rs.data(),isSat,
|
props_[phase_usage_.phase_pos[Oil]]->mu(n, po.data(), rs.data(), &cond[0],
|
||||||
mu.data(), dmudp.data(), dmudr.data());
|
mu.data(), dmudp.data(), dmudr.data());
|
||||||
return mu;
|
return mu;
|
||||||
}
|
}
|
||||||
@@ -287,12 +287,12 @@ namespace Opm
|
|||||||
/// Oil viscosity.
|
/// Oil viscosity.
|
||||||
/// \param[in] po Array of n oil pressure values.
|
/// \param[in] po Array of n oil pressure values.
|
||||||
/// \param[in] rs Array of n gas solution factor values.
|
/// \param[in] rs Array of n gas solution factor values.
|
||||||
/// \param[in] isSat Array of n booleans telling whether the fluid is saturated or not.
|
/// \param[in] cond Array of n taxonomies classifying fluid condition.
|
||||||
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
||||||
/// \return Array of n viscosity values.
|
/// \return Array of n viscosity values.
|
||||||
ADB BlackoilPropsAdFromDeck::muOil(const ADB& po,
|
ADB BlackoilPropsAdFromDeck::muOil(const ADB& po,
|
||||||
const ADB& rs,
|
const ADB& rs,
|
||||||
const bool* isSat,
|
const std::vector<PhasePresence>& cond,
|
||||||
const Cells& cells) const
|
const Cells& cells) const
|
||||||
{
|
{
|
||||||
if (!phase_usage_.phase_used[Oil]) {
|
if (!phase_usage_.phase_used[Oil]) {
|
||||||
@@ -304,8 +304,8 @@ namespace Opm
|
|||||||
V dmudp(n);
|
V dmudp(n);
|
||||||
V dmudr(n);
|
V dmudr(n);
|
||||||
|
|
||||||
props_[phase_usage_.phase_pos[Oil]]->mu(n, po.value().data(), rs.value().data(), isSat,
|
props_[phase_usage_.phase_pos[Oil]]->mu(n, po.value().data(), rs.value().data(),
|
||||||
mu.data(), dmudp.data(), dmudr.data());
|
&cond[0], mu.data(), dmudp.data(), dmudr.data());
|
||||||
|
|
||||||
ADB::M dmudp_diag = spdiag(dmudp);
|
ADB::M dmudp_diag = spdiag(dmudp);
|
||||||
ADB::M dmudr_diag = spdiag(dmudr);
|
ADB::M dmudr_diag = spdiag(dmudr);
|
||||||
@@ -391,11 +391,12 @@ namespace Opm
|
|||||||
/// Oil formation volume factor.
|
/// Oil formation volume factor.
|
||||||
/// \param[in] po Array of n oil pressure values.
|
/// \param[in] po Array of n oil pressure values.
|
||||||
/// \param[in] rs Array of n gas solution factor values.
|
/// \param[in] rs Array of n gas solution factor values.
|
||||||
|
/// \param[in] cond Array of n taxonomies classifying fluid condition.
|
||||||
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
||||||
/// \return Array of n formation volume factor values.
|
/// \return Array of n formation volume factor values.
|
||||||
V BlackoilPropsAdFromDeck::bOil(const V& po,
|
V BlackoilPropsAdFromDeck::bOil(const V& po,
|
||||||
const V& rs,
|
const V& rs,
|
||||||
const bool* isSat,
|
const std::vector<PhasePresence>& cond,
|
||||||
const Cells& cells) const
|
const Cells& cells) const
|
||||||
{
|
{
|
||||||
if (!phase_usage_.phase_used[Oil]) {
|
if (!phase_usage_.phase_used[Oil]) {
|
||||||
@@ -408,7 +409,7 @@ namespace Opm
|
|||||||
V dbdp(n);
|
V dbdp(n);
|
||||||
V dbdr(n);
|
V dbdr(n);
|
||||||
|
|
||||||
props_[phase_usage_.phase_pos[Oil]]->b(n, po.data(), rs.data(),isSat,
|
props_[phase_usage_.phase_pos[Oil]]->b(n, po.data(), rs.data(), &cond[0],
|
||||||
b.data(), dbdp.data(), dbdr.data());
|
b.data(), dbdp.data(), dbdr.data());
|
||||||
|
|
||||||
return b;
|
return b;
|
||||||
@@ -471,12 +472,12 @@ namespace Opm
|
|||||||
/// Oil formation volume factor.
|
/// Oil formation volume factor.
|
||||||
/// \param[in] po Array of n oil pressure values.
|
/// \param[in] po Array of n oil pressure values.
|
||||||
/// \param[in] rs Array of n gas solution factor values.
|
/// \param[in] rs Array of n gas solution factor values.
|
||||||
/// \param[in] isSat Array of n booleans telling whether the fluid is saturated or not.
|
/// \param[in] cond Array of n taxonomies classifying fluid condition.
|
||||||
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
||||||
/// \return Array of n formation volume factor values.
|
/// \return Array of n formation volume factor values.
|
||||||
ADB BlackoilPropsAdFromDeck::bOil(const ADB& po,
|
ADB BlackoilPropsAdFromDeck::bOil(const ADB& po,
|
||||||
const ADB& rs,
|
const ADB& rs,
|
||||||
const bool* isSat,
|
const std::vector<PhasePresence>& cond,
|
||||||
const Cells& cells) const
|
const Cells& cells) const
|
||||||
{
|
{
|
||||||
if (!phase_usage_.phase_used[Oil]) {
|
if (!phase_usage_.phase_used[Oil]) {
|
||||||
@@ -489,8 +490,8 @@ namespace Opm
|
|||||||
V dbdp(n);
|
V dbdp(n);
|
||||||
V dbdr(n);
|
V dbdr(n);
|
||||||
|
|
||||||
props_[phase_usage_.phase_pos[Oil]]->b(n, po.value().data(), rs.value().data(),isSat,
|
props_[phase_usage_.phase_pos[Oil]]->b(n, po.value().data(), rs.value().data(),
|
||||||
b.data(), dbdp.data(), dbdr.data());
|
&cond[0], b.data(), dbdp.data(), dbdr.data());
|
||||||
|
|
||||||
ADB::M dbdp_diag = spdiag(dbdp);
|
ADB::M dbdp_diag = spdiag(dbdp);
|
||||||
ADB::M dbdr_diag = spdiag(dbdr);
|
ADB::M dbdr_diag = spdiag(dbdr);
|
||||||
|
|||||||
@@ -110,12 +110,12 @@ namespace Opm
|
|||||||
/// Oil viscosity.
|
/// Oil viscosity.
|
||||||
/// \param[in] po Array of n oil pressure values.
|
/// \param[in] po Array of n oil pressure values.
|
||||||
/// \param[in] rs Array of n gas solution factor values.
|
/// \param[in] rs Array of n gas solution factor values.
|
||||||
/// \param[in] isSat Array of n booleans telling whether the fluid is saturated or not.
|
/// \param[in] cond Array of n taxonomies classifying fluid condition.
|
||||||
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
||||||
/// \return Array of n viscosity values.
|
/// \return Array of n viscosity values.
|
||||||
V muOil(const V& po,
|
V muOil(const V& po,
|
||||||
const V& rs,
|
const V& rs,
|
||||||
const bool* isSat,
|
const std::vector<PhasePresence>& cond,
|
||||||
const Cells& cells) const;
|
const Cells& cells) const;
|
||||||
|
|
||||||
/// Gas viscosity.
|
/// Gas viscosity.
|
||||||
@@ -135,12 +135,12 @@ namespace Opm
|
|||||||
/// Oil viscosity.
|
/// Oil viscosity.
|
||||||
/// \param[in] po Array of n oil pressure values.
|
/// \param[in] po Array of n oil pressure values.
|
||||||
/// \param[in] rs Array of n gas solution factor values.
|
/// \param[in] rs Array of n gas solution factor values.
|
||||||
/// \param[in] isSat Array of n booleans telling whether the fluid is saturated or not.
|
/// \param[in] cond Array of n taxonomies classifying fluid condition.
|
||||||
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
||||||
/// \return Array of n viscosity values.
|
/// \return Array of n viscosity values.
|
||||||
ADB muOil(const ADB& po,
|
ADB muOil(const ADB& po,
|
||||||
const ADB& rs,
|
const ADB& rs,
|
||||||
const bool* isSat,
|
const std::vector<PhasePresence>& cond,
|
||||||
const Cells& cells) const;
|
const Cells& cells) const;
|
||||||
|
|
||||||
/// Gas viscosity.
|
/// Gas viscosity.
|
||||||
@@ -163,12 +163,12 @@ namespace Opm
|
|||||||
/// Oil formation volume factor.
|
/// Oil formation volume factor.
|
||||||
/// \param[in] po Array of n oil pressure values.
|
/// \param[in] po Array of n oil pressure values.
|
||||||
/// \param[in] rs Array of n gas solution factor values.
|
/// \param[in] rs Array of n gas solution factor values.
|
||||||
/// \param[in] isSat Array of n booleans telling whether the fluid is saturated or not.
|
/// \param[in] cond Array of n taxonomies classifying fluid condition.
|
||||||
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
||||||
/// \return Array of n formation volume factor values.
|
/// \return Array of n formation volume factor values.
|
||||||
V bOil(const V& po,
|
V bOil(const V& po,
|
||||||
const V& rs,
|
const V& rs,
|
||||||
const bool* isSat,
|
const std::vector<PhasePresence>& cond,
|
||||||
const Cells& cells) const;
|
const Cells& cells) const;
|
||||||
|
|
||||||
/// Gas formation volume factor.
|
/// Gas formation volume factor.
|
||||||
@@ -188,12 +188,12 @@ namespace Opm
|
|||||||
/// Oil formation volume factor.
|
/// Oil formation volume factor.
|
||||||
/// \param[in] po Array of n oil pressure values.
|
/// \param[in] po Array of n oil pressure values.
|
||||||
/// \param[in] rs Array of n gas solution factor values.
|
/// \param[in] rs Array of n gas solution factor values.
|
||||||
/// \param[in] isSat Array of n booleans telling whether the fluid is saturated or not.
|
/// \param[in] cond Array of n taxonomies classifying fluid condition.
|
||||||
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
||||||
/// \return Array of n formation volume factor values.
|
/// \return Array of n formation volume factor values.
|
||||||
ADB bOil(const ADB& po,
|
ADB bOil(const ADB& po,
|
||||||
const ADB& rs,
|
const ADB& rs,
|
||||||
const bool* isSat,
|
const std::vector<PhasePresence>& cond,
|
||||||
const Cells& cells) const;
|
const Cells& cells) const;
|
||||||
|
|
||||||
/// Gas formation volume factor.
|
/// Gas formation volume factor.
|
||||||
|
|||||||
@@ -100,13 +100,13 @@ namespace Opm
|
|||||||
/// Oil viscosity.
|
/// Oil viscosity.
|
||||||
/// \param[in] po Array of n oil pressure values.
|
/// \param[in] po Array of n oil pressure values.
|
||||||
/// \param[in] rs Array of n gas solution factor values.
|
/// \param[in] rs Array of n gas solution factor values.
|
||||||
/// \param[in] isSat Array of n booleans telling whether the fluid is saturated or not.
|
/// \param[in] cond Array of n taxonomies classifying fluid condition.
|
||||||
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
||||||
/// \return Array of n viscosity values.
|
/// \return Array of n viscosity values.
|
||||||
virtual
|
virtual
|
||||||
V muOil(const V& po,
|
V muOil(const V& po,
|
||||||
const V& rs,
|
const V& rs,
|
||||||
const bool* isSat,
|
const std::vector<PhasePresence>& cond,
|
||||||
const Cells& cells) const = 0;
|
const Cells& cells) const = 0;
|
||||||
|
|
||||||
/// Gas viscosity.
|
/// Gas viscosity.
|
||||||
@@ -128,13 +128,13 @@ namespace Opm
|
|||||||
/// Oil viscosity.
|
/// Oil viscosity.
|
||||||
/// \param[in] po Array of n oil pressure values.
|
/// \param[in] po Array of n oil pressure values.
|
||||||
/// \param[in] rs Array of n gas solution factor values.
|
/// \param[in] rs Array of n gas solution factor values.
|
||||||
/// \param[in] isSat Array of n booleans telling whether the fluid is saturated or not.
|
/// \param[in] cond Array of n taxonomies classifying fluid condition.
|
||||||
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
||||||
/// \return Array of n viscosity values.
|
/// \return Array of n viscosity values.
|
||||||
virtual
|
virtual
|
||||||
ADB muOil(const ADB& po,
|
ADB muOil(const ADB& po,
|
||||||
const ADB& rs,
|
const ADB& rs,
|
||||||
const bool* isSat,
|
const std::vector<PhasePresence>& cond,
|
||||||
const Cells& cells) const = 0;
|
const Cells& cells) const = 0;
|
||||||
|
|
||||||
/// Gas viscosity.
|
/// Gas viscosity.
|
||||||
@@ -159,13 +159,13 @@ namespace Opm
|
|||||||
/// Oil formation volume factor.
|
/// Oil formation volume factor.
|
||||||
/// \param[in] po Array of n oil pressure values.
|
/// \param[in] po Array of n oil pressure values.
|
||||||
/// \param[in] rs Array of n gas solution factor values.
|
/// \param[in] rs Array of n gas solution factor values.
|
||||||
/// \param[in] isSat Array of n booleans telling whether the fluid is saturated or not.
|
/// \param[in] cond Array of n taxonomies classifying fluid condition.
|
||||||
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
||||||
/// \return Array of n formation volume factor values.
|
/// \return Array of n formation volume factor values.
|
||||||
virtual
|
virtual
|
||||||
V bOil(const V& po,
|
V bOil(const V& po,
|
||||||
const V& rs,
|
const V& rs,
|
||||||
const bool* isSat,
|
const std::vector<PhasePresence>& cond,
|
||||||
const Cells& cells) const = 0;
|
const Cells& cells) const = 0;
|
||||||
|
|
||||||
/// Gas formation volume factor.
|
/// Gas formation volume factor.
|
||||||
@@ -187,13 +187,13 @@ namespace Opm
|
|||||||
/// Oil formation volume factor.
|
/// Oil formation volume factor.
|
||||||
/// \param[in] po Array of n oil pressure values.
|
/// \param[in] po Array of n oil pressure values.
|
||||||
/// \param[in] rs Array of n gas solution factor values.
|
/// \param[in] rs Array of n gas solution factor values.
|
||||||
/// \param[in] isSat Array of n booleans telling whether the fluid is saturated or not.
|
/// \param[in] cond Array of n taxonomies classifying fluid condition.
|
||||||
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
||||||
/// \return Array of n formation volume factor values.
|
/// \return Array of n formation volume factor values.
|
||||||
virtual
|
virtual
|
||||||
ADB bOil(const ADB& po,
|
ADB bOil(const ADB& po,
|
||||||
const ADB& rs,
|
const ADB& rs,
|
||||||
const bool* isSat,
|
const std::vector<PhasePresence>& cond,
|
||||||
const Cells& cells) const = 0;
|
const Cells& cells) const = 0;
|
||||||
|
|
||||||
/// Gas formation volume factor.
|
/// Gas formation volume factor.
|
||||||
|
|||||||
@@ -528,8 +528,8 @@ namespace {
|
|||||||
const std::vector<ADB>& sat = state.saturation;
|
const std::vector<ADB>& sat = state.saturation;
|
||||||
const ADB& rs = state.rs;
|
const ADB& rs = state.rs;
|
||||||
|
|
||||||
bool isSat[rs.size()];
|
std::vector<PhasePresence> cond;
|
||||||
getSaturatedCells(state,&isSat[0]);
|
classifyCondition(state, cond);
|
||||||
|
|
||||||
const ADB pv_mult = poroMult(press);
|
const ADB pv_mult = poroMult(press);
|
||||||
|
|
||||||
@@ -537,7 +537,7 @@ namespace {
|
|||||||
for (int phase = 0; phase < maxnp; ++phase) {
|
for (int phase = 0; phase < maxnp; ++phase) {
|
||||||
if (active_[ phase ]) {
|
if (active_[ phase ]) {
|
||||||
const int pos = pu.phase_pos[ phase ];
|
const int pos = pu.phase_pos[ phase ];
|
||||||
rq_[pos].b = fluidReciprocFVF(phase, press, rs, &isSat[0], cells_);
|
rq_[pos].b = fluidReciprocFVF(phase, press, rs, cond, cells_);
|
||||||
rq_[pos].accum[aix] = pv_mult * rq_[pos].b * sat[pos];
|
rq_[pos].accum[aix] = pv_mult * rq_[pos].b * sat[pos];
|
||||||
// DUMP(rq_[pos].b);
|
// DUMP(rq_[pos].b);
|
||||||
// DUMP(rq_[pos].accum[aix]);
|
// DUMP(rq_[pos].accum[aix]);
|
||||||
@@ -595,8 +595,6 @@ namespace {
|
|||||||
// DUMP(residual_.mass_balance[phase]);
|
// DUMP(residual_.mass_balance[phase]);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isSat[grid_.number_of_cells];
|
|
||||||
getSaturatedCells(state,isSat);
|
|
||||||
// -------- Extra (optional) sg or rs equation, and rs contributions to the mass balance equations --------
|
// -------- Extra (optional) sg or rs equation, and rs contributions to the mass balance equations --------
|
||||||
|
|
||||||
// Add the extra (flux) terms to the gas mass balance equations
|
// Add the extra (flux) terms to the gas mass balance equations
|
||||||
@@ -654,11 +652,15 @@ namespace {
|
|||||||
assert(g[dd] == 0.0);
|
assert(g[dd] == 0.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<PhasePresence> cond;
|
||||||
|
classifyCondition(state, cond);
|
||||||
|
|
||||||
ADB cell_rho_total = ADB::constant(V::Zero(nc), state.pressure.blockPattern());
|
ADB cell_rho_total = ADB::constant(V::Zero(nc), state.pressure.blockPattern());
|
||||||
for (int phase = 0; phase < 3; ++phase) {
|
for (int phase = 0; phase < 3; ++phase) {
|
||||||
if (active_[phase]) {
|
if (active_[phase]) {
|
||||||
const int pos = pu.phase_pos[phase];
|
const int pos = pu.phase_pos[phase];
|
||||||
const ADB cell_rho = fluidDensity(phase, state.pressure, state.rs, &isSat[0],cells_);
|
const ADB cell_rho = fluidDensity(phase, state.pressure, state.rs, cond, cells_);
|
||||||
cell_rho_total += state.saturation[pos] * cell_rho;
|
cell_rho_total += state.saturation[pos] * cell_rho;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -668,7 +670,7 @@ namespace {
|
|||||||
for (int phase = 0; phase < 3; ++phase) {
|
for (int phase = 0; phase < 3; ++phase) {
|
||||||
if (active_[phase]) {
|
if (active_[phase]) {
|
||||||
const int pos = pu.phase_pos[phase];
|
const int pos = pu.phase_pos[phase];
|
||||||
const ADB cell_rho = fluidDensity(phase, state.pressure, state.rs, &isSat[0],cells_);
|
const ADB cell_rho = fluidDensity(phase, state.pressure, state.rs, cond, cells_);
|
||||||
const V fraction = compi.col(pos);
|
const V fraction = compi.col(pos);
|
||||||
inj_rho_total += (wops_.w2p * fraction.matrix()).array() * subset(cell_rho, well_cells);
|
inj_rho_total += (wops_.w2p * fraction.matrix()).array() * subset(cell_rho, well_cells);
|
||||||
}
|
}
|
||||||
@@ -1007,14 +1009,16 @@ namespace {
|
|||||||
const SolutionState& state )
|
const SolutionState& state )
|
||||||
{
|
{
|
||||||
const int phase = canph_[ actph ];
|
const int phase = canph_[ actph ];
|
||||||
bool isSat[grid_.number_of_cells];
|
|
||||||
getSaturatedCells(state,&isSat[0]);
|
std::vector<PhasePresence> cond;
|
||||||
const ADB mu = fluidViscosity(phase, state.pressure, state.rs, &isSat[0],cells_);
|
classifyCondition(state, cond);
|
||||||
|
|
||||||
|
const ADB mu = fluidViscosity(phase, state.pressure, state.rs, cond, cells_);
|
||||||
const ADB tr_mult = transMult(state.pressure);
|
const ADB tr_mult = transMult(state.pressure);
|
||||||
|
|
||||||
rq_[ actph ].mob = tr_mult * kr[ phase ] / mu;
|
rq_[ actph ].mob = tr_mult * kr[ phase ] / mu;
|
||||||
|
|
||||||
const ADB rho = fluidDensity(phase, state.pressure, state.rs, &isSat[0],cells_);
|
const ADB rho = fluidDensity(phase, state.pressure, state.rs, cond, cells_);
|
||||||
|
|
||||||
ADB& head = rq_[ actph ].head;
|
ADB& head = rq_[ actph ].head;
|
||||||
|
|
||||||
@@ -1067,14 +1071,14 @@ namespace {
|
|||||||
FullyImplicitBlackoilSolver::fluidViscosity(const int phase,
|
FullyImplicitBlackoilSolver::fluidViscosity(const int phase,
|
||||||
const ADB& p ,
|
const ADB& p ,
|
||||||
const ADB& rs ,
|
const ADB& rs ,
|
||||||
const bool* isSat,
|
const std::vector<PhasePresence>& cond,
|
||||||
const std::vector<int>& cells) const
|
const std::vector<int>& cells) const
|
||||||
{
|
{
|
||||||
switch (phase) {
|
switch (phase) {
|
||||||
case Water:
|
case Water:
|
||||||
return fluid_.muWat(p, cells);
|
return fluid_.muWat(p, cells);
|
||||||
case Oil: {
|
case Oil: {
|
||||||
return fluid_.muOil(p, rs, isSat,cells);
|
return fluid_.muOil(p, rs, cond, cells);
|
||||||
}
|
}
|
||||||
case Gas:
|
case Gas:
|
||||||
return fluid_.muGas(p, cells);
|
return fluid_.muGas(p, cells);
|
||||||
@@ -1091,14 +1095,14 @@ namespace {
|
|||||||
FullyImplicitBlackoilSolver::fluidReciprocFVF(const int phase,
|
FullyImplicitBlackoilSolver::fluidReciprocFVF(const int phase,
|
||||||
const ADB& p ,
|
const ADB& p ,
|
||||||
const ADB& rs ,
|
const ADB& rs ,
|
||||||
const bool* isSat,
|
const std::vector<PhasePresence>& cond,
|
||||||
const std::vector<int>& cells) const
|
const std::vector<int>& cells) const
|
||||||
{
|
{
|
||||||
switch (phase) {
|
switch (phase) {
|
||||||
case Water:
|
case Water:
|
||||||
return fluid_.bWat(p, cells);
|
return fluid_.bWat(p, cells);
|
||||||
case Oil: {
|
case Oil: {
|
||||||
return fluid_.bOil(p, rs, isSat, cells);
|
return fluid_.bOil(p, rs, cond, cells);
|
||||||
}
|
}
|
||||||
case Gas:
|
case Gas:
|
||||||
return fluid_.bGas(p, cells);
|
return fluid_.bGas(p, cells);
|
||||||
@@ -1115,11 +1119,11 @@ namespace {
|
|||||||
FullyImplicitBlackoilSolver::fluidDensity(const int phase,
|
FullyImplicitBlackoilSolver::fluidDensity(const int phase,
|
||||||
const ADB& p ,
|
const ADB& p ,
|
||||||
const ADB& rs ,
|
const ADB& rs ,
|
||||||
const bool* isSat,
|
const std::vector<PhasePresence>& cond,
|
||||||
const std::vector<int>& cells) const
|
const std::vector<int>& cells) const
|
||||||
{
|
{
|
||||||
const double* rhos = fluid_.surfaceDensity();
|
const double* rhos = fluid_.surfaceDensity();
|
||||||
ADB b = fluidReciprocFVF(phase, p, rs, isSat, cells);
|
ADB b = fluidReciprocFVF(phase, p, rs, cond, cells);
|
||||||
ADB rho = V::Constant(p.size(), 1, rhos[phase]) * b;
|
ADB rho = V::Constant(p.size(), 1, rhos[phase]) * b;
|
||||||
if (phase == Oil && active_[Gas]) {
|
if (phase == Oil && active_[Gas]) {
|
||||||
// It is correct to index into rhos with canonical phase indices.
|
// It is correct to index into rhos with canonical phase indices.
|
||||||
@@ -1206,16 +1210,41 @@ namespace {
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
FullyImplicitBlackoilSolver::getSaturatedCells(const SolutionState& state, bool* isSat) const
|
FullyImplicitBlackoilSolver::
|
||||||
|
classifyCondition(const SolutionState& state,
|
||||||
|
std::vector<PhasePresence>& cond ) const
|
||||||
{
|
{
|
||||||
const int pg = fluid_.phaseUsage().phase_pos[ Gas ];
|
const PhaseUsage& pu = fluid_.phaseUsage();
|
||||||
const V sg = state.saturation[pg].value();
|
|
||||||
for (int c=0; c < sg.size(); ++ c) {
|
if (active_[ Gas ]) {
|
||||||
if (sg[c]>0){
|
// Oil/Gas or Water/Oil/Gas system
|
||||||
isSat[c] = true;
|
const int po = pu.phase_pos[ Oil ];
|
||||||
|
const int pg = pu.phase_pos[ Gas ];
|
||||||
|
|
||||||
|
const V& so = state.saturation[ po ].value();
|
||||||
|
const V& sg = state.saturation[ pg ].value();
|
||||||
|
|
||||||
|
cond.resize(sg.size());
|
||||||
|
|
||||||
|
for (V::Index c = 0, e = sg.size(); c != e; ++c) {
|
||||||
|
if (so[c] > 0) { cond[c].setFreeOil (); }
|
||||||
|
if (sg[c] > 0) { cond[c].setFreeGas (); }
|
||||||
|
if (active_[ Water ]) { cond[c].setFreeWater(); }
|
||||||
}
|
}
|
||||||
else{
|
}
|
||||||
isSat[c] = false;
|
else {
|
||||||
|
// Water/Oil system
|
||||||
|
assert (active_[ Water ]);
|
||||||
|
|
||||||
|
const int po = pu.phase_pos[ Oil ];
|
||||||
|
const V& so = state.saturation[ po ].value();
|
||||||
|
|
||||||
|
cond.resize(so.size());
|
||||||
|
|
||||||
|
for (V::Index c = 0, e = so.size(); c != e; ++c) {
|
||||||
|
cond[c].setFreeWater();
|
||||||
|
|
||||||
|
if (so[c] > 0) { cond[c].setFreeOil(); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -189,21 +189,21 @@ namespace Opm {
|
|||||||
fluidViscosity(const int phase,
|
fluidViscosity(const int phase,
|
||||||
const ADB& p ,
|
const ADB& p ,
|
||||||
const ADB& rs ,
|
const ADB& rs ,
|
||||||
const bool* isSat,
|
const std::vector<PhasePresence>& cond,
|
||||||
const std::vector<int>& cells) const;
|
const std::vector<int>& cells) const;
|
||||||
|
|
||||||
ADB
|
ADB
|
||||||
fluidReciprocFVF(const int phase,
|
fluidReciprocFVF(const int phase,
|
||||||
const ADB& p ,
|
const ADB& p ,
|
||||||
const ADB& rs ,
|
const ADB& rs ,
|
||||||
const bool* isSat,
|
const std::vector<PhasePresence>& cond,
|
||||||
const std::vector<int>& cells) const;
|
const std::vector<int>& cells) const;
|
||||||
|
|
||||||
ADB
|
ADB
|
||||||
fluidDensity(const int phase,
|
fluidDensity(const int phase,
|
||||||
const ADB& p ,
|
const ADB& p ,
|
||||||
const ADB& rs ,
|
const ADB& rs ,
|
||||||
const bool* isSat,
|
const std::vector<PhasePresence>& cond,
|
||||||
const std::vector<int>& cells) const;
|
const std::vector<int>& cells) const;
|
||||||
|
|
||||||
V
|
V
|
||||||
@@ -221,7 +221,8 @@ namespace Opm {
|
|||||||
transMult(const ADB& p) const;
|
transMult(const ADB& p) const;
|
||||||
|
|
||||||
void
|
void
|
||||||
getSaturatedCells(const SolutionState& state, bool* isSat) const;
|
classifyCondition(const SolutionState& state,
|
||||||
|
std::vector<PhasePresence>& cond ) const;
|
||||||
};
|
};
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
|
||||||
|
|||||||
@@ -533,8 +533,9 @@ namespace {
|
|||||||
return fluid_.muWat(p, cells);
|
return fluid_.muWat(p, cells);
|
||||||
case Oil: {
|
case Oil: {
|
||||||
V dummy_rs = V::Zero(p.size(), 1) * p;
|
V dummy_rs = V::Zero(p.size(), 1) * p;
|
||||||
bool dummy_isSat[p.size()];
|
std::vector<PhasePresence> cond(dummy_rs.size());
|
||||||
return fluid_.muOil(p, dummy_rs, dummy_isSat, cells);
|
|
||||||
|
return fluid_.muOil(p, dummy_rs, cond, cells);
|
||||||
}
|
}
|
||||||
case Gas:
|
case Gas:
|
||||||
return fluid_.muGas(p, cells);
|
return fluid_.muGas(p, cells);
|
||||||
@@ -554,8 +555,9 @@ namespace {
|
|||||||
return fluid_.muWat(p, cells);
|
return fluid_.muWat(p, cells);
|
||||||
case Oil: {
|
case Oil: {
|
||||||
ADB dummy_rs = V::Zero(p.size(), 1) * p;
|
ADB dummy_rs = V::Zero(p.size(), 1) * p;
|
||||||
bool dummy_isSat[p.size()];
|
std::vector<PhasePresence> cond(dummy_rs.size());
|
||||||
return fluid_.muOil(p, dummy_rs, dummy_isSat, cells);
|
|
||||||
|
return fluid_.muOil(p, dummy_rs, cond, cells);
|
||||||
}
|
}
|
||||||
case Gas:
|
case Gas:
|
||||||
return fluid_.muGas(p, cells);
|
return fluid_.muGas(p, cells);
|
||||||
@@ -575,8 +577,9 @@ namespace {
|
|||||||
return fluid_.bWat(p, cells);
|
return fluid_.bWat(p, cells);
|
||||||
case Oil: {
|
case Oil: {
|
||||||
V dummy_rs = V::Zero(p.size(), 1) * p;
|
V dummy_rs = V::Zero(p.size(), 1) * p;
|
||||||
bool dummy_isSat[p.size()];
|
std::vector<PhasePresence> cond(dummy_rs.size());
|
||||||
return fluid_.bOil(p, dummy_rs, dummy_isSat,cells);
|
|
||||||
|
return fluid_.bOil(p, dummy_rs, cond, cells);
|
||||||
}
|
}
|
||||||
case Gas:
|
case Gas:
|
||||||
return fluid_.bGas(p, cells);
|
return fluid_.bGas(p, cells);
|
||||||
@@ -596,8 +599,9 @@ namespace {
|
|||||||
return fluid_.bWat(p, cells);
|
return fluid_.bWat(p, cells);
|
||||||
case Oil: {
|
case Oil: {
|
||||||
ADB dummy_rs = V::Zero(p.size(), 1) * p;
|
ADB dummy_rs = V::Zero(p.size(), 1) * p;
|
||||||
bool dummy_isSat[p.size()];
|
std::vector<PhasePresence> cond(dummy_rs.size());
|
||||||
return fluid_.bOil(p, dummy_rs, dummy_isSat,cells);
|
|
||||||
|
return fluid_.bOil(p, dummy_rs, cond, cells);
|
||||||
}
|
}
|
||||||
case Gas:
|
case Gas:
|
||||||
return fluid_.bGas(p, cells);
|
return fluid_.bGas(p, cells);
|
||||||
|
|||||||
Reference in New Issue
Block a user