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 60596 : LinearFVBoundaryCondition::validParams() 17 : { 18 60596 : InputParameters params = MooseObject::validParams(); 19 60596 : params += TransientInterface::validParams(); 20 60596 : params += BoundaryRestrictableRequired::validParams(); 21 60596 : params += TaggingInterface::validParams(); 22 60596 : params += NonADFunctorInterface::validParams(); 23 : 24 60596 : MultiMooseEnum vtags("rhs time", "rhs", true); 25 60596 : auto & vector_tag_enum = params.set<MultiMooseEnum>("vector_tags", true); 26 60596 : vector_tag_enum = vtags; 27 : 28 60596 : params.addRequiredParam<LinearVariableName>( 29 : "variable", "The name of the variable that this boundary condition applies to"); 30 60596 : params.declareControllable("enable"); 31 60596 : params.registerBase("LinearFVBoundaryCondition"); 32 60596 : params.registerSystemAttributeName("LinearFVBoundaryCondition"); 33 121192 : return params; 34 60596 : } 35 : 36 1768 : 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 1768 : _tid(parameters.get<THREAD_ID>("_tid")), 58 1768 : _subproblem(*getCheckedPointerParam<SubProblem *>("_subproblem")), 59 1768 : _mesh(_subproblem.mesh()), 60 1768 : _fv_problem(*getCheckedPointerParam<FEProblemBase *>("_fe_problem_base")), 61 1768 : _var(*mooseLinearVariableFV()), 62 1768 : _sys(_var.sys()), 63 1768 : _var_num(_var.number()), 64 3536 : _sys_num(_sys.number()) 65 : { 66 1768 : addMooseVariableDependency(&_var); 67 1768 : } 68 : 69 : bool 70 882680 : LinearFVBoundaryCondition::hasFaceSide(const FaceInfo & fi, bool fi_elem_side) const 71 : { 72 882680 : const auto ft = fi.faceType(std::make_pair(_var_num, _sys_num)); 73 882680 : if (fi_elem_side) 74 441340 : return ft == FaceInfo::VarFaceNeighbors::ELEM || ft == FaceInfo::VarFaceNeighbors::BOTH; 75 : else 76 441340 : return ft == FaceInfo::VarFaceNeighbors::NEIGHBOR || ft == FaceInfo::VarFaceNeighbors::BOTH; 77 : } 78 : 79 : Moose::FaceArg 80 420312 : 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 420312 : return makeFace(*fi, limiter_type, true, correct_skewness); 86 : } 87 : 88 : Real 89 147916 : LinearFVBoundaryCondition::computeCellToFaceDistance() const 90 : { 91 147916 : const auto cell_to_face_vector = computeCellToFaceVector(); 92 295832 : return std::abs(cell_to_face_vector * _current_face_info->normal()); 93 : } 94 : 95 : RealVectorValue 96 232070 : LinearFVBoundaryCondition::computeCellToFaceVector() const 97 : { 98 232070 : const auto is_on_mesh_boundary = !_current_face_info->neighborPtr(); 99 232070 : const auto defined_on_elem = 100 232070 : is_on_mesh_boundary ? true : (_current_face_type == FaceInfo::VarFaceNeighbors::ELEM); 101 232070 : if (is_on_mesh_boundary) 102 221654 : 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 : }