https://mooseframework.inl.gov
INSFVRhieChowInterpolatorSegregated.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
13 #include "CellCenteredMapFunctor.h"
14 #include "FaceCenteredMapFunctor.h"
15 #include "VectorComponentFunctor.h"
16 #include <unordered_map>
17 #include <set>
18 #include <unordered_set>
19 
20 class MooseMesh;
23 namespace libMesh
24 {
25 class Elem;
26 class MeshBase;
27 }
28 
34 {
35 public:
38 
40  VectorValue<ADReal> getVelocity(const Moose::FV::InterpMethod m,
41  const FaceInfo & fi,
42  const Moose::StateArg & time,
43  const THREAD_ID tid,
44  bool subtract_mesh_velocity) const override;
45 
47  void initFaceVelocities();
49  void computeFaceVelocity();
51  void computeCellVelocity();
52 
54  void addToA(const libMesh::Elem * /*elem*/,
55  unsigned int /*component*/,
56  const ADReal & /*value*/) override
57  {
58  mooseError(
59  "addToA function is not implemented for the RhieChow interpolation in segregated solvers.");
60  }
61 
62  void meshChanged() override;
63  void initialize() override;
64  void execute() override {}
65  void finalize() override {}
66 
67  bool segregated() const override { return true; };
68 
78  void linkMomentumSystem(std::vector<NonlinearSystemBase *> momentum_systems,
79  const std::vector<unsigned int> & momentum_system_numbers,
80  const TagID pressure_gradient_tag);
81 
86  void computeHbyA(bool verbose);
87 
88 protected:
90  void populateHbyA(const std::vector<std::unique_ptr<NumericVector<Number>>> & raw_hbya,
91  const std::vector<unsigned int> & var_nums);
99 
105  std::vector<std::unique_ptr<NumericVector<Number>>> _HbyA_raw;
106 
112 
114  std::unique_ptr<PiecewiseByBlockLambdaFunctor<ADRealVectorValue>> _vel;
115 
121 
123  std::vector<NonlinearSystemBase *> _momentum_systems;
124 
126  std::vector<unsigned int> _momentum_system_numbers;
127 
129  std::vector<libMesh::NonlinearImplicitSystem *> _momentum_implicit_systems;
130 
133 };
bool segregated() const override
Bool of the Rhie Chow user object is used in monolithic/segregated approaches.
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)
A functor whose evaluation relies on querying a map where the keys are face info ids and the values c...
unsigned int TagID
VectorValue< ADReal > getVelocity(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)
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
DualNumber< Real, DNDerivativeType, true > ADReal
CellCenteredMapFunctor< RealVectorValue, std::unordered_map< dof_id_type, RealVectorValue > > _Ainv
A map functor from element IDs to $1/A_i$.
void computeFaceVelocity()
Update the values of the face velocities in the containers.
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...
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 addToA(const libMesh::Elem *, unsigned int, const ADReal &) override
We disable this for the segregated solver.
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.
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}$...
void computeCellVelocity()
Update the cell values of the velocity variables.
TagID _pressure_gradient_tag
Residual tag corresponding to the pressure gradient contribution.
void mooseError(Args &&... args) const
std::unique_ptr< PiecewiseByBlockLambdaFunctor< ADRealVectorValue > > _vel
A functor for computing the (non-RC corrected) velocity.
INSFVRhieChowInterpolatorSegregated(const InputParameters &params)
void computeHbyA(bool verbose)
Computes the inverse of the digaonal (1/A) of the system matrix plus the H/A components for the press...
A user object which implements the Rhie Chow interpolation for segregated momentum-pressure systems...
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.
unsigned int THREAD_ID
A functor whose evaluation relies on querying a map where the keys are element ids and the values cor...
void initFaceVelocities()
Initialize the container for face velocities.