Loading [MathJax]/extensions/tex2jax.js
https://mooseframework.inl.gov
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
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 | List of all members
INSFVRhieChowInterpolatorSegregated Class Reference

A user object which implements the Rhie Chow interpolation for segregated momentum-pressure systems. More...

#include <INSFVRhieChowInterpolatorSegregated.h>

Inheritance diagram for INSFVRhieChowInterpolatorSegregated:
[legend]

Public Types

typedef DataFileName DataFileParameterType
 
enum  ResidualTagType { ResidualTagType::NonReference, ResidualTagType::Reference }
 

Public Member Functions

 INSFVRhieChowInterpolatorSegregated (const InputParameters &params)
 
VectorValue< ADRealgetVelocity (const Moose::FV::InterpMethod m, const FaceInfo &fi, const Moose::StateArg &time, const THREAD_ID tid, bool subtract_mesh_velocity) const override
 Get the face velocity (used in advection terms) More...
 
void initFaceVelocities ()
 Initialize the container for face velocities. More...
 
void computeFaceVelocity ()
 Update the values of the face velocities in the containers. More...
 
void computeCellVelocity ()
 Update the cell values of the velocity variables. More...
 
void addToA (const libMesh::Elem *, unsigned int, const ADReal &) override
 We disable this for the segregated solver. More...
 
void meshChanged () override
 
void initialize () override
 
void execute () override
 
void finalize () override
 
bool segregated () const override
 Bool of the Rhie Chow user object is used in monolithic/segregated approaches. More...
 
void linkMomentumSystem (std::vector< NonlinearSystemBase *> momentum_systems, const std::vector< unsigned int > &momentum_system_numbers, const TagID pressure_gradient_tag)
 Update the momentum system-related information. More...
 
void computeHbyA (bool verbose)
 Computes the inverse of the digaonal (1/A) of the system matrix plus the H/A components for the pressure equation plus Rhie-Chow interpolation. 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...
 
Moose::FV::InterpMethod velocityInterpolationMethod () const
 Return the interpolation method used for velocity. More...
 
virtual void ghostADataOnBoundary (const BoundaryID)
 makes sure coefficient data gets communicated on both sides of a given boundary. More...
 
const INSFVPressureVariablepressure (THREAD_ID tid) const
 
const INSFVVelocityVariablevel () const
 
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 & 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 initialSetup ()
 
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
 
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)
 
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 (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
 
void useVectorTag (const TagName &tag_name, VectorTagsKey)
 
void useVectorTag (TagID tag_id, VectorTagsKey)
 
void useMatrixTag (const TagName &tag_name, MatrixTagsKey)
 
void useMatrixTag (TagID tag_id, MatrixTagsKey)
 
bool isVectorTagged ()
 
bool isMatrixTagged ()
 
bool hasVectorTags () const
 
const std::set< TagID > & getVectorTags (VectorTagsKey) const
 
const std::set< TagID > & getMatrixTags (MatrixTagsKey) 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

void populateHbyA (const std::vector< std::unique_ptr< NumericVector< Number >>> &raw_hbya, const std::vector< unsigned int > &var_nums)
 Populate the face values of the H/A field. More...
 
virtual const Moose::FunctorBase< ADReal > & epsilon (THREAD_ID tid) const
 A virtual method that allows us to only implement getVelocity once for free and porous flows. More...
 
template<typename Container >
void fillContainer (const std::string &var_name, Container &container)
 Fill the passed-in variable container with the thread copies of var_name. More...
 
template<typename VarType >
void checkBlocks (const VarType &var) const
 Check the block consistency between the passed in var and us. 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 ()
 
void prepareVectorTag (Assembly &assembly, unsigned int ivar)
 
void prepareVectorTag (Assembly &assembly, unsigned int ivar, ResidualTagType tag_type)
 
void prepareVectorTagNeighbor (Assembly &assembly, unsigned int ivar)
 
void prepareVectorTagLower (Assembly &assembly, unsigned int ivar)
 
void prepareMatrixTag (Assembly &assembly, unsigned int ivar, unsigned int jvar)
 
void prepareMatrixTag (Assembly &assembly, unsigned int ivar, unsigned int jvar, DenseMatrix< Number > &k) const
 
void prepareMatrixTagNonlocal (Assembly &assembly, unsigned int ivar, unsigned int jvar)
 
void prepareMatrixTagNeighbor (Assembly &assembly, unsigned int ivar, unsigned int jvar, Moose::DGJacobianType type)
 
void prepareMatrixTagNeighbor (Assembly &assembly, unsigned int ivar, unsigned int jvar, Moose::DGJacobianType type, DenseMatrix< Number > &k) const
 
void prepareMatrixTagLower (Assembly &assembly, unsigned int ivar, unsigned int jvar, Moose::ConstraintJacobianType type)
 
void accumulateTaggedLocalResidual ()
 
void assignTaggedLocalResidual ()
 
void accumulateTaggedLocalMatrix ()
 
void accumulateTaggedLocalMatrix (Assembly &assembly, unsigned int ivar, unsigned int jvar, const DenseMatrix< Number > &k)
 
void accumulateTaggedLocalMatrix (Assembly &assembly, unsigned int ivar, unsigned int jvar, Moose::DGJacobianType type, const DenseMatrix< Number > &k)
 
void accumulateTaggedNonlocalMatrix ()
 
void assignTaggedLocalMatrix ()
 
void addResiduals (Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, Real scaling_factor)
 
void addResiduals (Assembly &assembly, const DenseVector< T > &residuals, const Indices &dof_indices, Real scaling_factor)
 
void addResidualsAndJacobian (Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, Real scaling_factor)
 
void addJacobian (Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, Real scaling_factor)
 
void addJacobian (Assembly &assembly, DenseMatrix< Real > &local_k, const std::vector< dof_id_type > &row_indices, const std::vector< dof_id_type > &column_indices, Real scaling_factor)
 
void addResidualsWithoutConstraints (Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, Real scaling_factor)
 
void addResidualsAndJacobianWithoutConstraints (Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, Real scaling_factor)
 
void addJacobianWithoutConstraints (Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, Real scaling_factor)
 
void addJacobianElement (Assembly &assembly, Real value, dof_id_type row_index, dof_id_type column_index, Real scaling_factor)
 
void setResidual (SystemBase &sys, const T &residual, MooseVariableFE< T > &var)
 
void setResidual (SystemBase &sys, Real residual, dof_id_type dof_index)
 
void setResidual (SystemBase &sys, SetResidualFunctor set_residual_functor)
 
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

FaceCenteredMapFunctor< RealVectorValue, std::unordered_map< dof_id_type, RealVectorValue > > _HbyA
 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...
 
CellCenteredMapFunctor< RealVectorValue, std::unordered_map< dof_id_type, RealVectorValue > > _Ainv
 A map functor from element IDs to $1/A_i$. More...
 
std::unique_ptr< PiecewiseByBlockLambdaFunctor< ADRealVectorValue > > _vel
 A functor for computing the (non-RC corrected) velocity. More...
 
FaceCenteredMapFunctor< RealVectorValue, std::unordered_map< dof_id_type, RealVectorValue > > _face_velocity
 A map functor from faces to face velocities which are used in the advection terms. More...
 
std::vector< NonlinearSystemBase * > _momentum_systems
 Pointers to the nonlinear system(s) corresponding to the momentum equation(s) More...
 
std::vector< unsigned int_momentum_system_numbers
 Numbers of the momentum system(s) More...
 
std::vector< libMesh::NonlinearImplicitSystem * > _momentum_implicit_systems
 Pointers to the momentum equation implicit system(s) More...
 
TagID _pressure_gradient_tag
 Residual tag corresponding to the pressure gradient contribution. More...
 
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...
 
INSFVPressureVariable *const _p
 The thread 0 copy of the pressure variable. More...
 
INSFVVelocityVariable *const _u
 The thread 0 copy of the x-velocity variable. More...
 
INSFVVelocityVariable *const _v
 The thread 0 copy of the y-velocity variable (null if the problem is 1D) More...
 
INSFVVelocityVariable *const _w
 The thread 0 copy of the z-velocity variable (null if the problem is not 3D) More...
 
std::vector< MooseVariableFVReal * > _ps
 All the thread copies of the pressure variable. More...
 
std::vector< MooseVariableFVReal * > _us
 All the thread copies of the x-velocity variable. More...
 
std::vector< MooseVariableFVReal * > _vs
 All the thread copies of the y-velocity variable. More...
 
std::vector< MooseVariableFVReal * > _ws
 All the thread copies of the z-velocity variable. More...
 
std::vector< unsigned int_var_numbers
 The velocity variable numbers. More...
 
SystemBase_sys
 The nonlinear system. More...
 
Moose::FV::InterpMethod _velocity_interp_method
 The interpolation method to use for the velocity. More...
 
const bool _displaced
 Whether this object is operating on the displaced mesh. More...
 
SubProblem_subproblem
 
SubProblem_subproblem
 
FEProblemBase_fe_problem
 
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
 
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
 
DenseVector< Number_local_re
 
DenseMatrix< Number_local_ke
 
DenseMatrix< Number_nonlocal_ke
 

Static Protected Attributes

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

Detailed Description

A user object which implements the Rhie Chow interpolation for segregated momentum-pressure systems.

Definition at line 33 of file INSFVRhieChowInterpolatorSegregated.h.

Constructor & Destructor Documentation

◆ INSFVRhieChowInterpolatorSegregated()

INSFVRhieChowInterpolatorSegregated::INSFVRhieChowInterpolatorSegregated ( const InputParameters params)

Definition at line 52 of file INSFVRhieChowInterpolatorSegregated.C.

54  : RhieChowInterpolatorBase(params),
55  _HbyA(_moose_mesh, blockIDs(), "HbyA"),
56  _Ainv(_moose_mesh, blockIDs(), "Ainv", false),
58  name(),
59  [this](const auto & r, const auto & t) -> ADRealVectorValue
60  {
61  ADRealVectorValue velocity((*_u)(r, t));
62  if (_dim >= 2)
63  velocity(1) = (*_v)(r, t);
64  if (_dim >= 3)
65  velocity(2) = (*_w)(r, t);
66  return velocity;
67  },
68  std::set<ExecFlagType>({EXEC_ALWAYS}),
70  blockIDs())),
71  _face_velocity(_moose_mesh, blockIDs(), "face_values")
72 {
73  if (_displaced)
74  paramError("use_displaced_mesh",
75  "The segregated Rhie-Chow user object does not currently support operation on a "
76  "displaced mesh");
77 
78  // Register the elemental/face functors which will be queried in the pressure equation
79  for (const auto tid : make_range(libMesh::n_threads()))
80  {
83  }
84 
86  paramError("velocity_interp_method",
87  "Segregated momentum-pressure solvers do not allow average interpolation methods!");
88 
89  if (!dynamic_cast<SIMPLENonlinearAssembly *>(getMooseApp().getExecutioner()))
90  mooseError(this->name(), " should only be used with a segregated thermal-hydraulics solver!");
91 }
unsigned int n_threads()
MooseMesh & _moose_mesh
The MooseMesh that this user object operates on.
INSFVVelocityVariable *const _u
The thread 0 copy of the x-velocity variable.
void addFunctor(const std::string &name, const Moose::FunctorBase< T > &functor, const THREAD_ID tid)
const bool _displaced
Whether this object is operating on the displaced mesh.
virtual const std::set< SubdomainID > & blockIDs() const
const ExecFlagType EXEC_ALWAYS
virtual const std::string & name() const
MooseApp & getMooseApp() const
CellCenteredMapFunctor< RealVectorValue, std::unordered_map< dof_id_type, RealVectorValue > > _Ainv
A map functor from element IDs to $1/A_i$.
SubProblem & _subproblem
RhieChowInterpolatorBase(const InputParameters &params)
FaceCenteredMapFunctor< RealVectorValue, std::unordered_map< dof_id_type, RealVectorValue > > _face_velocity
A map functor from faces to face velocities which are used in the advection terms.
const unsigned int _dim
The dimension of the mesh, e.g. 3 for hexes and tets, 2 for quads and tris.
void paramError(const std::string &param, Args... args) const
Moose::FV::InterpMethod _velocity_interp_method
The interpolation method to use for the velocity.
FaceCenteredMapFunctor< RealVectorValue, std::unordered_map< dof_id_type, RealVectorValue > > _HbyA
A map functor from faces to $HbyA_{ij} = (A_{offdiag}*{(predicted~velocity)} - {Source})_{ij}/A_{ij}$...
IntRange< T > make_range(T beg, T end)
void mooseError(Args &&... args) const
static const std::string velocity
Definition: NS.h:45
std::unique_ptr< PiecewiseByBlockLambdaFunctor< ADRealVectorValue > > _vel
A functor for computing the (non-RC corrected) velocity.

Member Function Documentation

◆ addToA()

void INSFVRhieChowInterpolatorSegregated::addToA ( const libMesh::Elem ,
unsigned int  ,
const ADReal  
)
inlineoverridevirtual

We disable this for the segregated solver.

Implements RhieChowInterpolatorBase.

Definition at line 54 of file INSFVRhieChowInterpolatorSegregated.h.

57  {
58  mooseError(
59  "addToA function is not implemented for the RhieChow interpolation in segregated solvers.");
60  }
void mooseError(Args &&... args) const

◆ checkBlocks()

template<typename VarType >
void RhieChowInterpolatorBase::checkBlocks ( const VarType &  var) const
protectedinherited

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

Definition at line 184 of file RhieChowInterpolatorBase.h.

Referenced by INSFVRhieChowInterpolator::INSFVRhieChowInterpolator(), and RhieChowInterpolatorBase::RhieChowInterpolatorBase().

185 {
186  const auto & var_blocks = var.blockIDs();
187  const auto & uo_blocks = blockIDs();
188 
189  // Error if this UO has any blocks that the variable does not
190  std::set<SubdomainID> uo_blocks_minus_var_blocks;
191  std::set_difference(uo_blocks.begin(),
192  uo_blocks.end(),
193  var_blocks.begin(),
194  var_blocks.end(),
195  std::inserter(uo_blocks_minus_var_blocks, uo_blocks_minus_var_blocks.end()));
196  if (uo_blocks_minus_var_blocks.size() > 0)
197  mooseError("Block restriction of interpolator user object '",
198  this->name(),
199  "' (",
201  ") includes blocks not in the block restriction of variable '",
202  var.name(),
203  "' (",
204  Moose::stringify(var.blocks()),
205  ")");
206 
207  // Get the blocks in the variable but not this UO
208  std::set<SubdomainID> var_blocks_minus_uo_blocks;
209  std::set_difference(var_blocks.begin(),
210  var_blocks.end(),
211  uo_blocks.begin(),
212  uo_blocks.end(),
213  std::inserter(var_blocks_minus_uo_blocks, var_blocks_minus_uo_blocks.end()));
214 
215  // For each block in the variable but not this UO, error if there is connection
216  // to any blocks on the UO.
217  for (auto & block_id : var_blocks_minus_uo_blocks)
218  {
219  const auto connected_blocks = _moose_mesh.getBlockConnectedBlocks(block_id);
220  std::set<SubdomainID> connected_blocks_on_uo;
221  std::set_intersection(connected_blocks.begin(),
222  connected_blocks.end(),
223  uo_blocks.begin(),
224  uo_blocks.end(),
225  std::inserter(connected_blocks_on_uo, connected_blocks_on_uo.end()));
226  if (connected_blocks_on_uo.size() > 0)
227  mooseError("Block restriction of interpolator user object '",
228  this->name(),
229  "' (",
230  Moose::stringify(uo_blocks),
231  ") doesn't match the block restriction of variable '",
232  var.name(),
233  "' (",
234  Moose::stringify(var_blocks),
235  ")");
236  }
237 }
MooseMesh & _moose_mesh
The MooseMesh that this user object operates on.
const std::set< SubdomainID > & getBlockConnectedBlocks(const SubdomainID subdomain_id) const
virtual const std::set< SubdomainID > & blockIDs() const
virtual const std::string & name() const
std::string stringify(const T &t)
const std::vector< SubdomainName > & blocks() const
void mooseError(Args &&... args) const

◆ computeCellVelocity()

void INSFVRhieChowInterpolatorSegregated::computeCellVelocity ( )

Update the cell values of the velocity variables.

Definition at line 232 of file INSFVRhieChowInterpolatorSegregated.C.

Referenced by SIMPLESolveNonlinearAssembly::solve().

233 {
234  std::vector<unsigned int> var_nums = {_momentum_implicit_systems[0]->variable_number(_u->name())};
235  if (_v)
236  var_nums.push_back(_momentum_implicit_systems[1]->variable_number(_v->name()));
237  if (_w)
238  var_nums.push_back(_momentum_implicit_systems[2]->variable_number(_w->name()));
239 
240  const auto time_arg = Moose::currentState();
241 
242  for (auto & elem :
243  as_range(_mesh.active_local_elements_begin(), _mesh.active_local_elements_end()))
244  {
245  if (hasBlocks(elem->subdomain_id()))
246  {
247  const auto elem_arg = makeElemArg(elem);
248  const RealVectorValue Ainv = _Ainv(elem_arg, time_arg);
249  const RealVectorValue & grad_p = raw_value(_p->gradient(elem_arg, time_arg));
250 
251  for (auto comp_index : make_range(_dim))
252  {
253  // If we are doing segregated momentum components we need to access different vector
254  // components otherwise everything is in the same vector (with different variable names)
255  const unsigned int system_number = _momentum_implicit_systems[comp_index]->number();
256  const auto index = elem->dof_number(system_number, var_nums[comp_index], 0);
257 
258  // We set the dof value in the solution vector the same logic applies:
259  // u_C = -(H/A)_C - (1/A)_C*grad(p)_C where C is the cell index
260  _momentum_implicit_systems[comp_index]->solution->set(
261  index, -(*_HbyA_raw[comp_index])(index)-Ainv(comp_index) * grad_p(comp_index));
262  }
263  }
264  }
265 
266  for (auto system_i : index_range(_momentum_implicit_systems))
267  {
268  _momentum_implicit_systems[system_i]->solution->close();
269  _momentum_implicit_systems[system_i]->update();
270  _momentum_systems[system_i]->setSolution(
271  *_momentum_implicit_systems[system_i]->current_local_solution);
272  }
273 }
INSFVPressureVariable *const _p
The thread 0 copy of the pressure variable.
std::vector< libMesh::NonlinearImplicitSystem * > _momentum_implicit_systems
Pointers to the momentum equation implicit system(s)
std::vector< NonlinearSystemBase * > _momentum_systems
Pointers to the nonlinear system(s) corresponding to the momentum equation(s)
INSFVVelocityVariable *const _u
The thread 0 copy of the x-velocity variable.
INSFVVelocityVariable *const _v
The thread 0 copy of the y-velocity variable (null if the problem is 1D)
auto raw_value(const Eigen::Map< T > &in)
const std::string & name() const override
CellCenteredMapFunctor< RealVectorValue, std::unordered_map< dof_id_type, RealVectorValue > > _Ainv
A map functor from element IDs to $1/A_i$.
Moose::ElemArg makeElemArg(const Elem *elem, bool correct_skewnewss=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...
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
const unsigned int _dim
The dimension of the mesh, e.g. 3 for hexes and tets, 2 for quads and tris.
const libMesh::MeshBase & _mesh
The libMesh mesh that this object acts on.
INSFVVelocityVariable *const _w
The thread 0 copy of the z-velocity variable (null if the problem is not 3D)
GradientType gradient(const ElemArg &elem, const StateArg &state) const
IntRange< T > make_range(T beg, T end)
bool hasBlocks(const SubdomainName &name) const
StateArg currentState()
auto index_range(const T &sizable)

◆ computeFaceVelocity()

void INSFVRhieChowInterpolatorSegregated::computeFaceVelocity ( )

Update the values of the face velocities in the containers.

Definition at line 172 of file INSFVRhieChowInterpolatorSegregated.C.

Referenced by SIMPLESolveNonlinearAssembly::solve().

173 {
174  const auto time_arg = Moose::currentState();
175 
176  for (auto & fi : _fe_problem.mesh().faceInfo())
177  {
178  if (hasBlocks(fi->elemPtr()->subdomain_id()) ||
179  (fi->neighborPtr() && hasBlocks(fi->neighborPtr()->subdomain_id())))
180  {
181  // On internal face we just use the interpolated H/A and the pressure face gradient
182  // So u_f = -(H/A)_f - (1/A)_f*grad(p)_f
183  // Notice the (-) sign on H/A which is because we use the Jacobian/Residual
184  // computations and we get -H instead of H.
185  if (_u->isInternalFace(*fi))
186  {
187  const Moose::FaceArg face{
188  fi, Moose::FV::LimiterType::CentralDifference, true, false, nullptr, nullptr};
189 
190  RealVectorValue Ainv;
191  RealVectorValue HbyA = MetaPhysicL::raw_value(_HbyA(face, time_arg));
192 
194  Ainv,
195  _Ainv(makeElemArg(fi->elemPtr()), time_arg),
196  _Ainv(makeElemArg(fi->neighborPtr()), time_arg),
197  *fi,
198  true);
199 
200  RealVectorValue grad_p = MetaPhysicL::raw_value(_p->gradient(face, time_arg));
201  for (const auto comp_index : make_range(_dim))
202  _face_velocity[fi->id()](comp_index) =
203  -HbyA(comp_index) - Ainv(comp_index) * grad_p(comp_index);
204  }
205  else
206  {
207  const Elem * const boundary_elem =
208  hasBlocks(fi->elemPtr()->subdomain_id()) ? fi->elemPtr() : fi->neighborPtr();
209  const Moose::FaceArg boundary_face{
210  fi, Moose::FV::LimiterType::CentralDifference, true, false, boundary_elem, nullptr};
211 
212  // If we have a dirichlet boundary conditions, this sill give us the exact value of the
213  // velocity on the face as expected (see populateHbyA())
214  if (_u->isDirichletBoundaryFace(*fi, boundary_elem, time_arg))
215  _face_velocity[fi->id()] = -MetaPhysicL::raw_value(_HbyA(boundary_face, time_arg));
216  else
217  {
218  const RealVectorValue & Ainv = MetaPhysicL::raw_value(_Ainv(boundary_face, time_arg));
219  const RealVectorValue & HbyA = MetaPhysicL::raw_value(_HbyA(boundary_face, time_arg));
220  const RealVectorValue & grad_p =
221  MetaPhysicL::raw_value(_p->gradient(boundary_face, time_arg));
222  for (const auto comp_index : make_range(_dim))
223  _face_velocity[fi->id()](comp_index) =
224  -HbyA(comp_index) - Ainv(comp_index) * grad_p(comp_index);
225  }
226  }
227  }
228  }
229 }
INSFVPressureVariable *const _p
The thread 0 copy of the pressure variable.
INSFVVelocityVariable *const _u
The thread 0 copy of the x-velocity variable.
auto raw_value(const Eigen::Map< T > &in)
CellCenteredMapFunctor< RealVectorValue, std::unordered_map< dof_id_type, RealVectorValue > > _Ainv
A map functor from element IDs to $1/A_i$.
virtual bool isDirichletBoundaryFace(const FaceInfo &fi, const Elem *elem, const Moose::StateArg &state) const
Moose::ElemArg makeElemArg(const Elem *elem, bool correct_skewnewss=false) const
bool isInternalFace(const FaceInfo &) const
const std::vector< const FaceInfo *> & faceInfo() const
FaceCenteredMapFunctor< RealVectorValue, std::unordered_map< dof_id_type, RealVectorValue > > _face_velocity
A map functor from faces to face velocities which are used in the advection terms.
const unsigned int _dim
The dimension of the mesh, e.g. 3 for hexes and tets, 2 for quads and tris.
FEProblemBase & _fe_problem
FaceCenteredMapFunctor< RealVectorValue, std::unordered_map< dof_id_type, RealVectorValue > > _HbyA
A map functor from faces to $HbyA_{ij} = (A_{offdiag}*{(predicted~velocity)} - {Source})_{ij}/A_{ij}$...
GradientType gradient(const ElemArg &elem, const StateArg &state) const
IntRange< T > make_range(T beg, T end)
virtual MooseMesh & mesh() override
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()

◆ computeHbyA()

void INSFVRhieChowInterpolatorSegregated::computeHbyA ( bool  verbose)

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

Definition at line 331 of file INSFVRhieChowInterpolatorSegregated.C.

Referenced by SIMPLESolveNonlinearAssembly::solve().

332 {
333  if (verbose)
334  {
335  _console << "************************************" << std::endl;
336  _console << "Computing HbyA" << std::endl;
337  _console << "************************************" << std::endl;
338  }
340  "The momentum system shall be linked before calling this function!");
341 
343 
344  std::vector<unsigned int> var_nums = {_momentum_implicit_systems[0]->variable_number(_u->name())};
345  if (_v)
346  var_nums.push_back(_momentum_implicit_systems[1]->variable_number(_v->name()));
347  if (_w)
348  var_nums.push_back(_momentum_implicit_systems[2]->variable_number(_w->name()));
349 
350  _HbyA_raw.clear();
351  for (auto system_i : index_range(_momentum_systems))
352  {
354 
355  momentum_system = _momentum_implicit_systems[system_i];
356 
357  NumericVector<Number> & rhs = *(momentum_system->rhs);
358  NumericVector<Number> & current_local_solution = *(momentum_system->current_local_solution);
359  NumericVector<Number> & solution = *(momentum_system->solution);
360  PetscMatrix<Number> * mmat = dynamic_cast<PetscMatrix<Number> *>(momentum_system->matrix);
361  mooseAssert(mmat,
362  "The matrices used in the segregated INSFVRhieChow objects need to be convertable "
363  "to PetscMAtrix!");
364 
365  if (verbose)
366  {
367  _console << "Matrix in rc object" << std::endl;
368  mmat->print();
369  }
370 
371  auto Ainv = current_local_solution.zero_clone();
372  PetscVector<Number> * Ainv_petsc = dynamic_cast<PetscVector<Number> *>(Ainv.get());
373 
374  mmat->get_diagonal(*Ainv_petsc);
375 
376  auto working_vector = momentum_system->current_local_solution->zero_clone();
377  PetscVector<Number> * working_vector_petsc =
378  dynamic_cast<PetscVector<Number> *>(working_vector.get());
379  mooseAssert(working_vector_petsc,
380  "The vectors used in the segregated INSFVRhieChow objects need to be convertable "
381  "to PetscVectors!");
382 
383  *working_vector_petsc = 1.0;
384  Ainv_petsc->pointwise_divide(*working_vector_petsc, *Ainv_petsc);
385 
386  _HbyA_raw.push_back(current_local_solution.zero_clone());
387  NumericVector<Number> & HbyA = *(_HbyA_raw.back());
388 
389  if (verbose)
390  {
391  _console << "Velocity solution in H(u)" << std::endl;
392  solution.print();
393  }
394 
395  // We fill the 1/A functor
396  auto active_local_begin =
397  _mesh.evaluable_elements_begin(momentum_system->get_dof_map(), var_nums[system_i]);
398  auto active_local_end =
399  _mesh.evaluable_elements_end(momentum_system->get_dof_map(), var_nums[system_i]);
400 
401  const auto & state = Moose::currentState();
402  for (auto it = active_local_begin; it != active_local_end; ++it)
403  {
404  const Elem * elem = *it;
405  if (this->hasBlocks(elem->subdomain_id()))
406  {
407  const Moose::ElemArg & elem_arg = makeElemArg(elem);
408  Real coord_multiplier;
409  const auto coord_type = _fe_problem.getCoordSystem(elem->subdomain_id());
410  const unsigned int rz_radial_coord =
412 
414  elem->vertex_average(), coord_multiplier, coord_type, rz_radial_coord);
415 
416  const Real volume = _moose_mesh.elemInfo(elem->id()).volume();
417  const auto dof_index = elem->dof_number(momentum_system->number(), var_nums[system_i], 0);
418  _Ainv[elem->id()](system_i) = MetaPhysicL::raw_value(epsilon(_tid)(elem_arg, state)) *
419  (*Ainv_petsc)(dof_index)*volume * coord_multiplier;
420  }
421  }
422 
423  // Now we set the diagonal of our system matrix to 0 so we can create H*u
424  // TODO: Add a function for this in libmesh
425  *working_vector_petsc = 0.0;
426  LibmeshPetscCall(MatDiagonalSet(mmat->mat(), working_vector_petsc->vec(), INSERT_VALUES));
427 
428  if (verbose)
429  {
430  _console << "H" << std::endl;
431  mmat->print();
432  }
433 
434  // We need to subtract the contribution of the pressure gradient from the residual (right hand
435  // side). We plug working_vector=0 in here to get the right hand side contribution
436  _fe_problem.computeResidualTag(*working_vector, HbyA, _pressure_gradient_tag);
437 
438  // Now we reorganize the association between tags and vectors to make sure
439  // that the next solve is perfect
440  _momentum_systems[system_i]->associateVectorToTag(
441  momentum_system->get_vector(_fe_problem.vectorTagName(0)), 0);
442  _momentum_systems[system_i]->associateVectorToTag(
443  momentum_system->get_vector(_fe_problem.vectorTagName(_pressure_gradient_tag)),
445  _momentum_systems[system_i]->setSolution(current_local_solution);
446 
447  if (verbose)
448  {
449  _console << "total RHS" << std::endl;
450  rhs.print();
451  _console << "pressure RHS" << std::endl;
452  HbyA.print();
453  }
454 
455  // We correct the right hand side to exclude the pressure contribution
456  HbyA.scale(-1.0);
457  HbyA.add(-1.0, rhs);
458 
459  if (verbose)
460  {
461  _console << "H RHS" << std::endl;
462  HbyA.print();
463  }
464 
465  // Create H(u)
466  mmat->vector_mult(*working_vector_petsc, solution);
467 
468  if (verbose)
469  {
470  _console << " H(u)" << std::endl;
471  working_vector_petsc->print();
472  }
473 
474  // Create H(u) - RHS
475  HbyA.add(*working_vector_petsc);
476 
477  if (verbose)
478  {
479  _console << " H(u)-rhs-relaxation_source" << std::endl;
480  HbyA.print();
481  }
482 
483  // Create 1/A*(H(u)-RHS)
484  HbyA.pointwise_mult(HbyA, *Ainv);
485 
486  if (verbose)
487  {
488  _console << " (H(u)-rhs)/A" << std::endl;
489  HbyA.print();
490  }
491  }
492 
493  populateHbyA(_HbyA_raw, var_nums);
494 
495  if (verbose)
496  {
497  _console << "************************************" << std::endl;
498  _console << "DONE Computing HbyA " << std::endl;
499  _console << "************************************" << std::endl;
500  }
501 }
unsigned int getAxisymmetricRadialCoord() const
std::vector< libMesh::NonlinearImplicitSystem * > _momentum_implicit_systems
Pointers to the momentum equation implicit system(s)
dof_id_type dof_number(const unsigned int s, const unsigned int var, const unsigned int comp) const
std::vector< NonlinearSystemBase * > _momentum_systems
Pointers to the nonlinear system(s) corresponding to the momentum equation(s)
std::vector< unsigned int > _momentum_system_numbers
Numbers of the momentum system(s)
const unsigned int invalid_uint
MooseMesh & _moose_mesh
The MooseMesh that this user object operates on.
virtual const Moose::FunctorBase< ADReal > & epsilon(THREAD_ID tid) const
A virtual method that allows us to only implement getVelocity once for free and porous flows...
INSFVVelocityVariable *const _u
The thread 0 copy of the x-velocity variable.
void vector_mult(NumericVector< T > &dest, const NumericVector< T > &arg) const
void coordTransformFactor(const P &point, C &factor, const Moose::CoordinateSystemType coord_type, const unsigned int rz_radial_coord=libMesh::invalid_uint)
INSFVVelocityVariable *const _v
The thread 0 copy of the y-velocity variable (null if the problem is 1D)
virtual std::unique_ptr< NumericVector< T > > zero_clone() const=0
auto raw_value(const Eigen::Map< T > &in)
const std::string & name() const override
virtual void pointwise_divide(const NumericVector< T > &vec1, const NumericVector< T > &vec2) override
CellCenteredMapFunctor< RealVectorValue, std::unordered_map< dof_id_type, RealVectorValue > > _Ainv
A map functor from element IDs to $1/A_i$.
Moose::ElemArg makeElemArg(const Elem *elem, bool correct_skewnewss=false) const
virtual void scale(const T factor)=0
void setCurrentNonlinearSystem(const unsigned int nl_sys_num)
dof_id_type id() 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 print(std::ostream &os=libMesh::out) const
Real volume(const MeshBase &mesh, unsigned int dim=libMesh::invalid_uint)
void populateHbyA(const std::vector< std::unique_ptr< NumericVector< Number >>> &raw_hbya, const std::vector< unsigned int > &var_nums)
Populate the face values of the H/A field.
const libMesh::MeshBase & _mesh
The libMesh mesh that this object acts on.
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
subdomain_id_type subdomain_id() const
INSFVVelocityVariable *const _w
The thread 0 copy of the z-velocity variable (null if the problem is not 3D)
FEProblemBase & _fe_problem
const THREAD_ID _tid
TagID _pressure_gradient_tag
Residual tag corresponding to the pressure gradient contribution.
Moose::CoordinateSystemType getCoordSystem(SubdomainID sid) const
virtual TagName vectorTagName(const TagID tag) const
const ConsoleStream _console
bool hasBlocks(const SubdomainName &name) const
virtual void add(const numeric_index_type i, const T value)=0
StateArg currentState()
auto index_range(const T &sizable)
void print(std::ostream &os=libMesh::out, const bool sparse=false) const
const ElemInfo & elemInfo(const dof_id_type id) const
Point vertex_average() const
virtual void computeResidualTag(const NumericVector< libMesh::Number > &soln, NumericVector< libMesh::Number > &residual, TagID tag)

◆ epsilon()

const Moose::FunctorBase< ADReal > & RhieChowInterpolatorBase::epsilon ( THREAD_ID  tid) const
inlineprotectedvirtualinherited

A virtual method that allows us to only implement getVelocity once for free and porous flows.

Reimplemented in PINSFVRhieChowInterpolator, and PINSFVRhieChowInterpolatorSegregated.

Definition at line 157 of file RhieChowInterpolatorBase.h.

Referenced by computeHbyA(), and INSFVRhieChowInterpolator::getVelocity().

158 {
159  return _unity_functor;
160 }
const Moose::ConstantFunctor< ADReal > _unity_functor
A unity functor used in the epsilon virtual method.

◆ execute()

void INSFVRhieChowInterpolatorSegregated::execute ( )
inlineoverridevirtual

Implements GeneralUserObject.

Definition at line 64 of file INSFVRhieChowInterpolatorSegregated.h.

64 {}

◆ fillContainer()

template<typename Container >
void RhieChowInterpolatorBase::fillContainer ( const std::string &  var_name,
Container &  container 
)
protectedinherited

Fill the passed-in variable container with the thread copies of var_name.

Definition at line 171 of file RhieChowInterpolatorBase.h.

Referenced by INSFVRhieChowInterpolator::INSFVRhieChowInterpolator(), and RhieChowInterpolatorBase::RhieChowInterpolatorBase().

172 {
173  typedef typename Container::value_type ContainedType;
174  for (const auto tid : make_range(libMesh::n_threads()))
175  {
176  auto * const var = static_cast<ContainedType>(
177  &UserObject::_subproblem.getVariable(tid, getParam<VariableName>(name)));
178  container[tid] = var;
179  }
180 }
unsigned int n_threads()
virtual const std::string & name() const
SubProblem & _subproblem
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
IntRange< T > make_range(T beg, T end)

◆ finalize()

void INSFVRhieChowInterpolatorSegregated::finalize ( )
inlineoverridevirtual

Implements GeneralUserObject.

Definition at line 65 of file INSFVRhieChowInterpolatorSegregated.h.

65 {}

◆ getVelocity()

VectorValue< ADReal > INSFVRhieChowInterpolatorSegregated::getVelocity ( const Moose::FV::InterpMethod  m,
const FaceInfo fi,
const Moose::StateArg time,
const THREAD_ID  tid,
bool  subtract_mesh_velocity 
) const
overridevirtual

Get the face velocity (used in advection terms)

Implements RhieChowInterpolatorBase.

Definition at line 160 of file INSFVRhieChowInterpolatorSegregated.C.

165 {
167  mooseError("Segregated solution algorithms only support Rhie-Chow interpolation!");
168  return _face_velocity.evaluate(&fi);
169 }
FaceCenteredMapFunctor< RealVectorValue, std::unordered_map< dof_id_type, RealVectorValue > > _face_velocity
A map functor from faces to face velocities which are used in the advection terms.
void mooseError(Args &&... args) const

◆ getVolumetricFaceFlux()

Real RhieChowInterpolatorBase::getVolumetricFaceFlux ( const Moose::FV::InterpMethod  m,
const FaceInfo fi,
const Moose::StateArg time,
const THREAD_ID  tid,
bool  subtract_mesh_velocity 
) const
overridevirtualinherited

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.

Definition at line 144 of file RhieChowInterpolatorBase.C.

149 {
150  return raw_value(this->getVelocity(m, fi, time, tid, subtract_mesh_velocity)) * fi.normal();
151 }
auto raw_value(const Eigen::Map< T > &in)
virtual VectorValue< ADReal > getVelocity(const Moose::FV::InterpMethod m, const FaceInfo &fi, const Moose::StateArg &time, const THREAD_ID tid, bool subtract_mesh_velocity) const =0
Retrieve a face velocity.
const Point & normal() const

◆ ghostADataOnBoundary()

virtual void RhieChowInterpolatorBase::ghostADataOnBoundary ( const BoundaryID  )
inlinevirtualinherited

makes sure coefficient data gets communicated on both sides of a given boundary.

This is a virtual function, mostly used for monolithic approaches.

Reimplemented in INSFVRhieChowInterpolator.

Definition at line 76 of file RhieChowInterpolatorBase.h.

Referenced by VolumetricFlowRate::initialSetup().

76 {}

◆ 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

◆ initFaceVelocities()

void INSFVRhieChowInterpolatorSegregated::initFaceVelocities ( )

Initialize the container for face velocities.

Definition at line 128 of file INSFVRhieChowInterpolatorSegregated.C.

Referenced by SIMPLESolveNonlinearAssembly::linkRhieChowUserObject().

129 {
130  for (auto & fi : _fe_problem.mesh().faceInfo())
131  {
132  if (hasBlocks(fi->elemPtr()->subdomain_id()) ||
133  (fi->neighborPtr() && hasBlocks(fi->neighborPtr()->subdomain_id())))
134  {
135  // On internal face we do a regular interpoaltion with geometric weights
136  if (_u->isInternalFace(*fi))
137  {
138  const Moose::FaceArg face{
139  fi, Moose::FV::LimiterType::CentralDifference, true, false, nullptr, nullptr};
140 
142  }
143  // On the boundary, we just take the boundary values
144  else
145  {
146  const Elem * const boundary_elem =
147  hasBlocks(fi->elemPtr()->subdomain_id()) ? fi->elemPtr() : fi->neighborPtr();
148 
149  const Moose::FaceArg boundary_face{
150  fi, Moose::FV::LimiterType::CentralDifference, true, false, boundary_elem, nullptr};
151 
152  _face_velocity[fi->id()] =
153  MetaPhysicL::raw_value((*_vel)(boundary_face, Moose::currentState()));
154  }
155  }
156  }
157 }
INSFVVelocityVariable *const _u
The thread 0 copy of the x-velocity variable.
auto raw_value(const Eigen::Map< T > &in)
bool isInternalFace(const FaceInfo &) const
const std::vector< const FaceInfo *> & faceInfo() const
FaceCenteredMapFunctor< RealVectorValue, std::unordered_map< dof_id_type, RealVectorValue > > _face_velocity
A map functor from faces to face velocities which are used in the advection terms.
FEProblemBase & _fe_problem
virtual MooseMesh & mesh() override
bool hasBlocks(const SubdomainName &name) const
std::unique_ptr< PiecewiseByBlockLambdaFunctor< ADRealVectorValue > > _vel
A functor for computing the (non-RC corrected) velocity.
StateArg currentState()

◆ initialize()

void INSFVRhieChowInterpolatorSegregated::initialize ( )
overridevirtual

Implements GeneralUserObject.

Definition at line 118 of file INSFVRhieChowInterpolatorSegregated.C.

119 {
120  for (const auto & pair : _HbyA)
121  _HbyA[pair.first] = 0;
122 
123  for (const auto & pair : _Ainv)
124  _Ainv[pair.first] = 0;
125 }
CellCenteredMapFunctor< RealVectorValue, std::unordered_map< dof_id_type, RealVectorValue > > _Ainv
A map functor from element IDs to $1/A_i$.
FaceCenteredMapFunctor< RealVectorValue, std::unordered_map< dof_id_type, RealVectorValue > > _HbyA
A map functor from faces to $HbyA_{ij} = (A_{offdiag}*{(predicted~velocity)} - {Source})_{ij}/A_{ij}$...

◆ linkMomentumSystem()

void INSFVRhieChowInterpolatorSegregated::linkMomentumSystem ( std::vector< NonlinearSystemBase *>  momentum_systems,
const std::vector< unsigned int > &  momentum_system_numbers,
const TagID  pressure_gradient_tag 
)

Update the momentum system-related information.

Parameters
momentum_systemsPointers to the momentum systems which are solved for the momentum vector components
momentum_system_numbersThe numbers of these systems
pressure_gradient_tagThe tag which is associated with the pressure gradient kernels. This is needed for separating the pressure contibution from other terms in the momentum systems.

Definition at line 94 of file INSFVRhieChowInterpolatorSegregated.C.

Referenced by SIMPLESolveNonlinearAssembly::linkRhieChowUserObject().

98 {
99  _momentum_systems = momentum_systems;
100  _momentum_system_numbers = momentum_system_numbers;
101  _pressure_gradient_tag = pressure_gradient_tag;
102 
104  for (auto & system : _momentum_systems)
105  _momentum_implicit_systems.push_back(
106  dynamic_cast<NonlinearImplicitSystem *>(&system->system()));
107 }
std::vector< libMesh::NonlinearImplicitSystem * > _momentum_implicit_systems
Pointers to the momentum equation implicit system(s)
std::vector< NonlinearSystemBase * > _momentum_systems
Pointers to the nonlinear system(s) corresponding to the momentum equation(s)
std::vector< unsigned int > _momentum_system_numbers
Numbers of the momentum system(s)
TagID _pressure_gradient_tag
Residual tag corresponding to the pressure gradient contribution.

◆ meshChanged()

void INSFVRhieChowInterpolatorSegregated::meshChanged ( )
overridevirtual

Reimplemented from GeneralUserObject.

Definition at line 110 of file INSFVRhieChowInterpolatorSegregated.C.

111 {
112  _HbyA.clear();
113  _Ainv.clear();
114  _face_velocity.clear();
115 }
CellCenteredMapFunctor< RealVectorValue, std::unordered_map< dof_id_type, RealVectorValue > > _Ainv
A map functor from element IDs to $1/A_i$.
FaceCenteredMapFunctor< RealVectorValue, std::unordered_map< dof_id_type, RealVectorValue > > _face_velocity
A map functor from faces to face velocities which are used in the advection terms.
FaceCenteredMapFunctor< RealVectorValue, std::unordered_map< dof_id_type, RealVectorValue > > _HbyA
A map functor from faces to $HbyA_{ij} = (A_{offdiag}*{(predicted~velocity)} - {Source})_{ij}/A_{ij}$...

◆ populateHbyA()

void INSFVRhieChowInterpolatorSegregated::populateHbyA ( const std::vector< std::unique_ptr< NumericVector< Number >>> &  raw_hbya,
const std::vector< unsigned int > &  var_nums 
)
protected

Populate the face values of the H/A field.

Definition at line 276 of file INSFVRhieChowInterpolatorSegregated.C.

Referenced by computeHbyA().

279 {
280  for (auto & fi : _fe_problem.mesh().faceInfo())
281  {
282  if (hasBlocks(fi->elemPtr()->subdomain_id()) ||
283  (fi->neighborPtr() && hasBlocks(fi->neighborPtr()->subdomain_id())))
284  {
285  // If we are on an internal face, we just interpolate the values to the faces.
286  // Otherwise, depending on the boundary type, we take the velocity value or
287  // extrapolated HbyA values.
288  if (_u->isInternalFace(*fi))
289  {
290  const Elem * elem = fi->elemPtr();
291  const Elem * neighbor = fi->neighborPtr();
292  for (auto comp_index : make_range(_dim))
293  {
294  unsigned int system_number = _momentum_implicit_systems[comp_index]->number();
295  const auto dof_index_elem = elem->dof_number(system_number, var_nums[comp_index], 0);
296  const auto dof_index_neighbor =
297  neighbor->dof_number(system_number, var_nums[comp_index], 0);
298 
300  _HbyA[fi->id()](comp_index),
301  (*raw_hbya[comp_index])(dof_index_elem),
302  (*raw_hbya[comp_index])(dof_index_neighbor),
303  *fi,
304  true);
305  }
306  }
307  else
308  {
309  const Elem * const boundary_elem =
310  hasBlocks(fi->elemPtr()->subdomain_id()) ? fi->elemPtr() : fi->neighborPtr();
311 
312  const Moose::FaceArg boundary_face{
313  fi, Moose::FV::LimiterType::CentralDifference, true, false, boundary_elem, nullptr};
314 
315  if (_u->isDirichletBoundaryFace(*fi, boundary_elem, Moose::currentState()))
316  _HbyA[fi->id()] = -MetaPhysicL::raw_value((*_vel)(boundary_face, Moose::currentState()));
317  else
318  for (const auto comp_index : make_range(_dim))
319  {
320  unsigned int system_number = _momentum_implicit_systems[comp_index]->number();
321  const auto dof_index_elem =
322  boundary_elem->dof_number(system_number, var_nums[comp_index], 0);
323  _HbyA[fi->id()](comp_index) = (*raw_hbya[comp_index])(dof_index_elem);
324  }
325  }
326  }
327  }
328 }
std::vector< libMesh::NonlinearImplicitSystem * > _momentum_implicit_systems
Pointers to the momentum equation implicit system(s)
dof_id_type dof_number(const unsigned int s, const unsigned int var, const unsigned int comp) const
INSFVVelocityVariable *const _u
The thread 0 copy of the x-velocity variable.
auto raw_value(const Eigen::Map< T > &in)
virtual bool isDirichletBoundaryFace(const FaceInfo &fi, const Elem *elem, const Moose::StateArg &state) const
bool isInternalFace(const FaceInfo &) const
const std::vector< const FaceInfo *> & faceInfo() const
const unsigned int _dim
The dimension of the mesh, e.g. 3 for hexes and tets, 2 for quads and tris.
FEProblemBase & _fe_problem
FaceCenteredMapFunctor< RealVectorValue, std::unordered_map< dof_id_type, RealVectorValue > > _HbyA
A map functor from faces to $HbyA_{ij} = (A_{offdiag}*{(predicted~velocity)} - {Source})_{ij}/A_{ij}$...
IntRange< T > make_range(T beg, T end)
virtual MooseMesh & mesh() override
bool hasBlocks(const SubdomainName &name) const
std::unique_ptr< PiecewiseByBlockLambdaFunctor< ADRealVectorValue > > _vel
A functor for computing the (non-RC corrected) velocity.
void interpolate(InterpMethod m, T &result, const T2 &value1, const T3 &value2, const FaceInfo &fi, const bool one_is_elem)
StateArg currentState()

◆ pressure()

const INSFVPressureVariable & RhieChowInterpolatorBase::pressure ( THREAD_ID  tid) const
inlineinherited
Returns
The pressure variable corresponding to the provided thread ID

Definition at line 163 of file RhieChowInterpolatorBase.h.

Referenced by PINSFVMomentumAdvection::PINSFVMomentumAdvection().

164 {
165  mooseAssert(tid < _ps.size(), "Attempt to access out-of-bounds in pressure variable container");
166  return *static_cast<INSFVPressureVariable *>(_ps[tid]);
167 }
std::vector< MooseVariableFVReal * > _ps
All the thread copies of the pressure variable.

◆ segregated()

bool INSFVRhieChowInterpolatorSegregated::segregated ( ) const
inlineoverridevirtual

Bool of the Rhie Chow user object is used in monolithic/segregated approaches.

Implements RhieChowInterpolatorBase.

Definition at line 67 of file INSFVRhieChowInterpolatorSegregated.h.

67 { return true; };

◆ validParams()

InputParameters INSFVRhieChowInterpolatorSegregated::validParams ( )
static

Definition at line 35 of file INSFVRhieChowInterpolatorSegregated.C.

Referenced by PINSFVRhieChowInterpolatorSegregated::validParams().

36 {
38 
39  params.addClassDescription("Computes H/A and 1/A together with face velocities for segregated "
40  "momentum-pressure equations.");
41 
42  // We disable the execution of this, should only provide functions
43  // for the SIMPLENonlinearAssembly executioner
44  ExecFlagEnum & exec_enum = params.set<ExecFlagEnum>("execute_on", true);
45  exec_enum.addAvailableFlags(EXEC_NONE);
46  exec_enum = {EXEC_NONE};
47  params.suppressParameter<ExecFlagEnum>("execute_on");
48 
49  return params;
50 }
const ExecFlagType EXEC_NONE
void addAvailableFlags(const ExecFlagType &flag, Args... flags)
static InputParameters validParams()

◆ vel()

const INSFVVelocityVariable* RhieChowInterpolatorBase::vel ( ) const
inlineinherited

Definition at line 83 of file RhieChowInterpolatorBase.h.

Referenced by INSFVRhieChowInterpolator::getVelocity().

83 { return _u; }
INSFVVelocityVariable *const _u
The thread 0 copy of the x-velocity variable.

◆ velocityInterpolationMethod()

Moose::FV::InterpMethod RhieChowInterpolatorBase::velocityInterpolationMethod ( ) const
inlineinherited

Return the interpolation method used for velocity.

Definition at line 70 of file RhieChowInterpolatorBase.h.

70 { return _velocity_interp_method; }
Moose::FV::InterpMethod _velocity_interp_method
The interpolation method to use for the velocity.

Member Data Documentation

◆ _Ainv

CellCenteredMapFunctor<RealVectorValue, std::unordered_map<dof_id_type, RealVectorValue> > INSFVRhieChowInterpolatorSegregated::_Ainv
protected

A map functor from element IDs to $1/A_i$.

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

Definition at line 111 of file INSFVRhieChowInterpolatorSegregated.h.

Referenced by computeCellVelocity(), computeFaceVelocity(), computeHbyA(), initialize(), and meshChanged().

◆ _dim

const unsigned int RhieChowInterpolatorBase::_dim
protectedinherited

◆ _displaced

const bool RhieChowInterpolatorBase::_displaced
protectedinherited

Whether this object is operating on the displaced mesh.

Definition at line 149 of file RhieChowInterpolatorBase.h.

Referenced by INSFVRhieChowInterpolator::execute(), and INSFVRhieChowInterpolator::INSFVRhieChowInterpolator().

◆ _face_velocity

FaceCenteredMapFunctor<RealVectorValue, std::unordered_map<dof_id_type, RealVectorValue> > INSFVRhieChowInterpolatorSegregated::_face_velocity
protected

A map functor from faces to face velocities which are used in the advection terms.

Definition at line 120 of file INSFVRhieChowInterpolatorSegregated.h.

Referenced by computeFaceVelocity(), getVelocity(), initFaceVelocities(), and meshChanged().

◆ _HbyA

FaceCenteredMapFunctor<RealVectorValue, std::unordered_map<dof_id_type, RealVectorValue> > INSFVRhieChowInterpolatorSegregated::_HbyA
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 98 of file INSFVRhieChowInterpolatorSegregated.h.

Referenced by computeFaceVelocity(), initialize(), meshChanged(), and populateHbyA().

◆ _HbyA_raw

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

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

This vector might be either of size 1 or DIM depending on if we segregate the velocity components as well.

Definition at line 105 of file INSFVRhieChowInterpolatorSegregated.h.

Referenced by computeCellVelocity(), and computeHbyA().

◆ _mesh

const libMesh::MeshBase& RhieChowInterpolatorBase::_mesh
protectedinherited

◆ _momentum_implicit_systems

std::vector<libMesh::NonlinearImplicitSystem *> INSFVRhieChowInterpolatorSegregated::_momentum_implicit_systems
protected

Pointers to the momentum equation implicit system(s)

Definition at line 129 of file INSFVRhieChowInterpolatorSegregated.h.

Referenced by computeCellVelocity(), computeHbyA(), linkMomentumSystem(), and populateHbyA().

◆ _momentum_system_numbers

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

Numbers of the momentum system(s)

Definition at line 126 of file INSFVRhieChowInterpolatorSegregated.h.

Referenced by computeHbyA(), and linkMomentumSystem().

◆ _momentum_systems

std::vector<NonlinearSystemBase *> INSFVRhieChowInterpolatorSegregated::_momentum_systems
protected

Pointers to the nonlinear system(s) corresponding to the momentum equation(s)

Definition at line 123 of file INSFVRhieChowInterpolatorSegregated.h.

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

◆ _moose_mesh

MooseMesh& RhieChowInterpolatorBase::_moose_mesh
protectedinherited

◆ _p

INSFVPressureVariable* const RhieChowInterpolatorBase::_p
protectedinherited

◆ _pressure_gradient_tag

TagID INSFVRhieChowInterpolatorSegregated::_pressure_gradient_tag
protected

Residual tag corresponding to the pressure gradient contribution.

Definition at line 132 of file INSFVRhieChowInterpolatorSegregated.h.

Referenced by computeHbyA(), and linkMomentumSystem().

◆ _ps

std::vector<MooseVariableFVReal *> RhieChowInterpolatorBase::_ps
protectedinherited

◆ _sys

SystemBase& RhieChowInterpolatorBase::_sys
protectedinherited

The nonlinear system.

Definition at line 143 of file RhieChowInterpolatorBase.h.

◆ _u

INSFVVelocityVariable* const RhieChowInterpolatorBase::_u
protectedinherited

◆ _us

std::vector<MooseVariableFVReal *> RhieChowInterpolatorBase::_us
protectedinherited

◆ _v

INSFVVelocityVariable* const RhieChowInterpolatorBase::_v
protectedinherited

The thread 0 copy of the y-velocity variable (null if the problem is 1D)

Definition at line 122 of file RhieChowInterpolatorBase.h.

Referenced by computeCellVelocity(), computeHbyA(), INSFVRhieChowInterpolator::getVelocity(), and RhieChowInterpolatorBase::RhieChowInterpolatorBase().

◆ _var_numbers

std::vector<unsigned int> RhieChowInterpolatorBase::_var_numbers
protectedinherited

◆ _vel

std::unique_ptr<PiecewiseByBlockLambdaFunctor<ADRealVectorValue> > INSFVRhieChowInterpolatorSegregated::_vel
protected

A functor for computing the (non-RC corrected) velocity.

Definition at line 114 of file INSFVRhieChowInterpolatorSegregated.h.

Referenced by initFaceVelocities(), and populateHbyA().

◆ _velocity_interp_method

Moose::FV::InterpMethod RhieChowInterpolatorBase::_velocity_interp_method
protectedinherited

◆ _vs

std::vector<MooseVariableFVReal *> RhieChowInterpolatorBase::_vs
protectedinherited

◆ _w

INSFVVelocityVariable* const RhieChowInterpolatorBase::_w
protectedinherited

The thread 0 copy of the z-velocity variable (null if the problem is not 3D)

Definition at line 125 of file RhieChowInterpolatorBase.h.

Referenced by computeCellVelocity(), computeHbyA(), INSFVRhieChowInterpolator::getVelocity(), and RhieChowInterpolatorBase::RhieChowInterpolatorBase().

◆ _ws

std::vector<MooseVariableFVReal *> RhieChowInterpolatorBase::_ws
protectedinherited

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