https://mooseframework.inl.gov
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 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) More...
 
Real getVolumetricFaceFlux (const FaceInfo &fi) const
 Get the volumetric face flux (used in advection terms) More...
 
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. More...
 
void initFaceMassFlux ()
 Initialize the container for face velocities. More...
 
void initCouplingField ()
 Initialize the coupling fields (HbyA and Ainv) More...
 
void computeFaceMassFlux ()
 Update the values of the face velocities in the containers. More...
 
void computeCellVelocity ()
 Update the cell values of the velocity variables. More...
 
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, const LinearSystem &pressure_system, const std::vector< unsigned int > &momentum_system_numbers)
 Update the momentum system-related information. More...
 
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. More...
 
bool hasFaceSide (const FaceInfo &fi, const bool fi_elem_side) const override
 
SubProblemgetSubProblem () const
 
bool shouldDuplicateInitialExecution () const
 
virtual Real spatialValue (const Point &) const
 
virtual const std::vector< Point > spatialPoints () 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)
 
void setPrimaryThreadCopy (UserObject *primary)
 
UserObjectprimaryThreadCopy ()
 
std::set< UserObjectName > getDependObjects () const
 
virtual bool needThreadedCopy () const
 
const std::set< std::string > & getRequestedItems () override
 
const std::set< std::string > & getSuppliedItems () override
 
unsigned int systemNumber () const
 
virtual bool enabled () const
 
std::shared_ptr< MooseObjectgetSharedPtr ()
 
std::shared_ptr< const MooseObjectgetSharedPtr () const
 
MooseAppgetMooseApp () const
 
const std::string & type () const
 
virtual const std::string & name () const
 
std::string typeAndName () const
 
std::string errorPrefix (const std::string &error_type) const
 
void callMooseError (std::string msg, const bool with_prefix) const
 
MooseObjectParameterName uniqueParameterName (const std::string &parameter_name) const
 
const InputParametersparameters () const
 
MooseObjectName uniqueName () const
 
const T & getParam (const std::string &name) const
 
std::vector< std::pair< T1, T2 > > getParam (const std::string &param1, const std::string &param2) const
 
const T * queryParam (const std::string &name) const
 
const T & getRenamedParam (const std::string &old_name, const std::string &new_name) const
 
getCheckedPointerParam (const std::string &name, const std::string &error_string="") const
 
bool isParamValid (const std::string &name) const
 
bool isParamSetByUser (const std::string &nm) const
 
void paramError (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
 
void connectControllableParams (const std::string &parameter, const std::string &object_type, const std::string &object_name, const std::string &object_parameter) const
 
void mooseError (Args &&... args) const
 
void mooseErrorNonPrefixed (Args &&... args) const
 
void mooseDocumentedError (const std::string &repo_name, const unsigned int issue_num, Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseInfo (Args &&... args) 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 T & getUserObject (const std::string &param_name, bool is_dependency=true) const
 
const T & getUserObjectByName (const UserObjectName &object_name, bool is_dependency=true) const
 
const UserObjectgetUserObjectBase (const std::string &param_name, bool is_dependency=true) const
 
const UserObjectgetUserObjectBaseByName (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)
 
std::pair< const MaterialProperty< T > *, std::set< SubdomainID > > getBlockMaterialProperty (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)
 
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 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
 
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
 
T & getSampler (const std::string &name)
 
SamplergetSampler (const std::string &name)
 
T & getSamplerByName (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 T & getDistribution (const std::string &name) const
 
const DistributiongetDistribution (const std::string &name) const
 
const T & getDistribution (const std::string &name) const
 
const DistributiongetDistributionByName (const DistributionName &name) const
 
const T & getDistributionByName (const std::string &name) const
 
const DistributiongetDistributionByName (const DistributionName &name) const
 
const T & getDistributionByName (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
 

Static Public Member Functions

static InputParameters validParams ()
 
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)
 
static std::string deduceFunctorName (const std::string &name, const InputParameters &params)
 

Public Attributes

const ConsoleStream _console
 

Static Public Attributes

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. More...
 
void setupMeshInformation ()
 Compute the cell volumes on the mesh. More...
 
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. More...
 
template<typename VarType >
void checkBlocks (const VarType &var) const
 Check the block consistency between the passed in var and us. More...
 
virtual bool supportMeshVelocity () const override
 Returns whether the UO can support mesh velocity advection. More...
 
virtual void addPostprocessorDependencyHelper (const PostprocessorName &name) const override
 
virtual void addVectorPostprocessorDependencyHelper (const VectorPostprocessorName &name) const override
 
virtual void addUserObjectDependencyHelper (const UserObject &uo) const override
 
void addReporterDependencyHelper (const ReporterName &reporter_name) override
 
const ReporterNamegetReporterName (const std::string &param_name) const
 
T & declareRestartableData (const std::string &data_name, Args &&... args)
 
ManagedValue< T > declareManagedRestartableDataWithContext (const std::string &data_name, void *context, Args &&... args)
 
const T & getRestartableData (const std::string &data_name) const
 
T & declareRestartableDataWithContext (const std::string &data_name, void *context, Args &&... args)
 
T & declareRecoverableData (const std::string &data_name, Args &&... args)
 
T & declareRestartableDataWithObjectName (const std::string &data_name, const std::string &object_name, Args &&... args)
 
T & declareRestartableDataWithObjectNameWithContext (const std::string &data_name, const std::string &object_name, void *context, Args &&... args)
 
std::string restartableName (const std::string &data_name) const
 
const T & getMeshProperty (const std::string &data_name, const std::string &prefix)
 
const T & getMeshProperty (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)
 
void markMatPropRequested (const std::string &)
 
MaterialPropertyName getMaterialPropertyName (const std::string &name) const
 
void checkExecutionStage ()
 
const T & getReporterValue (const std::string &param_name, const std::size_t time_index=0)
 
const T & getReporterValue (const std::string &param_name, ReporterMode mode, const std::size_t time_index=0)
 
const T & getReporterValue (const std::string &param_name, const std::size_t time_index=0)
 
const T & getReporterValue (const std::string &param_name, ReporterMode mode, const std::size_t time_index=0)
 
const T & getReporterValueByName (const ReporterName &reporter_name, const std::size_t time_index=0)
 
const T & getReporterValueByName (const ReporterName &reporter_name, ReporterMode mode, const std::size_t time_index=0)
 
const T & getReporterValueByName (const ReporterName &reporter_name, const std::size_t time_index=0)
 
const T & getReporterValueByName (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)
 
Moose::CoordinateSystemType getBlockCoordSystem ()
 
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)
 

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. More...
 
const libMesh::MeshBase_mesh
 The libMesh mesh that this object acts on. More...
 
const unsigned int _dim
 The dimension of the mesh, e.g. 3 for hexes and tets, 2 for quads and tris. More...
 
const MooseLinearVariableFVReal *const _p
 The thread 0 copy of the pressure variable. More...
 
std::vector< const MooseLinearVariableFVReal * > _vel
 The thread 0 copy of the x-velocity variable. More...
 
LinearFVAnisotropicDiffusion_p_diffusion_kernel
 Pointer to the pressure diffusion term in the pressure Poisson equation. More...
 
FaceCenteredMapFunctor< Real, std::unordered_map< dof_id_type, Real > > _HbyA_flux
 A map functor from faces to $HbyA_{ij} = (A_{offdiag}*{(predicted~velocity)} - {Source})_{ij}/A_{ij}$. More...
 
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. More...
 
FaceCenteredMapFunctor< RealVectorValue, std::unordered_map< dof_id_type, RealVectorValue > > _Ainv
 A map functor from faces to $(1/A)_f$. More...
 
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. More...
 
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. More...
 
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. More...
 
const Moose::Functor< Real > & _rho
 Functor describing the density of the fluid. More...
 
std::vector< LinearSystem * > _momentum_systems
 Pointers to the linear system(s) in moose corresponding to the momentum equation(s) More...
 
std::vector< unsigned int_momentum_system_numbers
 Numbers of the momentum system(s) More...
 
std::vector< unsigned int_global_momentum_system_numbers
 Global numbers of the momentum system(s) More...
 
std::vector< libMesh::LinearImplicitSystem * > _momentum_implicit_systems
 Pointers to the momentum equation implicit system(s) from libmesh. More...
 
const LinearSystem_pressure_system
 Pointer to the pressure system. More...
 
unsigned int _global_pressure_system_number
 Global number of the pressure system. More...
 
std::unique_ptr< NumericVector< Number > > _cell_volumes
 We will hold a vector of cell volumes to make sure we can do volume corrections rapidly. More...
 
const MooseEnum _pressure_projection_method
 Enumerator for the method used for pressure projection. More...
 
SubProblem_subproblem
 
FEProblemBase_fe_problem
 
SystemBase_sys
 
const THREAD_ID _tid
 
Assembly_assembly
 
const Moose::CoordinateSystemType_coord_sys
 
const bool _duplicate_initial_execution
 
std::set< std::string > _depend_uo
 
const bool & _enabled
 
MooseApp_app
 
const std::string _type
 
const std::string _name
 
const InputParameters_pars
 
Factory_factory
 
ActionFactory_action_factory
 
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 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 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. More...
 

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 36 of file RhieChowMassFlux.h.

Constructor & Destructor Documentation

◆ RhieChowMassFlux()

RhieChowMassFlux::RhieChowMassFlux ( const InputParameters params)

Definition at line 65 of file RhieChowMassFlux.C.

66  : RhieChowFaceFluxProvider(params),
71  _p(dynamic_cast<MooseLinearVariableFVReal *>(
72  &UserObject::_subproblem.getVariable(0, getParam<VariableName>(NS::pressure)))),
73  _vel(_dim, nullptr),
74  _HbyA_flux(_moose_mesh, blockIDs(), "HbyA_flux"),
75  _Ainv(_moose_mesh, blockIDs(), "Ainv"),
77  declareRestartableData<FaceCenteredMapFunctor<Real, std::unordered_map<dof_id_type, Real>>>(
78  "face_flux", _moose_mesh, blockIDs(), "face_values")),
79  _rho(getFunctor<Real>(NS::density)),
80  _pressure_projection_method(getParam<MooseEnum>("pressure_projection_method"))
81 {
82  if (!_p)
83  paramError(NS::pressure, "the pressure must be a MooseLinearVariableFVReal.");
84  checkBlocks(*_p);
85 
86  std::vector<std::string> vel_names = {"u", "v", "w"};
87  for (const auto i : index_range(_vel))
88  {
89  _vel[i] = dynamic_cast<MooseLinearVariableFVReal *>(
90  &UserObject::_subproblem.getVariable(0, getParam<VariableName>(vel_names[i])));
91 
92  if (!_vel[i])
93  paramError(vel_names[i], "the velocity must be a MOOSELinearVariableFVReal.");
94  checkBlocks(*_vel[i]);
95  }
96 
97  // Register the elemental/face functors which will be queried in the pressure equation
98  for (const auto tid : make_range(libMesh::n_threads()))
99  {
102  }
103 
104  if (!dynamic_cast<SIMPLE *>(getMooseApp().getExecutioner()) &&
105  !dynamic_cast<PIMPLE *>(getMooseApp().getExecutioner()))
106  mooseError(this->name(),
107  " should only be used with a linear segregated thermal-hydraulics solver!");
108 }
unsigned int blocksMaxDimension() const
const MooseEnum _pressure_projection_method
Enumerator for the method used for pressure projection.
unsigned int n_threads()
A functor whose evaluation relies on querying a map where the keys are face info ids and the values c...
void checkBlocks(const VarType &var) const
Check the block consistency between the passed in var and us.
RhieChowFaceFluxProvider(const InputParameters &params)
void addFunctor(const std::string &name, const Moose::FunctorBase< T > &functor, const THREAD_ID tid)
MeshBase & mesh
static const std::string density
Definition: NS.h:33
T & declareRestartableData(const std::string &data_name, Args &&... args)
FaceCenteredMapFunctor< RealVectorValue, std::unordered_map< dof_id_type, RealVectorValue > > _Ainv
A map functor from faces to $(1/A)_f$.
virtual const std::set< SubdomainID > & blockIDs() const
virtual const std::string & name() const
MooseApp & getMooseApp() const
SubProblem & _subproblem
FaceCenteredMapFunctor< Real, std::unordered_map< dof_id_type, Real > > _HbyA_flux
A map functor from faces to $HbyA_{ij} = (A_{offdiag}*{(predicted~velocity)} - {Source})_{ij}/A_{ij}$...
MeshBase & getMesh()
std::vector< const MooseLinearVariableFVReal * > _vel
The thread 0 copy of the x-velocity variable.
const MooseLinearVariableFVReal *const _p
The thread 0 copy of the pressure variable.
const Moose::Functor< Real > & _rho
Functor describing the density of the fluid.
const MooseMesh & _moose_mesh
The MooseMesh that this user object operates on.
void paramError(const std::string &param, Args... args) const
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
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.
static const std::string pressure
Definition: NS.h:56
IntRange< T > make_range(T beg, T end)
NonADFunctorInterface(const MooseObject *moose_object)
void mooseError(Args &&... args) const
auto index_range(const T &sizable)
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.

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 199 of file RhieChowMassFlux.h.

Referenced by RhieChowMassFlux().

200 {
201  const auto & var_blocks = var.blockIDs();
202  const auto & uo_blocks = blockIDs();
203 
204  // Error if this UO has any blocks that the variable does not
205  std::set<SubdomainID> uo_blocks_minus_var_blocks;
206  std::set_difference(uo_blocks.begin(),
207  uo_blocks.end(),
208  var_blocks.begin(),
209  var_blocks.end(),
210  std::inserter(uo_blocks_minus_var_blocks, uo_blocks_minus_var_blocks.end()));
211  if (uo_blocks_minus_var_blocks.size() > 0)
212  mooseError("Block restriction of interpolator user object '",
213  this->name(),
214  "' (",
216  ") includes blocks not in the block restriction of variable '",
217  var.name(),
218  "' (",
219  Moose::stringify(var.blocks()),
220  ")");
221 
222  // Get the blocks in the variable but not this UO
223  std::set<SubdomainID> var_blocks_minus_uo_blocks;
224  std::set_difference(var_blocks.begin(),
225  var_blocks.end(),
226  uo_blocks.begin(),
227  uo_blocks.end(),
228  std::inserter(var_blocks_minus_uo_blocks, var_blocks_minus_uo_blocks.end()));
229 
230  // For each block in the variable but not this UO, error if there is connection
231  // to any blocks on the UO.
232  for (auto & block_id : var_blocks_minus_uo_blocks)
233  {
234  const auto connected_blocks = _moose_mesh.getBlockConnectedBlocks(block_id);
235  std::set<SubdomainID> connected_blocks_on_uo;
236  std::set_intersection(connected_blocks.begin(),
237  connected_blocks.end(),
238  uo_blocks.begin(),
239  uo_blocks.end(),
240  std::inserter(connected_blocks_on_uo, connected_blocks_on_uo.end()));
241  if (connected_blocks_on_uo.size() > 0)
242  mooseError("Block restriction of interpolator user object '",
243  this->name(),
244  "' (",
245  Moose::stringify(uo_blocks),
246  ") doesn't match the block restriction of variable '",
247  var.name(),
248  "' (",
249  Moose::stringify(var_blocks),
250  ")");
251  }
252 }
const std::set< SubdomainID > & getBlockConnectedBlocks(const SubdomainID subdomain_id) const
virtual const std::set< SubdomainID > & blockIDs() const
virtual const std::string & name() const
const MooseMesh & _moose_mesh
The MooseMesh that this user object operates on.
std::string stringify(const T &t)
const std::vector< SubdomainName > & blocks() const
void mooseError(Args &&... args) const

◆ computeCellVelocity()

void RhieChowMassFlux::computeCellVelocity ( )

Update the cell values of the velocity variables.

Definition at line 355 of file RhieChowMassFlux.C.

Referenced by LinearAssemblySegregatedSolve::correctVelocity().

356 {
357  auto & pressure_gradient = _pressure_system->gradientContainer();
358 
359  // We set the dof value in the solution vector the same logic applies:
360  // u_C = -(H/A)_C - (1/A)_C*grad(p)_C where C is the cell index
361  for (const auto system_i : index_range(_momentum_implicit_systems))
362  {
363  auto working_vector = _Ainv_raw[system_i]->clone();
364  working_vector->pointwise_mult(*working_vector, *pressure_gradient[system_i]);
365  working_vector->add(*_HbyA_raw[system_i]);
366  working_vector->scale(-1.0);
367  (*_momentum_implicit_systems[system_i]->solution) = *working_vector;
368  _momentum_implicit_systems[system_i]->update();
369  _momentum_systems[system_i]->setSolution(
370  *_momentum_implicit_systems[system_i]->current_local_solution);
371  }
372 }
std::vector< LinearSystem * > _momentum_systems
Pointers to the linear system(s) in moose corresponding to the momentum equation(s) ...
std::vector< libMesh::LinearImplicitSystem * > _momentum_implicit_systems
Pointers to the momentum equation implicit system(s) from libmesh.
const std::vector< std::unique_ptr< NumericVector< Number > > > & gradientContainer() const
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...
const LinearSystem * _pressure_system
Pointer to the pressure system.
auto index_range(const T &sizable)
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...

◆ computeFaceMassFlux()

void RhieChowMassFlux::computeFaceMassFlux ( )

Update the values of the face velocities in the containers.

Definition at line 285 of file RhieChowMassFlux.C.

Referenced by LinearAssemblySegregatedSolve::correctVelocity().

286 {
287  using namespace Moose::FV;
288 
289  const auto time_arg = Moose::currentState();
290 
291  // Petsc vector reader to make the repeated reading from the vector faster
293 
294  // We loop through the faces and compute the face fluxes using the pressure gradient
295  // and the momentum matrix/right hand side
296  for (auto & fi : _flow_face_info)
297  {
298  // Making sure the kernel knows which face we are on
300 
301  // We are setting this to 1.0 because we don't want to multiply the kernel contributions
302  // with the surface area yet. The surface area will be factored in in the advection kernels.
304 
305  Real p_grad_flux = 0.0;
306  if (_p->isInternalFace(*fi))
307  {
308  const auto & elem_info = *fi->elemInfo();
309  const auto & neighbor_info = *fi->neighborInfo();
310 
311  // Fetching the dof indices for the pressure variable
312  const auto elem_dof = elem_info.dofIndices()[_global_pressure_system_number][0];
313  const auto neighbor_dof = neighbor_info.dofIndices()[_global_pressure_system_number][0];
314 
315  // Fetching the values of the pressure for the element and the neighbor
316  const auto p_elem_value = p_reader(elem_dof);
317  const auto p_neighbor_value = p_reader(neighbor_dof);
318 
319  // Compute the elem matrix contributions for the face
320  const auto elem_matrix_contribution = _p_diffusion_kernel->computeElemMatrixContribution();
321  const auto neighbor_matrix_contribution =
323  const auto elem_rhs_contribution =
325 
326  // Compute the face flux from the matrix and right hand side contributions
327  p_grad_flux = (p_neighbor_value * neighbor_matrix_contribution +
328  p_elem_value * elem_matrix_contribution) -
329  elem_rhs_contribution;
330  }
331  else if (auto * bc_pointer = _p->getBoundaryCondition(*fi->boundaryIDs().begin()))
332  {
333  mooseAssert(fi->boundaryIDs().size() == 1, "We should only have one boundary on every face.");
334 
335  bc_pointer->setupFaceData(
336  fi, fi->faceType(std::make_pair(_p->number(), _global_pressure_system_number)));
337 
338  const ElemInfo & elem_info =
339  hasBlocks(fi->elemPtr()->subdomain_id()) ? *fi->elemInfo() : *fi->neighborInfo();
340  const auto p_elem_value = _p->getElemValue(elem_info, time_arg);
341  const auto matrix_contribution =
343  const auto rhs_contribution =
345 
346  // On the boundary, only the element side has a contribution
347  p_grad_flux = (p_elem_value * matrix_contribution - rhs_contribution);
348  }
349  // Compute the new face flux
350  _face_mass_flux[fi->id()] = -_HbyA_flux[fi->id()] + p_grad_flux;
351  }
352 }
unsigned int number() const
virtual Real computeElemMatrixContribution() override
virtual void setupFaceData(const FaceInfo *face_info)
const LinearSystem * _pressure_system
Pointer to the pressure system.
LinearFVBoundaryCondition * getBoundaryCondition(const BoundaryID bd_id) const
virtual Real computeBoundaryMatrixContribution(const LinearFVBoundaryCondition &bc) override
bool isInternalFace(const FaceInfo &) const
FaceCenteredMapFunctor< Real, std::unordered_map< dof_id_type, Real > > _HbyA_flux
A map functor from faces to $HbyA_{ij} = (A_{offdiag}*{(predicted~velocity)} - {Source})_{ij}/A_{ij}$...
const MooseLinearVariableFVReal *const _p
The thread 0 copy of the pressure variable.
unsigned int _global_pressure_system_number
Global number of the pressure system.
virtual Real computeElemRightHandSideContribution() override
virtual Real computeNeighborMatrixContribution() override
void setCurrentFaceArea(const Real area)
virtual Real computeBoundaryRHSContribution(const LinearFVBoundaryCondition &bc) override
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.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Real getElemValue(const ElemInfo &elem_info, const StateArg &state) const
std::unique_ptr< NumericVector< Number > > current_local_solution
std::vector< const FaceInfo * > _flow_face_info
The subset of the FaceInfo objects that actually cover the subdomains which the flow field is defined...
bool hasBlocks(const SubdomainName &name) const
StateArg currentState()
LinearFVAnisotropicDiffusion * _p_diffusion_kernel
Pointer to the pressure diffusion term in the pressure Poisson equation.
virtual System & system() override

◆ 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 491 of file RhieChowMassFlux.C.

Referenced by LinearAssemblySegregatedSolve::correctVelocity().

492 {
493  if (verbose)
494  {
495  _console << "************************************" << std::endl;
496  _console << "Computing HbyA" << std::endl;
497  _console << "************************************" << std::endl;
498  }
500  "The momentum system shall be linked before calling this function!");
501 
502  auto & pressure_gradient = selectPressureGradient(with_updated_pressure);
503 
504  _HbyA_raw.clear();
505  _Ainv_raw.clear();
506  for (auto system_i : index_range(_momentum_systems))
507  {
508  LinearImplicitSystem * momentum_system = _momentum_implicit_systems[system_i];
509 
510  NumericVector<Number> & rhs = *(momentum_system->rhs);
511  NumericVector<Number> & current_local_solution = *(momentum_system->current_local_solution);
512  NumericVector<Number> & solution = *(momentum_system->solution);
513  PetscMatrix<Number> * mmat = dynamic_cast<PetscMatrix<Number> *>(momentum_system->matrix);
514  mooseAssert(mmat,
515  "The matrices used in the segregated INSFVRhieChow objects need to be convertable "
516  "to PetscMatrix!");
517 
518  if (verbose)
519  {
520  _console << "Matrix in rc object" << std::endl;
521  mmat->print();
522  }
523 
524  // First, we extract the diagonal and we will hold on to it for a little while
525  _Ainv_raw.push_back(current_local_solution.zero_clone());
526  NumericVector<Number> & Ainv = *(_Ainv_raw.back());
527 
528  mmat->get_diagonal(Ainv);
529 
530  if (verbose)
531  {
532  _console << "Velocity solution in H(u)" << std::endl;
533  solution.print();
534  }
535 
536  // Time to create H(u) = M_{offdiag} * u - b_{nonpressure}
537  _HbyA_raw.push_back(current_local_solution.zero_clone());
538  NumericVector<Number> & HbyA = *(_HbyA_raw.back());
539 
540  // We start with the matrix product part, we will do
541  // M*u - A*u for 2 reasons:
542  // 1, We assume A*u petsc operation is faster than setting the matrix diagonal to 0
543  // 2, In PISO loops we need to reuse the matrix so we can't just set the diagonals to 0
544 
545  // We create a working vector to ease some of the operations, we initialize its values
546  // with the current solution values to have something for the A*u term
547  auto working_vector = momentum_system->current_local_solution->zero_clone();
548  PetscVector<Number> * working_vector_petsc =
549  dynamic_cast<PetscVector<Number> *>(working_vector.get());
550  mooseAssert(working_vector_petsc,
551  "The vectors used in the RhieChowMassFlux objects need to be convertable "
552  "to PetscVectors!");
553 
554  mmat->vector_mult(HbyA, solution);
555  working_vector_petsc->pointwise_mult(Ainv, solution);
556  HbyA.add(-1.0, *working_vector_petsc);
557 
558  if (verbose)
559  {
560  _console << " H(u)" << std::endl;
561  HbyA.print();
562  }
563 
564  // We continue by adding the momentum right hand side contributions
565  HbyA.add(-1.0, rhs);
566 
567  // Unfortunately, the pressure forces are included in the momentum RHS
568  // so we have to correct them back
569  working_vector_petsc->pointwise_mult(*pressure_gradient[system_i], *_cell_volumes);
570  HbyA.add(-1.0, *working_vector_petsc);
571 
572  if (verbose)
573  {
574  _console << "total RHS" << std::endl;
575  rhs.print();
576  _console << "pressure RHS" << std::endl;
577  pressure_gradient[system_i]->print();
578  _console << " H(u)-rhs-relaxation_source" << std::endl;
579  HbyA.print();
580  }
581 
582  // It is time to create element-wise 1/A-s based on the the diagonal of the momentum matrix
583  *working_vector_petsc = 1.0;
584  Ainv.pointwise_divide(*working_vector_petsc, Ainv);
585 
586  // Create 1/A*(H(u)-RHS)
587  HbyA.pointwise_mult(HbyA, Ainv);
588 
589  if (verbose)
590  {
591  _console << " (H(u)-rhs)/A" << std::endl;
592  HbyA.print();
593  }
594 
595  if (_pressure_projection_method == "consistent")
596  {
597 
598  // Consistent Corrections to SIMPLE
599  // 1. Ainv_old = 1/a_p <- Ainv = 1/(a_p + \sum_n a_n)
600  // 2. H(u) <- H(u*) + H(u') = H(u*) - (Ainv - Ainv_old) * grad(p) * Vc
601 
602  if (verbose)
603  _console << "Performing SIMPLEC projection." << std::endl;
604 
605  // Lambda function to calculate the sum of diagonal and neighbor coefficients
606  auto get_row_sum = [mmat](NumericVector<Number> & sum_vector)
607  {
608  // Ensure the sum_vector is zeroed out
609  sum_vector.zero();
610 
611  // Local row size
612  const auto local_size = mmat->local_m();
613 
614  for (const auto row_i : make_range(local_size))
615  {
616  // Get all non-zero components of the row of the matrix
617  const auto global_index = mmat->row_start() + row_i;
618  std::vector<numeric_index_type> indices;
619  std::vector<Real> values;
620  mmat->get_row(global_index, indices, values);
621 
622  // Sum row elements (no absolute values)
623  const Real row_sum = std::accumulate(values.cbegin(), values.cend(), 0.0);
624 
625  // Add the sum of diagonal and elements to the sum_vector
626  sum_vector.add(global_index, row_sum);
627  }
628  sum_vector.close();
629  };
630 
631  // Create a temporary vector to store the sum of diagonal and neighbor coefficients
632  auto row_sum = current_local_solution.zero_clone();
633  get_row_sum(*row_sum);
634 
635  // Create vector with new inverse projection matrix
636  auto Ainv_full = current_local_solution.zero_clone();
637  *working_vector_petsc = 1.0;
638  Ainv_full->pointwise_divide(*working_vector_petsc, *row_sum);
639  const auto Ainv_full_old = Ainv_full->clone();
640 
641  // Correct HbyA
642  Ainv_full->add(-1.0, Ainv);
643  working_vector_petsc->pointwise_mult(*Ainv_full, *pressure_gradient[system_i]);
644  working_vector_petsc->pointwise_mult(*working_vector_petsc, *_cell_volumes);
645  HbyA.add(-1.0, *working_vector_petsc);
646 
647  // Correct Ainv
648  Ainv = *Ainv_full_old;
649  }
650 
651  Ainv.pointwise_mult(Ainv, *_cell_volumes);
652  }
653 
654  // We fill the 1/A and H/A functors
656 
657  if (verbose)
658  {
659  _console << "************************************" << std::endl;
660  _console << "DONE Computing HbyA " << std::endl;
661  _console << "************************************" << std::endl;
662  }
663 }
std::vector< LinearSystem * > _momentum_systems
Pointers to the linear system(s) in moose corresponding to the momentum equation(s) ...
const MooseEnum _pressure_projection_method
Enumerator for the method used for pressure projection.
virtual numeric_index_type local_m() const final
std::vector< libMesh::LinearImplicitSystem * > _momentum_implicit_systems
Pointers to the momentum equation implicit system(s) from libmesh.
void vector_mult(NumericVector< T > &dest, const NumericVector< T > &arg) const
virtual std::unique_ptr< NumericVector< T > > zero_clone() const=0
NumericVector< Number > * rhs
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...
virtual void pointwise_divide(const NumericVector< T > &vec1, const NumericVector< T > &vec2) override
virtual void pointwise_mult(const NumericVector< T > &vec1, const NumericVector< T > &vec2) override
std::unique_ptr< NumericVector< Number > > solution
virtual void print(std::ostream &os=libMesh::out) const
virtual void get_row(numeric_index_type i, std::vector< numeric_index_type > &indices, std::vector< T > &values) const override
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. ...
virtual void pointwise_mult(const NumericVector< T > &vec1, const NumericVector< T > &vec2)=0
virtual void get_diagonal(NumericVector< T > &dest) const override
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
SparseMatrix< Number > * matrix
IntRange< T > make_range(T beg, T end)
virtual numeric_index_type row_start() const override
std::unique_ptr< NumericVector< Number > > current_local_solution
const ConsoleStream _console
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.
virtual void add(const numeric_index_type i, const T value)=0
auto index_range(const T &sizable)
void print(std::ostream &os=libMesh::out, const bool sparse=false) const
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...
virtual void pointwise_divide(const NumericVector< T > &vec1, const NumericVector< T > &vec2)=0
std::unique_ptr< NumericVector< Number > > _cell_volumes
We will hold a vector of cell volumes to make sure we can do volume corrections rapidly.

◆ execute()

virtual void RhieChowMassFlux::execute ( )
inlineoverridevirtual

Implements GeneralUserObject.

Definition at line 65 of file RhieChowMassFlux.h.

65 {}

◆ finalize()

virtual void RhieChowMassFlux::finalize ( )
inlineoverridevirtual

Implements GeneralUserObject.

Definition at line 66 of file RhieChowMassFlux.h.

66 {}

◆ getMassFlux()

Real RhieChowMassFlux::getMassFlux ( const FaceInfo fi) const

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

Definition at line 249 of file RhieChowMassFlux.C.

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

250 {
251  return _face_mass_flux.evaluate(&fi);
252 }
ValueType evaluate(const FaceInfo *const fi) const
Evaluate the face functor using a FaceInfo argument.
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.

◆ getVolumetricFaceFlux() [1/2]

Real RhieChowMassFlux::getVolumetricFaceFlux ( const FaceInfo fi) const

Get the volumetric face flux (used in advection terms)

Definition at line 255 of file RhieChowMassFlux.C.

Referenced by LinearFVScalarAdvection::setupFaceData().

256 {
257  const Moose::FaceArg face_arg{&fi,
259  /*elem_is_upwind=*/true,
260  /*correct_skewness=*/false,
261  &fi.elem(),
262  /*state_limiter*/ nullptr};
263  const Real face_rho = _rho(face_arg, Moose::currentState());
264  return libmesh_map_find(_face_mass_flux, fi.id()) / face_rho;
265 }
const Elem & elem() const
const Moose::Functor< Real > & _rho
Functor describing the density of the fluid.
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.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
dof_id_type id() const
StateArg currentState()

◆ 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 29 of file RhieChowFaceFluxProvider.C.

30 {
31  if (fi_elem_side)
32  return hasBlocks(fi.elem().subdomain_id());
33  else
34  return fi.neighborPtr() && hasBlocks(fi.neighbor().subdomain_id());
35 }
const Elem & elem() const
const Elem * neighborPtr() const
const Elem & neighbor() const
subdomain_id_type subdomain_id() const
bool hasBlocks(const SubdomainName &name) const

◆ initCouplingField()

void RhieChowMassFlux::initCouplingField ( )

Initialize the coupling fields (HbyA and Ainv)

Definition at line 375 of file RhieChowMassFlux.C.

Referenced by LinearAssemblySegregatedSolve::linkRhieChowUserObject().

376 {
377  // We loop through the faces and populate the coupling fields (face H/A and 1/H)
378  // with 0s for now. Pressure corrector solves will always come after the
379  // momentum source so we expect these fields to change before the actual solve.
380  for (auto & fi : _fe_problem.mesh().faceInfo())
381  {
382  _Ainv[fi->id()];
383  _HbyA_flux[fi->id()];
384  }
385 }
FaceCenteredMapFunctor< RealVectorValue, std::unordered_map< dof_id_type, RealVectorValue > > _Ainv
A map functor from faces to $(1/A)_f$.
const std::vector< const FaceInfo *> & faceInfo() const
FaceCenteredMapFunctor< Real, std::unordered_map< dof_id_type, Real > > _HbyA_flux
A map functor from faces to $HbyA_{ij} = (A_{offdiag}*{(predicted~velocity)} - {Source})_{ij}/A_{ij}$...
FEProblemBase & _fe_problem
virtual MooseMesh & mesh() override

◆ initFaceMassFlux()

void RhieChowMassFlux::initFaceMassFlux ( )

Initialize the container for face velocities.

Definition at line 198 of file RhieChowMassFlux.C.

Referenced by LinearAssemblySegregatedSolve::linkRhieChowUserObject().

199 {
200  using namespace Moose::FV;
201 
202  const auto time_arg = Moose::currentState();
203 
204  // We loop through the faces and compute the resulting face fluxes from the
205  // initial conditions for velocity
206  for (auto & fi : _flow_face_info)
207  {
208  RealVectorValue density_times_velocity;
209 
210  // On internal face we do a regular interpolation with geometric weights
211  if (_vel[0]->isInternalFace(*fi))
212  {
213  const auto & elem_info = *fi->elemInfo();
214  const auto & neighbor_info = *fi->neighborInfo();
215 
216  Real elem_rho = _rho(makeElemArg(fi->elemPtr()), time_arg);
217  Real neighbor_rho = _rho(makeElemArg(fi->neighborPtr()), time_arg);
218 
219  for (const auto dim_i : index_range(_vel))
220  interpolate(InterpMethod::Average,
221  density_times_velocity(dim_i),
222  _vel[dim_i]->getElemValue(elem_info, time_arg) * elem_rho,
223  _vel[dim_i]->getElemValue(neighbor_info, time_arg) * neighbor_rho,
224  *fi,
225  true);
226  }
227  // On the boundary, we just take the boundary values
228  else
229  {
230  const bool elem_is_fluid = hasBlocks(fi->elemPtr()->subdomain_id());
231  const Elem * const boundary_elem = elem_is_fluid ? fi->elemPtr() : fi->neighborPtr();
232 
233  // We need this multiplier in case the face is an internal face and
234  const Real boundary_normal_multiplier = elem_is_fluid ? 1.0 : -1.0;
235  const Moose::FaceArg boundary_face{
236  fi, Moose::FV::LimiterType::CentralDifference, true, false, boundary_elem, nullptr};
237 
238  const Real face_rho = _rho(boundary_face, time_arg);
239  for (const auto dim_i : index_range(_vel))
240  density_times_velocity(dim_i) = boundary_normal_multiplier * face_rho *
241  raw_value((*_vel[dim_i])(boundary_face, time_arg));
242  }
243 
244  _face_mass_flux[fi->id()] = density_times_velocity * fi->normal();
245  }
246 }
auto raw_value(const Eigen::Map< T > &in)
Moose::ElemArg makeElemArg(const Elem *elem, bool correct_skewnewss=false) const
std::vector< const MooseLinearVariableFVReal * > _vel
The thread 0 copy of the x-velocity variable.
const Moose::Functor< Real > & _rho
Functor describing the density of the fluid.
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.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::vector< const FaceInfo * > _flow_face_info
The subset of the FaceInfo objects that actually cover the subdomains which the flow field is defined...
bool hasBlocks(const SubdomainName &name) const
void interpolate(InterpMethod m, T &result, const T2 &value1, const T3 &value2, const FaceInfo &fi, const bool one_is_elem)
StateArg currentState()
auto index_range(const T &sizable)

◆ initialize()

void RhieChowMassFlux::initialize ( )
overridevirtual

Implements GeneralUserObject.

Definition at line 188 of file RhieChowMassFlux.C.

189 {
190  for (const auto & pair : _HbyA_flux)
191  _HbyA_flux[pair.first] = 0;
192 
193  for (const auto & pair : _Ainv)
194  _Ainv[pair.first] = 0;
195 }
FaceCenteredMapFunctor< RealVectorValue, std::unordered_map< dof_id_type, RealVectorValue > > _Ainv
A map functor from faces to $(1/A)_f$.
FaceCenteredMapFunctor< Real, std::unordered_map< dof_id_type, Real > > _HbyA_flux
A map functor from faces to $HbyA_{ij} = (A_{offdiag}*{(predicted~velocity)} - {Source})_{ij}/A_{ij}$...

◆ initialSetup()

void RhieChowMassFlux::initialSetup ( )
overridevirtual

Reimplemented from GeneralUserObject.

Definition at line 141 of file RhieChowMassFlux.C.

142 {
143  // We fetch the pressure diffusion kernel to ensure that the face flux correction
144  // is consistent with the pressure discretization in the Poisson equation.
145  std::vector<LinearFVFluxKernel *> flux_kernel;
146  auto base_query = _fe_problem.theWarehouse()
147  .query()
148  .template condition<AttribThread>(_tid)
149  .template condition<AttribSysNum>(_p->sys().number())
150  .template condition<AttribSystem>("LinearFVFluxKernel")
151  .template condition<AttribName>(getParam<std::string>("p_diffusion_kernel"))
152  .queryInto(flux_kernel);
153  if (flux_kernel.size() != 1)
154  paramError(
155  "p_diffusion_kernel",
156  "The kernel with the given name could not be found or multiple instances were identified.");
157  _p_diffusion_kernel = dynamic_cast<LinearFVAnisotropicDiffusion *>(flux_kernel[0]);
158  if (!_p_diffusion_kernel)
159  paramError("p_diffusion_kernel",
160  "The provided diffusion kernel should of type LinearFVAnisotropicDiffusion!");
161 }
TheWarehouse & theWarehouse() const
const MooseLinearVariableFVReal *const _p
The thread 0 copy of the pressure variable.
void paramError(const std::string &param, Args... args) const
unsigned int number() const
FEProblemBase & _fe_problem
Query query()
const THREAD_ID _tid
LinearFVAnisotropicDiffusion * _p_diffusion_kernel
Pointer to the pressure diffusion term in the pressure Poisson equation.

◆ linkMomentumPressureSystems()

void RhieChowMassFlux::linkMomentumPressureSystems ( const std::vector< LinearSystem *> &  momentum_systems,
const 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 111 of file RhieChowMassFlux.C.

Referenced by LinearAssemblySegregatedSolve::linkRhieChowUserObject().

115 {
116  _momentum_systems = momentum_systems;
117  _momentum_system_numbers = momentum_system_numbers;
118  _pressure_system = &pressure_system;
120 
122  for (auto & system : _momentum_systems)
123  {
124  _global_momentum_system_numbers.push_back(system->number());
125  _momentum_implicit_systems.push_back(dynamic_cast<LinearImplicitSystem *>(&system->system()));
126  }
127 
129 }
std::vector< LinearSystem * > _momentum_systems
Pointers to the linear system(s) in moose corresponding to the momentum equation(s) ...
void setupMeshInformation()
Compute the cell volumes on the mesh.
std::vector< libMesh::LinearImplicitSystem * > _momentum_implicit_systems
Pointers to the momentum equation implicit system(s) from libmesh.
const LinearSystem * _pressure_system
Pointer to the pressure system.
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)
unsigned int _global_pressure_system_number
Global number of the pressure system.
unsigned int number() const

◆ meshChanged()

void RhieChowMassFlux::meshChanged ( )
overridevirtual

Reimplemented from GeneralUserObject.

Definition at line 132 of file RhieChowMassFlux.C.

133 {
134  _HbyA_flux.clear();
135  _Ainv.clear();
136  _face_mass_flux.clear();
138 }
void setupMeshInformation()
Compute the cell volumes on the mesh.
FaceCenteredMapFunctor< RealVectorValue, std::unordered_map< dof_id_type, RealVectorValue > > _Ainv
A map functor from faces to $(1/A)_f$.
FaceCenteredMapFunctor< Real, std::unordered_map< dof_id_type, Real > > _HbyA_flux
A map functor from faces to $HbyA_{ij} = (A_{offdiag}*{(predicted~velocity)} - {Source})_{ij}/A_{ij}$...
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.

◆ 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 388 of file RhieChowMassFlux.C.

Referenced by computeHbyA().

391 {
392  // We have the raw H/A and 1/A vectors in a petsc format. This function
393  // will create face functors from them
394  using namespace Moose::FV;
395  const auto time_arg = Moose::currentState();
396 
397  // Create the petsc vector readers for faster repeated access
398  std::vector<PetscVectorReader> hbya_reader;
399  for (const auto dim_i : index_range(raw_hbya))
400  hbya_reader.emplace_back(*raw_hbya[dim_i]);
401 
402  std::vector<PetscVectorReader> ainv_reader;
403  for (const auto dim_i : index_range(raw_Ainv))
404  ainv_reader.emplace_back(*raw_Ainv[dim_i]);
405 
406  // We loop through the faces and populate the coupling fields (face H/A and 1/H)
407  for (auto & fi : _flow_face_info)
408  {
409  Real face_rho = 0;
410  RealVectorValue face_hbya;
411 
412  // We do the lookup in advance
413  auto & Ainv = _Ainv[fi->id()];
414 
415  // If it is internal, we just interpolate (using geometric weights) to the face
416  if (_vel[0]->isInternalFace(*fi))
417  {
418  // Get the dof indices for the element and the neighbor
419  const auto & elem_info = *fi->elemInfo();
420  const auto & neighbor_info = *fi->neighborInfo();
421  const auto elem_dof = elem_info.dofIndices()[_global_momentum_system_numbers[0]][0];
422  const auto neighbor_dof = neighbor_info.dofIndices()[_global_momentum_system_numbers[0]][0];
423 
424  // Get the density values for the element and neighbor. We need this multiplication to make
425  // the coupling fields mass fluxes.
426  const Real elem_rho = _rho(makeElemArg(fi->elemPtr()), time_arg);
427  const Real neighbor_rho = _rho(makeElemArg(fi->neighborPtr()), time_arg);
428 
429  // Now we do the interpolation to the face
430  interpolate(Moose::FV::InterpMethod::Average, face_rho, elem_rho, neighbor_rho, *fi, true);
431  for (const auto dim_i : index_range(raw_hbya))
432  {
434  face_hbya(dim_i),
435  hbya_reader[dim_i](elem_dof),
436  hbya_reader[dim_i](neighbor_dof),
437  *fi,
438  true);
439  interpolate(InterpMethod::Average,
440  Ainv(dim_i),
441  elem_rho * ainv_reader[dim_i](elem_dof),
442  neighbor_rho * ainv_reader[dim_i](neighbor_dof),
443  *fi,
444  true);
445  }
446  }
447  else
448  {
449  const bool elem_is_fluid = hasBlocks(fi->elemPtr()->subdomain_id());
450 
451  // We need this multiplier in case the face is an internal face and
452  const Real boundary_normal_multiplier = elem_is_fluid ? 1.0 : -1.0;
453 
454  const ElemInfo & elem_info = elem_is_fluid ? *fi->elemInfo() : *fi->neighborInfo();
455  const auto elem_dof = elem_info.dofIndices()[_global_momentum_system_numbers[0]][0];
456 
457  // If it is a Dirichlet BC, we use the dirichlet value the make sure the face flux
458  // is consistent
459  if (_vel[0]->isDirichletBoundaryFace(*fi))
460  {
461  const Moose::FaceArg boundary_face{
462  fi, Moose::FV::LimiterType::CentralDifference, true, false, elem_info.elem(), nullptr};
463  face_rho = _rho(boundary_face, Moose::currentState());
464 
465  for (const auto dim_i : make_range(_dim))
466  face_hbya(dim_i) =
467  -boundary_normal_multiplier *
468  MetaPhysicL::raw_value((*_vel[dim_i])(boundary_face, Moose::currentState()));
469  }
470  // Otherwise we just do a one-term expansion (so we just use the element value)
471  else
472  {
473  const auto elem_dof = elem_info.dofIndices()[_global_momentum_system_numbers[0]][0];
474 
475  face_rho = _rho(makeElemArg(elem_info.elem()), time_arg);
476  for (const auto dim_i : make_range(_dim))
477  face_hbya(dim_i) = boundary_normal_multiplier * hbya_reader[dim_i](elem_dof);
478  }
479 
480  // We just do a one-term expansion for 1/A no matter what
481  const Real elem_rho = _rho(makeElemArg(elem_info.elem()), time_arg);
482  for (const auto dim_i : index_range(raw_Ainv))
483  Ainv(dim_i) = elem_rho * ainv_reader[dim_i](elem_dof);
484  }
485  // Lastly, we populate the face flux resulted by H/A
486  _HbyA_flux[fi->id()] = face_hbya * fi->normal() * face_rho;
487  }
488 }
const Elem * elem() const
auto raw_value(const Eigen::Map< T > &in)
FaceCenteredMapFunctor< RealVectorValue, std::unordered_map< dof_id_type, RealVectorValue > > _Ainv
A map functor from faces to $(1/A)_f$.
std::vector< unsigned int > _global_momentum_system_numbers
Global numbers of the momentum system(s)
Moose::ElemArg makeElemArg(const Elem *elem, bool correct_skewnewss=false) const
FaceCenteredMapFunctor< Real, std::unordered_map< dof_id_type, Real > > _HbyA_flux
A map functor from faces to $HbyA_{ij} = (A_{offdiag}*{(predicted~velocity)} - {Source})_{ij}/A_{ij}$...
std::vector< const MooseLinearVariableFVReal * > _vel
The thread 0 copy of the x-velocity variable.
const Moose::Functor< Real > & _rho
Functor describing the density of the fluid.
const std::vector< std::vector< dof_id_type > > & dofIndices() const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
IntRange< T > make_range(T beg, T end)
std::vector< const FaceInfo * > _flow_face_info
The subset of the FaceInfo objects that actually cover the subdomains which the flow field is defined...
bool hasBlocks(const SubdomainName &name) const
void interpolate(InterpMethod m, T &result, const T2 &value1, const T3 &value2, const FaceInfo &fi, const bool one_is_elem)
StateArg currentState()
auto index_range(const T &sizable)
const unsigned int _dim
The dimension of the mesh, e.g. 3 for hexes and tets, 2 for quads and tris.

◆ 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 666 of file RhieChowMassFlux.C.

Referenced by computeHbyA().

667 {
668  if (updated_pressure)
669  {
670  _grad_p_current.clear();
671  for (const auto & component : _pressure_system->gradientContainer())
672  _grad_p_current.push_back(component->clone());
673  }
674 
675  return _grad_p_current;
676 }
const std::vector< std::unique_ptr< NumericVector< Number > > > & gradientContainer() const
static const std::string component
Definition: NS.h:153
const LinearSystem * _pressure_system
Pointer to the pressure system.
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.

◆ setupMeshInformation()

void RhieChowMassFlux::setupMeshInformation ( )
protected

Compute the cell volumes on the mesh.

Definition at line 164 of file RhieChowMassFlux.C.

Referenced by linkMomentumPressureSystems(), and meshChanged().

165 {
166  // We cache the cell volumes into a petsc vector for corrections here so we can use
167  // the optimized petsc operations for the normalization
169  for (const auto & elem_info : _fe_problem.mesh().elemInfoVector())
170  // We have to check this because the variable might not be defined on the given
171  // block
172  if (hasBlocks(elem_info->subdomain_id()))
173  {
174  const auto elem_dof = elem_info->dofIndices()[_global_pressure_system_number][0];
175  _cell_volumes->set(elem_dof, elem_info->volume() * elem_info->coordFactor());
176  }
177 
178  _cell_volumes->close();
179 
180  _flow_face_info.clear();
181  for (auto & fi : _fe_problem.mesh().faceInfo())
182  if (hasBlocks(fi->elemPtr()->subdomain_id()) ||
183  (fi->neighborPtr() && hasBlocks(fi->neighborPtr()->subdomain_id())))
184  _flow_face_info.push_back(fi);
185 }
const std::vector< const ElemInfo *> & elemInfoVector() const
virtual std::unique_ptr< NumericVector< T > > zero_clone() const=0
const LinearSystem * _pressure_system
Pointer to the pressure system.
const std::vector< const FaceInfo *> & faceInfo() const
virtual const NumericVector< Number > *const & currentSolution() const override final
unsigned int _global_pressure_system_number
Global number of the pressure system.
FEProblemBase & _fe_problem
virtual MooseMesh & mesh() override
std::vector< const FaceInfo * > _flow_face_info
The subset of the FaceInfo objects that actually cover the subdomains which the flow field is defined...
bool hasBlocks(const SubdomainName &name) const
std::unique_ptr< NumericVector< Number > > _cell_volumes
We will hold a vector of cell volumes to make sure we can do volume corrections rapidly.

◆ supportMeshVelocity()

virtual bool RhieChowMassFlux::supportMeshVelocity ( ) const
inlineoverrideprotectedvirtual

Returns whether the UO can support mesh velocity advection.

Reimplemented from RhieChowFaceFluxProvider.

Definition at line 105 of file RhieChowMassFlux.h.

105 { return false; }

◆ validParams()

InputParameters RhieChowMassFlux::validParams ( )
static

Definition at line 32 of file RhieChowMassFlux.C.

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

Member Data Documentation

◆ _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 143 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 149 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 186 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 114 of file RhieChowMassFlux.h.

Referenced by 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 154 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 194 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 174 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 183 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 160 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}*{(predicted~velocity)} - {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 131 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 137 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 111 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 177 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 171 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 168 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 108 of file RhieChowMassFlux.h.

Referenced by checkBlocks().

◆ _p

const MooseLinearVariableFVReal* const RhieChowMassFlux::_p
protected

The thread 0 copy of the pressure variable.

Definition at line 117 of file RhieChowMassFlux.h.

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

◆ _p_diffusion_kernel

LinearFVAnisotropicDiffusion* RhieChowMassFlux::_p_diffusion_kernel
protected

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

Definition at line 123 of file RhieChowMassFlux.h.

Referenced by computeFaceMassFlux(), and initialSetup().

◆ _pressure_projection_method

const MooseEnum RhieChowMassFlux::_pressure_projection_method
protected

Enumerator for the method used for pressure projection.

Definition at line 189 of file RhieChowMassFlux.h.

Referenced by computeHbyA().

◆ _pressure_system

const LinearSystem* RhieChowMassFlux::_pressure_system
protected

◆ _rho

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

Functor describing the density of the fluid.

Definition at line 165 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 120 of file RhieChowMassFlux.h.

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


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