Skip to content

Commit

Permalink
refactoring duplicate + enable STONEII use in Hysteresis
Browse files Browse the repository at this point in the history
  • Loading branch information
jacquesn7 committed Dec 19, 2024
1 parent 26a514e commit 61fa74f
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,14 @@ class BrooksCoreyBakerRelativePermeability : public RelativePermeabilityBase
real64 getWettingPhaseMinVolumeFraction() const override
{
integer ipWetting;
std::tie( ipWetting, std::ignore ) = phaseIndex( getPhaseOrder());
std::tie( ipWetting, std::ignore ) = wettingAndNonWettingPhaseIndices();
return m_phaseMinVolumeFraction[ipWetting];
}

real64 getNonWettingMinVolumeFraction() const override
{
integer ipNonWetting;
std::tie( std::ignore, ipNonWetting ) = phaseIndex( getPhaseOrder());
std::tie( std::ignore, ipNonWetting ) = wettingAndNonWettingPhaseIndices();
return m_phaseMinVolumeFraction[ipNonWetting];
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,21 +103,21 @@ class BrooksCoreyRelativePermeability : public RelativePermeabilityBase
static constexpr char const * phaseRelPermExponentString() { return "phaseRelPermExponent"; }
static constexpr char const * phaseRelPermMaxValueString() { return "phaseRelPermMaxValue"; }
static constexpr char const * volFracScaleString() { return "volFracScale"; }
} vieKeysBrooksCoreyRelativePermeability;
};
//END_SPHINX_INCLUDE_01
arrayView1d< real64 const > getPhaseMinVolumeFraction() const override { return m_phaseMinVolumeFraction; };

real64 getWettingPhaseMinVolumeFraction() const override
{
integer ipWetting;
std::tie( ipWetting, std::ignore ) = phaseIndex( getPhaseOrder());
std::tie( ipWetting, std::ignore ) = wettingAndNonWettingPhaseIndices();
return m_phaseMinVolumeFraction[ipWetting];
}

real64 getNonWettingMinVolumeFraction() const override
{
integer ipNonWetting;
std::tie( std::ignore, ipNonWetting ) = phaseIndex( getPhaseOrder());
std::tie( std::ignore, ipNonWetting ) = wettingAndNonWettingPhaseIndices();
return m_phaseMinVolumeFraction[ipNonWetting];
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,14 @@ class BrooksCoreyStone2RelativePermeability : public RelativePermeabilityBase
real64 getWettingPhaseMinVolumeFraction() const override
{
integer ipWetting;
std::tie( ipWetting, std::ignore ) = phaseIndex( getPhaseOrder());
std::tie( ipWetting, std::ignore ) = wettingAndNonWettingPhaseIndices();
return m_phaseMinVolumeFraction[ipWetting];
}

real64 getNonWettingMinVolumeFraction() const override
{
integer ipNonWetting;
std::tie( std::ignore, ipNonWetting ) = phaseIndex( getPhaseOrder());
std::tie( std::ignore, ipNonWetting ) = wettingAndNonWettingPhaseIndices();
return m_phaseMinVolumeFraction[ipNonWetting];
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,45 +224,6 @@ class RelativePermeabilityBase : public ConstitutiveBase

};


/// for use in RelpermDriver to browse the drainage curves
/// by setting the MaxHistoricalNonWettingSat to Snwmin and MinWettingSat to Sw
inline std::tuple< integer, integer > RelativePermeabilityBase::phaseIndex( arrayView1d< integer const > const & phaseOrder )
{
using PT = PhaseType;
integer const ipWater = phaseOrder[PT::WATER];
integer const ipOil = phaseOrder[PT::OIL];
integer const ipGas = phaseOrder[PT::GAS];

integer ipWetting = -1, ipNonWetting = -1;

if( ipWater >= 0 && ipOil >= 0 && ipGas >= 0 )
{
ipWetting = ipWater;
ipNonWetting = ipGas;
}
else if( ipWater < 0 )
{
ipWetting = ipOil;
ipNonWetting = ipGas;
}
else if( ipOil < 0 )
{
ipWetting = ipWater;
ipNonWetting = ipGas;
}
else if( ipGas < 0 )
{
ipWetting = ipWater;
ipNonWetting = ipOil;
}

//maybe a bit too pythonic
return std::make_tuple( ipWetting, ipNonWetting );
}



} // namespace constitutive

} // namespace geos
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,14 @@ class TableRelativePermeability : public RelativePermeabilityBase
real64 getWettingPhaseMinVolumeFraction() const override
{
integer ipWetting;
std::tie( ipWetting, std::ignore ) = phaseIndex( getPhaseOrder());
std::tie( ipWetting, std::ignore ) = wettingAndNonWettingPhaseIndices();
return m_phaseMinVolumeFraction[ipWetting];
}

real64 getNonWettingMinVolumeFraction() const override
{
integer ipNonWetting;
std::tie( std::ignore, ipNonWetting ) = phaseIndex( getPhaseOrder());
std::tie( std::ignore, ipNonWetting ) = wettingAndNonWettingPhaseIndices();
return m_phaseMinVolumeFraction[ipNonWetting];
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,15 @@ TableRelativePermeabilityHysteresis::TableRelativePermeabilityHysteresis( std::s
setSizedFromParent( 0 ).
setRestartFlags( RestartFlags::NO_WRITE );

// registerWrapper( viewKeyStruct::waterOilMaxRelPermString(), &m_waterOilMaxRelPerm ).
// setInputFlag( InputFlags::FALSE ). // will be deduced from tables
// setSizedFromParent( 0 );
//
// registerWrapper( viewKeyStruct::threePhaseInterpolatorString(), &m_threePhaseInterpolator ).
// setInputFlag( InputFlags::OPTIONAL ).
// setApplyDefaultValue( ThreePhaseInterpolator::BAKER ).
// setDescription( "Type of Three phase interpolator."
// "Valid options \n* " + EnumStrings< ThreePhaseInterpolator >::concat( "\n* " ) );
registerWrapper( viewKeyStruct::waterOilMaxRelPermString(), &m_waterOilMaxRelPerm ).
setInputFlag( InputFlags::FALSE ). // will be deduced from tables
setSizedFromParent( 0 );

registerWrapper( viewKeyStruct::threePhaseInterpolatorString(), &m_threePhaseInterpolator ).
setInputFlag( InputFlags::OPTIONAL ).
setApplyDefaultValue( ThreePhaseInterpolator::BAKER ).
setDescription( "Type of Three phase interpolator."
"Valid options \n* " + EnumStrings< ThreePhaseInterpolator >::concat( "\n* " ) );

registerWrapper( viewKeyStruct::phaseHasHysteresisString(),
&m_phaseHasHysteresis ).
Expand Down Expand Up @@ -263,7 +263,7 @@ void TableRelativePermeabilityHysteresis::checkExistenceAndValidateWettingRelPer
using IPT = TableRelativePermeabilityHysteresis::ImbibitionPhasePairPhaseType;
integer const numPhases = m_phaseNames.size();
integer ipWetting = -1, ipNonWetting = -1;
std::tie( ipWetting, ipNonWetting ) = RelativePermeabilityBase::phaseIndex( m_phaseOrder );
std::tie( ipWetting, ipNonWetting ) = RelativePermeabilityBase::wettingAndNonWettingPhaseIndices();

// Step 1.a: take care of the two-phase case
real64 drainagePhaseMinVolFraction = -1; // output
Expand Down Expand Up @@ -339,7 +339,7 @@ void TableRelativePermeabilityHysteresis::checkExistenceAndValidateNonWettingRel

integer const numPhases = m_phaseNames.size();
integer ipWetting = -1, ipNonWetting = -1;
std::tie( ipWetting, ipNonWetting ) = RelativePermeabilityBase::phaseIndex( m_phaseOrder );
std::tie( ipWetting, ipNonWetting ) = RelativePermeabilityBase::wettingAndNonWettingPhaseIndices();

// treat drainage
real64 drainagePhaseMinVolFraction = -1; // output
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,14 @@ class VanGenuchtenBakerRelativePermeability : public RelativePermeabilityBase
real64 getWettingPhaseMinVolumeFraction() const override
{
integer ipWetting;
std::tie( ipWetting, std::ignore ) = phaseIndex( getPhaseOrder());
std::tie( ipWetting, std::ignore ) = wettingAndNonWettingPhaseIndices();
return m_phaseMinVolumeFraction[ipWetting];
}

real64 getNonWettingMinVolumeFraction() const override
{
integer ipNonWetting;
std::tie( std::ignore, ipNonWetting ) = phaseIndex( getPhaseOrder());
std::tie( std::ignore, ipNonWetting ) = wettingAndNonWettingPhaseIndices();
return m_phaseMinVolumeFraction[ipNonWetting];
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,14 @@ class VanGenuchtenStone2RelativePermeability : public RelativePermeabilityBase
real64 getWettingPhaseMinVolumeFraction() const override
{
integer ipWetting;
std::tie( ipWetting, std::ignore ) = phaseIndex( getPhaseOrder());
std::tie( ipWetting, std::ignore ) = wettingAndNonWettingPhaseIndices();
return m_phaseMinVolumeFraction[ipWetting];
}

real64 getNonWettingMinVolumeFraction() const override
{
integer ipNonWetting;
std::tie( std::ignore, ipNonWetting ) = phaseIndex( getPhaseOrder());
std::tie( std::ignore, ipNonWetting ) = wettingAndNonWettingPhaseIndices();
return m_phaseMinVolumeFraction[ipNonWetting];
}

Expand Down Expand Up @@ -280,16 +280,7 @@ VanGenuchtenStone2RelativePermeabilityUpdate::
{
real64 const shiftedWaterVolFrac = (phaseVolFraction[ipWater] - m_phaseMinVolumeFraction[ipWater]);

// TODO: change name of the class and add template to choose interpolation
// relpermInterpolators::Stone2::compute( shiftedWaterVolFrac,
// phaseVolFraction[ipGas],
// m_phaseOrder,
// oilRelPerm_wo,
// dOilRelPerm_wo_dOilVolFrac,
// oilRelPerm_go,
// dOilRelPerm_go_dOilVolFrac,
// phaseRelPerm[ipOil],
// dPhaseRelPerm_dPhaseVolFrac[ipOil] );


relpermInterpolators::Stone2::compute( shiftedWaterVolFrac,
phaseVolFraction[ipGas],
Expand Down

0 comments on commit 61fa74f

Please sign in to comment.