feat: well_manager + well estimator - #3972
Conversation
…aint class hierachy , 3) Remove all old constraint handling methods/variables, 4) it compiles ...
…lephase still needs testing
…t compositionalMultiphaseFlow/soreideWhitson/1D_100cells/1D_benchmark.xml
… to fixed and inputFiles regenerated
…d convert compositionalMultiphaseFlow/soreideWhitson/1D_100cells/1D_benchmark.xml" This reverts commit fa61ab1.
…well initialization vagaries assoiated with useSurfaceConditions=0
| string const bhp_type = isProducerWell ? MinimumBHPConstraint::catalogName() : MaximumBHPConstraint::catalogName(); | ||
| bool const no_match_found = std::none_of( constraints.begin(), constraints.end(), [&bhp_type]( const auto & constraint_tuple ) | ||
| { | ||
| return std::get< 1 >( constraint_tuple ) == bhp_type; | ||
| } ); | ||
| GEOS_THROW_IF( no_match_found, |
There was a problem hiding this comment.
When the sole BHP or rate constraint has constraintActive=0, these existence checks still accept it, while getBHPConstraint and the rate-list helpers filter it out. Subsequent selection either dereferences null or erases an end() iterator because the current constraint is absent from the active list.
There was a problem hiding this comment.
Not sure if this address your comment... for all current models constraintActive = 1. The addition of this flag was needed for 2 workflows, wellheadpressure, where the simulator can impose an "internal constraint" and the underpinning of future functionality where a well can be assigned producer and injection constraints, which then come into consideration when only the well type changes, versus the need to define 2 wells with same perforation information. For either the code will need to ensure that an active pressure and rate constraint are present.
| m_useMass( false ), | ||
| m_useTotalMassEquation( 1 ), | ||
| m_isThermal( 0 ), | ||
| m_isCompositional( true ), |
There was a problem hiding this comment.
should'nt it be an integer and registered for restart ? what happen if we want to restard a non-compositional well ?
There was a problem hiding this comment.
The variable is an internal flag set for initial and restart runs. I'm guessing the integratedTests would fail if it was set for restarts.
| array1d< real64 > localResidualNorm, wellResidalNorm; | ||
| array1d< real64 > localResidualNormalizer; | ||
|
|
||
| if( isThermal() ) |
There was a problem hiding this comment.
Sticking to conventionm shouldn't it be set by NDOF or so ?
There was a problem hiding this comment.
Yes, it would add the volume balance.. I will create a separate PR so any changes are associated with a specific change.
| if( wellResidalNorm[i] > localResidualNorm[i] ) | ||
| { | ||
| localResidualNorm[i] = wellResidalNorm[i]; | ||
| } |
There was a problem hiding this comment.
| if( wellResidalNorm[i] > localResidualNorm[i] ) | |
| { | |
| localResidualNorm[i] = wellResidalNorm[i]; | |
| } | |
| localResidualNorm[i] = LvArray::math::max( localResidualNorm[i], wellResidualNorm[i] ); |
jhuang2601
left a comment
There was a problem hiding this comment.
@tjb-ltk Great job!
Please update the branch with latest develop repo, which will fix the following failures for readthedoc build:
WARNING: Error, no command xref target from index:QuickStart
WARNING: Error, no command xref target from index:Tutorials
WARNING: Error, no command xref target from index:BasicExamples
WARNING: Error, no command xref target from index:AdvancedExamples
WARNING: Error, no command xref target from index:UserGuide
| std::cout << " Well: " << subRegion.getName() << " Est Attempt: " << dtAttempt | ||
| << ", ConfigurationIter: " << configurationLoopIter | ||
| << ", NewtonIter: " << newtonIter | ||
| << ", Residual Norm: " << residualNorm << std::endl; |
There was a problem hiding this comment.
This is inside a Newton iteration loop and will spam output every iteration.
Remove it? or guard by a log level?
| #include "fileIO/Outputs/OutputBase.hpp" | ||
| #include "physicsSolvers/fluidFlow/wells/WellFields.hpp" | ||
|
|
||
| #include "functions/FunctionManager.hpp" |
There was a problem hiding this comment.
| #include "functions/FunctionManager.hpp" |
remove this duplicate, as it has already been added in line 37
| setApplyDefaultValue( 0 ). | ||
| setInputFlag( InputFlags::OPTIONAL ). | ||
| setDescription( "Name of the BHP table when the rate is a time dependent function" ); | ||
| setDescription( "Flag to esitmate well solution prior to coupled reservoir and well solve." ); |
There was a problem hiding this comment.
| setDescription( "Flag to esitmate well solution prior to coupled reservoir and well solve." ); | |
| setDescription( "Flag to estimate well solution prior to coupled reservoir and well solve." ); |
| @@ -345,8 +401,6 @@ | |||
| scale="0.1"/> | |||
| </FieldSpecifications> | |||
There was a problem hiding this comment.
| </FieldSpecifications> | |
| </FieldSpecifications> | |
| <!-- SPHINX_TUT_DEAD_OIL_EGG_FIELD_SPECS_END --> |
|
|
||
| <!-- SPHINX_TUT_DEAD_OIL_EGG_FIELD_SPECS_END --> | ||
| <!-- SPHINX_TUT_DEAD_OIL_EGG_OUTPUTS --> | ||
| <Outputs> |
There was a problem hiding this comment.
| <Outputs> | |
| <!-- SPHINX_TUT_DEAD_OIL_EGG_OUTPUTS --> | |
| <Outputs> |
| <Restart | ||
| name="restartOutput"/> | ||
|
|
||
| </Outputs> |
There was a problem hiding this comment.
| </Outputs> | |
| </Outputs> | |
| <!-- SPHINX_TUT_DEAD_OIL_EGG_OUTPUTS_END --> |
|
|
||
| <!-- SPHINX_TUT_DEAD_OIL_EGG_OUTPUTS_END --> | ||
| <!-- SPHINX_TUT_DEAD_OIL_EGG_TASKS --> | ||
| <Tasks> |
There was a problem hiding this comment.
| <Tasks> | |
| <!-- SPHINX_TUT_DEAD_OIL_EGG_TASKS --> | |
| <Tasks> |
| objectPath="ElementRegions/wellRegion4/wellRegion4UniqueSubRegion" | ||
| fieldName="wellElementMixtureConnectionRate"/> | ||
| fieldName="wellElementConnectionRate"/> | ||
| </Tasks> |
There was a problem hiding this comment.
| </Tasks> | |
| </Tasks> | |
| <!-- SPHINX_TUT_DEAD_OIL_EGG_TASKS_END --> |
jhuang2601
left a comment
There was a problem hiding this comment.
@tjb-ltk Great job!
Please update the branch with latest develop repo, which will fix the following failures for readthedoc build:
WARNING: Error, no command xref target from index:QuickStart
WARNING: Error, no command xref target from index:Tutorials
WARNING: Error, no command xref target from index:BasicExamples
WARNING: Error, no command xref target from index:AdvancedExamples
WARNING: Error, no command xref target from index:UserGuide
…computed, no changes in results
…eature/byer3/wm_we
| { | ||
| setInputFlags( InputFlags::OPTIONAL_NONUNIQUE ); | ||
|
|
||
| registerWrapper( viewKeyStruct::massRateString(), &m_constraintValue ). |
There was a problem hiding this comment.
To clarify the comment, the base class WellConstraintBase registers the data member m_constraintValue using the string "value" (WellConstraintBase::viewKeyStruct::constraintValueString()). This means the user will have two field options "value" and "massRate" to set the same value. So we need to deregister the first string before we can attach this one. This applies to the other derived types from WellConstraintBase.
There was a problem hiding this comment.
removed registration from base class
| control="totalVolRate" | ||
| maxRelativePressureChange="0.5" | ||
| maxCompFractionChange="0.5"> | ||
| <InjectionPhaseVolumeRateConstraint |
There was a problem hiding this comment.
Remove undefined constraint?
| <!--massRate => Maximum mass rate (kg/s)--> | ||
| <xsd:attribute name="massRate" type="real64" default="0" /> | ||
| <!--value => Constraint value. | ||
| --> | ||
| <xsd:attribute name="value" type="groupNameRef" default="0" /> |
There was a problem hiding this comment.
For instance, here "value" and "massRate" refer to the same piece of data.
There was a problem hiding this comment.
I removed registration in the base constraint class
|
|
||
| <!-- SPHINX_TUT_DEAD_OIL_EGG_EVENTS_END --> | ||
| <!-- SPHINX_TUT_DEAD_OIL_EGG_NUMERICAL_METHODS --> | ||
| <NumericalMethods> |
There was a problem hiding this comment.
The SPHINX anchors may be used in the documentation build.
There was a problem hiding this comment.
these were added back
victorapm
left a comment
There was a problem hiding this comment.
Looks great, thanks for all the work, Tom!
MelReyCG
left a comment
There was a problem hiding this comment.
The PR is a big improvement in architecture and in feature scalability (classes per constraints), thanks for your work Tom!
I have a some concerns on code quality, but i will submit a PR or an issue later, thanks to not delete the branch.
|
We are lacking an approval from @OmarDuran, @bd713, @jafranc, @rrsettgast, and/or @wrtobin for the |
|
I reverted the changes, we will apply them back later in another (smaller) PR. I left some |
Replaces PR #3735 and extends PR #3971
Overview
This PR introduces
An improved well schema layout and code refactor better suited for well modeling. The previous implementation primarily targeted Jacobian generation requirements for the coupled reservoir and well system.
The well estimator is used to select the active well constraint by solving the well system assuming fixed reservoir conditions and selecting the constraint with the highest or lowest well flowing pressure.
This is a breaking change, detailed migration instructions and migration script are posted at #4081