LCOV - code coverage report
Current view: top level - src/linearfvbcs - LinearFVBoundaryCondition.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 1f9d31 Lines: 45 45 100.0 %
Date: 2025-09-02 20:01:20 Functions: 6 6 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             : #include "LinearFVBoundaryCondition.h"
      11             : #include "Problem.h"
      12             : #include "SystemBase.h"
      13             : #include "MooseVariableFV.h"
      14             : 
      15             : InputParameters
      16       76089 : LinearFVBoundaryCondition::validParams()
      17             : {
      18       76089 :   InputParameters params = MooseObject::validParams();
      19       76089 :   params += TransientInterface::validParams();
      20       76089 :   params += BoundaryRestrictableRequired::validParams();
      21       76089 :   params += TaggingInterface::validParams();
      22       76089 :   params += NonADFunctorInterface::validParams();
      23             : 
      24      152178 :   MultiMooseEnum vtags("rhs time", "rhs", true);
      25       76089 :   auto & vector_tag_enum = params.set<MultiMooseEnum>("vector_tags", true);
      26       76089 :   vector_tag_enum = vtags;
      27             : 
      28      228267 :   params.addRequiredParam<LinearVariableName>(
      29             :       "variable", "The name of the variable that this boundary condition applies to");
      30      228267 :   params.declareControllable("enable");
      31      152178 :   params.registerBase("LinearFVBoundaryCondition");
      32       76089 :   params.registerSystemAttributeName("LinearFVBoundaryCondition");
      33      152178 :   return params;
      34       76089 : }
      35             : 
      36        2382 : LinearFVBoundaryCondition::LinearFVBoundaryCondition(const InputParameters & parameters)
      37             :   : MooseObject(parameters),
      38             :     BoundaryRestrictableRequired(this, false),
      39             :     SetupInterface(this),
      40             :     FunctionInterface(this),
      41             :     DistributionInterface(this),
      42             :     UserObjectInterface(this),
      43             :     TransientInterface(this),
      44             :     PostprocessorInterface(this),
      45             :     VectorPostprocessorInterface(this),
      46             :     GeometricSearchInterface(this),
      47             :     MeshChangedInterface(parameters),
      48             :     TaggingInterface(this),
      49             :     MooseVariableInterface(this,
      50             :                            false,
      51             :                            "variable",
      52             :                            Moose::VarKindType::VAR_ANY,
      53             :                            Moose::VarFieldType::VAR_FIELD_STANDARD),
      54             :     MooseVariableDependencyInterface(this),
      55             :     NonADFunctorInterface(this),
      56             :     FaceArgProducerInterface(),
      57        2382 :     _tid(parameters.get<THREAD_ID>("_tid")),
      58        9528 :     _subproblem(*getCheckedPointerParam<SubProblem *>("_subproblem")),
      59        2382 :     _mesh(_subproblem.mesh()),
      60        9528 :     _fv_problem(*getCheckedPointerParam<FEProblemBase *>("_fe_problem_base")),
      61        2382 :     _var(*mooseLinearVariableFV()),
      62        2382 :     _sys(_var.sys()),
      63        2382 :     _var_num(_var.number()),
      64        9528 :     _sys_num(_sys.number())
      65             : {
      66        2382 :   addMooseVariableDependency(&_var);
      67        2382 : }
      68             : 
      69             : bool
      70     1001232 : LinearFVBoundaryCondition::hasFaceSide(const FaceInfo & fi, bool fi_elem_side) const
      71             : {
      72     1001232 :   const auto ft = fi.faceType(std::make_pair(_var_num, _sys_num));
      73     1001232 :   if (fi_elem_side)
      74      500616 :     return ft == FaceInfo::VarFaceNeighbors::ELEM || ft == FaceInfo::VarFaceNeighbors::BOTH;
      75             :   else
      76      500616 :     return ft == FaceInfo::VarFaceNeighbors::NEIGHBOR || ft == FaceInfo::VarFaceNeighbors::BOTH;
      77             : }
      78             : 
      79             : Moose::FaceArg
      80      472420 : LinearFVBoundaryCondition::singleSidedFaceArg(const FaceInfo * fi,
      81             :                                               const Moose::FV::LimiterType limiter_type,
      82             :                                               const bool correct_skewness) const
      83             : {
      84             :   mooseAssert(fi, "FaceInfo should not be null!");
      85      472420 :   return makeFace(*fi, limiter_type, true, correct_skewness);
      86             : }
      87             : 
      88             : Real
      89      169780 : LinearFVBoundaryCondition::computeCellToFaceDistance() const
      90             : {
      91      169780 :   const auto cell_to_face_vector = computeCellToFaceVector();
      92      339560 :   return std::abs(cell_to_face_vector * _current_face_info->normal());
      93             : }
      94             : 
      95             : RealVectorValue
      96      272414 : LinearFVBoundaryCondition::computeCellToFaceVector() const
      97             : {
      98      272414 :   const auto is_on_mesh_boundary = !_current_face_info->neighborPtr();
      99      272414 :   const auto defined_on_elem =
     100      272414 :       is_on_mesh_boundary ? true : (_current_face_type == FaceInfo::VarFaceNeighbors::ELEM);
     101      272414 :   if (is_on_mesh_boundary)
     102      261998 :     return _current_face_info->dCN();
     103             :   else
     104       10416 :     return (_current_face_info->faceCentroid() - (defined_on_elem
     105       10416 :                                                       ? _current_face_info->elemCentroid()
     106       10416 :                                                       : _current_face_info->neighborCentroid()));
     107             : }

Generated by: LCOV version 1.14