https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
RhieChowMassFlux Class Reference

User object responsible for determining the face fluxes using the Rhie-Chow interpolation in a segregated solver that uses the linear FV formulation. More...

#include <RhieChowMassFlux.h>

Inheritance diagram for RhieChowMassFlux:
[legend]

Public Types

typedef DataFileName DataFileParameterType
 

Public Member Functions

 RhieChowMassFlux (const InputParameters &params)
 
Real getMassFlux (const FaceInfo &fi) const
 Get the face velocity times density (used in advection terms)
 
Real getVolumetricFaceFlux (const FaceInfo &fi) const
 Get the volumetric face flux (used in advection terms)
 
const LinearFVGradientReaderpressureGradientField () const
 Get the registered pressure gradient field used by compatible momentum pressure kernels.
 
virtual Real getVolumetricFaceFlux (const Moose::FV::InterpMethod m, const FaceInfo &fi, const Moose::StateArg &time, const THREAD_ID tid, bool subtract_mesh_velocity) const override
 Retrieve the volumetric face flux, will not include derivatives.
 
void initFaceMassFlux ()
 Initialize the container for face velocities.
 
void initCouplingField ()
 Initialize the coupling fields (HbyA and Ainv)
 
void computeFaceMassFlux ()
 Update the values of the face velocities in the containers.
 
void computeCellVelocity ()
 Update the cell values of the velocity variables.
 
virtual void meshChanged () override
 
virtual void initialize () override
 
virtual void execute () override
 
virtual void finalize () override
 
virtual void initialSetup () override
 
void linkMomentumPressureSystems (const std::vector< LinearSystem * > &momentum_systems, LinearSystem &pressure_system, const std::vector< unsigned int > &momentum_system_numbers)
 Update the momentum system-related information.
 
void computeHbyA (const bool with_updated_pressure, const bool verbose)
 Computes the inverse of the diagonal (1/A) of the system matrix plus the H/A components for the pressure equation plus Rhie-Chow interpolation.
 
bool hasFaceSide (const FaceInfo &fi, const bool fi_elem_side) const override
 
virtual Real spatialValue (const Point &) const
 
virtual const std::vector< Point > spatialPoints () const
 
void setPrimaryThreadCopy (UserObject *primary)
 
UserObjectprimaryThreadCopy ()
 
SubProblemgetSubProblem () const
 
bool shouldDuplicateInitialExecution () const
 
void gatherSum (T &value)
 
void gatherMax (T &value)
 
void gatherMin (T &value)
 
void gatherProxyValueMax (T1 &proxy, T2 &value)
 
void gatherProxyValueMin (T1 &proxy, T2 &value)
 
std::set< UserObjectName > getDependObjects () const
 
const std::set< std::string > & getRequestedItems () override
 
const std::set< std::string > & getSuppliedItems () override
 
unsigned int systemNumber () const
 
virtual bool needThreadedCopy () const
 
virtual bool enabled () const
 
std::shared_ptr< MooseObjectgetSharedPtr ()
 
std::shared_ptr< const MooseObjectgetSharedPtr () const
 
bool isKokkosObject () const
 
MooseAppgetMooseApp () const
 
const std::string & type () const
 
const std::string & name () const
 
std::string typeAndName () const
 
MooseObjectParameterName uniqueParameterName (const std::string &parameter_name) const
 
MooseObjectName uniqueName () const
 
const InputParametersparameters () const
 
const hit::Node * getHitNode () const
 
bool hasBase () const
 
const std::string & getBase () const
 
const TgetParam (const std::string &name) const
 
std::vector< std::pair< T1, T2 > > getParam (const std::string &param1, const std::string &param2) const
 
const TqueryParam (const std::string &name) const
 
const TgetRenamedParam (const std::string &old_name, const std::string &new_name) const
 
T getCheckedPointerParam (const std::string &name, const std::string &error_string="") const
 
bool isParamValid (const std::string &name) const
 
bool isParamSetByUser (const std::string &name) const
 
void connectControllableParams (const std::string &parameter, const std::string &object_type, const std::string &object_name, const std::string &object_parameter) const
 
void paramError (const std::string &param, Args... args) const
 
void paramWarning (const std::string &param, Args... args) const
 
void paramWarning (const std::string &param, Args... args) const
 
void paramInfo (const std::string &param, Args... args) const
 
std::string messagePrefix (const bool hit_prefix=true) const
 
std::string errorPrefix (const std::string &) const
 
void mooseError (Args &&... args) const
 
void mooseDocumentedError (const std::string &repo_name, const unsigned int issue_num, Args &&... args) const
 
void mooseErrorNonPrefixed (Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseDeprecatedNoTrace (Args &&... args) const
 
void mooseInfo (Args &&... args) const
 
void callMooseError (std::string msg, const bool with_prefix, const hit::Node *node=nullptr, const bool show_trace=true) const
 
std::string getDataFileName (const std::string &param) const
 
std::string getDataFileNameByName (const std::string &relative_path) const
 
std::string getDataFilePath (const std::string &relative_path) const
 
virtual void timestepSetup ()
 
virtual void jacobianSetup ()
 
virtual void residualSetup ()
 
virtual void customSetup (const ExecFlagType &)
 
const ExecFlagEnumgetExecuteOnEnum () const
 
UserObjectName getUserObjectName (const std::string &param_name) const
 
const TgetUserObject (const std::string &param_name, bool is_dependency=true) const
 
const TgetUserObjectByName (const UserObjectName &object_name, bool is_dependency=true) const
 
const UserObjectBasegetUserObjectBase (const std::string &param_name, bool is_dependency=true) const
 
const UserObjectBasegetUserObjectBaseByName (const UserObjectName &object_name, bool is_dependency=true) const
 
const std::vector< MooseVariableScalar * > & getCoupledMooseScalarVars ()
 
const std::set< TagID > & getScalarVariableCoupleableVectorTags () const
 
const std::set< TagID > & getScalarVariableCoupleableMatrixTags () const
 
const GenericMaterialProperty< T, is_ad > & getGenericMaterialProperty (const std::string &name, MaterialData &material_data, const unsigned int state=0)
 
const GenericMaterialProperty< T, is_ad > & getGenericMaterialProperty (const std::string &name, const unsigned int state=0)
 
const GenericMaterialProperty< T, is_ad > & getGenericMaterialProperty (const std::string &name, const unsigned int state=0)
 
const MaterialProperty< T > & getMaterialProperty (const std::string &name, MaterialData &material_data, const unsigned int state=0)
 
const MaterialProperty< T > & getMaterialProperty (const std::string &name, const unsigned int state=0)
 
const MaterialProperty< T > & getMaterialProperty (const std::string &name, const unsigned int state=0)
 
const ADMaterialProperty< T > & getADMaterialProperty (const std::string &name, MaterialData &material_data)
 
const ADMaterialProperty< T > & getADMaterialProperty (const std::string &name)
 
const ADMaterialProperty< T > & getADMaterialProperty (const std::string &name)
 
const MaterialProperty< T > & getMaterialPropertyOld (const std::string &name, MaterialData &material_data)
 
const MaterialProperty< T > & getMaterialPropertyOld (const std::string &name)
 
const MaterialProperty< T > & getMaterialPropertyOld (const std::string &name)
 
const MaterialProperty< T > & getMaterialPropertyOlder (const std::string &name, MaterialData &material_data)
 
const MaterialProperty< T > & getMaterialPropertyOlder (const std::string &name)
 
const MaterialProperty< T > & getMaterialPropertyOlder (const std::string &name)
 
const GenericMaterialProperty< T, is_ad > & getGenericMaterialPropertyByName (const MaterialPropertyName &name, MaterialData &material_data, const unsigned int state)
 
const GenericMaterialProperty< T, is_ad > & getGenericMaterialPropertyByName (const MaterialPropertyName &name, const unsigned int state=0)
 
const GenericMaterialProperty< T, is_ad > & getGenericMaterialPropertyByName (const MaterialPropertyName &name, const unsigned int state=0)
 
const MaterialProperty< T > & getMaterialPropertyByName (const MaterialPropertyName &name, MaterialData &material_data, const unsigned int state=0)
 
const MaterialProperty< T > & getMaterialPropertyByName (const MaterialPropertyName &name, const unsigned int state=0)
 
const MaterialProperty< T > & getMaterialPropertyByName (const MaterialPropertyName &name, const unsigned int state=0)
 
const ADMaterialProperty< T > & getADMaterialPropertyByName (const MaterialPropertyName &name, MaterialData &material_data)
 
const ADMaterialProperty< T > & getADMaterialPropertyByName (const MaterialPropertyName &name)
 
const ADMaterialProperty< T > & getADMaterialPropertyByName (const MaterialPropertyName &name)
 
const MaterialProperty< T > & getMaterialPropertyOldByName (const MaterialPropertyName &name, MaterialData &material_data)
 
const MaterialProperty< T > & getMaterialPropertyOldByName (const MaterialPropertyName &name)
 
const MaterialProperty< T > & getMaterialPropertyOldByName (const MaterialPropertyName &name)
 
const MaterialProperty< T > & getMaterialPropertyOlderByName (const MaterialPropertyName &name, MaterialData &material_data)
 
const MaterialProperty< T > & getMaterialPropertyOlderByName (const MaterialPropertyName &name)
 
const MaterialProperty< T > & getMaterialPropertyOlderByName (const MaterialPropertyName &name)
 
Moose::Kokkos::MaterialProperty< T, dimension > getKokkosMaterialPropertyByName (const std::string &prop_name_in)
 
Moose::Kokkos::MaterialProperty< T, dimension > getKokkosMaterialPropertyOldByName (const std::string &prop_name)
 
Moose::Kokkos::MaterialProperty< T, dimension > getKokkosMaterialPropertyOlderByName (const std::string &prop_name)
 
Moose::Kokkos::MaterialProperty< T, dimension > getKokkosMaterialProperty (const std::string &name)
 
Moose::Kokkos::MaterialProperty< T, dimension > getKokkosMaterialPropertyOld (const std::string &name)
 
Moose::Kokkos::MaterialProperty< T, dimension > getKokkosMaterialPropertyOlder (const std::string &name)
 
std::pair< const MaterialProperty< T > *, std::set< SubdomainID > > getBlockMaterialProperty (const MaterialPropertyName &name)
 
std::pair< Moose::Kokkos::MaterialProperty< T, dimension >, std::set< SubdomainID > > getKokkosBlockMaterialProperty (const MaterialPropertyName &name)
 
const GenericMaterialProperty< T, is_ad > & getGenericZeroMaterialProperty (const std::string &name)
 
const GenericMaterialProperty< T, is_ad > & getGenericZeroMaterialProperty ()
 
const GenericMaterialProperty< T, is_ad > & getGenericZeroMaterialPropertyByName (const std::string &prop_name)
 
const MaterialProperty< T > & getZeroMaterialProperty (Ts... args)
 
std::set< SubdomainIDgetMaterialPropertyBlocks (const std::string &name)
 
std::vector< SubdomainName > getMaterialPropertyBlockNames (const std::string &name)
 
std::set< BoundaryIDgetMaterialPropertyBoundaryIDs (const std::string &name)
 
std::vector< BoundaryName > getMaterialPropertyBoundaryNames (const std::string &name)
 
void checkBlockAndBoundaryCompatibility (std::shared_ptr< MaterialBase > discrete)
 
std::unordered_map< SubdomainID, std::vector< MaterialBase * > > buildRequiredMaterials (bool allow_stateful=true)
 
void statefulPropertiesAllowed (bool)
 
virtual bool getMaterialPropertyCalled () const
 
virtual const std::unordered_set< unsigned int > & getMatPropDependencies () const
 
virtual void resolveOptionalProperties ()
 
const GenericMaterialProperty< T, is_ad > & getPossiblyConstantGenericMaterialPropertyByName (const MaterialPropertyName &prop_name, MaterialData &material_data, const unsigned int state)
 
bool isImplicit ()
 
Moose::StateArg determineState () const
 
virtual void threadJoin (const UserObject &) override
 
virtual void threadJoin (const UserObject &) override
 
virtual void subdomainSetup () override
 
virtual void subdomainSetup () override
 
bool hasUserObject (const std::string &param_name) const
 
bool hasUserObject (const std::string &param_name) const
 
bool hasUserObject (const std::string &param_name) const
 
bool hasUserObject (const std::string &param_name) const
 
bool hasUserObjectByName (const UserObjectName &object_name) const
 
bool hasUserObjectByName (const UserObjectName &object_name) const
 
bool hasUserObjectByName (const UserObjectName &object_name) const
 
bool hasUserObjectByName (const UserObjectName &object_name) const
 
const GenericOptionalMaterialProperty< T, is_ad > & getGenericOptionalMaterialProperty (const std::string &name, const unsigned int state=0)
 
const GenericOptionalMaterialProperty< T, is_ad > & getGenericOptionalMaterialProperty (const std::string &name, const unsigned int state=0)
 
const OptionalMaterialProperty< T > & getOptionalMaterialProperty (const std::string &name, const unsigned int state=0)
 
const OptionalMaterialProperty< T > & getOptionalMaterialProperty (const std::string &name, const unsigned int state=0)
 
const OptionalADMaterialProperty< T > & getOptionalADMaterialProperty (const std::string &name)
 
const OptionalADMaterialProperty< T > & getOptionalADMaterialProperty (const std::string &name)
 
const OptionalMaterialProperty< T > & getOptionalMaterialPropertyOld (const std::string &name)
 
const OptionalMaterialProperty< T > & getOptionalMaterialPropertyOld (const std::string &name)
 
const OptionalMaterialProperty< T > & getOptionalMaterialPropertyOlder (const std::string &name)
 
const OptionalMaterialProperty< T > & getOptionalMaterialPropertyOlder (const std::string &name)
 
MaterialBasegetMaterial (const std::string &name)
 
MaterialBasegetMaterial (const std::string &name)
 
MaterialBasegetMaterialByName (const std::string &name, bool no_warn=false)
 
MaterialBasegetMaterialByName (const std::string &name, bool no_warn=false)
 
bool hasMaterialProperty (const std::string &name)
 
bool hasMaterialProperty (const std::string &name)
 
bool hasMaterialPropertyByName (const std::string &name)
 
bool hasMaterialPropertyByName (const std::string &name)
 
bool hasADMaterialProperty (const std::string &name)
 
bool hasADMaterialProperty (const std::string &name)
 
bool hasADMaterialPropertyByName (const std::string &name)
 
bool hasADMaterialPropertyByName (const std::string &name)
 
bool hasKokkosMaterialProperty (const std::string &name)
 
bool hasKokkosMaterialProperty (const std::string &name)
 
bool hasKokkosMaterialPropertyByName (const std::string &name)
 
bool hasKokkosMaterialPropertyByName (const std::string &name)
 
bool hasGenericMaterialProperty (const std::string &name)
 
bool hasGenericMaterialProperty (const std::string &name)
 
bool hasGenericMaterialPropertyByName (const std::string &name)
 
bool hasGenericMaterialPropertyByName (const std::string &name)
 
const FunctiongetFunction (const std::string &name) const
 
const FunctiongetFunctionByName (const FunctionName &name) const
 
bool hasFunction (const std::string &param_name) const
 
bool hasFunctionByName (const FunctionName &name) const
 
Moose::Kokkos::Function getKokkosFunction (const std::string &name) const
 
const TgetKokkosFunction (const std::string &name) const
 
Moose::Kokkos::Function getKokkosFunctionByName (const FunctionName &name) const
 
const TgetKokkosFunctionByName (const FunctionName &name) const
 
bool hasKokkosFunction (const std::string &param_name) const
 
bool hasKokkosFunctionByName (const FunctionName &name) const
 
bool isDefaultPostprocessorValue (const std::string &param_name, const unsigned int index=0) const
 
bool hasPostprocessor (const std::string &param_name, const unsigned int index=0) const
 
bool hasPostprocessorByName (const PostprocessorName &name) const
 
std::size_t coupledPostprocessors (const std::string &param_name) const
 
const PostprocessorName & getPostprocessorName (const std::string &param_name, const unsigned int index=0) const
 
const VectorPostprocessorValuegetVectorPostprocessorValue (const std::string &param_name, const std::string &vector_name) const
 
const VectorPostprocessorValuegetVectorPostprocessorValue (const std::string &param_name, const std::string &vector_name, bool needs_broadcast) const
 
const VectorPostprocessorValuegetVectorPostprocessorValueByName (const VectorPostprocessorName &name, const std::string &vector_name) const
 
const VectorPostprocessorValuegetVectorPostprocessorValueByName (const VectorPostprocessorName &name, const std::string &vector_name, bool needs_broadcast) const
 
const VectorPostprocessorValuegetVectorPostprocessorValueOld (const std::string &param_name, const std::string &vector_name) const
 
const VectorPostprocessorValuegetVectorPostprocessorValueOld (const std::string &param_name, const std::string &vector_name, bool needs_broadcast) const
 
const VectorPostprocessorValuegetVectorPostprocessorValueOldByName (const VectorPostprocessorName &name, const std::string &vector_name) const
 
const VectorPostprocessorValuegetVectorPostprocessorValueOldByName (const VectorPostprocessorName &name, const std::string &vector_name, bool needs_broadcast) const
 
const ScatterVectorPostprocessorValuegetScatterVectorPostprocessorValue (const std::string &param_name, const std::string &vector_name) const
 
const ScatterVectorPostprocessorValuegetScatterVectorPostprocessorValueByName (const VectorPostprocessorName &name, const std::string &vector_name) const
 
const ScatterVectorPostprocessorValuegetScatterVectorPostprocessorValueOld (const std::string &param_name, const std::string &vector_name) const
 
const ScatterVectorPostprocessorValuegetScatterVectorPostprocessorValueOldByName (const VectorPostprocessorName &name, const std::string &vector_name) const
 
bool hasVectorPostprocessor (const std::string &param_name, const std::string &vector_name) const
 
bool hasVectorPostprocessor (const std::string &param_name) const
 
bool hasVectorPostprocessorByName (const VectorPostprocessorName &name, const std::string &vector_name) const
 
bool hasVectorPostprocessorByName (const VectorPostprocessorName &name) const
 
const VectorPostprocessorName & getVectorPostprocessorName (const std::string &param_name) const
 
TgetSampler (const std::string &name)
 
SamplergetSampler (const std::string &name)
 
TgetSamplerByName (const SamplerName &name)
 
SamplergetSamplerByName (const SamplerName &name)
 
virtual void meshDisplaced ()
 
PerfGraphperfGraph ()
 
const PostprocessorValuegetPostprocessorValue (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValue (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValueOld (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValueOld (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValueOlder (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValueOlder (const std::string &param_name, const unsigned int index=0) const
 
virtual const PostprocessorValuegetPostprocessorValueByName (const PostprocessorName &name) const
 
virtual const PostprocessorValuegetPostprocessorValueByName (const PostprocessorName &name) const
 
const PostprocessorValuegetPostprocessorValueOldByName (const PostprocessorName &name) const
 
const PostprocessorValuegetPostprocessorValueOldByName (const PostprocessorName &name) const
 
const PostprocessorValuegetPostprocessorValueOlderByName (const PostprocessorName &name) const
 
const PostprocessorValuegetPostprocessorValueOlderByName (const PostprocessorName &name) const
 
bool isVectorPostprocessorDistributed (const std::string &param_name) const
 
bool isVectorPostprocessorDistributed (const std::string &param_name) const
 
bool isVectorPostprocessorDistributedByName (const VectorPostprocessorName &name) const
 
bool isVectorPostprocessorDistributedByName (const VectorPostprocessorName &name) const
 
const DistributiongetDistribution (const std::string &name) const
 
const TgetDistribution (const std::string &name) const
 
const DistributiongetDistribution (const std::string &name) const
 
const TgetDistribution (const std::string &name) const
 
const DistributiongetDistributionByName (const DistributionName &name) const
 
const TgetDistributionByName (const std::string &name) const
 
const DistributiongetDistributionByName (const DistributionName &name) const
 
const TgetDistributionByName (const std::string &name) const
 
const Parallel::Communicator & comm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 
const std::vector< SubdomainName > & blocks () const
 
unsigned int numBlocks () const
 
virtual const std::set< SubdomainID > & blockIDs () const
 
unsigned int blocksMaxDimension () const
 
bool hasBlocks (const SubdomainName &name) const
 
bool hasBlocks (const std::vector< SubdomainName > &names) const
 
bool hasBlocks (const std::set< SubdomainName > &names) const
 
bool hasBlocks (SubdomainID id) const
 
bool hasBlocks (const std::vector< SubdomainID > &ids) const
 
bool hasBlocks (const std::set< SubdomainID > &ids) const
 
bool isBlockSubset (const std::set< SubdomainID > &ids) const
 
bool isBlockSubset (const std::vector< SubdomainID > &ids) const
 
bool hasBlockMaterialProperty (const std::string &prop_name)
 
const std::set< SubdomainID > & meshBlockIDs () const
 
virtual bool blockRestricted () const
 
virtual void checkVariable (const MooseVariableFieldBase &variable) const
 
const Moose::Functor< Real > * defaultFunctor (const std::string &name)
 
const Moose::Functor< ADReal > * defaultFunctor (const std::string &name)
 

Static Public Member Functions

static InputParameters validParams ()
 
static void callMooseError (MooseApp *const app, const InputParameters &params, std::string msg, const bool with_prefix, const hit::Node *node, const bool show_trace=true)
 
static void sort (typename std::vector< T > &vector)
 
static void sortDFS (typename std::vector< T > &vector)
 
static void cyclicDependencyError (CyclicDependencyException< T2 > &e, const std::string &header, NameFunc &&name_func)
 
static void cyclicDependencyError (CyclicDependencyException< T2 > &e, const std::string &header)
 
static std::string deduceFunctorName (const std::string &name, const InputParameters &params)
 

Public Attributes

 usingCombinedWarningSolutionWarnings
 
const ConsoleStream _console
 

Static Public Attributes

static const std::string type_param
 
static const std::string name_param
 
static const std::string unique_name_param
 
static const std::string app_param
 
static const std::string moose_base_param
 
static const std::string kokkos_object_param
 
static constexpr PropertyValue::id_type default_property_id
 
static constexpr PropertyValue::id_type zero_property_id
 
static constexpr auto SYSTEM
 
static constexpr auto NAME
 

Protected Member Functions

std::vector< std::unique_ptr< NumericVector< Number > > > & selectPressureGradient (const bool updated_pressure)
 Select the right pressure gradient field and return a reference to the container.
 
const std::vector< std::unique_ptr< NumericVector< Number > > > & pressureGradientComponents () const
 Get the registered pressure gradient component vectors.
 
void setupMeshInformation ()
 Compute the cell volumes on the mesh.
 
void populateCouplingFunctors (const std::vector< std::unique_ptr< NumericVector< Number > > > &raw_hbya, const std::vector< std::unique_ptr< NumericVector< Number > > > &raw_Ainv)
 Populate the face values of the H/A and 1/A fields.
 
template<typename VarType >
void checkBlocks (const VarType &var) const
 Check the block consistency between the passed in var and us.
 
virtual bool supportMeshVelocity () const override
 Returns whether the UO can support mesh velocity advection.
 
virtual void addPostprocessorDependencyHelper (const PostprocessorName &name) const override
 
virtual void addVectorPostprocessorDependencyHelper (const VectorPostprocessorName &name) const override
 
virtual void addUserObjectDependencyHelper (const UserObjectBase &uo) const override
 
void addReporterDependencyHelper (const ReporterName &reporter_name) override
 
void flagInvalidSolutionInternal (const InvalidSolutionID invalid_solution_id) const
 
InvalidSolutionID registerInvalidSolutionInternal (const std::string &message, const bool warning) const
 
const ReporterContextBasegetReporterContextBaseByName (const ReporterName &reporter_name) const
 
const ReporterNamegetReporterName (const std::string &param_name) const
 
TdeclareRestartableData (const std::string &data_name, Args &&... args)
 
ManagedValue< TdeclareManagedRestartableDataWithContext (const std::string &data_name, void *context, Args &&... args)
 
const TgetRestartableData (const std::string &data_name) const
 
TdeclareRestartableDataWithContext (const std::string &data_name, void *context, Args &&... args)
 
TdeclareRecoverableData (const std::string &data_name, Args &&... args)
 
TdeclareRestartableDataWithObjectName (const std::string &data_name, const std::string &object_name, Args &&... args)
 
TdeclareRestartableDataWithObjectNameWithContext (const std::string &data_name, const std::string &object_name, void *context, Args &&... args)
 
std::string restartableName (const std::string &data_name) const
 
const TgetMeshProperty (const std::string &data_name, const std::string &prefix)
 
const TgetMeshProperty (const std::string &data_name)
 
bool hasMeshProperty (const std::string &data_name, const std::string &prefix) const
 
bool hasMeshProperty (const std::string &data_name, const std::string &prefix) const
 
bool hasMeshProperty (const std::string &data_name) const
 
bool hasMeshProperty (const std::string &data_name) const
 
std::string meshPropertyName (const std::string &data_name) const
 
PerfID registerTimedSection (const std::string &section_name, const unsigned int level) const
 
PerfID registerTimedSection (const std::string &section_name, const unsigned int level, const std::string &live_message, const bool print_dots=true) const
 
std::string timedSectionName (const std::string &section_name) const
 
bool isCoupledScalar (const std::string &var_name, unsigned int i=0) const
 
unsigned int coupledScalarComponents (const std::string &var_name) const
 
unsigned int coupledScalar (const std::string &var_name, unsigned int comp=0) const
 
libMesh::Order coupledScalarOrder (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarValue (const std::string &var_name, unsigned int comp=0) const
 
const ADVariableValueadCoupledScalarValue (const std::string &var_name, unsigned int comp=0) const
 
const GenericVariableValue< is_ad > & coupledGenericScalarValue (const std::string &var_name, unsigned int comp=0) const
 
const GenericVariableValue< false > & coupledGenericScalarValue (const std::string &var_name, const unsigned int comp) const
 
const GenericVariableValue< true > & coupledGenericScalarValue (const std::string &var_name, const unsigned int comp) const
 
const VariableValuecoupledVectorTagScalarValue (const std::string &var_name, TagID tag, unsigned int comp=0) const
 
const VariableValuecoupledMatrixTagScalarValue (const std::string &var_name, TagID tag, unsigned int comp=0) const
 
const VariableValuecoupledScalarValueOld (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarValueOlder (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDot (const std::string &var_name, unsigned int comp=0) const
 
const ADVariableValueadCoupledScalarDot (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDotDot (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDotOld (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDotDotOld (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDotDu (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDotDotDu (const std::string &var_name, unsigned int comp=0) const
 
const MooseVariableScalargetScalarVar (const std::string &var_name, unsigned int comp) const
 
virtual void checkMaterialProperty (const std::string &name, const unsigned int state)
 
virtual void getKokkosMaterialPropertyHook (const std::string &, const unsigned int)
 
void markMatPropRequested (const std::string &)
 
MaterialPropertyName getMaterialPropertyName (const std::string &name) const
 
void checkExecutionStage ()
 
const TgetReporterValue (const std::string &param_name, const std::size_t time_index=0)
 
const TgetReporterValue (const std::string &param_name, ReporterMode mode, const std::size_t time_index=0)
 
const TgetReporterValue (const std::string &param_name, const std::size_t time_index=0)
 
const TgetReporterValue (const std::string &param_name, ReporterMode mode, const std::size_t time_index=0)
 
const TgetReporterValueByName (const ReporterName &reporter_name, const std::size_t time_index=0)
 
const TgetReporterValueByName (const ReporterName &reporter_name, ReporterMode mode, const std::size_t time_index=0)
 
const TgetReporterValueByName (const ReporterName &reporter_name, const std::size_t time_index=0)
 
const TgetReporterValueByName (const ReporterName &reporter_name, ReporterMode mode, const std::size_t time_index=0)
 
bool hasReporterValue (const std::string &param_name) const
 
bool hasReporterValue (const std::string &param_name) const
 
bool hasReporterValue (const std::string &param_name) const
 
bool hasReporterValue (const std::string &param_name) const
 
bool hasReporterValueByName (const ReporterName &reporter_name) const
 
bool hasReporterValueByName (const ReporterName &reporter_name) const
 
bool hasReporterValueByName (const ReporterName &reporter_name) const
 
bool hasReporterValueByName (const ReporterName &reporter_name) const
 
const GenericMaterialProperty< T, is_ad > * defaultGenericMaterialProperty (const std::string &name)
 
const GenericMaterialProperty< T, is_ad > * defaultGenericMaterialProperty (const std::string &name)
 
const MaterialProperty< T > * defaultMaterialProperty (const std::string &name)
 
const MaterialProperty< T > * defaultMaterialProperty (const std::string &name)
 
const ADMaterialProperty< T > * defaultADMaterialProperty (const std::string &name)
 
const ADMaterialProperty< T > * defaultADMaterialProperty (const std::string &name)
 
virtual bool hasBlockMaterialPropertyHelper (const std::string &prop_name)
 
void initializeBlockRestrictable (const MooseObject *moose_object)
 
void initializeKokkosBlockRestrictable ()
 
Moose::CoordinateSystemType getBlockCoordSystem ()
 
KOKKOS_FUNCTION dof_id_type numKokkosBlockElements () const
 
KOKKOS_FUNCTION dof_id_type numKokkosBlockNodes () const
 
KOKKOS_FUNCTION dof_id_type numKokkosBlockSides () const
 
KOKKOS_FUNCTION ContiguousElementID kokkosBlockElementID (Moose::Kokkos::ThreadID tid) const
 
KOKKOS_FUNCTION ContiguousElementID kokkosBlockNodeID (Moose::Kokkos::ThreadID tid) const
 
KOKKOS_FUNCTION auto kokkosBlockElementSideID (Moose::Kokkos::ThreadID tid) const
 
std::string deduceFunctorName (const std::string &name) const
 
const Moose::Functor< T > & getFunctor (const std::string &name)
 
const Moose::Functor< T > & getFunctor (const std::string &name, THREAD_ID tid)
 
const Moose::Functor< T > & getFunctor (const std::string &name, SubProblem &subproblem)
 
const Moose::Functor< T > & getFunctor (const std::string &name, SubProblem &subproblem, THREAD_ID tid)
 
bool isFunctor (const std::string &name) const
 
bool isFunctor (const std::string &name, const SubProblem &subproblem) const
 
Moose::ElemArg makeElemArg (const Elem *elem, bool correct_skewnewss=false) const
 
void checkFunctorSupportsSideIntegration (const std::string &name, bool qp_integration)
 
const Moose::Functor< T > & getFunctorByName (const std::string &name)
 

Static Protected Member Functions

static std::string meshPropertyName (const std::string &data_name, const std::string &prefix)
 

Protected Attributes

const MooseMesh_moose_mesh
 The MooseMesh that this user object operates on.
 
const libMesh::MeshBase_mesh
 The libMesh mesh that this object acts on.
 
const unsigned int _dim
 The dimension of the mesh, e.g. 3 for hexes and tets, 2 for quads and tris.
 
const MooseLinearVariableFVReal *const _p
 The thread 0 copy of the pressure variable.
 
std::vector< const MooseLinearVariableFVReal * > _vel
 The thread 0 copy of the x-velocity variable.
 
LinearFVPressureCorrectionDiffusion_p_diffusion_kernel
 Pointer to the pressure diffusion term in the pressure Poisson equation.
 
FaceCenteredMapFunctor< Real, std::unordered_map< dof_id_type, Real > > _HbyA_flux
 A map functor from faces to $HbyA_{ij} = (A_{offdiag}*\mathrm{(predicted~velocity)} - \mathrm{Source})_{ij}/A_{ij}$.
 
std::vector< std::unique_ptr< NumericVector< Number > > > _HbyA_raw
 We hold on to the cell-based HbyA vectors so that we can easily reconstruct the cell velocities as well.
 
FaceCenteredMapFunctor< RealVectorValue, std::unordered_map< dof_id_type, RealVectorValue > > _Ainv
 A map functor from faces to $(1/A)_f$.
 
std::vector< std::unique_ptr< NumericVector< Number > > > _Ainv_raw
 We hold on to the cell-based 1/A vectors so that we can easily reconstruct the cell velocities as well.
 
std::unique_ptr< NumericVector< Number > > _A_avg
 
FaceCenteredMapFunctor< Real, std::unordered_map< dof_id_type, Real > > & _face_mass_flux
 A map functor from faces to mass fluxes which are used in the advection terms.
 
std::vector< std::unique_ptr< NumericVector< Number > > > _grad_p_current
 for a PISO iteration we need to hold on to the original pressure gradient field.
 
const Moose::Functor< Real > & _rho
 Functor describing the density of the fluid.
 
std::vector< LinearSystem * > _momentum_systems
 Pointers to the linear system(s) in moose corresponding to the momentum equation(s)
 
std::vector< unsigned int_momentum_system_numbers
 Numbers of the momentum system(s)
 
std::vector< unsigned int_global_momentum_system_numbers
 Global numbers of the momentum system(s)
 
std::vector< libMesh::LinearImplicitSystem * > _momentum_implicit_systems
 Pointers to the momentum equation implicit system(s) from libmesh.
 
LinearSystem_pressure_system
 Pointer to the pressure system.
 
const LinearFVGradientReader_pressure_gradient_field
 Registered pressure gradient field used by Rhie-Chow and compatible momentum pressure kernels.
 
unsigned int _global_pressure_system_number
 Global number of the pressure system.
 
std::unique_ptr< NumericVector< Number > > _cell_volumes
 We will hold a vector of cell volumes to make sure we can do volume corrections rapidly.
 
const MooseEnum _pressure_projection_method
 Enumerator for the method used for pressure projection.
 
const Moose::FV::InterpMethod _pressure_diffusion_interp_method
 Interpolation method used for the pressure diffusion coefficient on faces.
 
const Moose::CoordinateSystemType_coord_sys
 
const THREAD_ID _tid
 
SubProblem_subproblem
 
FEProblemBase_fe_problem
 
SystemBase_sys
 
Assembly_assembly
 
const bool _duplicate_initial_execution
 
std::set< std::string > _depend_uo
 
const bool & _enabled
 
MooseApp_app
 
Factory_factory
 
ActionFactory_action_factory
 
const std::string & _type
 
const std::string & _name
 
const InputParameters_pars
 
const ExecFlagEnum_execute_enum
 
const ExecFlagType_current_execute_flag
 
MooseApp_restartable_app
 
const std::string _restartable_system_name
 
const THREAD_ID _restartable_tid
 
const bool _restartable_read_only
 
FEProblemBase_mci_feproblem
 
FEProblemBase_mdi_feproblem
 
MooseApp_pg_moose_app
 
const std::string _prefix
 
FEProblemBase_sc_fe_problem
 
const THREAD_ID _sc_tid
 
const Real & _real_zero
 
const VariableValue_scalar_zero
 
const Point & _point_zero
 
const InputParameters_mi_params
 
const std::string _mi_name
 
const MooseObjectName _mi_moose_object_name
 
FEProblemBase_mi_feproblem
 
SubProblem_mi_subproblem
 
const THREAD_ID _mi_tid
 
const bool _is_kokkos_object
 
const Moose::MaterialDataType _material_data_type
 
MaterialData_material_data
 
bool _stateful_allowed
 
bool _get_material_property_called
 
std::vector< std::unique_ptr< PropertyValue > > _default_properties
 
std::unordered_set< unsigned int_material_property_dependencies
 
const MaterialPropertyName _get_suffix
 
const bool _use_interpolated_state
 
const InputParameters_ti_params
 
FEProblemBase_ti_feproblem
 
bool _is_implicit
 
Real & _t
 
const Real & _t_old
 
int_t_step
 
Real & _dt
 
Real & _dt_old
 
bool _is_transient
 
const Parallel::Communicator & _communicator
 
const MaterialData_blk_material_data
 

Static Protected Attributes

static const std::string _interpolated_old
 
static const std::string _interpolated_older
 

Private Member Functions

const Moose::FunctionBasegetKokkosFunctionByNameHelper (const FunctionName &name) const
 
const UserObjectBasegetUserObjectFromFEProblem (const UserObjectName &object_name, const THREAD_ID tid=0) const
 
const TcastUserObject (const UserObjectBase &uo_base, const std::string &param_name="") const
 
void mooseObjectError (const std::string &param_name, std::stringstream &oss) const
 
const std::string & userObjectType (const UserObjectBase &uo) const
 
const std::string & userObjectName (const UserObjectBase &uo) const
 
const PostprocessorName & getPostprocessorNameInternal (const std::string &param_name, const unsigned int index, const bool allow_default_value=true) const
 
bool isDefaultPostprocessorValueByName (const PostprocessorName &name) const
 
PostprocessorValue getDefaultPostprocessorValueByName (const PostprocessorName &name) const
 
void checkParam (const std::string &param_name, const unsigned int index=std::numeric_limits< unsigned int >::max()) const
 
bool postprocessorsAdded () const
 
const VectorPostprocessorValuegetVectorPostprocessorByNameHelper (const VectorPostprocessorName &name, const std::string &vector_name, bool broadcast, std::size_t t_index) const
 
const VectorPostprocessorContext< VectorPostprocessorValue > & getVectorPostprocessorContextByNameHelper (const VectorPostprocessorName &name, const std::string &vector_name) const
 
bool vectorPostprocessorsAdded () const
 
bool reportersAdded () const
 
void possiblyCheckHasReporter (const ReporterName &reporter_name, const std::string &param_name="") const
 
RestartableDataValueregisterRestartableDataOnApp (std::unique_ptr< RestartableDataValue > data, THREAD_ID tid) const
 
void registerRestartableNameWithFilterOnApp (const std::string &name, Moose::RESTARTABLE_FILTER filter)
 
RestartableData< T > & declareRestartableDataHelper (const std::string &data_name, void *context, Args &&... args) const
 
virtual std::string meshPropertyPrefix (const std::string &data_name) const
 
const RestartableDataValuegetMeshPropertyInternal (const std::string &data_name, const std::string &prefix) const
 
void mooseErrorInternal (Args &&... args) const
 
const VariableValuegetDefaultValue (const std::string &var_name) const
 
const ADVariableValuegetADDefaultValue (const std::string &var_name) const
 
void checkVar (const std::string &var_name) const
 
void validateExecutionerType (const std::string &name, const std::string &fn_name) const
 
Moose::MaterialDataType getMaterialDataType (const std::set< BoundaryID > &boundary_ids) const
 
unsigned int getMaxQps () const
 
void addConsumedPropertyName (const MooseObjectName &obj_name, const std::string &prop_name)
 
const PostprocessorValuegetPostprocessorValueInternal (const std::string &param_name, unsigned int index, std::size_t t_index) const
 
const PostprocessorValuegetPostprocessorValueInternal (const std::string &param_name, unsigned int index, std::size_t t_index) const
 
const PostprocessorValuegetPostprocessorValueByNameInternal (const PostprocessorName &name, std::size_t t_index) const
 
const PostprocessorValuegetPostprocessorValueByNameInternal (const PostprocessorName &name, std::size_t t_index) const
 
void possiblyCheckHasVectorPostprocessor (const std::string &param_name, const std::string &vector_name) const
 
void possiblyCheckHasVectorPostprocessor (const std::string &param_name, const std::string &vector_name) const
 
void possiblyCheckHasVectorPostprocessorByName (const VectorPostprocessorName &name, const std::string &vector_name) const
 
void possiblyCheckHasVectorPostprocessorByName (const VectorPostprocessorName &name, const std::string &vector_name) const
 
const Moose::Functor< T > * defaultFunctor (const std::string &name)
 
const Moose::Functor< Real > * defaultFunctor (const std::string &name)
 
const Moose::Functor< ADReal > * defaultFunctor (const std::string &name)
 
const Moose::Functor< T > & getFunctorByName (const std::string &name, SubProblem &subproblem, THREAD_ID tid)
 
virtual bool isADObject () const override
 

Static Private Member Functions

static const hit::Node * getHitNode (const InputParameters &params)
 
static std::string messagePrefix (const InputParameters &params, const bool hit_prefix)
 

Private Attributes

std::vector< const FaceInfo * > _flow_face_info
 The subset of the FaceInfo objects that actually cover the subdomains which the flow field is defined on.
 
UserObject_primary_thread_copy
 
std::set< std::string > _supplied_uo
 
const ParallelParamObject_parent
 
const MooseBase_si_moose_base
 
const FEProblemBase_si_problem
 
ExecFlagEnum _empty_execute_enum
 
const MooseObject_fni_object
 
const InputParameters_fni_params
 
FEProblemBase_fni_feproblem
 
const THREAD_ID _fni_tid
 
const MooseObject_uoi_moose_object
 
const FEProblemBase_uoi_feproblem
 
const THREAD_ID _uoi_tid
 
const MooseObject_ppi_moose_object
 
const InputParameters_ppi_params
 
const FEProblemBase_ppi_feproblem
 
std::map< PostprocessorName, std::unique_ptr< PostprocessorValue > > _default_values
 
const bool _broadcast_by_default
 
const MooseObject_vpi_moose_object
 
const FEProblemBase_vpi_feproblem
 
const THREAD_ID _vpi_tid
 
const InputParameters_ri_params
 
FEProblemBase_ri_fe_problem_base
 
const ReporterData_ri_reporter_data
 
const MooseObject_ri_moose_object
 
const InputParameters_dni_params
 
FEProblemBase_dni_feproblem
 
const MooseObject *const _dni_moose_object_ptr
 
const InputParameters_si_params
 
FEProblemBase_si_feproblem
 
THREAD_ID _si_tid
 
const RestartableDataMapName _metaname
 
std::string _restartable_name
 
MooseApp_meta_data_app
 
const MooseObject *const _meta_data_object
 
const InputParameters_sc_parameters
 
const std::string & _sc_name
 
const bool _sc_is_implicit
 
std::unordered_map< std::string, std::vector< MooseVariableScalar * > > _coupled_scalar_vars
 
std::unordered_map< std::string, std::unique_ptr< VariableValue > > _default_value
 
std::unordered_map< std::string, std::unique_ptr< ADVariableValue > > _dual_default_value
 
std::vector< MooseVariableScalar * > _coupled_moose_scalar_vars
 
std::unordered_map< std::string, std::vector< MooseVariableFieldBase * > > _sc_coupled_vars
 
std::set< TagID_sc_coupleable_vector_tags
 
std::set< TagID_sc_coupleable_matrix_tags
 
const MooseObject_mi_moose_object
 
const bool _mi_boundary_restricted
 
const std::set< SubdomainID > & _mi_block_ids
 
const std::set< BoundaryID > & _mi_boundary_ids
 
std::vector< std::unique_ptr< OptionalMaterialPropertyProxyBase< MaterialPropertyInterface > > > _optional_property_proxies
 
const std::string _ti_name
 
std::set< SubdomainID_blk_ids
 
std::vector< SubdomainID_vec_ids
 
std::vector< SubdomainName > _blocks
 
const bool _blk_dual_restrictable
 
FEProblemBase_blk_feproblem
 
const MooseMesh_blk_mesh
 
const std::set< BoundaryID_empty_boundary_ids
 
const std::set< BoundaryID > & _boundary_ids
 
THREAD_ID _blk_tid
 
const std::string & _blk_name
 
unsigned int _blk_dim
 
const MooseObject_moose_object
 
Moose::Kokkos::Array< ContiguousElementID_kokkos_element_ids
 
Moose::Kokkos::Array< ContiguousNodeID_kokkos_node_ids
 
Moose::Kokkos::Array< Moose::Kokkos::Pair< ContiguousElementID, unsigned int > > _kokkos_element_side_ids
 
const InputParameters_fi_params
 
const std::string _fi_name
 
SubProblem *const _fi_subproblem
 
const THREAD_ID _fi_tid
 
std::vector< std::unique_ptr< Moose::Functor< Real > > > _default_real_functors
 
std::vector< std::unique_ptr< Moose::Functor< ADReal > > > _default_ad_real_functors
 

Detailed Description

User object responsible for determining the face fluxes using the Rhie-Chow interpolation in a segregated solver that uses the linear FV formulation.

Definition at line 37 of file RhieChowMassFlux.h.

Constructor & Destructor Documentation

◆ RhieChowMassFlux()

RhieChowMassFlux::RhieChowMassFlux ( const InputParameters params)

Definition at line 70 of file RhieChowMassFlux.C.

76 _p(dynamic_cast<MooseLinearVariableFVReal *>(
77 &UserObject::_subproblem.getVariable(0, getParam<VariableName>(NS::pressure)))),
78 _vel(_dim, nullptr),
79 _HbyA_flux(_moose_mesh, blockIDs(), "HbyA_flux"),
80 _Ainv(_moose_mesh, blockIDs(), "Ainv"),
82 declareRestartableData<FaceCenteredMapFunctor<Real, std::unordered_map<dof_id_type, Real>>>(
83 "face_flux", _moose_mesh, blockIDs(), "face_values")),
84 _rho(getFunctor<Real>(NS::density)),
85 _pressure_system(nullptr),
88 _pressure_projection_method(getParam<MooseEnum>("pressure_projection_method")),
89 _pressure_diffusion_interp_method(getParam<MooseEnum>("pressure_diffusion_interpolation") ==
90 "harmonic"
91 ? Moose::FV::InterpMethod::HarmonicAverage
92 : Moose::FV::InterpMethod::Average)
93{
94 if (!_p)
95 paramError(NS::pressure, "the pressure must be a MooseLinearVariableFVReal.");
97
98 std::vector<std::string> vel_names = {"u", "v", "w"};
99 for (const auto i : index_range(_vel))
100 {
101 _vel[i] = dynamic_cast<MooseLinearVariableFVReal *>(
102 &UserObject::_subproblem.getVariable(0, getParam<VariableName>(vel_names[i])));
103
104 if (!_vel[i])
105 paramError(vel_names[i], "the velocity must be a MOOSELinearVariableFVReal.");
106 checkBlocks(*_vel[i]);
107 }
108
109 // Register the elemental/face functors which will be queried in the pressure equation
110 for (const auto tid : make_range(libMesh::n_threads()))
111 {
114 }
115
116 if (!dynamic_cast<SIMPLE *>(getMooseApp().getExecutioner()) &&
117 !dynamic_cast<PIMPLE *>(getMooseApp().getExecutioner()))
118 mooseError(this->name(),
119 " should only be used with a linear segregated thermal-hydraulics solver!");
120}
unsigned int blocksMaxDimension() const
virtual const std::set< SubdomainID > & blockIDs() const
A functor whose evaluation relies on querying a map where the keys are face info ids and the values c...
const std::string & name() const
void paramError(const std::string &param, Args... args) const
void mooseError(Args &&... args) const
MooseApp & getMooseApp() const
MeshBase & getMesh()
Executioner set up to solve a transient thermal-hydraulics problem using the PIMPLE algorithm.
Definition PIMPLE.h:21
T & declareRestartableData(const std::string &data_name, Args &&... args)
const MooseMesh & _moose_mesh
The MooseMesh that this user object operates on.
const Moose::FV::InterpMethod _pressure_diffusion_interp_method
Interpolation method used for the pressure diffusion coefficient on faces.
const LinearFVGradientReader * _pressure_gradient_field
Registered pressure gradient field used by Rhie-Chow and compatible momentum pressure kernels.
std::vector< const MooseLinearVariableFVReal * > _vel
The thread 0 copy of the x-velocity variable.
const libMesh::MeshBase & _mesh
The libMesh mesh that this object acts on.
unsigned int _global_pressure_system_number
Global number of the pressure system.
const MooseLinearVariableFVReal *const _p
The thread 0 copy of the pressure variable.
LinearSystem * _pressure_system
Pointer to the pressure system.
void checkBlocks(const VarType &var) const
Check the block consistency between the passed in var and us.
const Moose::Functor< Real > & _rho
Functor describing the density of the fluid.
FaceCenteredMapFunctor< RealVectorValue, std::unordered_map< dof_id_type, RealVectorValue > > _Ainv
A map functor from faces to $(1/A)_f$.
const unsigned int _dim
The dimension of the mesh, e.g. 3 for hexes and tets, 2 for quads and tris.
FaceCenteredMapFunctor< Real, std::unordered_map< dof_id_type, Real > > & _face_mass_flux
A map functor from faces to mass fluxes which are used in the advection terms.
FaceCenteredMapFunctor< Real, std::unordered_map< dof_id_type, Real > > _HbyA_flux
A map functor from faces to $HbyA_{ij} = (A_{offdiag}*\mathrm{(predicted~velocity)} - \mathrm{Source}...
const MooseEnum _pressure_projection_method
Enumerator for the method used for pressure projection.
Executioner set up to solve a thermal-hydraulics problem using the SIMPLE algorithm.
Definition SIMPLE.h:20
virtual const MooseVariableFieldBase & getVariable(const THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type=Moose::VarKindType::VAR_ANY, Moose::VarFieldType expected_var_field_type=Moose::VarFieldType::VAR_FIELD_ANY) const=0
void addFunctor(const std::string &name, const Moose::FunctorBase< T > &functor, const THREAD_ID tid)
SubProblem & _subproblem
MeshBase & mesh
static const std::string density
Definition NS.h:34
static const std::string pressure
Definition NS.h:57
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
auto index_range(const T &sizable)
IntRange< T > make_range(T beg, T end)
unsigned int n_threads()

Member Function Documentation

◆ checkBlocks()

template<typename VarType >
void RhieChowMassFlux::checkBlocks ( const VarType &  var) const
protected

Check the block consistency between the passed in var and us.

Definition at line 214 of file RhieChowMassFlux.h.

215{
216 const auto & var_blocks = var.blockIDs();
217 const auto & uo_blocks = blockIDs();
218
219 // Error if this UO has any blocks that the variable does not
220 std::set<SubdomainID> uo_blocks_minus_var_blocks;
221 std::set_difference(uo_blocks.begin(),
222 uo_blocks.end(),
223 var_blocks.begin(),
224 var_blocks.end(),
225 std::inserter(uo_blocks_minus_var_blocks, uo_blocks_minus_var_blocks.end()));
226 if (uo_blocks_minus_var_blocks.size() > 0)
227 mooseError("Block restriction of interpolator user object '",
228 this->name(),
229 "' (",
231 ") includes blocks not in the block restriction of variable '",
232 var.name(),
233 "' (",
234 Moose::stringify(var.blocks()),
235 ")");
236
237 // Get the blocks in the variable but not this UO
238 std::set<SubdomainID> var_blocks_minus_uo_blocks;
239 std::set_difference(var_blocks.begin(),
240 var_blocks.end(),
241 uo_blocks.begin(),
242 uo_blocks.end(),
243 std::inserter(var_blocks_minus_uo_blocks, var_blocks_minus_uo_blocks.end()));
244
245 // For each block in the variable but not this UO, error if there is connection
246 // to any blocks on the UO.
247 for (auto & block_id : var_blocks_minus_uo_blocks)
248 {
249 const auto connected_blocks = _moose_mesh.getBlockConnectedBlocks(block_id);
250 std::set<SubdomainID> connected_blocks_on_uo;
251 std::set_intersection(connected_blocks.begin(),
252 connected_blocks.end(),
253 uo_blocks.begin(),
254 uo_blocks.end(),
255 std::inserter(connected_blocks_on_uo, connected_blocks_on_uo.end()));
256 if (connected_blocks_on_uo.size() > 0)
257 mooseError("Block restriction of interpolator user object '",
258 this->name(),
259 "' (",
260 Moose::stringify(uo_blocks),
261 ") doesn't match the block restriction of variable '",
262 var.name(),
263 "' (",
264 Moose::stringify(var_blocks),
265 ")");
266 }
267}
const std::vector< SubdomainName > & blocks() const
const std::set< SubdomainID > & getBlockConnectedBlocks(const SubdomainID subdomain_id) const
std::string stringify(const T &t)

Referenced by RhieChowMassFlux().

◆ computeCellVelocity()

void RhieChowMassFlux::computeCellVelocity ( )

Update the cell values of the velocity variables.

Definition at line 416 of file RhieChowMassFlux.C.

417{
418 const auto & pressure_gradient = pressureGradientComponents();
419
420 // We set the dof value in the solution vector the same logic applies:
421 // u_C = -(H/A)_C - (1/A)_C*grad(p)_C where C is the cell index
422 for (const auto system_i : index_range(_momentum_implicit_systems))
423 {
424 auto working_vector = _Ainv_raw[system_i]->clone();
425 working_vector->pointwise_mult(*working_vector, *pressure_gradient[system_i]);
426 working_vector->add(*_HbyA_raw[system_i]);
427 working_vector->scale(-1.0);
428 (*_momentum_implicit_systems[system_i]->solution) = *working_vector;
429 _momentum_implicit_systems[system_i]->update();
430 _momentum_systems[system_i]->setSolution(
431 *_momentum_implicit_systems[system_i]->current_local_solution);
432 }
433}
const std::vector< std::unique_ptr< NumericVector< Number > > > & pressureGradientComponents() const
Get the registered pressure gradient component vectors.
std::vector< LinearSystem * > _momentum_systems
Pointers to the linear system(s) in moose corresponding to the momentum equation(s)
std::vector< std::unique_ptr< NumericVector< Number > > > _Ainv_raw
We hold on to the cell-based 1/A vectors so that we can easily reconstruct the cell velocities as wel...
std::vector< std::unique_ptr< NumericVector< Number > > > _HbyA_raw
We hold on to the cell-based HbyA vectors so that we can easily reconstruct the cell velocities as we...
std::vector< libMesh::LinearImplicitSystem * > _momentum_implicit_systems
Pointers to the momentum equation implicit system(s) from libmesh.

Referenced by LinearAssemblySegregatedSolve::correctVelocity().

◆ computeFaceMassFlux()

void RhieChowMassFlux::computeFaceMassFlux ( )

Update the values of the face velocities in the containers.

Definition at line 346 of file RhieChowMassFlux.C.

347{
348 using namespace Moose::FV;
349
350 const auto time_arg = Moose::currentState();
351
352 // Petsc vector reader to make the repeated reading from the vector faster
353 PetscVectorReader p_reader(*_pressure_system->system().current_local_solution);
354
355 // We loop through the faces and compute the face fluxes using the pressure gradient
356 // and the momentum matrix/right hand side
357 for (auto & fi : _flow_face_info)
358 {
359 // Making sure the kernel knows which face we are on
361
362 // We are setting this to 1.0 because we don't want to multiply the kernel contributions
363 // with the surface area yet. The surface area will be factored in in the advection kernels.
365
366 Real p_grad_flux = 0.0;
367 if (_p->isInternalFace(*fi))
368 {
369 const auto & elem_info = *fi->elemInfo();
370 const auto & neighbor_info = *fi->neighborInfo();
371
372 // Fetching the dof indices for the pressure variable
373 const auto elem_dof = elem_info.dofIndices()[_global_pressure_system_number][0];
374 const auto neighbor_dof = neighbor_info.dofIndices()[_global_pressure_system_number][0];
375
376 // Fetching the values of the pressure for the element and the neighbor
377 const auto p_elem_value = p_reader(elem_dof);
378 const auto p_neighbor_value = p_reader(neighbor_dof);
379
380 // Compute the elem matrix contributions for the face
381 const auto elem_matrix_contribution = _p_diffusion_kernel->computeElemMatrixContribution();
382 const auto neighbor_matrix_contribution =
384 const auto elem_rhs_contribution =
386
387 // Compute the face flux from the matrix and right hand side contributions
388 p_grad_flux = (p_neighbor_value * neighbor_matrix_contribution +
389 p_elem_value * elem_matrix_contribution) -
390 elem_rhs_contribution;
391 }
392 else if (auto * bc_pointer = _p->getBoundaryCondition(*fi->boundaryIDs().begin()))
393 {
394 mooseAssert(fi->boundaryIDs().size() == 1, "We should only have one boundary on every face.");
395
396 bc_pointer->setupFaceData(
397 fi, fi->faceType(std::make_pair(_p->number(), _global_pressure_system_number)));
398
399 const ElemInfo & elem_info =
400 hasBlocks(fi->elemPtr()->subdomain_id()) ? *fi->elemInfo() : *fi->neighborInfo();
401 const auto p_elem_value = _p->getElemValue(elem_info, time_arg);
402 const auto matrix_contribution =
404 const auto rhs_contribution =
406
407 // On the boundary, only the element side has a contribution
408 p_grad_flux = (p_elem_value * matrix_contribution - rhs_contribution);
409 }
410 // Compute the new face flux
411 _face_mass_flux[fi->id()] = -_HbyA_flux[fi->id()] + p_grad_flux;
412 }
413}
bool hasBlocks(const SubdomainName &name) const
virtual Real computeBoundaryRHSContribution(const LinearFVBoundaryCondition &bc) override
virtual Real computeElemMatrixContribution() override
virtual Real computeNeighborMatrixContribution() override
virtual Real computeElemRightHandSideContribution() override
virtual Real computeBoundaryMatrixContribution(const LinearFVBoundaryCondition &bc) override
virtual void setupFaceData(const FaceInfo *face_info)
void setCurrentFaceArea(const Real area)
virtual System & system() override
Real getElemValue(const ElemInfo &elem_info, const StateArg &state) const
LinearFVBoundaryCondition * getBoundaryCondition(const BoundaryID bd_id) const
unsigned int number() const
bool isInternalFace(const FaceInfo &) const
LinearFVPressureCorrectionDiffusion * _p_diffusion_kernel
Pointer to the pressure diffusion term in the pressure Poisson equation.
std::vector< const FaceInfo * > _flow_face_info
The subset of the FaceInfo objects that actually cover the subdomains which the flow field is defined...
StateArg currentState()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

Referenced by LinearAssemblySegregatedSolve::correctVelocity().

◆ computeHbyA()

void RhieChowMassFlux::computeHbyA ( const bool  with_updated_pressure,
const bool  verbose 
)

Computes the inverse of the diagonal (1/A) of the system matrix plus the H/A components for the pressure equation plus Rhie-Chow interpolation.

Definition at line 561 of file RhieChowMassFlux.C.

562{
563 if (verbose)
564 {
565 _console << "************************************" << std::endl;
566 _console << "Computing HbyA" << std::endl;
567 _console << "************************************" << std::endl;
568 }
570 "The momentum system shall be linked before calling this function!");
571
572 auto & pressure_gradient = selectPressureGradient(with_updated_pressure);
573
574 _HbyA_raw.clear();
575 _Ainv_raw.clear();
576
577 for (auto system_i : index_range(_momentum_systems))
578 {
579 LinearImplicitSystem * momentum_system = _momentum_implicit_systems[system_i];
580
581 NumericVector<Number> & rhs = *(momentum_system->rhs);
582 NumericVector<Number> & current_local_solution = *(momentum_system->current_local_solution);
583 NumericVector<Number> & solution = *(momentum_system->solution);
584 PetscMatrix<Number> * mmat = dynamic_cast<PetscMatrix<Number> *>(momentum_system->matrix);
585 mooseAssert(mmat,
586 "The matrices used in the segregated INSFVRhieChow objects need to be convertable "
587 "to PetscMatrix!");
588
589 if (verbose)
590 {
591 _console << "Matrix in rc object" << std::endl;
592 mmat->print();
593 }
594
595 // First, we extract the diagonal and we will hold on to it for a little while
596 _Ainv_raw.push_back(current_local_solution.zero_clone());
597 NumericVector<Number> & Ainv = *(_Ainv_raw.back());
598
599 mmat->get_diagonal(Ainv);
600
601 if (verbose)
602 {
603 _console << "Velocity solution in H(u)" << std::endl;
604 solution.print();
605 }
606
607 // Time to create H(u) = M_{offdiag} * u - b_{nonpressure}
608 _HbyA_raw.push_back(current_local_solution.zero_clone());
609 NumericVector<Number> & HbyA = *(_HbyA_raw.back());
610
611 // We start with the matrix product part, we will do
612 // M*u - A*u for 2 reasons:
613 // 1, We assume A*u petsc operation is faster than setting the matrix diagonal to 0
614 // 2, In PISO loops we need to reuse the matrix so we can't just set the diagonals to 0
615
616 // We create a working vector to ease some of the operations, we initialize its values
617 // with the current solution values to have something for the A*u term
618 auto working_vector = momentum_system->current_local_solution->zero_clone();
619 PetscVector<Number> * working_vector_petsc =
620 dynamic_cast<PetscVector<Number> *>(working_vector.get());
621 mooseAssert(working_vector_petsc,
622 "The vectors used in the RhieChowMassFlux objects need to be convertable "
623 "to PetscVectors!");
624
625 mmat->vector_mult(HbyA, solution);
626 working_vector_petsc->pointwise_mult(Ainv, solution);
627 HbyA.add(-1.0, *working_vector_petsc);
628
629 if (verbose)
630 {
631 _console << " H(u)" << std::endl;
632 HbyA.print();
633 }
634
635 // We continue by adding the momentum right hand side contributions
636 HbyA.add(-1.0, rhs);
637
638 // Unfortunately, the pressure forces are included in the momentum RHS
639 // so we have to correct them back
640 working_vector_petsc->pointwise_mult(*pressure_gradient[system_i], *_cell_volumes);
641 HbyA.add(-1.0, *working_vector_petsc);
642
643 if (verbose)
644 {
645 _console << "total RHS" << std::endl;
646 rhs.print();
647 _console << "pressure RHS" << std::endl;
648 pressure_gradient[system_i]->print();
649 _console << " H(u)-rhs-relaxation_source" << std::endl;
650 HbyA.print();
651 }
652
653 // It is time to create element-wise 1/A-s based on the the diagonal of the momentum matrix
654 *working_vector_petsc = 1.0;
655 Ainv.pointwise_divide(*working_vector_petsc, Ainv);
656
657 // Create 1/A*(H(u)-RHS)
658 HbyA.pointwise_mult(HbyA, Ainv);
659
660 if (verbose)
661 {
662 _console << " (H(u)-rhs)/A" << std::endl;
663 HbyA.print();
664 }
665
666 if (_pressure_projection_method == "consistent")
667 {
668
669 // Consistent Corrections to SIMPLE
670 // 1. Ainv_old = 1/a_p <- Ainv = 1/(a_p + \sum_n a_n)
671 // 2. H(u) <- H(u*) + H(u') = H(u*) - (Ainv - Ainv_old) * grad(p) * Vc
672
673 if (verbose)
674 _console << "Performing SIMPLEC projection." << std::endl;
675
676 // Lambda function to calculate the sum of diagonal and neighbor coefficients
677 auto get_row_sum = [mmat](NumericVector<Number> & sum_vector)
678 {
679 // Ensure the sum_vector is zeroed out
680 sum_vector.zero();
681
682 // Local row size
683 const auto local_size = mmat->local_m();
684
685 for (const auto row_i : make_range(local_size))
686 {
687 // Get all non-zero components of the row of the matrix
688 const auto global_index = mmat->row_start() + row_i;
689 std::vector<numeric_index_type> indices;
690 std::vector<Real> values;
691 mmat->get_row(global_index, indices, values);
692
693 // Sum row elements (no absolute values)
694 const Real row_sum = std::accumulate(values.cbegin(), values.cend(), 0.0);
695
696 // Add the sum of diagonal and elements to the sum_vector
697 sum_vector.add(global_index, row_sum);
698 }
699 sum_vector.close();
700 };
701
702 // Create a temporary vector to store the sum of diagonal and neighbor coefficients
703 auto row_sum = current_local_solution.zero_clone();
704 get_row_sum(*row_sum);
705
706 // Create vector with new inverse projection matrix
707 auto Ainv_full = current_local_solution.zero_clone();
708 *working_vector_petsc = 1.0;
709 Ainv_full->pointwise_divide(*working_vector_petsc, *row_sum);
710 const auto Ainv_full_old = Ainv_full->clone();
711
712 // Correct HbyA
713 Ainv_full->add(-1.0, Ainv);
714 working_vector_petsc->pointwise_mult(*Ainv_full, *pressure_gradient[system_i]);
715 working_vector_petsc->pointwise_mult(*working_vector_petsc, *_cell_volumes);
716 HbyA.add(-1.0, *working_vector_petsc);
717
718 // Correct Ainv
719 Ainv = *Ainv_full_old;
720 }
721
722 Ainv.pointwise_mult(Ainv, *_cell_volumes);
723
724 if (verbose)
725 {
726 _console << " 1/A" << std::endl;
727 Ainv.print();
728 }
729 }
730
731 // We fill the 1/A and H/A functors
733
734 if (verbose)
735 {
736 _console << "************************************" << std::endl;
737 _console << "DONE Computing HbyA " << std::endl;
738 _console << "************************************" << std::endl;
739 }
740}
std::array< Real, 2 > values
const ConsoleStream _console
std::vector< std::unique_ptr< NumericVector< Number > > > & selectPressureGradient(const bool updated_pressure)
Select the right pressure gradient field and return a reference to the container.
std::unique_ptr< NumericVector< Number > > _cell_volumes
We will hold a vector of cell volumes to make sure we can do volume corrections rapidly.
void populateCouplingFunctors(const std::vector< std::unique_ptr< NumericVector< Number > > > &raw_hbya, const std::vector< std::unique_ptr< NumericVector< Number > > > &raw_Ainv)
Populate the face values of the H/A and 1/A fields.

Referenced by LinearAssemblySegregatedSolve::correctVelocity().

◆ execute()

virtual void RhieChowMassFlux::execute ( )
inlineoverridevirtual

Implements GeneralUserObject.

Definition at line 69 of file RhieChowMassFlux.h.

69{}

◆ finalize()

virtual void RhieChowMassFlux::finalize ( )
inlineoverridevirtual

Implements GeneralUserObject.

Definition at line 70 of file RhieChowMassFlux.h.

70{}

◆ getMassFlux()

Real RhieChowMassFlux::getMassFlux ( const FaceInfo fi) const

Get the face velocity times density (used in advection terms)

Definition at line 300 of file RhieChowMassFlux.C.

301{
302 return _face_mass_flux.evaluate(&fi);
303}
ValueType evaluate(const FaceInfo *const fi) const
Evaluate the face functor using a FaceInfo argument.

Referenced by LinearFVEnergyAdvection::setupFaceData(), LinearFVTurbulentAdvection::setupFaceData(), LinearWCNSFV2PMomentumDriftFlux::setupFaceData(), and LinearWCNSFVMomentumFlux::setupFaceData().

◆ getVolumetricFaceFlux() [1/2]

Real RhieChowMassFlux::getVolumetricFaceFlux ( const FaceInfo fi) const

Get the volumetric face flux (used in advection terms)

Definition at line 306 of file RhieChowMassFlux.C.

307{
308 const Moose::FaceArg face_arg{&fi,
309 /*limiter_type=*/Moose::FV::LimiterType::CentralDifference,
310 /*elem_is_upwind=*/true,
311 /*correct_skewness=*/false,
312 &fi.elem(),
313 /*state_limiter*/ nullptr};
314 const Real face_rho = _rho(face_arg, Moose::currentState());
315 return libmesh_map_find(_face_mass_flux, fi.id()) / face_rho;
316}
const Elem & elem() const
dof_id_type id() const

Referenced by LinearFVScalarAdvection::setupFaceData().

◆ getVolumetricFaceFlux() [2/2]

virtual Real RhieChowMassFlux::getVolumetricFaceFlux ( const Moose::FV::InterpMethod  m,
const FaceInfo fi,
const Moose::StateArg time,
const THREAD_ID  tid,
bool  subtract_mesh_velocity 
) const
overridevirtual

Retrieve the volumetric face flux, will not include derivatives.

Parameters
mThe velocity interpolation method. This is either Rhie-Chow or Average. Rhie-Chow is recommended as it avoids checkerboards in the pressure field
fiThe face that we wish to retrieve the velocity for
tidThe thread ID
Returns
The face velocity

Implements RhieChowFaceFluxProvider.

◆ hasFaceSide()

bool RhieChowFaceFluxProvider::hasFaceSide ( const FaceInfo fi,
const bool  fi_elem_side 
) const
overridevirtualinherited

Implements FaceArgInterface.

Definition at line 27 of file RhieChowFaceFluxProvider.C.

28{
29 if (fi_elem_side)
30 return hasBlocks(fi.elem().subdomain_id());
31 else
32 return fi.neighborPtr() && hasBlocks(fi.neighbor().subdomain_id());
33}
const Elem * neighborPtr() const
const Elem & neighbor() const

◆ initCouplingField()

void RhieChowMassFlux::initCouplingField ( )

Initialize the coupling fields (HbyA and Ainv)

Definition at line 436 of file RhieChowMassFlux.C.

437{
438 // We loop through the faces and populate the coupling fields (face H/A and 1/H)
439 // with 0s for now. Pressure corrector solves will always come after the
440 // momentum source so we expect these fields to change before the actual solve.
441 for (auto & fi : _fe_problem.mesh().faceInfo())
442 {
443 _Ainv[fi->id()];
444 _HbyA_flux[fi->id()];
445 }
446}
FEProblemBase & _fe_problem

Referenced by LinearAssemblySegregatedSolve::linkRhieChowUserObject().

◆ initFaceMassFlux()

void RhieChowMassFlux::initFaceMassFlux ( )

Initialize the container for face velocities.

Definition at line 249 of file RhieChowMassFlux.C.

250{
251 using namespace Moose::FV;
252
253 const auto time_arg = Moose::currentState();
254
255 // We loop through the faces and compute the resulting face fluxes from the
256 // initial conditions for velocity
257 for (auto & fi : _flow_face_info)
258 {
259 RealVectorValue density_times_velocity;
260
261 // On internal face we do a regular interpolation with geometric weights
262 if (_vel[0]->isInternalFace(*fi))
263 {
264 const auto & elem_info = *fi->elemInfo();
265 const auto & neighbor_info = *fi->neighborInfo();
266
267 Real elem_rho = _rho(makeElemArg(fi->elemPtr()), time_arg);
268 Real neighbor_rho = _rho(makeElemArg(fi->neighborPtr()), time_arg);
269
270 for (const auto dim_i : index_range(_vel))
271 interpolate(InterpMethod::Average,
272 density_times_velocity(dim_i),
273 _vel[dim_i]->getElemValue(elem_info, time_arg) * elem_rho,
274 _vel[dim_i]->getElemValue(neighbor_info, time_arg) * neighbor_rho,
275 *fi,
276 true);
277 }
278 // On the boundary, we just take the boundary values
279 else
280 {
281 const bool elem_is_fluid = hasBlocks(fi->elemPtr()->subdomain_id());
282 const Elem * const boundary_elem = elem_is_fluid ? fi->elemPtr() : fi->neighborPtr();
283
284 // We need this multiplier in case the face is an internal face and
285 const Real boundary_normal_multiplier = elem_is_fluid ? 1.0 : -1.0;
286 const Moose::FaceArg boundary_face{
287 fi, Moose::FV::LimiterType::CentralDifference, true, false, boundary_elem, nullptr};
288
289 const Real face_rho = _rho(boundary_face, time_arg);
290 for (const auto dim_i : index_range(_vel))
291 density_times_velocity(dim_i) = boundary_normal_multiplier * face_rho *
292 raw_value((*_vel[dim_i])(boundary_face, time_arg));
293 }
294
295 _face_mass_flux[fi->id()] = density_times_velocity * fi->normal();
296 }
297}
Moose::ElemArg makeElemArg(const Elem *elem, bool correct_skewnewss=false) const
auto raw_value(const Eigen::Map< T > &in)
void interpolate(InterpMethod m, T &result, const T2 &value1, const T3 &value2, const FaceInfo &fi, const bool one_is_elem)
VectorValue< Real > RealVectorValue

Referenced by LinearAssemblySegregatedSolve::linkRhieChowUserObject().

◆ initialize()

void RhieChowMassFlux::initialize ( )
overridevirtual

Implements GeneralUserObject.

Definition at line 239 of file RhieChowMassFlux.C.

240{
241 for (const auto & pair : _HbyA_flux)
242 _HbyA_flux[pair.first] = 0;
243
244 for (const auto & pair : _Ainv)
245 _Ainv[pair.first] = 0;
246}

◆ initialSetup()

void RhieChowMassFlux::initialSetup ( )
overridevirtual

Reimplemented from GeneralUserObject.

Definition at line 191 of file RhieChowMassFlux.C.

192{
193 // We fetch the pressure diffusion kernel to ensure that the face flux correction
194 // is consistent with the pressure discretization in the Poisson equation.
195 std::vector<LinearFVFluxKernel *> flux_kernel;
196 auto base_query = _fe_problem.theWarehouse()
197 .query()
198 .template condition<AttribThread>(_tid)
199 .template condition<AttribSysNum>(_p->sys().number())
200 .template condition<AttribSystem>("LinearFVFluxKernel")
201 .template condition<AttribName>(getParam<std::string>("p_diffusion_kernel"))
202 .queryInto(flux_kernel);
203 if (flux_kernel.size() != 1)
205 "p_diffusion_kernel",
206 "The kernel with the given name could not be found or multiple instances were identified.");
207 _p_diffusion_kernel = dynamic_cast<LinearFVPressureCorrectionDiffusion *>(flux_kernel[0]);
209 paramError("p_diffusion_kernel",
210 "The provided diffusion kernel must be of type "
211 "LinearFVPressureCorrectionDiffusion.");
212}
TheWarehouse & theWarehouse() const
Pressure correction diffusion kernel for the linear finite volume SIMPLE algorithm.
SystemBase & sys()
unsigned int number() const
Query query()
const THREAD_ID _tid

◆ linkMomentumPressureSystems()

void RhieChowMassFlux::linkMomentumPressureSystems ( const std::vector< LinearSystem * > &  momentum_systems,
LinearSystem pressure_system,
const std::vector< unsigned int > &  momentum_system_numbers 
)

Update the momentum system-related information.

Parameters
momentum_systemsPointers to the momentum systems which are solved for the momentum vector components
pressure_systemReference to the pressure system
momentum_system_numbersThe numbers of these systems

Definition at line 123 of file RhieChowMassFlux.C.

127{
128 _momentum_systems = momentum_systems;
129 _momentum_system_numbers = momentum_system_numbers;
130 _pressure_system = &pressure_system;
132
133 auto * const pressure_var =
135 if (!pressure_var)
136 mooseError("The pressure variable in system '",
138 "' must be a MooseLinearVariableFVReal.");
139
140 _pressure_gradient_field = &pressure_var->requestCellGradients();
141
143 for (auto & system : _momentum_systems)
144 {
145 _global_momentum_system_numbers.push_back(system->number());
146 _momentum_implicit_systems.push_back(dynamic_cast<LinearImplicitSystem *>(&system->system()));
147 }
148
150
151 std::set<BoundaryID> velocity_boundary_ids;
152 for (const auto dim_i : make_range(_dim))
153 for (const auto & [boundary_id, _] : _vel[dim_i]->getBoundaryConditionMap())
154 velocity_boundary_ids.insert(boundary_id);
155
156 const auto is_dirichlet =
157 [](const MooseLinearVariableFVReal & variable, const BoundaryID boundary_id)
158 {
159 return dynamic_cast<const LinearFVAdvectionDiffusionFunctorDirichletBC *>(
160 variable.getBoundaryCondition(boundary_id)) != nullptr;
161 };
162
163 // The legacy boundary HbyA reconstruction uses the x-velocity BC as a proxy for every velocity
164 // component, so all components must have the same Dirichlet classification on those boundaries.
165 for (const auto boundary_id : velocity_boundary_ids)
166 {
167 const auto * const pressure_bc = _p->getBoundaryCondition(boundary_id);
168 if (dynamic_cast<const LinearFVPressureFluxBC *>(pressure_bc))
169 continue;
170
171 const bool velocity_is_dirichlet = is_dirichlet(*_vel[0], boundary_id);
172 for (const auto dim_i : make_range(_dim))
173 if (is_dirichlet(*_vel[dim_i], boundary_id) != velocity_is_dirichlet)
174 mooseError("All velocity components must either have Dirichlet boundary conditions or "
175 "non-Dirichlet boundary conditions on boundary '",
176 _moose_mesh.getBoundaryName(boundary_id),
177 "' when the pressure boundary condition is not a LinearFVPressureFluxBC.");
178 }
179}
boundary_id_type BoundaryID
for(PetscInt i=0;i< nvars;++i)
Class implementing a flux boundary condition for linear finite volume pressure variables used in the ...
std::vector< unsigned int > _momentum_system_numbers
Numbers of the momentum system(s)
void setupMeshInformation()
Compute the cell volumes on the mesh.
std::vector< unsigned int > _global_momentum_system_numbers
Global numbers of the momentum system(s)
MooseVariableFieldBase & getVariable(THREAD_ID tid, const std::string &var_name) const
virtual const std::string & name() const
if(subdm)

Referenced by LinearAssemblySegregatedSolve::linkRhieChowUserObject().

◆ meshChanged()

void RhieChowMassFlux::meshChanged ( )
overridevirtual

Reimplemented from GeneralUserObject.

Definition at line 182 of file RhieChowMassFlux.C.

183{
184 _HbyA_flux.clear();
185 _Ainv.clear();
186 _face_mass_flux.clear();
188}

◆ populateCouplingFunctors()

void RhieChowMassFlux::populateCouplingFunctors ( const std::vector< std::unique_ptr< NumericVector< Number > > > &  raw_hbya,
const std::vector< std::unique_ptr< NumericVector< Number > > > &  raw_Ainv 
)
protected

Populate the face values of the H/A and 1/A fields.

Definition at line 449 of file RhieChowMassFlux.C.

452{
453 // We have the raw H/A and 1/A vectors in a petsc format. This function
454 // will create face functors from them
455 using namespace Moose::FV;
456 const auto time_arg = Moose::currentState();
457
458 // Create the petsc vector readers for faster repeated access
459 std::vector<PetscVectorReader> hbya_reader;
460 for (const auto dim_i : index_range(raw_hbya))
461 hbya_reader.emplace_back(*raw_hbya[dim_i]);
462
463 std::vector<PetscVectorReader> ainv_reader;
464 for (const auto dim_i : index_range(raw_Ainv))
465 ainv_reader.emplace_back(*raw_Ainv[dim_i]);
466
467 // We loop through the faces and populate the coupling fields (face H/A and 1/A)
468 for (auto & fi : _flow_face_info)
469 {
470 Real face_rho = 0;
471 RealVectorValue face_hbya;
472
473 // We do the lookup in advance
474 auto & Ainv = _Ainv[fi->id()];
475
476 // If it is internal, we just interpolate (using geometric weights) to the face
477 if (_vel[0]->isInternalFace(*fi))
478 {
479 // Get the dof indices for the element and the neighbor
480 const auto & elem_info = *fi->elemInfo();
481 const auto & neighbor_info = *fi->neighborInfo();
482 const auto elem_dof = elem_info.dofIndices()[_global_momentum_system_numbers[0]][0];
483 const auto neighbor_dof = neighbor_info.dofIndices()[_global_momentum_system_numbers[0]][0];
484
485 // Get the density values for the element and neighbor. We need this multiplication to make
486 // the coupling fields mass fluxes.
487 const Real elem_rho = _rho(makeElemArg(fi->elemPtr()), time_arg);
488 const Real neighbor_rho = _rho(makeElemArg(fi->neighborPtr()), time_arg);
489
490 // Now we do the interpolation to the face
491 interpolate(Moose::FV::InterpMethod::Average, face_rho, elem_rho, neighbor_rho, *fi, true);
492 for (const auto dim_i : index_range(raw_hbya))
493 {
494 interpolate(Moose::FV::InterpMethod::Average,
495 face_hbya(dim_i),
496 hbya_reader[dim_i](elem_dof),
497 hbya_reader[dim_i](neighbor_dof),
498 *fi,
499 true);
501 Ainv(dim_i),
502 elem_rho * ainv_reader[dim_i](elem_dof),
503 neighbor_rho * ainv_reader[dim_i](neighbor_dof),
504 *fi,
505 true);
506 }
507 }
508 else
509 {
510 const bool elem_is_fluid = hasBlocks(fi->elemPtr()->subdomain_id());
511
512 // We need this multiplier in case the face is an internal face and
513 const Real boundary_normal_multiplier = elem_is_fluid ? 1.0 : -1.0;
514
515 const ElemInfo & elem_info = elem_is_fluid ? *fi->elemInfo() : *fi->neighborInfo();
516 const auto elem_dof = elem_info.dofIndices()[_global_momentum_system_numbers[0]][0];
517
518 mooseAssert(fi->boundaryIDs().size() == 1, "We should only have one boundary on every face.");
519 const auto * pressure_bc = _p->getBoundaryCondition(*fi->boundaryIDs().begin());
520
521 // For the legacy Dirichlet-velocity plus extrapolated-pressure path, we still need a
522 // special boundary HbyA reconstruction to keep the face flux consistent. When the pressure
523 // BC itself is a LinearFVPressureFluxBC, that object already enforces the prescribed
524 // boundary mass flux, so we use the standard one-term boundary expansion instead.
525 if (_vel[0]->isDirichletBoundaryFace(*fi) &&
526 !dynamic_cast<const LinearFVPressureFluxBC *>(pressure_bc))
527 {
528 const Moose::FaceArg boundary_face{
529 fi, Moose::FV::LimiterType::CentralDifference, true, false, elem_info.elem(), nullptr};
530 face_rho = _rho(boundary_face, Moose::currentState());
531
532 for (const auto dim_i : make_range(_dim))
533 {
534
535 face_hbya(dim_i) =
536 -MetaPhysicL::raw_value((*_vel[dim_i])(boundary_face, Moose::currentState()));
537 face_hbya(dim_i) *= boundary_normal_multiplier;
538 }
539 }
540 // Otherwise we just do a one-term expansion (so we just use the element value)
541 else
542 {
543 const auto elem_dof = elem_info.dofIndices()[_global_momentum_system_numbers[0]][0];
544
545 face_rho = _rho(makeElemArg(elem_info.elem()), time_arg);
546 for (const auto dim_i : make_range(_dim))
547 face_hbya(dim_i) = boundary_normal_multiplier * hbya_reader[dim_i](elem_dof);
548 }
549
550 // We just do a one-term expansion for 1/A no matter what
551 const Real elem_rho = _rho(makeElemArg(elem_info.elem()), time_arg);
552 for (const auto dim_i : index_range(raw_Ainv))
553 Ainv(dim_i) = elem_rho * ainv_reader[dim_i](elem_dof);
554 }
555 // Lastly, we populate the face flux resulted by H/A
556 _HbyA_flux[fi->id()] = face_hbya * fi->normal() * face_rho;
557 }
558}
const Elem * elem() const
const std::vector< std::vector< dof_id_type > > & dofIndices() const

Referenced by computeHbyA().

◆ pressureGradientComponents()

const std::vector< std::unique_ptr< NumericVector< Number > > > & RhieChowMassFlux::pressureGradientComponents ( ) const
protected

Get the registered pressure gradient component vectors.

Definition at line 760 of file RhieChowMassFlux.C.

761{
763}
const GradientContainer & components() const
const LinearFVGradientReader & pressureGradientField() const
Get the registered pressure gradient field used by compatible momentum pressure kernels.

Referenced by computeCellVelocity(), and selectPressureGradient().

◆ pressureGradientField()

const LinearFVGradientReader & RhieChowMassFlux::pressureGradientField ( ) const

Get the registered pressure gradient field used by compatible momentum pressure kernels.

Definition at line 319 of file RhieChowMassFlux.C.

320{
323 "The pressure gradient field has not been registered for RhieChowMassFlux '", name(), "'.");
324
326}

Referenced by pressureGradientComponents().

◆ selectPressureGradient()

std::vector< std::unique_ptr< NumericVector< Number > > > & RhieChowMassFlux::selectPressureGradient ( const bool  updated_pressure)
protected

Select the right pressure gradient field and return a reference to the container.

Definition at line 743 of file RhieChowMassFlux.C.

744{
745 if (updated_pressure)
746 {
747 _grad_p_current.clear();
748 for (const auto & component : pressureGradientComponents())
749 _grad_p_current.push_back(component->clone());
750 }
751
752 if (_grad_p_current.empty())
753 for (const auto & component : pressureGradientComponents())
754 _grad_p_current.push_back(component->clone());
755
756 return _grad_p_current;
757}
std::vector< std::unique_ptr< NumericVector< Number > > > _grad_p_current
for a PISO iteration we need to hold on to the original pressure gradient field.
T component(const RankTwoTensorTempl< T > &r2tensor, unsigned int i, unsigned int j)

Referenced by computeHbyA().

◆ setupMeshInformation()

void RhieChowMassFlux::setupMeshInformation ( )
protected

Compute the cell volumes on the mesh.

Definition at line 215 of file RhieChowMassFlux.C.

216{
217 // We cache the cell volumes into a petsc vector for corrections here so we can use
218 // the optimized petsc operations for the normalization
220 for (const auto & elem_info : _fe_problem.mesh().elemInfoVector())
221 // We have to check this because the variable might not be defined on the given
222 // block
223 if (hasBlocks(elem_info->subdomain_id()))
224 {
225 const auto elem_dof = elem_info->dofIndices()[_global_pressure_system_number][0];
226 _cell_volumes->set(elem_dof, elem_info->volume() * elem_info->coordFactor());
227 }
228
229 _cell_volumes->close();
230
231 _flow_face_info.clear();
232 for (auto & fi : _fe_problem.mesh().faceInfo())
233 if (hasBlocks(fi->elemPtr()->subdomain_id()) ||
234 (fi->neighborPtr() && hasBlocks(fi->neighborPtr()->subdomain_id())))
235 _flow_face_info.push_back(fi);
236}
virtual const NumericVector< Number > *const & currentSolution() const override final
virtual std::unique_ptr< NumericVector< T > > zero_clone() const=0

Referenced by linkMomentumPressureSystems(), and meshChanged().

◆ supportMeshVelocity()

virtual bool RhieChowMassFlux::supportMeshVelocity ( ) const
inlineoverrideprotectedvirtual

Returns whether the UO can support mesh velocity advection.

Reimplemented from RhieChowFaceFluxProvider.

Definition at line 112 of file RhieChowMassFlux.h.

112{ return false; }

◆ validParams()

InputParameters RhieChowMassFlux::validParams ( )
static

Definition at line 33 of file RhieChowMassFlux.C.

34{
37
38 params.addClassDescription("Computes H/A and 1/A together with face mass fluxes for segregated "
39 "momentum-pressure equations using linear systems.");
40
41 params.addRequiredParam<VariableName>(NS::pressure, "The pressure variable.");
42 params.addRequiredParam<VariableName>("u", "The x-component of velocity");
43 params.addParam<VariableName>("v", "The y-component of velocity");
44 params.addParam<VariableName>("w", "The z-component of velocity");
45 params.addRequiredParam<std::string>(
46 "p_diffusion_kernel",
47 "The LinearFVPressureCorrectionDiffusion kernel acting on the pressure.");
48
49 params.addRequiredParam<MooseFunctorName>(NS::density, "Density functor");
50
51 // We disable the execution of this, should only provide functions
52 // for the SIMPLE executioner
53 ExecFlagEnum & exec_enum = params.set<ExecFlagEnum>("execute_on", true);
54 exec_enum.addAvailableFlags(EXEC_NONE);
55 exec_enum = {EXEC_NONE};
56 params.suppressParameter<ExecFlagEnum>("execute_on");
57
58 // Pressure projection
59 params.addParam<MooseEnum>("pressure_projection_method",
60 MooseEnum("standard consistent", "standard"),
61 "The method to use in the pressure projection for Ainv - "
62 "standard (SIMPLE) or consistent (SIMPLEC)");
63 params.addParam<MooseEnum>(
64 "pressure_diffusion_interpolation",
65 MooseEnum("average harmonic", "average"),
66 "The face interpolation method for Ainv in the pressure correction diffusion term.");
67 return params;
68}
const ExecFlagType EXEC_NONE
void addAvailableFlags(const ExecFlagType &flag, Args... flags)
static InputParameters validParams()
static InputParameters validParams()

Referenced by WCNSLinearFVFlowPhysics::validParams().

Member Data Documentation

◆ _A_avg

std::unique_ptr<NumericVector<Number> > RhieChowMassFlux::_A_avg
protected

Definition at line 158 of file RhieChowMassFlux.h.

◆ _Ainv

FaceCenteredMapFunctor<RealVectorValue, std::unordered_map<dof_id_type, RealVectorValue> > RhieChowMassFlux::_Ainv
protected

A map functor from faces to $(1/A)_f$.

Where $A_i$ is the diagonal of the system matrix for the momentum equation.

Definition at line 150 of file RhieChowMassFlux.h.

Referenced by initCouplingField(), initialize(), meshChanged(), populateCouplingFunctors(), and RhieChowMassFlux().

◆ _Ainv_raw

std::vector<std::unique_ptr<NumericVector<Number> > > RhieChowMassFlux::_Ainv_raw
protected

We hold on to the cell-based 1/A vectors so that we can easily reconstruct the cell velocities as well.

Definition at line 156 of file RhieChowMassFlux.h.

Referenced by computeCellVelocity(), and computeHbyA().

◆ _cell_volumes

std::unique_ptr<NumericVector<Number> > RhieChowMassFlux::_cell_volumes
protected

We will hold a vector of cell volumes to make sure we can do volume corrections rapidly.

Definition at line 198 of file RhieChowMassFlux.h.

Referenced by computeHbyA(), and setupMeshInformation().

◆ _dim

const unsigned int RhieChowMassFlux::_dim
protected

The dimension of the mesh, e.g. 3 for hexes and tets, 2 for quads and tris.

Definition at line 121 of file RhieChowMassFlux.h.

Referenced by linkMomentumPressureSystems(), and populateCouplingFunctors().

◆ _face_mass_flux

FaceCenteredMapFunctor<Real, std::unordered_map<dof_id_type, Real> >& RhieChowMassFlux::_face_mass_flux
protected

A map functor from faces to mass fluxes which are used in the advection terms.

Definition at line 163 of file RhieChowMassFlux.h.

Referenced by computeFaceMassFlux(), getMassFlux(), getVolumetricFaceFlux(), initFaceMassFlux(), and meshChanged().

◆ _flow_face_info

std::vector<const FaceInfo *> RhieChowMassFlux::_flow_face_info
private

The subset of the FaceInfo objects that actually cover the subdomains which the flow field is defined on.

Cached for performance optimization.

Definition at line 209 of file RhieChowMassFlux.h.

Referenced by computeFaceMassFlux(), initFaceMassFlux(), populateCouplingFunctors(), and setupMeshInformation().

◆ _global_momentum_system_numbers

std::vector<unsigned int> RhieChowMassFlux::_global_momentum_system_numbers
protected

Global numbers of the momentum system(s)

Definition at line 183 of file RhieChowMassFlux.h.

Referenced by linkMomentumPressureSystems(), and populateCouplingFunctors().

◆ _global_pressure_system_number

unsigned int RhieChowMassFlux::_global_pressure_system_number
protected

Global number of the pressure system.

Definition at line 195 of file RhieChowMassFlux.h.

Referenced by computeFaceMassFlux(), linkMomentumPressureSystems(), and setupMeshInformation().

◆ _grad_p_current

std::vector<std::unique_ptr<NumericVector<Number> > > RhieChowMassFlux::_grad_p_current
protected

for a PISO iteration we need to hold on to the original pressure gradient field.

Should not be used in other conditions.

Definition at line 169 of file RhieChowMassFlux.h.

Referenced by selectPressureGradient().

◆ _HbyA_flux

FaceCenteredMapFunctor<Real, std::unordered_map<dof_id_type, Real> > RhieChowMassFlux::_HbyA_flux
protected

A map functor from faces to $HbyA_{ij} = (A_{offdiag}*\mathrm{(predicted~velocity)} - \mathrm{Source})_{ij}/A_{ij}$.

So this contains the off-diagonal part of the system matrix multiplied by the predicted velocity minus the source terms from the right hand side of the linearized momentum predictor step.

Definition at line 138 of file RhieChowMassFlux.h.

Referenced by computeFaceMassFlux(), initCouplingField(), initialize(), meshChanged(), populateCouplingFunctors(), and RhieChowMassFlux().

◆ _HbyA_raw

std::vector<std::unique_ptr<NumericVector<Number> > > RhieChowMassFlux::_HbyA_raw
protected

We hold on to the cell-based HbyA vectors so that we can easily reconstruct the cell velocities as well.

Definition at line 144 of file RhieChowMassFlux.h.

Referenced by computeCellVelocity(), and computeHbyA().

◆ _mesh

const libMesh::MeshBase& RhieChowMassFlux::_mesh
protected

The libMesh mesh that this object acts on.

Definition at line 118 of file RhieChowMassFlux.h.

◆ _momentum_implicit_systems

std::vector<libMesh::LinearImplicitSystem *> RhieChowMassFlux::_momentum_implicit_systems
protected

Pointers to the momentum equation implicit system(s) from libmesh.

Definition at line 186 of file RhieChowMassFlux.h.

Referenced by computeCellVelocity(), computeHbyA(), and linkMomentumPressureSystems().

◆ _momentum_system_numbers

std::vector<unsigned int> RhieChowMassFlux::_momentum_system_numbers
protected

Numbers of the momentum system(s)

Definition at line 180 of file RhieChowMassFlux.h.

Referenced by linkMomentumPressureSystems().

◆ _momentum_systems

std::vector<LinearSystem *> RhieChowMassFlux::_momentum_systems
protected

Pointers to the linear system(s) in moose corresponding to the momentum equation(s)

Definition at line 177 of file RhieChowMassFlux.h.

Referenced by computeCellVelocity(), computeHbyA(), and linkMomentumPressureSystems().

◆ _moose_mesh

const MooseMesh& RhieChowMassFlux::_moose_mesh
protected

The MooseMesh that this user object operates on.

Definition at line 115 of file RhieChowMassFlux.h.

Referenced by checkBlocks(), and linkMomentumPressureSystems().

◆ _p

const MooseLinearVariableFVReal* const RhieChowMassFlux::_p
protected

The thread 0 copy of the pressure variable.

Definition at line 124 of file RhieChowMassFlux.h.

Referenced by computeFaceMassFlux(), initialSetup(), linkMomentumPressureSystems(), populateCouplingFunctors(), and RhieChowMassFlux().

◆ _p_diffusion_kernel

LinearFVPressureCorrectionDiffusion* RhieChowMassFlux::_p_diffusion_kernel
protected

Pointer to the pressure diffusion term in the pressure Poisson equation.

Definition at line 130 of file RhieChowMassFlux.h.

Referenced by computeFaceMassFlux(), and initialSetup().

◆ _pressure_diffusion_interp_method

const Moose::FV::InterpMethod RhieChowMassFlux::_pressure_diffusion_interp_method
protected

Interpolation method used for the pressure diffusion coefficient on faces.

Definition at line 204 of file RhieChowMassFlux.h.

Referenced by populateCouplingFunctors().

◆ _pressure_gradient_field

const LinearFVGradientReader* RhieChowMassFlux::_pressure_gradient_field
protected

Registered pressure gradient field used by Rhie-Chow and compatible momentum pressure kernels.

Definition at line 192 of file RhieChowMassFlux.h.

Referenced by linkMomentumPressureSystems(), and pressureGradientField().

◆ _pressure_projection_method

const MooseEnum RhieChowMassFlux::_pressure_projection_method
protected

Enumerator for the method used for pressure projection.

Definition at line 201 of file RhieChowMassFlux.h.

Referenced by computeHbyA().

◆ _pressure_system

LinearSystem* RhieChowMassFlux::_pressure_system
protected

Pointer to the pressure system.

Definition at line 189 of file RhieChowMassFlux.h.

Referenced by computeFaceMassFlux(), linkMomentumPressureSystems(), and setupMeshInformation().

◆ _rho

const Moose::Functor<Real>& RhieChowMassFlux::_rho
protected

Functor describing the density of the fluid.

Definition at line 174 of file RhieChowMassFlux.h.

Referenced by getVolumetricFaceFlux(), initFaceMassFlux(), and populateCouplingFunctors().

◆ _vel

std::vector<const MooseLinearVariableFVReal *> RhieChowMassFlux::_vel
protected

The thread 0 copy of the x-velocity variable.

Definition at line 127 of file RhieChowMassFlux.h.

Referenced by initFaceMassFlux(), linkMomentumPressureSystems(), populateCouplingFunctors(), and RhieChowMassFlux().


The documentation for this class was generated from the following files: