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 "Kernel.h" 13 : 14 : /** 15 : * This class computes strong and weak components of the INS governing 16 : * equations. These terms can then be assembled in child classes 17 : */ 18 : class INSBase : public Kernel 19 : { 20 : public: 21 : static InputParameters validParams(); 22 : 23 : INSBase(const InputParameters & parameters); 24 : 25 3697 : virtual ~INSBase() {} 26 : 27 : protected: 28 : virtual Real computeQpResidual() = 0; 29 : virtual Real computeQpJacobian() = 0; 30 : virtual Real computeQpOffDiagJacobian(unsigned jvar) = 0; 31 : 32 : virtual RealVectorValue convectiveTerm(); 33 : virtual RealVectorValue dConvecDUComp(unsigned comp); 34 : 35 : virtual RealVectorValue strongViscousTermLaplace(); 36 : virtual RealVectorValue strongViscousTermTraction(); 37 : virtual RealVectorValue dStrongViscDUCompLaplace(unsigned comp); 38 : virtual RealVectorValue dStrongViscDUCompTraction(unsigned comp); 39 : 40 : virtual RealVectorValue weakViscousTermLaplace(unsigned comp); 41 : virtual RealVectorValue weakViscousTermTraction(unsigned comp); 42 : virtual RealVectorValue dWeakViscDUCompLaplace(); 43 : virtual RealVectorValue dWeakViscDUCompTraction(); 44 : 45 : virtual RealVectorValue strongPressureTerm(); 46 : virtual Real weakPressureTerm(); 47 : virtual RealVectorValue dStrongPressureDPressure(); 48 : virtual Real dWeakPressureDPressure(); 49 : 50 : virtual RealVectorValue gravityTerm(); 51 : 52 : virtual RealVectorValue timeDerivativeTerm(); 53 : virtual RealVectorValue dTimeDerivativeDUComp(unsigned comp); 54 : 55 : virtual Real tau(); 56 : virtual Real dTauDUComp(unsigned comp); 57 : 58 : /// Provides tau which yields superconvergence for 1D advection-diffusion 59 : virtual Real tauNodal(); 60 : 61 : /** 62 : * Compute the velocity. If displacements are provided, then this routine will subtract the time 63 : * derivative of the displacements, e.g. the mesh velocity 64 : */ 65 : RealVectorValue relativeVelocity() const; 66 : 67 : /** 68 : * Computes the additional RZ terms for the Laplace form of the strong viscous term 69 : */ 70 : RealVectorValue strongViscousTermLaplaceRZ() const; 71 : 72 : /** 73 : * Computes the Jacobian for the additional RZ terms for the Laplace form of the strong viscous 74 : * term for the given velocity component \p comp 75 : */ 76 : RealVectorValue dStrongViscDUCompLaplaceRZ(const unsigned int comp) const; 77 : 78 : /** 79 : * Computes the additional RZ terms for the Traction form of the strong viscous term 80 : */ 81 : RealVectorValue strongViscousTermTractionRZ() const; 82 : 83 : /** 84 : * Computes the Jacobian for the additional RZ terms for the Traction form of the strong viscous 85 : * term for the given velocity component \p comp 86 : */ 87 : RealVectorValue dStrongViscDUCompTractionRZ(const unsigned int comp) const; 88 : 89 : /// second derivatives of the shape function 90 : const VariablePhiSecond & _second_phi; 91 : 92 : // Coupled variables 93 : const VariableValue & _u_vel; 94 : const VariableValue & _v_vel; 95 : const VariableValue & _w_vel; 96 : const VariableValue & _p; 97 : 98 : const bool _picard; 99 : const VariableValue * const _u_vel_previous_nl; 100 : const VariableValue * const _v_vel_previous_nl; 101 : const VariableValue * const _w_vel_previous_nl; 102 : 103 : // Gradients 104 : const VariableGradient & _grad_u_vel; 105 : const VariableGradient & _grad_v_vel; 106 : const VariableGradient & _grad_w_vel; 107 : const VariableGradient & _grad_p; 108 : 109 : // Seconds 110 : const VariableSecond & _second_u_vel; 111 : const VariableSecond & _second_v_vel; 112 : const VariableSecond & _second_w_vel; 113 : 114 : // Time derivatives 115 : const VariableValue & _u_vel_dot; 116 : const VariableValue & _v_vel_dot; 117 : const VariableValue & _w_vel_dot; 118 : 119 : // Derivatives of time derivatives 120 : const VariableValue & _d_u_vel_dot_du; 121 : const VariableValue & _d_v_vel_dot_dv; 122 : const VariableValue & _d_w_vel_dot_dw; 123 : 124 : // Variable numberings 125 : unsigned _u_vel_var_number; 126 : unsigned _v_vel_var_number; 127 : unsigned _w_vel_var_number; 128 : unsigned _p_var_number; 129 : 130 : RealVectorValue _gravity; 131 : 132 : // Material properties 133 : const MaterialProperty<Real> & _mu; 134 : const MaterialProperty<Real> & _rho; 135 : 136 : const Real & _alpha; 137 : bool _laplace; 138 : bool _convective_term; 139 : bool _transient_term; 140 : 141 : /// Whether displacements are provided 142 : const bool _disps_provided; 143 : /// Time derivative of the x-displacement, mesh velocity in the x-direction 144 : const VariableValue & _disp_x_dot; 145 : /// Time derivative of the y-displacement, mesh velocity in the y-direction 146 : const VariableValue & _disp_y_dot; 147 : /// Time derivative of the z-displacement, mesh velocity in the z-direction 148 : const VariableValue & _disp_z_dot; 149 : 150 : /// The radial coordinate index for RZ coordinate systems 151 : const unsigned int _rz_radial_coord; 152 : };