www.mooseframework.org
INSMomentumNoBCBCTractionForm.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 
9 #include "MooseMesh.h"
10 
11 template <>
12 InputParameters
14 {
15  InputParameters params = validParams<INSMomentumNoBCBCBase>();
16 
17  params.addClassDescription("This class implements the 'No BC' boundary condition based on the "
18  "'traction' form of the viscous stress tensor.");
19  return params;
20 }
21 
23  : INSMomentumNoBCBCBase(parameters)
24 {
25 }
26 
27 Real
29 {
30  // Compute n . sigma . v, where n is unit normal and v is the test function.
31  RealTensorValue sigma;
32 
33  // First row
34  sigma(0, 0) = 2. * _mu[_qp] * _grad_u_vel[_qp](0);
35  sigma(0, 1) = _mu[_qp] * (_grad_u_vel[_qp](1) + _grad_v_vel[_qp](0));
36  sigma(0, 2) = _mu[_qp] * (_grad_u_vel[_qp](2) + _grad_w_vel[_qp](0));
37 
38  // Second row
39  sigma(1, 0) = _mu[_qp] * (_grad_v_vel[_qp](0) + _grad_u_vel[_qp](1));
40  sigma(1, 1) = 2. * _mu[_qp] * _grad_v_vel[_qp](1);
41  sigma(1, 2) = _mu[_qp] * (_grad_v_vel[_qp](2) + _grad_w_vel[_qp](1));
42 
43  // Third row
44  sigma(2, 0) = _mu[_qp] * (_grad_w_vel[_qp](0) + _grad_u_vel[_qp](2));
45  sigma(2, 1) = _mu[_qp] * (_grad_w_vel[_qp](1) + _grad_v_vel[_qp](2));
46  sigma(2, 2) = 2. * _mu[_qp] * _grad_w_vel[_qp](2);
47 
48  // If the pressure term is integrated by parts, it is part of the
49  // no-BC-BC, otherwise, it is not.
51  {
52  sigma(0, 0) -= _p[_qp];
53  sigma(1, 1) -= _p[_qp];
54  sigma(2, 2) -= _p[_qp];
55  }
56 
57  // Set up test function
58  RealVectorValue test;
59  test(_component) = _test[_i][_qp];
60 
61  return -_normals[_qp] * (sigma * test);
62 }
63 
64 Real
66 {
67  // The extra contribution comes from the "2" on the diagonal of the viscous stress tensor
68  return -_mu[_qp] * (_grad_phi[_j][_qp] * _normals[_qp] +
69  _grad_phi[_j][_qp](_component) * _normals[_qp](_component)) *
70  _test[_i][_qp];
71 }
72 
73 Real
75 {
76  if (jvar == _u_vel_var_number)
77  return -_mu[_qp] * _grad_phi[_j][_qp](_component) * _normals[_qp](0) * _test[_i][_qp];
78 
79  else if (jvar == _v_vel_var_number)
80  return -_mu[_qp] * _grad_phi[_j][_qp](_component) * _normals[_qp](1) * _test[_i][_qp];
81 
82  else if (jvar == _w_vel_var_number)
83  return -_mu[_qp] * _grad_phi[_j][_qp](_component) * _normals[_qp](2) * _test[_i][_qp];
84 
85  else if (jvar == _p_var_number)
86  {
88  return _phi[_j][_qp] * _normals[_qp](_component) * _test[_i][_qp];
89  else
90  return 0.;
91  }
92 
93  else
94  return 0.;
95 }
const VariableGradient & _grad_v_vel
const VariableGradient & _grad_w_vel
virtual Real computeQpOffDiagJacobian(unsigned jvar)
const MaterialProperty< Real > & _mu
const VariableValue & _p
INSMomentumNoBCBCTractionForm(const InputParameters &parameters)
InputParameters validParams< INSMomentumNoBCBCBase >()
InputParameters validParams< INSMomentumNoBCBCTractionForm >()
const VariableGradient & _grad_u_vel
Base class for the "No BC" boundary condition.