www.mooseframework.org
NSMomentumViscousBC.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 #include "NSMomentumViscousBC.h"
8 
9 template <>
10 InputParameters
12 {
13  InputParameters params = validParams<NSIntegratedBC>();
14  params.addClassDescription("This class corresponds to the viscous part of the 'natural' boundary "
15  "condition for the momentum equations.");
16  params.addRequiredParam<unsigned>(
17  "component", "(0,1,2) = (x,y,z) for which momentum component this BC is applied to");
18  return params;
19 }
20 
21 NSMomentumViscousBC::NSMomentumViscousBC(const InputParameters & parameters)
22  : NSIntegratedBC(parameters),
23  _component(getParam<unsigned>("component")),
24  // Derivative computing object
25  _vst_derivs(*this)
26 {
27 }
28 
29 Real
31 {
32  // n . (-tau) . v
33 
34  // Vector-valued test function
35  RealVectorValue v_test;
36  v_test(_component) = _test[_i][_qp];
37 
38  // The viscous contribution: n . tau . v
39  Real visc_term = _normals[_qp] * (_viscous_stress_tensor[_qp] * v_test);
40 
41  // Note the sign...
42  return -visc_term;
43 }
44 
45 Real
47 {
48  // See Eqns. (41)--(43) from the notes for the viscous boundary term contributions
49  Real visc_term = 0.0;
50 
51  // Set variable names as in the notes
52  const unsigned int k = _component;
53  const unsigned int m = _component + 1; // _component = 0,1,2 -> m = 1,2,3 global variable number
54 
55  // FIXME: attempt calling shared dtau function
56  for (unsigned int ell = 0; ell < LIBMESH_DIM; ++ell)
57  visc_term += _vst_derivs.dtau(k, ell, m) * _normals[_qp](ell);
58 
59  // Multiply visc_term by test function
60  visc_term *= _test[_i][_qp];
61 
62  // Note the sign...
63  return -visc_term;
64 }
65 
66 Real
68 {
69  if (isNSVariable(jvar))
70  {
71 
72  // See Eqns. (41)--(43) from the notes for the viscous boundary
73  // term contributions.
74 
75  // Map jvar into the variable m for our problem, regardless of
76  // how Moose has numbered things.
77  unsigned m = mapVarNumber(jvar);
78 
79  // Now compute viscous contribution
80  Real visc_term = 0.0;
81 
82  // Set variable names as in the notes
83  const unsigned int k = _component;
84 
85  for (unsigned int ell = 0; ell < LIBMESH_DIM; ++ell)
86  visc_term += _vst_derivs.dtau(k, ell, m) * _normals[_qp](ell);
87 
88  // Multiply visc_term by test function
89  visc_term *= _test[_i][_qp];
90 
91  // Note the sign...
92  return -visc_term;
93  }
94  else
95  return 0.0;
96 }
virtual Real computeQpJacobian()
bool isNSVariable(unsigned var)
This class couples together all the variables for the compressible Navier-Stokes equations to allow t...
virtual Real computeQpOffDiagJacobian(unsigned jvar)
const unsigned _component
InputParameters validParams< NSMomentumViscousBC >()
NSViscStressTensorDerivs< NSMomentumViscousBC > _vst_derivs
Real dtau(unsigned k, unsigned ell, unsigned m)
The primary interface for computing viscous stress tensor derivatives.
const MaterialProperty< RealTensorValue > & _viscous_stress_tensor
NSMomentumViscousBC(const InputParameters &parameters)
unsigned mapVarNumber(unsigned var)
InputParameters validParams< NSIntegratedBC >()
virtual Real computeQpResidual()
Just like other kernels, we must overload the Residual and Jacobian contributions...