Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://www.mooseframework.org 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 "HDGKernel.h" 13 : 14 : /* 15 : * Imposes a singular perturbation on the component momentum equations penalizing discontinuities in 16 : * mass flux. Similar to \p MassFluxPenalty except it does not couple interior degrees of freedom on 17 : * neighboring elements, which makes this class useful in tandem with hybridized discretizations 18 : * because it supports static condensation 19 : */ 20 : class MassFluxPenaltyIPHDG : public HDGKernel 21 : { 22 : public: 23 : static InputParameters validParams(); 24 : 25 : MassFluxPenaltyIPHDG(const InputParameters & parameters); 26 : 27 146432 : virtual void computeResidual() override {} 28 0 : virtual void computeJacobian() override {} 29 399360 : virtual void computeOffDiagJacobian(unsigned int) override {} 30 : virtual void computeResidualOnSide() override; 31 : virtual void computeJacobianOnSide() override; 32 : 33 : protected: 34 : ADReal computeQpResidualOnSide(); 35 : 36 : const MooseVariableField<Real> & _vel_x_var; 37 : const MooseVariableField<Real> & _vel_y_var; 38 : const MooseVariableField<Real> & _vel_x_face_var; 39 : const MooseVariableField<Real> & _vel_y_face_var; 40 : const ADVariableValue & _vel_x; 41 : const ADVariableValue & _vel_y; 42 : const ADVariableValue & _vel_x_face; 43 : const ADVariableValue & _vel_y_face; 44 : const MooseArray<std::vector<Real>> & _vel_x_phi; 45 : const MooseArray<std::vector<Real>> & _vel_y_phi; 46 : const MooseArray<std::vector<Real>> & _vel_x_face_phi; 47 : const MooseArray<std::vector<Real>> & _vel_y_face_phi; 48 : const unsigned short _comp; 49 : const Real _gamma; 50 : 51 : std::vector<Real> _residuals; 52 : std::vector<ADReal> _ad_residuals; 53 : 54 : private: 55 : /** 56 : * Helper method to reduce code duplication, this will multiply quadrature point residuals 57 : * corresponding to the jump in mass flux by the passed-in \p test functions (corresponding to 58 : * either interior or face test functions) and \p sign (+1 or -1 respectively) 59 : */ 60 : template <typename T> 61 : void computeOnSideHelper(std::vector<T> & residuals, 62 : const MooseArray<std::vector<Real>> & test, 63 : Real sign); 64 : };