Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Activate fluid models #3123

Merged
merged 13 commits into from
Jun 4, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,19 @@ void constitutiveUpdatePassThru( MultiFluidBase const & fluid,
{
ConstitutivePassThruHandler< DeadOilFluid,
BlackOilFluid,
CompositionalTwoPhasePengRobinsonConstantViscosity,
CompositionalTwoPhaseSoaveRedlichKwongConstantViscosity,
// CompositionalTwoPhasePengRobinsonLBCViscosity,
// CompositionalTwoPhaseSoaveRedlichKwongLBCViscosity,
#ifdef GEOSX_USE_PVTPackage
CompositionalMultiphaseFluidPVTPackage,
#endif
CO2BrinePhillipsFluid,
CO2BrineEzrokhiFluid,
CO2BrinePhillipsThermalFluid
// ,CO2BrineEzrokhiThermalFluid "Uncommenting this will lead to compiler segfault. Need to split compilation
// units for all the options"
CO2BrinePhillipsThermalFluid,
#if !defined(GEOS_DEVICE_COMPILE)
CO2BrineEzrokhiThermalFluid,
CompositionalTwoPhasePengRobinsonLBCViscosity,
CompositionalTwoPhaseSoaveRedlichKwongLBCViscosity,
#endif
CompositionalTwoPhasePengRobinsonConstantViscosity,
CompositionalTwoPhaseSoaveRedlichKwongConstantViscosity
>::execute( fluid, std::forward< LAMBDA >( lambda ) );
}

Expand All @@ -62,18 +63,19 @@ void constitutiveUpdatePassThru( MultiFluidBase & fluid,
{
ConstitutivePassThruHandler< DeadOilFluid,
BlackOilFluid,
CompositionalTwoPhasePengRobinsonConstantViscosity,
CompositionalTwoPhaseSoaveRedlichKwongConstantViscosity,
// CompositionalTwoPhasePengRobinsonLBCViscosity,
// CompositionalTwoPhaseSoaveRedlichKwongLBCViscosity,
#ifdef GEOSX_USE_PVTPackage
CompositionalMultiphaseFluidPVTPackage,
#endif
CO2BrinePhillipsFluid,
CO2BrineEzrokhiFluid,
CO2BrinePhillipsThermalFluid
//,CO2BrineEzrokhiThermalFluid "Uncommenting this will lead to compiler segfault. Need to split compilation
// units for all the options"
CO2BrinePhillipsThermalFluid,
#if !defined(GEOS_DEVICE_COMPILE)
CO2BrineEzrokhiThermalFluid,
CompositionalTwoPhasePengRobinsonLBCViscosity,
CompositionalTwoPhaseSoaveRedlichKwongLBCViscosity,
#endif
CompositionalTwoPhasePengRobinsonConstantViscosity,
CompositionalTwoPhaseSoaveRedlichKwongConstantViscosity
>::execute( fluid, std::forward< LAMBDA >( lambda ) );
}

Expand Down
10 changes: 7 additions & 3 deletions src/coreComponents/constitutive/fluid/multifluid/PVTDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,10 @@
{
headerRows++;
}
if( m_outputMassDensity )
{
headerRows++;

Check warning on line 314 in src/coreComponents/constitutive/fluid/multifluid/PVTDriver.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/constitutive/fluid/multifluid/PVTDriver.cpp#L314

Added line #L314 was not covered by tests
}
if( m_outputPhaseComposition )
{
headerRows += getFluid().numFluidPhases();
Expand All @@ -335,9 +339,9 @@

real64 const error = fabs( m_table[row][col]-value ) / ( fabs( value )+1 );
GEOS_THROW_IF( error > MultiFluidConstants::baselineTolerance,
"Results do not match baseline at data row " << row+1
<< " (row " << row+headerRows << " with header)"
<< " and column " << col+1, std::runtime_error );
GEOS_FMT( "Results do not match baseline ({} vs {}) at data row {} (row {} with header) and column {}",
m_table[row][col], value, row+1, row+headerRows, col+1 ),
std::runtime_error );
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,27 +93,14 @@ struct NegativeTwoPhaseFlash
}

bool kValueReset = true;
constexpr real64 boundsTolerance = 1.0e-3;
constexpr real64 boundsTolerance = MultiFluidConstants::SSITolerance;
if( needInitialisation )
{
KValueInitialization::computeWilsonGasLiquidKvalue( numComps,
pressure,
temperature,
componentProperties,
kVapourLiquid );/**
vapourPhaseMoleFraction = RachfordRice::solve(
kVapourLiquid.toSliceConst(), composition, presentComponents
);
if( vapourPhaseMoleFraction < -boundsTolerance ||
vapourPhaseMoleFraction > 1.0 + boundsTolerance )
{
kValueReset = true;
KValueInitialization::computeConstantLiquidKvalue( numComps,
pressure,
temperature,
componentProperties,
kVapourLiquid );
}*/
kVapourLiquid );
}

vapourPhaseMoleFraction = RachfordRice::solve( kVapourLiquid.toSliceConst(), composition, presentComponents );
Expand Down Expand Up @@ -164,20 +151,7 @@ struct NegativeTwoPhaseFlash
kVapourLiquid[ic] *= exp( fugacityRatios[ic] );
}
}
//std::cout
//<< std::setw(3) << iterationCount << " "
//<< std::setw(12) << pressure << " "
//<< std::setw(10) << temperature << " "
//<< std::setw(15) << error << " "
//<< std::setw(15) << vapourPhaseMoleFraction << " ";
//for( integer const ic : {0,1,8} )
//{
// std::cout << std::setw(15) << kVapourLiquid[ic] << " ";
//}
//std::cout
//<< "\n";
}
//std::cout << "================================================================================\n";

// Retrieve physical bounds from negative flash values
if( vapourPhaseMoleFraction < MultiFluidConstants::epsilon )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@
phaseFraction.value[m_vapourIndex],
phaseCompFraction.value[m_liquidIndex],
phaseCompFraction.value[m_vapourIndex] );
GEOS_UNUSED_VAR( flashStatus );
//GEOS_ERROR_IF( !flashStatus,
dkachuma marked this conversation as resolved.
Show resolved Hide resolved
// GEOS_FMT( "Negative two phase flash failed to converge {:.5e} {:.3f}", pressure, temperature ));
GEOS_ERROR_IF( !flashStatus,

Check warning on line 77 in src/coreComponents/constitutive/fluid/multifluid/compositional/models/NegativeTwoPhaseFlashModel.hpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/constitutive/fluid/multifluid/compositional/models/NegativeTwoPhaseFlashModel.hpp#L77

Added line #L77 was not covered by tests
GEOS_FMT( "Negative two phase flash failed to converge at pressure {:.5e} and temperature {:.3f}",
pressure, temperature ));

// Calculate derivatives
NegativeTwoPhaseFlash::computeDerivatives< EOS_TYPE_LIQUID, EOS_TYPE_VAPOUR >(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
outputMassDensity="1"
outputCompressibility="1"
outputPhaseComposition="1"
output="testPVT_Compositional_liveOilPR.txt"
baseline="testPVT_Compositional_liveOilPR.txt"
logLevel="1"/>
<PVTDriver
name="testLiveOilPRLBC"
Expand All @@ -24,7 +24,7 @@
outputMassDensity="1"
outputCompressibility="1"
outputPhaseComposition="1"
output="testPVT_Compositional_liveOilPRLBC.txt"
baseline="testPVT_Compositional_liveOilPRLBC.txt"
logLevel="1"/>
<PVTDriver
name="testLiveOilSRK"
Expand All @@ -36,7 +36,7 @@
outputMassDensity="1"
outputCompressibility="1"
outputPhaseComposition="1"
output="testPVT_Compositional_liveOilSRK.txt"
baseline="testPVT_Compositional_liveOilSRK.txt"
logLevel="1"/>
<PVTDriver
name="testLiveOilSRKLBC"
Expand All @@ -48,7 +48,7 @@
outputMassDensity="1"
outputCompressibility="1"
outputPhaseComposition="1"
output="testPVT_Compositional_liveOilSRKLBC.txt"
baseline="testPVT_Compositional_liveOilSRKLBC.txt"
logLevel="1"/>
</Tasks>

Expand Down