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 79099 : LinearFVBoundaryCondition::validParams() 17 : { 18 79099 : InputParameters params = MooseObject::validParams(); 19 79099 : params += TransientInterface::validParams(); 20 79099 : params += BoundaryRestrictableRequired::validParams(); 21 79099 : params += GeometricSearchInterface::validParams(); 22 79099 : params += TaggingInterface::validParams(); 23 79099 : params += NonADFunctorInterface::validParams(); 24 : 25 158198 : MultiMooseEnum vtags("rhs time", "rhs", true); 26 79099 : auto & vector_tag_enum = params.set<MultiMooseEnum>("vector_tags", true); 27 79099 : vector_tag_enum = vtags; 28 : 29 237297 : params.addRequiredParam<LinearVariableName>( 30 : "variable", "The name of the variable that this boundary condition applies to"); 31 237297 : params.declareControllable("enable"); 32 158198 : params.registerBase("LinearFVBoundaryCondition"); 33 79099 : params.registerSystemAttributeName("LinearFVBoundaryCondition"); 34 158198 : return params; 35 79099 : } 36 : 37 2382 : LinearFVBoundaryCondition::LinearFVBoundaryCondition(const InputParameters & parameters) 38 : : MooseObject(parameters), 39 : BoundaryRestrictableRequired(this, false), 40 : SetupInterface(this), 41 : FunctionInterface(this), 42 : DistributionInterface(this), 43 : UserObjectInterface(this), 44 : TransientInterface(this), 45 : PostprocessorInterface(this), 46 : VectorPostprocessorInterface(this), 47 : GeometricSearchInterface(this), 48 : MeshChangedInterface(parameters), 49 : TaggingInterface(this), 50 : MooseVariableInterface(this, 51 : false, 52 : "variable", 53 : Moose::VarKindType::VAR_ANY, 54 : Moose::VarFieldType::VAR_FIELD_STANDARD), 55 : MooseVariableDependencyInterface(this), 56 : NonADFunctorInterface(this), 57 : FaceArgProducerInterface(), 58 2382 : _tid(parameters.get<THREAD_ID>("_tid")), 59 9528 : _subproblem(*getCheckedPointerParam<SubProblem *>("_subproblem")), 60 2382 : _mesh(_subproblem.mesh()), 61 9528 : _fv_problem(*getCheckedPointerParam<FEProblemBase *>("_fe_problem_base")), 62 2382 : _var(*mooseLinearVariableFV()), 63 2382 : _sys(_var.sys()), 64 2382 : _var_num(_var.number()), 65 9528 : _sys_num(_sys.number()) 66 : { 67 2382 : addMooseVariableDependency(&_var); 68 2382 : } 69 : 70 : bool 71 1001232 : LinearFVBoundaryCondition::hasFaceSide(const FaceInfo & fi, bool fi_elem_side) const 72 : { 73 1001232 : const auto ft = fi.faceType(std::make_pair(_var_num, _sys_num)); 74 1001232 : if (fi_elem_side) 75 500616 : return ft == FaceInfo::VarFaceNeighbors::ELEM || ft == FaceInfo::VarFaceNeighbors::BOTH; 76 : else 77 500616 : return ft == FaceInfo::VarFaceNeighbors::NEIGHBOR || ft == FaceInfo::VarFaceNeighbors::BOTH; 78 : } 79 : 80 : Moose::FaceArg 81 472420 : LinearFVBoundaryCondition::singleSidedFaceArg(const FaceInfo * fi, 82 : const Moose::FV::LimiterType limiter_type, 83 : const bool correct_skewness) const 84 : { 85 : mooseAssert(fi, "FaceInfo should not be null!"); 86 472420 : return makeFace(*fi, limiter_type, true, correct_skewness); 87 : } 88 : 89 : Real 90 169780 : LinearFVBoundaryCondition::computeCellToFaceDistance() const 91 : { 92 169780 : const auto cell_to_face_vector = computeCellToFaceVector(); 93 339560 : return std::abs(cell_to_face_vector * _current_face_info->normal()); 94 : } 95 : 96 : RealVectorValue 97 272414 : LinearFVBoundaryCondition::computeCellToFaceVector() const 98 : { 99 272414 : const auto defined_on_elem = _current_face_type == FaceInfo::VarFaceNeighbors::ELEM; 100 272414 : return (_current_face_info->faceCentroid() - (defined_on_elem 101 272414 : ? _current_face_info->elemCentroid() 102 544828 : : _current_face_info->neighborCentroid())); 103 : }