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 "INSFVVariable.h" 11 : #include "InputParameters.h" 12 : #include "MooseError.h" 13 : #include "INSFVFullyDevelopedFlowBC.h" 14 : #include "Attributes.h" 15 : #include "SubProblem.h" 16 : #include "MooseApp.h" 17 : #include "TheWarehouse.h" 18 : #include "INSFVAttributes.h" 19 : #include "SystemBase.h" 20 : #include "INSFVHydraulicSeparatorInterface.h" 21 : #include "FVFluxBC.h" 22 : 23 : InputParameters 24 58854 : INSFVVariable::validParams() 25 : { 26 58854 : return MooseVariableFVReal::validParams(); 27 : } 28 : 29 31398 : INSFVVariable::INSFVVariable(const InputParameters & params) 30 31398 : : MooseVariableFVReal(params), _qp_calculations(false) 31 : { 32 31398 : } 33 : 34 : void 35 85479 : INSFVVariable::cacheSeparatorBoundaries() 36 : { 37 : _boundary_id_to_separator.clear(); 38 : std::vector<FVFluxBC *> bcs; 39 : 40 85479 : const auto base_query = this->_subproblem.getMooseApp() 41 : .theWarehouse() 42 85479 : .query() 43 85479 : .template condition<AttribSystem>("FVFluxBC") 44 85479 : .template condition<AttribThread>(_tid); 45 : 46 444248 : for (const auto bnd_id : this->_mesh.getBoundaryIDs()) 47 : { 48 358769 : auto base_query_copy = base_query; 49 717538 : base_query_copy.template condition<AttribBoundaries>(std::set<BoundaryID>({bnd_id})) 50 : .queryInto(bcs); 51 520018 : for (const auto bc : bcs) 52 : { 53 161249 : const auto separator = dynamic_cast<const INSFVHydraulicSeparatorInterface *>(bc); 54 161249 : if (separator) 55 : _boundary_id_to_separator.emplace(bnd_id, separator); 56 : } 57 358769 : } 58 85479 : } 59 : 60 : void 61 54738 : INSFVVariable::timestepSetup() 62 : { 63 54738 : MooseVariableFVReal::timestepSetup(); 64 54738 : cacheSeparatorBoundaries(); 65 54738 : } 66 : 67 : void 68 0 : INSFVVariable::meshChanged() 69 : { 70 0 : MooseVariableFVReal::meshChanged(); 71 0 : cacheSeparatorBoundaries(); 72 0 : } 73 : 74 : void 75 30741 : INSFVVariable::initialSetup() 76 : { 77 30741 : MooseVariableFVReal::initialSetup(); 78 30741 : cacheSeparatorBoundaries(); 79 30741 : } 80 : 81 : bool 82 1354416710 : INSFVVariable::isSeparatorBoundary(const FaceInfo & fi) const 83 : { 84 1356237564 : for (const auto bid : fi.boundaryIDs()) 85 : if (_boundary_id_to_separator.count(bid)) 86 118198 : return true; 87 : 88 1354298512 : return false; 89 : } 90 : 91 : bool 92 1390466791 : INSFVVariable::isExtrapolatedBoundaryFace(const FaceInfo & fi, 93 : const Elem * const elem, 94 : const Moose::StateArg & time) const 95 : { 96 1390466791 : if (isDirichletBoundaryFace(fi, elem, time)) 97 : return false; 98 1380613917 : if (!isInternalFace(fi)) 99 : // We are neither a Dirichlet nor an internal face 100 : return true; 101 : 102 : // If we got here, then we're definitely on an internal face 103 1352050216 : if (isSeparatorBoundary(fi)) 104 : return true; 105 : 106 : return false; 107 : } 108 : 109 : bool 110 120087293 : INSFVVariable::isFullyDevelopedFlowFace(const FaceInfo & fi) const 111 : { 112 120087293 : const auto & face_type = fi.faceType(std::make_pair(this->number(), this->sys().number())); 113 : 114 : mooseAssert(face_type != FaceInfo::VarFaceNeighbors::NEITHER, 115 : "I'm concerned that if you're calling this method with a FaceInfo that doesn't have " 116 : "this variable defined on either side, that you are doing something dangerous."); 117 : 118 : // If we're defined on both sides of the face, then we're not a boundary face 119 120087293 : if (face_type == FaceInfo::VarFaceNeighbors::BOTH) 120 : return false; 121 : 122 : std::vector<INSFVFullyDevelopedFlowBC *> bcs; 123 : 124 19486649 : this->_subproblem.getMooseApp() 125 : .theWarehouse() 126 19486649 : .query() 127 38973298 : .template condition<AttribINSFVBCs>(INSFVBCs::INSFVFullyDevelopedFlowBC) 128 19486649 : .template condition<AttribBoundaries>(fi.boundaryIDs()) 129 : .queryInto(bcs); 130 : 131 19486649 : return !bcs.empty(); 132 19486649 : }