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
| * @class BHPConstraint | ||
| * @brief This class describes a minimum pressure constraint used to control a injection well. | ||
| */ | ||
| class BHPConstraint : public WellConstraintBase |
There was a problem hiding this comment.
Instead of declaring almost the same class twice I would just use a template parameter e.g.
template <WellTypes WELL_TYPE>
class BHPConstraint : public WellConstraintBase
{
// ...
static string catalogName()
{
if constexpr (WELL_TYPE == WellControls::Type::PRODUCER)
{
return "MinimumBHPConstraint";
}
else
{
return "MaximumBHPConstraint";
}
}
// ...
};
using MinimumBHPConstraint = BHPConstraint<WellTypes::PRODUCER>;
using MaximumBHPConstraint = BHPConstraint<WellTypes::INJECTOR>;There was a problem hiding this comment.
In terms of splitting the PR... I think it would probably take at least a month and not sure why go this route.
| * Either producer or injector | ||
| */ | ||
| enum class Type : integer | ||
| { |
There was a problem hiding this comment.
We now have WellTypes defined in WellConstants.cpp. Maybe now we can remove this.
| { | ||
| this->setInputFlags( InputFlags::OPTIONAL_NONUNIQUE ); | ||
|
|
||
| this->registerWrapper( viewKeyStruct::massRateString(), &this->m_constraintValue ). |
There was a problem hiding this comment.
We need to deregister the "value" wrapper before we can register this. Otherwise the object will have two wrappers that point to the same data.
There was a problem hiding this comment.
I removed the this->. But not sure what is meant by deregister. The above code follows pattern in many classes...
| setInputFlag( InputFlags::OPTIONAL ). | ||
| setDescription( "Name of the well constraint schedule table when the constraint value is a time dependent function. \n" ); | ||
|
|
||
| registerWrapper( viewKeyStruct::constraintValueString(), &m_constraintValue ). |
There was a problem hiding this comment.
Most of the sub-classes reregister this value under a different name. Before that we need to ensure that this is deregistered to avoid multiple wrapper names referring to the same data.
| // Quantities computed from well constraint solve with this boundary condition | ||
|
|
||
| // botton hole pressure | ||
| real64 m_BHP; | ||
|
|
||
| // phase rates | ||
| array1d< real64 > m_phaseVolumeRates; | ||
|
|
||
| // liquid rate | ||
| real64 m_liquidRate; | ||
|
|
||
| // total volume rate | ||
| real64 m_totalVolumeRate; | ||
|
|
||
| // mass rate | ||
| real64 m_massRate; | ||
|
|
||
| /// Rate sign. +1 for injector, -1 for producer | ||
| real64 m_rateSign; |
There was a problem hiding this comment.
These variables seem specific to some of the sub classes. Do they need to appear in the base class?
There was a problem hiding this comment.
When a constraint is solved using the estimator these quantities define the state of the solve, which is then used to compare constraints to determine limiting constraint. I struggled with how to best associate a state with each constraint, so decided to keep it simple and just store what is needed for compo and single phase in base class. Open to suggestions
|
|
||
| // set the reference well element where the BHP control is applied | ||
| wellControls.setReferenceGravityCoef( refElev * gravVector[2] ); | ||
| wellControls.setReferenceGravityCoef( refElev * gravVector[2] ); // tjb remove |
There was a problem hiding this comment.
Should this not be size 3
| wellControls.setReferenceGravityCoef( refElev * gravVector[2] ); // tjb remove | |
| wellControls.setReferenceGravityCoef( refElev * gravVector[3] ); // tjb remove |
| //struct ConstraintHelper< NC, IS_THERMAL > {}; | ||
|
|
||
| template< integer NC, integer IS_THERMAL, typename CONSTRAINT = BHPConstraint > | ||
| struct ConstraintHelper |
There was a problem hiding this comment.
This file looks like it might be difficult to compile. Can we use the kernelSpecs.json to generate instantiations?
| control="totalVolRate" | ||
| maxRelativePressureChange="0.5" | ||
| maxCompFractionChange="0.5" | ||
| useMass="0"> |
There was a problem hiding this comment.
Are we going to be specifying this per well?
| <InjectionPhaseVolumeRateConstraint | ||
| name="inj" | ||
| phaseName="water"/> |
There was a problem hiding this comment.
| <InjectionPhaseVolumeRateConstraint | |
| name="inj" | |
| phaseName="water"/> |
Not sure we need these empty constraints.
|
|
||
| /// Number of bits in mask storage | ||
| static constexpr int NUM_BITS = internal::roundToNextPowerOfTwo( MAX_COMP ); | ||
| static constexpr int NUM_BITS = geos::internal::roundToNextPowerOfTwo( MAX_COMP ); |
There was a problem hiding this comment.
I don't think we need changes to this file.
feat: Formalize definition of well constraints (this replaces #3862 feat: feature/byer3/well constraints)
allow more than 2 constraints per well
minimize restrictions on rate type
allow production/injection constraints for one well (future capability)
improve code for constraint processing in general and also needed for well estimator
Schema changes / refactoring
WellManager replaces CompositionalMultiphaseWell and SinglePhaseWell, well manager implements physic solver interfaces and iterates over wells to fill coupled Jacobin.
WellControl is now either CompositionalMultiphaseWell or SinglePhaseWell, which implements WellControl interfaces . WellControl should be renamed to "Well"
WellControl provides methods independent of fluid model. CompositionalMulitphasewell /singlephasewell are only kept as owners of Jacobian generation kernels. These could be placed in wellcontrol with simple iscompo check, maybe later.
Subsequent PR's based on this PR
wmwe. - well manager PR with well estimator
wmwe + wellhead pressure constraint