LCOV - code coverage report
Current view: top level - include/linearfvbcs - LinearFVBoundaryCondition.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 4 4 100.0 %
Date: 2025-07-17 01:28:37 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://mooseframework.inl.gov
       3             : //*
       4             : //* All rights reserved, see COPYRIGHT for full restrictions
       5             : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
       6             : //*
       7             : //* Licensed under LGPL 2.1, please see LICENSE for details
       8             : //* https://www.gnu.org/licenses/lgpl-2.1.html
       9             : 
      10             : #pragma once
      11             : 
      12             : // MOOSE
      13             : #include "MooseObject.h"
      14             : #include "SetupInterface.h"
      15             : #include "ParallelUniqueId.h"
      16             : #include "FunctionInterface.h"
      17             : #include "DistributionInterface.h"
      18             : #include "UserObjectInterface.h"
      19             : #include "TransientInterface.h"
      20             : #include "PostprocessorInterface.h"
      21             : #include "VectorPostprocessorInterface.h"
      22             : #include "GeometricSearchInterface.h"
      23             : #include "BoundaryRestrictableRequired.h"
      24             : #include "MeshChangedInterface.h"
      25             : #include "TaggingInterface.h"
      26             : #include "MooseVariableDependencyInterface.h"
      27             : #include "NonADFunctorInterface.h"
      28             : #include "FaceArgInterface.h"
      29             : #include "MooseLinearVariableFV.h"
      30             : #include "MooseVariableInterface.h"
      31             : 
      32             : #include "libmesh/linear_implicit_system.h"
      33             : 
      34             : // Forward declerations
      35             : class MooseMesh;
      36             : class Problem;
      37             : class SubProblem;
      38             : class SystemBase;
      39             : 
      40             : /**
      41             :  * Base class for boundary conditions for linear FV systems.
      42             :  */
      43             : class LinearFVBoundaryCondition : public MooseObject,
      44             :                                   public BoundaryRestrictableRequired,
      45             :                                   public SetupInterface,
      46             :                                   public FunctionInterface,
      47             :                                   public DistributionInterface,
      48             :                                   public UserObjectInterface,
      49             :                                   public TransientInterface,
      50             :                                   public PostprocessorInterface,
      51             :                                   public VectorPostprocessorInterface,
      52             :                                   public GeometricSearchInterface,
      53             :                                   public MeshChangedInterface,
      54             :                                   public TaggingInterface,
      55             :                                   public MooseVariableInterface<Real>,
      56             :                                   public MooseVariableDependencyInterface,
      57             :                                   public NonADFunctorInterface,
      58             :                                   public FaceArgProducerInterface
      59             : {
      60             : public:
      61             :   /**
      62             :    * Class constructor.
      63             :    * @param parameters The InputParameters for the object
      64             :    */
      65             :   LinearFVBoundaryCondition(const InputParameters & parameters);
      66             : 
      67             :   static InputParameters validParams();
      68             : 
      69             :   virtual bool hasFaceSide(const FaceInfo & fi, bool fi_elem_side) const override;
      70             : 
      71             :   /**
      72             :    * Get a reference to the subproblem
      73             :    * @return Reference to SubProblem
      74             :    */
      75             :   const SubProblem & subProblem() const { return _subproblem; }
      76             : 
      77             :   /// Return the linear finite volume variable
      78             :   const MooseLinearVariableFV<Real> & variable() const { return _var; }
      79             : 
      80             :   /**
      81             :    * Computes the boundary value of this object. This relies on the current solution field.
      82             :    */
      83             :   virtual Real computeBoundaryValue() const = 0;
      84             : 
      85             :   /**
      86             :    * Computes the normal gradient (often used in diffusion terms) on the boundary.
      87             :    */
      88             :   virtual Real computeBoundaryNormalGradient() const = 0;
      89             : 
      90             :   /// Set current face info
      91             :   void setupFaceData(const FaceInfo * face_info, const FaceInfo::VarFaceNeighbors face_type);
      92             : 
      93             :   const FaceInfo * currentFaceInfo() const { return _current_face_info; }
      94             :   FaceInfo::VarFaceNeighbors currentFaceType() const { return _current_face_type; }
      95             : 
      96             : protected:
      97             :   /**
      98             :    * Compute the distance between the cell center and the face.
      99             :    */
     100             :   Real computeCellToFaceDistance() const;
     101             : 
     102             :   /**
     103             :    * Computes the vector connecting the cell and boundary face centers.
     104             :    * It is needed because sometimes boundaries can be assigned to internal faces as well.
     105             :    */
     106             :   RealVectorValue computeCellToFaceVector() const;
     107             : 
     108             :   /**
     109             :    * Determine the single sided face argument when evaluating a functor on a face.
     110             :    * @param fi the FaceInfo for this face
     111             :    * @param limiter_type the limiter type, to be specified if more than the default average
     112             :    *        interpolation is required for the parameters of the functor
     113             :    * @param correct_skewness whether to perform skew correction at the face
     114             :    */
     115             :   Moose::FaceArg singleSidedFaceArg(
     116             :       const FaceInfo * fi,
     117             :       Moose::FV::LimiterType limiter_type = Moose::FV::LimiterType::CentralDifference,
     118             :       bool correct_skewness = false) const;
     119             : 
     120             :   /// Thread id
     121             :   const THREAD_ID _tid;
     122             : 
     123             :   /// Reference to SubProblem
     124             :   SubProblem & _subproblem;
     125             : 
     126             :   /// Mesh this BC is defined on
     127             :   MooseMesh & _mesh;
     128             : 
     129             :   /// Reference to the ruling finite volume problem
     130             :   FEProblemBase & _fv_problem;
     131             : 
     132             :   /// Reference to the linear finite volume variable object
     133             :   MooseLinearVariableFV<Real> & _var;
     134             : 
     135             :   /// Reference to system base class in MOOSE
     136             :   SystemBase & _sys;
     137             : 
     138             :   /// Pointer to the face info we are operating on right now
     139             :   const FaceInfo * _current_face_info;
     140             : 
     141             :   /// Face ownership information for the current face
     142             :   FaceInfo::VarFaceNeighbors _current_face_type;
     143             : 
     144             :   /// Cache for the variable number
     145             :   const unsigned int _var_num;
     146             : 
     147             :   /// Cache for the system number
     148             :   const unsigned int _sys_num;
     149             : };
     150             : 
     151             : inline void
     152      682234 : LinearFVBoundaryCondition::setupFaceData(const FaceInfo * face_info,
     153             :                                          const FaceInfo::VarFaceNeighbors face_type)
     154             : {
     155             :   mooseAssert(
     156             :       face_info,
     157             :       "The face info pointer should not be null when passing to the LinearFVBoundaryCondition!");
     158      682234 :   _current_face_info = face_info;
     159      682234 :   _current_face_type = face_type;
     160      682234 : }

Generated by: LCOV version 1.14