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