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 67173 : void requireQpComputations() const override { _qp_calculations = true; } 31 : virtual void initialSetup() override; 32 : virtual void timestepSetup() override; 33 : virtual void meshChanged() override; 34 : 35 : // If the given boundary is a hydraulic separator bouundary for this variable 36 : bool isSeparatorBoundary(const FaceInfo & fi) const; 37 : 38 : bool isExtrapolatedBoundaryFace(const FaceInfo & fi, 39 : const Elem * elem, 40 : const Moose::StateArg & time) const override; 41 : 42 : protected: 43 : /** 44 : * Returns whether the passed-in \p FaceInfo corresponds to a fully-developed flow face 45 : */ 46 : bool isFullyDevelopedFlowFace(const FaceInfo & fi) const; 47 : 48 : /** 49 : * Caches the separator boundaries 50 : */ 51 : void cacheSeparatorBoundaries(); 52 : 53 : /// A container for quick access of hydraulic separator BCs associated with this 54 : /// variable. 55 : std::unordered_map<BoundaryID, const INSFVHydraulicSeparatorInterface *> 56 : _boundary_id_to_separator; 57 : 58 : private: 59 : /// Whether to pre-initialize variable data for use in traditional MOOSE quadrature point based 60 : /// objects. This can be changed to true if objects request variable values in a way that is 61 : /// generated by quadrature point based calculations 62 : mutable bool _qp_calculations; 63 : }; 64 : 65 : inline void 66 189270222 : INSFVVariable::computeFaceValues(const FaceInfo & fi) 67 : { 68 189270222 : if (_qp_calculations) 69 50235972 : MooseVariableFVReal::computeFaceValues(fi); 70 189270222 : } 71 : 72 : inline void 73 118123327 : INSFVVariable::computeElemValues() 74 : { 75 118123327 : if (_qp_calculations) 76 38256513 : MooseVariableFVReal::computeElemValues(); 77 : else 78 79866814 : _element_data->setGeometry(Moose::Volume); 79 118123327 : } 80 : 81 : inline void 82 304852 : INSFVVariable::computeElemValuesFace() 83 : { 84 304852 : if (_qp_calculations) 85 201162 : MooseVariableFVReal::computeElemValuesFace(); 86 304852 : } 87 : 88 : inline void 89 0 : INSFVVariable::computeNeighborValuesFace() 90 : { 91 0 : if (_qp_calculations) 92 0 : MooseVariableFVReal::computeNeighborValuesFace(); 93 0 : } 94 : 95 : inline void 96 0 : INSFVVariable::computeNeighborValues() 97 : { 98 0 : if (_qp_calculations) 99 0 : MooseVariableFVReal::computeNeighborValues(); 100 0 : }