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 59469 : INSFVVariable::validParams() 25 : { 26 59469 : return MooseVariableFVReal::validParams(); 27 : } 28 : 29 31728 : INSFVVariable::INSFVVariable(const InputParameters & params) 30 31728 : : MooseVariableFVReal(params), _qp_calculations(false) 31 : { 32 31728 : } 33 : 34 : void 35 86952 : INSFVVariable::cacheSeparatorBoundaries() 36 : { 37 : _boundary_id_to_separator.clear(); 38 : std::vector<FVFluxBC *> bcs; 39 : 40 86952 : const auto base_query = this->_subproblem.getMooseApp() 41 : .theWarehouse() 42 86952 : .query() 43 86952 : .template condition<AttribSystem>("FVFluxBC") 44 86952 : .template condition<AttribThread>(_tid); 45 : 46 450913 : for (const auto bnd_id : this->_mesh.getBoundaryIDs()) 47 : { 48 363961 : auto base_query_copy = base_query; 49 727922 : base_query_copy.template condition<AttribBoundaries>(std::set<BoundaryID>({bnd_id})) 50 : .queryInto(bcs); 51 528048 : for (const auto bc : bcs) 52 : { 53 164087 : const auto separator = dynamic_cast<const INSFVHydraulicSeparatorInterface *>(bc); 54 164087 : if (separator) 55 : _boundary_id_to_separator.emplace(bnd_id, separator); 56 : } 57 363961 : } 58 86952 : } 59 : 60 : void 61 55881 : INSFVVariable::timestepSetup() 62 : { 63 55881 : MooseVariableFVReal::timestepSetup(); 64 55881 : cacheSeparatorBoundaries(); 65 55881 : } 66 : 67 : void 68 0 : INSFVVariable::meshChanged() 69 : { 70 0 : MooseVariableFVReal::meshChanged(); 71 0 : cacheSeparatorBoundaries(); 72 0 : } 73 : 74 : void 75 31071 : INSFVVariable::initialSetup() 76 : { 77 31071 : MooseVariableFVReal::initialSetup(); 78 31071 : cacheSeparatorBoundaries(); 79 31071 : } 80 : 81 : bool 82 1364767862 : INSFVVariable::isSeparatorBoundary(const FaceInfo & fi) const 83 : { 84 1366588716 : for (const auto bid : fi.boundaryIDs()) 85 : if (_boundary_id_to_separator.count(bid)) 86 118198 : return true; 87 : 88 1364649664 : return false; 89 : } 90 : 91 : bool 92 1401540211 : INSFVVariable::isExtrapolatedBoundaryFace(const FaceInfo & fi, 93 : const Elem * const elem, 94 : const Moose::StateArg & time) const 95 : { 96 1401540211 : if (isDirichletBoundaryFace(fi, elem, time)) 97 : return false; 98 1391570653 : 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 1362401664 : if (isSeparatorBoundary(fi)) 104 : return true; 105 : 106 : return false; 107 : } 108 : 109 : bool 110 120872949 : INSFVVariable::isFullyDevelopedFlowFace(const FaceInfo & fi) const 111 : { 112 120872949 : 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 120872949 : if (face_type == FaceInfo::VarFaceNeighbors::BOTH) 120 : return false; 121 : 122 : std::vector<INSFVFullyDevelopedFlowBC *> bcs; 123 : 124 19795745 : this->_subproblem.getMooseApp() 125 : .theWarehouse() 126 19795745 : .query() 127 39591490 : .template condition<AttribINSFVBCs>(INSFVBCs::INSFVFullyDevelopedFlowBC) 128 19795745 : .template condition<AttribBoundaries>(fi.boundaryIDs()) 129 : .queryInto(bcs); 130 : 131 19795745 : return !bcs.empty(); 132 19795745 : }