https://mooseframework.inl.gov
Loading...
Searching...
No Matches
INSMomentumNoBCBCTractionForm.C
Go to the documentation of this file.
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
11#include "MooseMesh.h"
12
14
17{
19
20 params.addClassDescription("This class implements the 'No BC' boundary condition based on the "
21 "'traction' form of the viscous stress tensor.");
22 return params;
23}
24
29
30Real
32{
33 // Compute n . sigma . v, where n is unit normal and v is the test function.
34 RealTensorValue sigma;
35
36 // First row
37 sigma(0, 0) = 2. * _mu[_qp] * _grad_u_vel[_qp](0);
38 sigma(0, 1) = _mu[_qp] * (_grad_u_vel[_qp](1) + _grad_v_vel[_qp](0));
39 sigma(0, 2) = _mu[_qp] * (_grad_u_vel[_qp](2) + _grad_w_vel[_qp](0));
40
41 // Second row
42 sigma(1, 0) = _mu[_qp] * (_grad_v_vel[_qp](0) + _grad_u_vel[_qp](1));
43 sigma(1, 1) = 2. * _mu[_qp] * _grad_v_vel[_qp](1);
44 sigma(1, 2) = _mu[_qp] * (_grad_v_vel[_qp](2) + _grad_w_vel[_qp](1));
45
46 // Third row
47 sigma(2, 0) = _mu[_qp] * (_grad_w_vel[_qp](0) + _grad_u_vel[_qp](2));
48 sigma(2, 1) = _mu[_qp] * (_grad_w_vel[_qp](1) + _grad_v_vel[_qp](2));
49 sigma(2, 2) = 2. * _mu[_qp] * _grad_w_vel[_qp](2);
50
51 // If the pressure term is integrated by parts, it is part of the
52 // no-BC-BC, otherwise, it is not.
54 {
55 sigma(0, 0) -= _p[_qp];
56 sigma(1, 1) -= _p[_qp];
57 sigma(2, 2) -= _p[_qp];
58 }
59
60 // Set up test function
61 RealVectorValue test;
62 test(_component) = _test[_i][_qp];
63
64 return -_normals[_qp] * (sigma * test);
65}
66
67Real
69{
70 // The extra contribution comes from the "2" on the diagonal of the viscous stress tensor
71 return -_mu[_qp] *
74 _test[_i][_qp];
75}
76
77Real
79{
80 if (jvar == _u_vel_var_number)
81 return -_mu[_qp] * _grad_phi[_j][_qp](_component) * _normals[_qp](0) * _test[_i][_qp];
82
83 else if (jvar == _v_vel_var_number)
84 return -_mu[_qp] * _grad_phi[_j][_qp](_component) * _normals[_qp](1) * _test[_i][_qp];
85
86 else if (jvar == _w_vel_var_number)
87 return -_mu[_qp] * _grad_phi[_j][_qp](_component) * _normals[_qp](2) * _test[_i][_qp];
88
89 else if (jvar == _p_var_number)
90 {
92 return _phi[_j][_qp] * _normals[_qp](_component) * _test[_i][_qp];
93 else
94 return 0.;
95 }
96
97 else
98 return 0.;
99}
registerMooseObject("NavierStokesApp", INSMomentumNoBCBCTractionForm)
Base class for the "No BC" boundary condition.
const VariableGradient & _grad_u_vel
const VariableGradient & _grad_v_vel
const VariableValue & _p
static InputParameters validParams()
const VariableGradient & _grad_w_vel
const MaterialProperty< Real > & _mu
This class implements the "No BC" boundary condition based on the "traction" form of the viscous stre...
INSMomentumNoBCBCTractionForm(const InputParameters &parameters)
virtual Real computeQpOffDiagJacobian(unsigned jvar)
void addClassDescription(const std::string &doc_string)
unsigned int _qp
unsigned int _i
unsigned int _j
const VariablePhiGradient & _grad_phi
const VariablePhiValue & _phi
const MooseArray< Point > & _normals
const VariableTestValue & _test