www.mooseframework.org
INSMomentumNoBCBCTractionForm.C
Go to the documentation of this file.
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 
11 #include "MooseMesh.h"
12 
14 
15 template <>
16 InputParameters
18 {
19  InputParameters params = validParams<INSMomentumNoBCBCBase>();
20 
21  params.addClassDescription("This class implements the 'No BC' boundary condition based on the "
22  "'traction' form of the viscous stress tensor.");
23  return params;
24 }
25 
27  : INSMomentumNoBCBCBase(parameters)
28 {
29 }
30 
31 Real
33 {
34  // Compute n . sigma . v, where n is unit normal and v is the test function.
35  RealTensorValue sigma;
36 
37  // First row
38  sigma(0, 0) = 2. * _mu[_qp] * _grad_u_vel[_qp](0);
39  sigma(0, 1) = _mu[_qp] * (_grad_u_vel[_qp](1) + _grad_v_vel[_qp](0));
40  sigma(0, 2) = _mu[_qp] * (_grad_u_vel[_qp](2) + _grad_w_vel[_qp](0));
41 
42  // Second row
43  sigma(1, 0) = _mu[_qp] * (_grad_v_vel[_qp](0) + _grad_u_vel[_qp](1));
44  sigma(1, 1) = 2. * _mu[_qp] * _grad_v_vel[_qp](1);
45  sigma(1, 2) = _mu[_qp] * (_grad_v_vel[_qp](2) + _grad_w_vel[_qp](1));
46 
47  // Third row
48  sigma(2, 0) = _mu[_qp] * (_grad_w_vel[_qp](0) + _grad_u_vel[_qp](2));
49  sigma(2, 1) = _mu[_qp] * (_grad_w_vel[_qp](1) + _grad_v_vel[_qp](2));
50  sigma(2, 2) = 2. * _mu[_qp] * _grad_w_vel[_qp](2);
51 
52  // If the pressure term is integrated by parts, it is part of the
53  // no-BC-BC, otherwise, it is not.
55  {
56  sigma(0, 0) -= _p[_qp];
57  sigma(1, 1) -= _p[_qp];
58  sigma(2, 2) -= _p[_qp];
59  }
60 
61  // Set up test function
62  RealVectorValue test;
63  test(_component) = _test[_i][_qp];
64 
65  return -_normals[_qp] * (sigma * test);
66 }
67 
68 Real
70 {
71  // The extra contribution comes from the "2" on the diagonal of the viscous stress tensor
72  return -_mu[_qp] * (_grad_phi[_j][_qp] * _normals[_qp] +
73  _grad_phi[_j][_qp](_component) * _normals[_qp](_component)) *
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 }
registerMooseObject
registerMooseObject("NavierStokesApp", INSMomentumNoBCBCTractionForm)
INSMomentumNoBCBCTractionForm.h
INSMomentumNoBCBCTractionForm::computeQpOffDiagJacobian
virtual Real computeQpOffDiagJacobian(unsigned jvar)
Definition: INSMomentumNoBCBCTractionForm.C:78
INSMomentumNoBCBCBase::_grad_w_vel
const VariableGradient & _grad_w_vel
Definition: INSMomentumNoBCBCBase.h:47
INSMomentumNoBCBCBase::_p_var_number
unsigned _p_var_number
Definition: INSMomentumNoBCBCBase.h:53
INSMomentumNoBCBCTractionForm::computeQpResidual
virtual Real computeQpResidual()
Definition: INSMomentumNoBCBCTractionForm.C:32
INSMomentumNoBCBCTractionForm::INSMomentumNoBCBCTractionForm
INSMomentumNoBCBCTractionForm(const InputParameters &parameters)
Definition: INSMomentumNoBCBCTractionForm.C:26
INSMomentumNoBCBCBase::_p
const VariableValue & _p
Definition: INSMomentumNoBCBCBase.h:42
INSMomentumNoBCBCTractionForm::computeQpJacobian
virtual Real computeQpJacobian()
Definition: INSMomentumNoBCBCTractionForm.C:69
validParams< INSMomentumNoBCBCBase >
InputParameters validParams< INSMomentumNoBCBCBase >()
Definition: INSMomentumNoBCBCBase.C:15
INSMomentumNoBCBCTractionForm
This class implements the "No BC" boundary condition based on the "traction" form of the viscous stre...
Definition: INSMomentumNoBCBCTractionForm.h:24
INSMomentumNoBCBCBase::_integrate_p_by_parts
bool _integrate_p_by_parts
Definition: INSMomentumNoBCBCBase.h:57
INSMomentumNoBCBCBase::_component
unsigned _component
Definition: INSMomentumNoBCBCBase.h:56
INSMomentumNoBCBCBase::_w_vel_var_number
unsigned _w_vel_var_number
Definition: INSMomentumNoBCBCBase.h:52
validParams< INSMomentumNoBCBCTractionForm >
InputParameters validParams< INSMomentumNoBCBCTractionForm >()
Definition: INSMomentumNoBCBCTractionForm.C:17
INSMomentumNoBCBCBase::_mu
const MaterialProperty< Real > & _mu
Definition: INSMomentumNoBCBCBase.h:59
INSMomentumNoBCBCBase::_v_vel_var_number
unsigned _v_vel_var_number
Definition: INSMomentumNoBCBCBase.h:51
INSMomentumNoBCBCBase
Base class for the "No BC" boundary condition.
Definition: INSMomentumNoBCBCBase.h:30
INSMomentumNoBCBCBase::_grad_u_vel
const VariableGradient & _grad_u_vel
Definition: INSMomentumNoBCBCBase.h:45
INSMomentumNoBCBCBase::_u_vel_var_number
unsigned _u_vel_var_number
Definition: INSMomentumNoBCBCBase.h:50
INSMomentumNoBCBCBase::_grad_v_vel
const VariableGradient & _grad_v_vel
Definition: INSMomentumNoBCBCBase.h:46