20 #ifndef GEOS_PHYSICSSOLVERS_FLUIDFLOW_WELLS_COMPOSITIONALMULTIPHASEWELL_HPP_
21 #define GEOS_PHYSICSSOLVERS_FLUIDFLOW_WELLS_COMPOSITIONALMULTIPHASEWELL_HPP_
24 #include "constitutive/fluid/multifluid/Layouts.hpp"
25 #include "constitutive/relativePermeability/Layouts.hpp"
26 #include "mesh/MeshLevel.hpp"
30 #include "physicsSolvers/fluidFlow/wells/WellConstraintsBase.hpp"
31 #include "physicsSolvers/fluidFlow/wells/WellControls.hpp"
35 namespace constitutive
37 class ConstitutiveManager;
41 namespace compositionalMultiphaseStatistics
43 class StatsAggregator;
61 Group *
const parent );
84 void setReservoirStatsAggregator( std::unique_ptr< compositionalMultiphaseStatistics::StatsAggregator > aggregator );
103 virtual void initializeWellPostInitialConditionsPreSubGroups(
WellElementSubRegion & subRegion )
override;
105 virtual bool isCompositional()
const override {
return true; }
176 calculateWellResidualNorm(
real64 const & time_n,
189 real64 & maxDeltaCompDens,
191 real64 & minPresScalingFactor,
192 real64 & minCompDensScalingFactor,
193 real64 & minTempScalingFactor,
207 real64 const scalingFactor,
222 real64 const scalingFactor,
228 virtual void applyWellBoundaryConditions(
real64 const time_n,
240 virtual void implicitStepSetup(
real64 const & time_n,
243 string const & meshBodyName,
248 implicitStepComplete(
real64 const & time,
252 virtual void printRates(
real64 const & time_n,
329 virtual string wellElementDofName()
const override {
return viewKeyStruct::dofFieldString(); }
331 virtual string resElementDofName()
const override {
return CompositionalMultiphaseBase::viewKeyStruct::elemDofFieldString(); }
337 integer useTotalMassEquation()
const {
return m_useTotalMassEquation; }
348 static constexpr
char const * dofFieldString() {
return "wellVars"; }
352 static constexpr
char const * useMassFlagString() {
return CompositionalMultiphaseBase::viewKeyStruct::useMassFlagString(); }
354 static constexpr
char const * useTotalMassEquationString() {
return CompositionalMultiphaseBase::viewKeyStruct::useTotalMassEquationString(); }
356 static constexpr
char const * maxCompFracChangeString() {
return CompositionalMultiphaseBase::viewKeyStruct::maxCompFracChangeString(); }
358 static constexpr
char const * maxRelativePresChangeString() {
return "maxRelativePressureChange"; }
360 static constexpr
char const * maxAbsolutePresChangeString() {
return "maxAbsolutePressureChange"; }
362 static constexpr
char const * maxRelativeCompDensChangeString() {
return "maxRelativeCompDensChange"; }
364 static constexpr
char const * maxRelativeTempChangeString() {
return "maxRelativeTemperatureChange"; }
366 static constexpr
char const * allowLocalCompDensChoppingString() {
return CompositionalMultiphaseBase::viewKeyStruct::allowLocalCompDensChoppingString(); }
370 } viewKeysCompMultiphaseWell;
381 void validateFluidModel( constitutive::MultiFluidBase
const & fluid, constitutive::MultiFluidBase
const & referenceFluid )
const;
416 struct ReferenceConditions
425 void precomputeReferenceConditions(
real64 time_n,
434 integer m_useTotalMassEquation;
437 real64 m_maxCompFracChange;
440 real64 m_maxRelativePresChange;
443 real64 m_maxAbsolutePresChange;
446 real64 m_maxRelativeCompDensChange;
449 real64 m_maxRelativeTempChange;
452 real64 m_minScalingFactor;
455 integer m_allowCompDensChopping;
#define GEOS_UNUSED_PARAM(X)
Mark an unused argument and silence compiler warnings.
void updateFluidModel(WellElementSubRegion &subRegion)
Update all relevant fluid models using current values of pressure and composition.
void chopNegativeDensities(WellElementSubRegion &subRegion)
Sets all the negative component densities (if any) to zero.
CompositionalMultiphaseWell(CompositionalMultiphaseWell const &)=delete
deleted copy constructor
void updateGlobalComponentFraction(WellElementSubRegion &subRegion) const
Recompute global component fractions from primary variables (component densities)
void updateTotalMassDensity(WellElementSubRegion &subRegion) const
Recompute total mass densities from mass density and phase volume fractions.
void calculateReferenceElementRates(WellElementSubRegion &subRegion)
Calculate well rates at reference element.
virtual void initializePostInitialConditionsPreSubGroups() override
Called by InitializePostInitialConditions() prior to initializing sub-Groups.
void updateSeparator(real64 time_n, MeshBody const &meshBody, ElementRegionManager const &elemManager, WellElementSubRegion &subRegion)
Update well separator using current values of pressure and composition at the reference element.
virtual void createSeparator(WellElementSubRegion &subRegion) override
Create well separator.
void updateVolRatesForConstraint(WellElementSubRegion const &subRegion)
Recompute the volumetric rates that are used in the well constraints.
void validateFluidModel(constitutive::MultiFluidBase const &fluid, constitutive::MultiFluidBase const &referenceFluid) const
Checks fluild model compatibility and validity.
virtual void postRestartInitialization() override
Performs initialization required after reading from a restart file.
CompositionalMultiphaseWell(CompositionalMultiphaseWell &&)=delete
deleted move constructor
virtual void validateWellConstraints(real64 const &time_n, real64 const &dt, WellElementSubRegion const &subRegion) override
Make sure that the well constraints are compatible.
CompositionalMultiphaseWell(const string &name, Group *const parent)
main constructor for Group Objects
std::unique_ptr< compositionalMultiphaseStatistics::StatsAggregator > m_reservoirStatsAggregator
optional statistics aggregator to get the average pressure of simulated region
virtual real64 updateWellState(MeshBody const &meshBody, ElementRegionManager const &elemManager, WellElementSubRegion &subRegion) override
Recompute all dependent quantities from primary variables (including constitutive models)
CompositionalMultiphaseWell & operator=(CompositionalMultiphaseWell &&)=delete
deleted move operator
CompositionalMultiphaseWell & operator=(CompositionalMultiphaseWell const &)=delete
deleted assignment operator
CompositionalMultiphaseWell()=delete
deleted default constructor
virtual void postInputInitialization() override
real64 updatePhaseVolumeFraction(WellElementSubRegion &subRegion) const
Recompute phase volume fractions (saturations) from constitutive and primary variables.
void updateBHPForConstraint(WellElementSubRegion &subRegion)
Recompute the current BHP pressure.
virtual void initializePostSubGroups() override
Called by Initialize() after to initializing sub-Groups.
virtual ~CompositionalMultiphaseWell() override
default destructor
The DoFManager is responsible for allocating global dofs, constructing sparsity patterns,...
Partition of the decomposed physical domain. It also manages the connexion information to its neighbo...
The ElementRegionManager class provides an interface to ObjectManagerBase in order to manage ElementR...
A buffer to count and store element ids during kernel execution. This facilitates the reporting mecha...
The class is used to manage mesh body.
Class facilitating the representation of a multi-level discretization of a MeshBody.
This class describes the controls used to operate a well.
This class describes a collection of local well elements and perforations.
Reponsible of computing physical statistics over the grid, registering the result in the data reposit...
virtual void resetStateToBeginningOfStep(DomainPartition &domain, string const &meshBodyName, ElementRegionManager const &elemManager, WellElementSubRegion &subRegion) override
Reset the well state to the beginning of the time step.
virtual array1d< real64 > calculateLocalWellResidualNorm(real64 const &time_n, real64 const &dt, NonlinearSolverParameters const &nonlinearSolverParameters, WellElementSubRegion const &subRegion, DofManager const &dofManager, arrayView1d< real64 const > const &localRhs) override
real64 scalingForLocalSystemSolution(WellElementSubRegion &subRegion, DofManager const &dofManager, real64 &maxDeltaPres, real64 &maxDeltaCompDens, real64 &maxDeltaTemp, real64 &minPresScalingFactor, real64 &minCompDensScalingFactor, real64 &minTempScalingFactor, arrayView1d< real64 const > const &localSolution)
virtual bool checkWellSystemSolution(WellElementSubRegion &subRegion, DofManager const &dofManager, arrayView1d< real64 const > const &localSolution, real64 const scalingFactor, real64 &minPressure, real64 &minDensity, real64 &minTotalDensity, ElementsReporterBuffer &negPressureIds, ElementsReporterBuffer &negDensityIds, ElementsReporterBuffer &negTotalDensityIds) override
virtual void applyWellSystemSolution(DofManager const &dofManager, arrayView1d< real64 const > const &localSolution, real64 const scalingFactor, real64 const dt, DomainPartition &domain, MeshLevel &mesh, WellElementSubRegion &subRegion) override
virtual void initializeWell(DomainPartition &domain, Group &meshBodies, string const &meshBodyName, MeshLevel &mesh, WellElementSubRegion &subRegion, real64 const &time_n) override
Initialize well for the beginning of a simulation or restart.
virtual void assembleWellPressureRelations(real64 const &time_n, real64 const &dt, WellElementSubRegion const &subRegion, DofManager const &dofManager, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs) override
assembles the well momentum terms for an individual well
virtual void assembleWellAccumulationTerms(real64 const &time, real64 const &dt, WellElementSubRegion &subRegion, DofManager const &dofManager, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs) override
assembles the accumulation term for an individual well
virtual void assembleWellFluxTerms(real64 const &time, real64 const &dt, WellElementSubRegion const &subRegion, DofManager const &dofManager, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs) override
virtual void assembleWellConstraintTerms(real64 const &time_n, real64 const &dt, WellElementSubRegion const &subRegion, DofManager const &dofManager, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs) override
assembles the well constraint terms for an individual well
virtual void computeWellPerforationRates(real64 const &time_n, real64 const &GEOS_UNUSED_PARAM(dt), ElementRegionManager &elemManager, WellElementSubRegion &subRegion) override
Recompute the perforation rates for all the wells.
integer m_numComponents
the number of fluid components
integer m_numPhases
the max number of fluid phases
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
double real64
64-bit floating point type.
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
LvArray::CRSMatrixView< T, COL_INDEX, INDEX_TYPE const, LvArray::ChaiBuffer > CRSMatrixView
Alias for CRS Matrix View.
int integer
Signed integer type.
Array< T, 1 > array1d
Alias for 1D array.
Struct to serve as a container for variable strings and keys.