https://mooseframework.inl.gov
Loading...
Searching...
No Matches
FVReconstructedPressureGradient.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#pragma once
11
12#include "FVGradientMethod.h"
15
16#include "libmesh/numeric_vector.h"
17#include "libmesh/dense_matrix.h"
18#include "libmesh/dense_vector.h"
19
20#include <unordered_set>
21
22class ElemInfo;
23class FaceInfo;
24class FEProblemBase;
26
44{
45public:
48
50
52
54 void linkFlowSystem(RhieChowMassFlux & rc, const LinearFVGradientReader & pressure_gradient);
55
57 void validateSetup(const RhieChowMassFlux & rc) const;
58
60 const GradientMethodName & baseGradientMethodName() const { return _base_gradient_method_name; }
61
63 void resetForTimeStep(const RhieChowMassFlux & rc);
64
67
70
73
82 const GradientView & base_gradient);
83
84 virtual void meshChanged() override;
85
86private:
97
110
112 SystemBase & system,
113 GradientContainer & gradient,
114 const std::unordered_set<unsigned int> & variable_numbers) const override;
115
116 void resolveGradientMethodDependencies(FEProblemBase & fe_problem) override;
117
119 void checkFlowSystem(const RhieChowMassFlux & rc) const;
120
122 void copyGradient(const GradientView & source, GradientContainer & destination);
123
126
129 const GradientView & base_gradient,
130 const GradientContainer & reconstructed_candidate);
131
133 RealVectorValue reconstructionVelocityGradient(const RhieChowMassFlux & rc,
134 const RealVectorValue & elem_gradient,
135 const FaceInfo & fi,
136 bool elem_has_info,
137 unsigned int velocity_component) const;
138
163 const ElemInfo & elem_info,
164 const std::vector<RealVectorValue> & elem_velocity_gradients,
165 const FaceInfo * fi,
166 const Point & surface_vector,
167 bool elem_has_info,
168 DenseMatrix<Real> & matrix,
169 DenseVector<Real> & projection_rhs) const;
170
172 DenseVector<Real> solveFaceProjection(const DenseMatrix<Real> & matrix,
173 const DenseVector<Real> & projection_rhs) const;
174
177 const ElemInfo & elem_info,
178 unsigned int component,
179 Real reconstructed_velocity) const;
180
182 const GradientMethodName _base_gradient_method_name;
183
186
189
191 const RhieChowMassFlux * _rhie_chow = nullptr;
192
194 const SystemBase * _pressure_system = nullptr;
195
198
200 std::vector<const SystemBase *> _momentum_systems;
201
203 std::vector<const LinearFVGradientReader *> _velocity_gradient_fields;
204
206 std::vector<std::vector<std::unique_ptr<NumericVector<Number>>>>
208
212
215
218
221};
std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > GradientContainer
Gradient method that reconstructs and relaxes the pressure gradient used for Rhie-Chow momentum-press...
void updateCouplingPressureGradient(const RhieChowMassFlux &rc, const GradientView &base_gradient, const GradientContainer &reconstructed_candidate)
Blend a reconstructed candidate into the persistent coupling pressure gradient.
void finalizeCouplingPressureGradient(const RhieChowMassFlux &rc, const GradientView &base_gradient)
Relax and publish the current candidate as the coupling pressure gradient.
LinearFVGradientReader::GradientContainer GradientView
std::vector< std::vector< std::unique_ptr< NumericVector< Number > > > > _lagged_reconstruction_velocity_gradient
Lagged velocity gradients indexed by velocity component and spatial direction.
void resolveGradientMethodDependencies(FEProblemBase &fe_problem) override
DenseVector< Real > solveFaceProjection(const DenseMatrix< Real > &matrix, const DenseVector< Real > &projection_rhs) const
Solve a cell's velocity-projection system.
void validateSetup(const RhieChowMassFlux &rc) const
Validate the one-time Rhie-Chow linkage and field layouts required by reconstruction.
Real reconstructPressureGradient(const RhieChowMassFlux &rc, const ElemInfo &elem_info, unsigned int component, Real reconstructed_velocity) const
Invert one diagonal momentum equation to recover a pressure-gradient component.
PressureGradientReconstructionState _reconstruction_state
Current position in the pressure-gradient reconstruction cycle.
void linkFlowSystem(RhieChowMassFlux &rc, const LinearFVGradientReader &pressure_gradient)
Link this stateful method to one Rhie-Chow flow-system configuration.
void transition(PressureGradientReconstructionEvent event)
Apply and validate one reconstruction-cycle transition.
void assembleFaceProjection(const RhieChowMassFlux &rc, const ElemInfo &elem_info, const std::vector< RealVectorValue > &elem_velocity_gradients, const FaceInfo *fi, const Point &surface_vector, bool elem_has_info, DenseMatrix< Real > &matrix, DenseVector< Real > &projection_rhs) const
Add one face's contribution to the area-weighted least-squares system that reconstructs the cell velo...
const GradientMethodName _base_gradient_method_name
Gradient method used before the reconstructed coupling pressure gradient exists.
GradientContainer _reconstructed_pressure_gradient
Reconstructed pressure-gradient candidate.
dof_id_type _last_reconstructed_face_flux_iteration
Corrected face-flux iteration used by the previous reconstruction.
RealVectorValue reconstructionVelocityGradient(const RhieChowMassFlux &rc, const RealVectorValue &elem_gradient, const FaceInfo &fi, bool elem_has_info, unsigned int velocity_component) const
Interpolate a lagged velocity-component gradient to a face.
void saveLaggedVelocityGradient(RhieChowMassFlux &rc)
Save the lagged cell velocity gradient used by the reconstruction.
const GradientContainer & reconstructedCandidate(const RhieChowMassFlux &rc) const
Get the conservative candidate produced by the current pressure corrector.
void copyGradient(const GradientView &source, GradientContainer &destination)
Copy gradient values while reusing compatible destination storage.
const FVGradientMethod * _base_gradient_method
Resolved method used before the reconstructed coupling pressure gradient exists.
void computeCandidateFromCorrectedFlux(const RhieChowMassFlux &rc)
Reconstruct the conservative pressure-gradient candidate from the corrected face flux.
void checkFlowSystem(const RhieChowMassFlux &rc) const
Check that a stateful operation is requested by the bound Rhie-Chow object.
void computeGradientWithoutLimiter(SystemBase &system, GradientContainer &gradient, const std::unordered_set< unsigned int > &variable_numbers) const override
GradientContainer _coupling_pressure_gradient
Persistent coupling pressure gradient.
const GradientMethodName & baseGradientMethodName() const
Name of the gradient method used before the reconstructed coupling pressure gradient exists.
PressureGradientReconstructionEvent
Operations that advance or reset the pressure-gradient reconstruction cycle.
@ Reset
Reset the cycle to require a new lagged velocity-gradient snapshot.
@ ReconstructCandidate
Record that a pressure-gradient candidate has been reconstructed.
@ PublishCandidate
Record that the reconstructed candidate has been published.
@ SaveLaggedVelocityGradient
Record that the lagged velocity-gradient snapshot has been saved.
std::vector< const SystemBase * > _momentum_systems
Momentum systems coupled through the owning Rhie-Chow object.
std::vector< const LinearFVGradientReader * > _velocity_gradient_fields
Ordinary gradient fields for the velocity components.
FVGradientMethod::GradientContainer GradientContainer
const Real _gradient_relaxation
Relaxation factor applied to reconstructed pressure gradients.
const SystemBase * _pressure_system
Pressure system that owns the reconstructed pressure variable.
const RhieChowMassFlux * _rhie_chow
Rhie-Chow object that owns this stateful reconstruction method.
unsigned int _pressure_variable_number
Pressure variable reconstructed by this method.
PressureGradientReconstructionState
Current stage of the pressure-gradient reconstruction cycle.
@ CandidateReady
The reconstructed candidate is available and ready to be published.
@ NeedLaggedVelocityGradient
The next reconstruction cycle requires a lagged velocity-gradient snapshot.
@ NeedCandidate
The lagged velocity gradient is available and a reconstructed candidate is required.
void resetForTimeStep(const RhieChowMassFlux &rc)
Prepare solver-iteration state for a new time-step attempt.
std::vector< libMesh::NumericVector< libMesh::Number > * > GradientContainer
User object responsible for determining the face fluxes using the Rhie-Chow interpolation in a segreg...
const unsigned int invalid_uint