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 "INSFVAdvectionKernel.h" 13 : #include "INSFVMomentumResidualObject.h" 14 : #include "PiecewiseByBlockLambdaFunctor.h" 15 : 16 : /** 17 : * An advection kernel that implements interpolation schemes specific to Navier-Stokes flow 18 : * physics 19 : */ 20 : class INSFVMomentumAdvection : public INSFVAdvectionKernel, public INSFVMomentumResidualObject 21 : { 22 : public: 23 : static InputParameters validParams(); 24 : INSFVMomentumAdvection(const InputParameters & params); 25 : 26 : /** 27 : * Parameters of this object that should be added to the NSFV action that are unique to this 28 : * object 29 : */ 30 : static InputParameters uniqueParams(); 31 : 32 : /** 33 : * @returns A list of the parameters that are common between this object and the NSFV action 34 : */ 35 : static std::vector<std::string> listOfCommonParams(); 36 : 37 0 : void gatherRCData(const Elem &) override final {} 38 : void gatherRCData(const FaceInfo & fi) override final; 39 : void initialSetup() override; 40 : using INSFVAdvectionKernel::computeResidual; 41 : void computeResidual(const FaceInfo & fi) override final; 42 : using INSFVAdvectionKernel::computeJacobian; 43 : void computeJacobian(const FaceInfo & fi) override final; 44 : 45 : protected: 46 : virtual ADReal computeQpResidual() override final; 47 190489519 : virtual bool hasMaterialTimeDerivative() const override { return true; } 48 : 49 : /** 50 : * A virtual method that allows us to reuse all the code from free-flow for porous 51 : */ 52 576003863 : virtual const Moose::FunctorBase<ADReal> & epsilon() const { return _unity_functor; } 53 : 54 : /** 55 : * Helper method that computes the 'a' coefficients and AD residuals 56 : */ 57 : virtual void computeResidualsAndAData(const FaceInfo & fi); 58 : 59 : /// Density 60 : const Moose::Functor<ADReal> & _rho; 61 : 62 : /// Whether to approximately calculate the 'a' coefficients 63 : const bool _approximate_as; 64 : 65 : /// Characteristic speed 66 : const Real _cs; 67 : 68 : /// Our local momentum functor 69 : std::unique_ptr<PiecewiseByBlockLambdaFunctor<ADReal>> _rho_u; 70 : 71 : /// The a coefficient for the element 72 : ADReal _ae = 0; 73 : 74 : /// The a coefficient for the neighbor 75 : ADReal _an = 0; 76 : 77 : /// The element residual 78 : ADReal _elem_residual = 0; 79 : 80 : /// The neighbor residual 81 : ADReal _neighbor_residual = 0; 82 : 83 : /// A unity functor used in the epsilon virtual method 84 : const Moose::ConstantFunctor<ADReal> _unity_functor{1}; 85 : };