Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
targetBHP="5e7"
targetTotalRateTableName="injectorTotalRateTable"
useSurfaceConditions="1"
surfaceTemperature="300"
surfacePressure="101325"/>
</SinglePhaseWell>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
targetBHP="5e7"
targetTotalRateTableName="injectorTotalRateTable"
useSurfaceConditions="1"
surfaceTemperature="300"
surfacePressure="101325"/>
</SinglePhaseWell>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
control="totalVolRate"
useSurfaceConditions="1"
surfacePressure="101325"
surfaceTemperature="300"
referenceElevation="12"
targetBHP="1e7"
targetTotalRate="1e-6"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ void SinglePhaseWell::updateVolRateForConstraint( ElementRegionManager const & e
arrayView1d< real64 const > const pres =
subRegion.getField< well::pressure >();

arrayView1d< real64 const > const & temp = subRegion.getField< well::temperature >();

arrayView1d< real64 const > const & connRate =
subRegion.getField< well::connectionRate >();

Expand All @@ -282,11 +284,12 @@ void SinglePhaseWell::updateVolRateForConstraint( ElementRegionManager const & e
string const wellControlsName = wellControls.getName();
bool const logSurfaceCondition = isLogLevelActive< logInfo::WellControl >( wellControls.getLogLevel());
integer const useSurfaceConditions = wellControls.useSurfaceConditions();
real64 flashPressure;
real64 flashPressure, flashTemperature;
if( useSurfaceConditions )
{
// use surface conditions
flashPressure = wellControls.getSurfacePressure();
flashTemperature = wellControls.getSurfaceTemperature();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we ensure that users supply this for single phase?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we do now

}
else
{
Expand All @@ -309,10 +312,12 @@ void SinglePhaseWell::updateVolRateForConstraint( ElementRegionManager const & e
}
// use region conditions
flashPressure = wellControls.getRegionAveragePressure();
flashTemperature = wellControls.getRegionAverageTemperature();
if( flashPressure < 0.0 )
{
// use segment conditions
flashPressure = pres[iwelemRef];
flashTemperature = temp[iwelemRef];
}
}
real64 & currentVolRate =
Expand All @@ -332,12 +337,14 @@ void SinglePhaseWell::updateVolRateForConstraint( ElementRegionManager const & e
// bring everything back to host, capture the scalars by reference
forAll< serialPolicy >( 1, [fluidWrapper,
pres,
temp,
connRate,
dens,
dDens,
logSurfaceCondition,
&useSurfaceConditions,
&flashPressure,
&flashTemperature,
&currentVolRate,
dCurrentVolRate,
&iwelemRef,
Expand All @@ -350,12 +357,14 @@ void SinglePhaseWell::updateVolRateForConstraint( ElementRegionManager const & e
if( useSurfaceConditions )
{
// we need to compute the surface density
fluidWrapper.update( iwelemRef, 0, flashPressure );

fluidWrapper.update( iwelemRef, 0, flashPressure, flashTemperature );

if( logSurfaceCondition )
{

GEOS_LOG_RANK( GEOS_FMT( "{}: surface density computed with P_surface = {} Pa",
wellControlsName, flashPressure ) );
GEOS_LOG_RANK( GEOS_FMT( "{}: surface density computed with P_surface = {} Pa, T_surface = {} K",
wellControlsName, flashPressure, flashTemperature ) );
}

#ifdef GEOS_USE_HIP
Expand All @@ -366,7 +375,10 @@ void SinglePhaseWell::updateVolRateForConstraint( ElementRegionManager const & e
else
{
real64 const refPres = pres[iwelemRef];
fluidWrapper.update( iwelemRef, 0, refPres );
real64 const refTemp = temp[iwelemRef];

fluidWrapper.update( iwelemRef, 0, refPres, refTemp );

}

real64 const densInv = 1.0 / dens[iwelemRef][0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ WellControls::WellControls( string const & name, Group * const parent )
m_targetPhaseRate( 0.0 ),
m_targetMassRate( 0.0 ),
m_useSurfaceConditions( 0 ),
m_surfacePres( 0.0 ),
m_surfaceTemp( 0.0 ),
m_surfacePres( -1.0 ),
m_surfaceTemp( -1.0 ),
m_isCrossflowEnabled( 1 ),
m_initialPressureCoefficient( 0.1 ),
m_rateSign( -1.0 ),
Expand Down Expand Up @@ -305,6 +305,17 @@ void WellControls::postInputInitialization()
"The flag to select surface/reservoir conditions must be equal to 0 or 1",
InputError, getWrapperDataContext( viewKeyStruct::useSurfaceConditionsString() ) );

if( m_useSurfaceConditions )
{
// 3a) check the flag for surface condition P&T
GEOS_THROW_IF( m_surfacePres <= 0.0,
"Surface conditions set to 1 but surface pressure is not set",
InputError, getWrapperDataContext( viewKeyStruct::useSurfaceConditionsString() ) );
GEOS_THROW_IF( m_surfaceTemp <= 0.0,
"Surface conditions set to 1 but surface temperature is not set",
InputError, getWrapperDataContext( viewKeyStruct::useSurfaceConditionsString() ) );

}
// 4) check that at least one rate constraint has been defined
GEOS_THROW_IF( ((m_targetPhaseRate <= 0.0 && m_targetPhaseRateTableName.empty()) &&
(m_targetMassRate <= 0.0 && m_targetMassRateTableName.empty()) &&
Expand Down
Loading