www.mooseframework.org
NSMomentumViscousFlux.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 /****************************************************************/
8 
9 template <>
10 InputParameters
12 {
13  InputParameters params = validParams<NSKernel>();
14  params.addClassDescription(
15  "Derived instance of the NSViscousFluxBase class for the momentum equations.");
16  params.addRequiredParam<unsigned int>("component", "");
17  return params;
18 }
19 
20 NSMomentumViscousFlux::NSMomentumViscousFlux(const InputParameters & parameters)
21  : NSKernel(parameters), _component(getParam<unsigned int>("component")), _vst_derivs(*this)
22 {
23 }
24 
25 Real
27 {
28  // Yay for less typing!
29  const RealTensorValue & vst = _viscous_stress_tensor[_qp];
30 
31  // _component'th column of vst...
32  RealVectorValue vec(vst(0, _component), vst(1, _component), vst(2, _component));
33 
34  // ... dotted with grad(phi), note: sign is positive as this term was -div(tau) on the lhs
35  return vec * _grad_test[_i][_qp];
36 }
37 
38 Real
40 {
41  Real value = 0.0;
42 
43  // Set variable names as in the notes
44  const unsigned k = _component;
45  const unsigned m = _component + 1; // _component = 0,1,2 -> m = 1,2,3 global variable number
46 
47  // Use external templated friend class for common viscous stress
48  // tensor derivative computations.
49  for (unsigned int ell = 0; ell < LIBMESH_DIM; ++ell)
50  value += _vst_derivs.dtau(k, ell, m) * _grad_test[_i][_qp](ell);
51 
52  return value;
53 }
54 
55 Real
57 {
58  if (isNSVariable(jvar))
59  {
60  Real value = 0.0;
61 
62  // Set variable names as in the notes
63  const unsigned int k = _component;
64 
65  // Map jvar into the variable m for our problem, regardless of
66  // how Moose has numbered things.
67  unsigned int m = mapVarNumber(jvar);
68 
69  for (unsigned ell = 0; ell < LIBMESH_DIM; ++ell)
70  value += _vst_derivs.dtau(k, ell, m) * _grad_test[_i][_qp](ell);
71 
72  return value;
73  }
74  else
75  return 0.0;
76 }
This class couples together all the variables for the compressible Navier-Stokes equations to allow t...
Definition: NSKernel.h:27
const unsigned int _component
NSMomentumViscousFlux(const InputParameters &parameters)
Real dtau(unsigned k, unsigned ell, unsigned m)
The primary interface for computing viscous stress tensor derivatives.
virtual Real computeQpResidual()
InputParameters validParams< NSKernel >()
Definition: NSKernel.C:20
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
bool isNSVariable(unsigned var)
Helper functions for mapping Moose variable numberings into the "canonical" numbering for the compres...
Definition: NSKernel.C:76
const MaterialProperty< RealTensorValue > & _viscous_stress_tensor
Definition: NSKernel.h:60
InputParameters validParams< NSMomentumViscousFlux >()
NSViscStressTensorDerivs< NSMomentumViscousFlux > _vst_derivs
virtual Real computeQpJacobian()
unsigned mapVarNumber(unsigned var)
Definition: NSKernel.C:86