20 #ifndef GEOS_PHYSICSSOLVERS_FLUIDFLOW_WELLS_COMPOSITIONALMULTIPHASEWELL_HPP_
21 #define GEOS_PHYSICSSOLVERS_FLUIDFLOW_WELLS_COMPOSITIONALMULTIPHASEWELL_HPP_
23 #include "constitutive/fluid/multifluid/Layouts.hpp"
24 #include "constitutive/relativePermeability/Layouts.hpp"
28 #include "physicsSolvers/fluidFlow/wells/WellConstraintsBase.hpp"
33 namespace constitutive
35 class ConstitutiveManager;
54 Group *
const parent );
80 static string catalogName() {
return "CompositionalMultiphaseWell"; }
98 calculateWellResidualNorm(
real64 const & time_n,
125 real64 const scalingFactor )
override;
131 real64 const scalingFactor )
override;
134 applyWellSystemSolution(
DofManager const & dofManager,
136 real64 const scalingFactor,
145 real64 const scalingFactor,
247 virtual string resElementDofName()
const override {
return CompositionalMultiphaseBase::viewKeyStruct::elemDofFieldString(); }
253 integer useTotalMassEquation()
const {
return m_useTotalMassEquation; }
255 virtual void assembleWellFluxTerms(
real64 const & time,
257 WellElementSubRegion
const & subRegion,
258 DofManager
const & dofManager,
259 CRSMatrixView< real64, globalIndex const >
const & localMatrix,
260 arrayView1d< real64 >
const & localRhs )
override;
279 virtual void assembleWellAccumulationTerms(
real64 const & time,
300 virtual void assembleWellConstraintTerms(
real64 const & time_n,
307 virtual void applyWellBoundaryConditions(
real64 const time_n,
357 static constexpr
char const * dofFieldString() {
return "compositionalWellVars"; }
361 static constexpr
char const * useMassFlagString() {
return CompositionalMultiphaseBase::viewKeyStruct::useMassFlagString(); }
363 static constexpr
char const * useTotalMassEquationString() {
return CompositionalMultiphaseBase::viewKeyStruct::useTotalMassEquationString(); }
365 static constexpr
char const * maxCompFracChangeString() {
return CompositionalMultiphaseBase::viewKeyStruct::maxCompFracChangeString(); }
367 static constexpr
char const * maxRelativePresChangeString() {
return "maxRelativePressureChange"; }
369 static constexpr
char const * maxAbsolutePresChangeString() {
return "maxAbsolutePressureChange"; }
371 static constexpr
char const * maxRelativeCompDensChangeString() {
return "maxRelativeCompDensChange"; }
373 static constexpr
char const * maxRelativeTempChangeString() {
return "maxRelativeTemperatureChange"; }
375 static constexpr
char const * allowLocalCompDensChoppingString() {
return CompositionalMultiphaseBase::viewKeyStruct::allowLocalCompDensChoppingString(); }
379 static constexpr
char const * massDensityString() {
return "massDensity";}
381 static constexpr
char const * currentBHPString() {
return "currentBHP"; }
382 static constexpr
char const * dCurrentBHPString() {
return "dCurrentBHP"; }
384 static constexpr
char const * dCurrentBHP_dPresString() {
return "dCurrentBHP_dPres"; }
385 static constexpr
char const * dCurrentBHP_dCompDensString() {
return "dCurrentBHP_dCompDens"; }
387 static constexpr
char const * currentPhaseVolRateString() {
return "currentPhaseVolumetricRate"; }
388 static constexpr
char const * dCurrentPhaseVolRateString() {
return "dCurrentPhaseVolumetricRate"; }
391 static constexpr
char const * dCurrentPhaseVolRate_dPresString() {
return "dCurrentPhaseVolumetricRate_dPres"; }
393 static constexpr
char const * dCurrentPhaseVolRate_dCompDensString() {
return "dCurrentPhaseVolumetricRate_dCompDens"; }
395 static constexpr
char const * dCurrentPhaseVolRate_dRateString() {
return "dCurrentPhaseVolumetricRate_dRate"; }
397 static constexpr
char const * currentTotalVolRateString() {
return "currentTotalVolumetricRate"; }
398 static constexpr
char const * dCurrentTotalVolRateString() {
return "dCurrentTotalVolumetricRate"; }
400 static constexpr
char const * currentMassRateString() {
return "currentMassRate"; }
402 static constexpr
char const * dCurrentTotalVolRate_dPresString() {
return "dCurrentTotalVolumetricRate_dPres"; }
404 static constexpr
char const * dCurrentTotalVolRate_dCompDensString() {
return "dCurrentTotalVolumetricRate_dCompDens"; }
406 static constexpr
char const * dCurrentTotalVolRate_dRateString() {
return "dCurrentTotalVolumetricRate_dRate"; }
408 } viewKeysCompMultiphaseWell;
428 void validateConstitutiveModels(
DomainPartition const & domain ) const;
435 constitutive::MultiFluidBase const & fluid ) const;
455 void printRates(
real64 const & time_n,
459 virtual
bool evaluateConstraints(
real64 const & time_n,
462 integer const coupledIterationNumber,
481 template< typename ... GROUPTYPES >
488 integer const coupledIterationNumber,
500 integer m_useTotalMassEquation;
503 real64 m_maxCompFracChange;
506 real64 m_maxRelativePresChange;
509 real64 m_maxAbsolutePresChange;
512 real64 m_maxRelativeCompDensChange;
515 real64 m_maxRelativeTempChange;
518 real64 m_minScalingFactor;
521 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.
virtual void assembleFluxTerms(real64 const &time_n, real64 const &dt, DomainPartition &domain, DofManager const &dofManager, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs) override
assembles the flux terms for all connections between well elements
virtual void updateState(DomainPartition &domain) override
Recompute all dependent quantities from primary variables (including constitutive models)
void chopNegativeDensities(DomainPartition &domain)
Sets all the negative component densities (if any) to zero.
virtual string wellElementDofName() const override
get the name of DOF defined on well elements
CompositionalMultiphaseWell(CompositionalMultiphaseWell const &)=delete
deleted copy constructor
void validateWellControlsForFluid(WellControls const &wellControls, constitutive::MultiFluidBase const &fluid) const
Checks if the WellControls parameters are within the fluid tables ranges.
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 pressure relations at all connections between well elements except at the well head
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.
CompositionalMultiphaseWell(CompositionalMultiphaseWell &&)=default
default move constructor
void calculateReferenceElementRates(WellElementSubRegion &subRegion)
Calculate well rates at reference element.
virtual void initializePostInitialConditionsPreSubGroups() override
Called by InitializePostInitialConditions() prior to initializing sub-Groups.
virtual real64 updateWellState(WellElementSubRegion &subRegion) override
Recompute all dependent quantities from primary variables (including constitutive models)
virtual void computePerforationRates(real64 const &time_n, real64 const &dt, DomainPartition &domain) override
Recompute the perforation rates for all the wells.
void updateSeparator(WellElementSubRegion &subRegion)
Update well separator using current values of pressure and composition at the reference element.
virtual real64 updateSubRegionState(WellElementSubRegion &subRegion) override
Recompute all dependent quantities from primary variables (including constitutive models)
virtual ~CompositionalMultiphaseWell() override=default
default destructor
virtual localIndex numFluidComponents() const override
const getter for the number of fluid components
virtual void validateWellConstraints(real64 const &time_n, real64 const &dt, WellElementSubRegion const &subRegion, ElementRegionManager const &elemManager) override
Make sure that the well constraints are compatible.
CompositionalMultiphaseWell(const string &name, Group *const parent)
main constructor for Group Objects
static string catalogName()
name of the node manager in the object catalog
virtual void registerDataOnMesh(Group &meshBodies) override
Register wrappers that contain data on the mesh objects.
void createSeparator()
Create well separator.
CompositionalMultiphaseWell & operator=(CompositionalMultiphaseWell &&)=delete
deleted move operator
string getCatalogName() const override
virtual void postRestartInitialization() override final
Performs initialization required after reading from a restart file.
virtual void assembleAccumulationTerms(real64 const &time_n, real64 const &dt, DomainPartition &domain, DofManager const &dofManager, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs) override
assembles the accumulation term for all the well elements
virtual void computeWellPerforationRates(real64 const &time_n, real64 const &GEOS_UNUSED_PARAM(dt), ElementRegionManager const &elemManager, WellElementSubRegion &subRegion) override
Recompute the perforation rates for all the wells.
void updateVolRatesForConstraint(WellElementSubRegion &subRegion)
Recompute the volumetric rates that are used in the well constraints.
virtual void assemblePressureRelations(real64 const &time_n, real64 const &dt, DomainPartition const &domain, DofManager const &dofManager, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs) override
assembles the pressure relations at all connections between well elements except at the well head
virtual localIndex numFluidPhases() const override
Get the number of fluid phases.
CompositionalMultiphaseWell & operator=(CompositionalMultiphaseWell const &)=delete
deleted assignment operator
virtual string resElementDofName() const override
get the name of DOF defined on well elements
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.
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...
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.
integer m_numComponents
the number of fluid components
integer m_numPhases
the max number of fluid phases
virtual real64 scalingForSystemSolution(DomainPartition &domain, DofManager const &dofManager, arrayView1d< real64 const > const &localSolution) override
Function to determine if the solution vector should be scaled back in order to maintain a known const...
virtual void implicitStepSetup(real64 const &time, real64 const &dt, DomainPartition &domain) override
function to perform setup for implicit timestep
virtual void resetStateToBeginningOfStep(DomainPartition &domain) override
reset state of physics back to the beginning of the step.
virtual void implicitStepComplete(real64 const &time, real64 const &dt, DomainPartition &domain) override
perform cleanup for implicit timestep
virtual real64 calculateResidualNorm(real64 const &time_n, real64 const &dt, DomainPartition const &domain, DofManager const &dofManager, arrayView1d< real64 const > const &localRhs) override
calculate the norm of the global system residual
virtual void applySystemSolution(DofManager const &dofManager, arrayView1d< real64 const > const &localSolution, real64 const scalingFactor, real64 const dt, DomainPartition &domain) override
Function to apply the solution vector to the state.
virtual bool checkSystemSolution(DomainPartition &domain, DofManager const &dofManager, arrayView1d< real64 const > const &localSolution, real64 const scalingFactor) override
Function to check system solution for physical consistency and constraint violation.
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.