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 : #pragma once 11 : 12 : #include "MooseVariableFV.h" 13 : 14 : class InputParameters; 15 : class INSFVHydraulicSeparatorInterface; 16 : 17 : class INSFVVariable : public MooseVariableFVReal 18 : { 19 : public: 20 : INSFVVariable(const InputParameters & params); 21 : 22 : static InputParameters validParams(); 23 : 24 : // The INSFV system relies on on-the-fly functor evaluation and does not need any pre-init'd data 25 : void computeFaceValues(const FaceInfo &) override; 26 : void computeElemValues() override; 27 : void computeElemValuesFace() override; 28 : void computeNeighborValuesFace() override; 29 : void computeNeighborValues() override; 30 36996 : void requireQpComputations() const override { _qp_calculations = true; } 31 2 : bool supportsQpBasedLoops() const override { return _qp_calculations; } 32 2 : bool supportsGeometricInfoBasedLoops() const override { return true; } 33 : virtual void initialSetup() override; 34 : virtual void timestepSetup() override; 35 : virtual void meshChanged() override; 36 : 37 : // If the given boundary is a hydraulic separator bouundary for this variable 38 : bool isSeparatorBoundary(const FaceInfo & fi) const; 39 : 40 : bool isExtrapolatedBoundaryFace(const FaceInfo & fi, 41 : const Elem * elem, 42 : const Moose::StateArg & time) const override; 43 : 44 : protected: 45 : /** 46 : * Returns whether the passed-in \p FaceInfo corresponds to a fully-developed flow face 47 : */ 48 : bool isFullyDevelopedFlowFace(const FaceInfo & fi) const; 49 : 50 : /** 51 : * Caches the separator boundaries 52 : */ 53 : void cacheSeparatorBoundaries(); 54 : 55 : /// A container for quick access of hydraulic separator BCs associated with this 56 : /// variable. 57 : std::unordered_map<BoundaryID, const INSFVHydraulicSeparatorInterface *> 58 : _boundary_id_to_separator; 59 : 60 : private: 61 : /// Whether to pre-initialize variable data for use in traditional MOOSE quadrature point based 62 : /// objects. This can be changed to true if objects request variable values in a way that is 63 : /// generated by quadrature point based calculations 64 : mutable bool _qp_calculations; 65 : }; 66 : 67 : inline void 68 130878022 : INSFVVariable::computeFaceValues(const FaceInfo & fi) 69 : { 70 130878022 : if (_qp_calculations) 71 37552444 : MooseVariableFVReal::computeFaceValues(fi); 72 130878022 : } 73 : 74 : inline void 75 80470498 : INSFVVariable::computeElemValues() 76 : { 77 80470498 : if (_qp_calculations) 78 27380414 : MooseVariableFVReal::computeElemValues(); 79 : else 80 53090084 : _element_data->setGeometry(Moose::Volume); 81 80470498 : } 82 : 83 : inline void 84 201871 : INSFVVariable::computeElemValuesFace() 85 : { 86 201871 : if (_qp_calculations) 87 130202 : MooseVariableFVReal::computeElemValuesFace(); 88 201871 : } 89 : 90 : inline void 91 0 : INSFVVariable::computeNeighborValuesFace() 92 : { 93 0 : if (_qp_calculations) 94 0 : MooseVariableFVReal::computeNeighborValuesFace(); 95 0 : } 96 : 97 : inline void 98 0 : INSFVVariable::computeNeighborValues() 99 : { 100 0 : if (_qp_calculations) 101 0 : MooseVariableFVReal::computeNeighborValues(); 102 0 : }