https://mooseframework.inl.gov
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 
26  : INSMomentumNoBCBCBase(parameters)
27 {
28 }
29 
30 Real
32 {
33  // Compute n . sigma . v, where n is unit normal and v is the test function.
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 
67 Real
69 {
70  // The extra contribution comes from the "2" on the diagonal of the viscous stress tensor
71  return -_mu[_qp] *
72  (_grad_phi[_j][_qp] * _normals[_qp] +
74  _test[_i][_qp];
75 }
76 
77 Real
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 }
const VariableGradient & _grad_v_vel
const VariableTestValue & _test
unsigned int _j
const VariableGradient & _grad_w_vel
const MooseArray< Point > & _normals
virtual Real computeQpOffDiagJacobian(unsigned jvar)
const MaterialProperty< Real > & _mu
unsigned int _i
const VariableValue & _p
const VariablePhiValue & _phi
unsigned int _qp
const VariablePhiGradient & _grad_phi
TensorValue< Real > RealTensorValue
registerMooseObject("NavierStokesApp", INSMomentumNoBCBCTractionForm)
This class implements the "No BC" boundary condition based on the "traction" form of the viscous stre...
INSMomentumNoBCBCTractionForm(const InputParameters &parameters)
static InputParameters validParams()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const VariableGradient & _grad_u_vel
void addClassDescription(const std::string &doc_string)
Base class for the "No BC" boundary condition.