www.mooseframework.org
NSMomentumViscousFlux.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 "NSMomentumViscousFlux.h"
11 
12 registerMooseObject("NavierStokesApp", NSMomentumViscousFlux);
13 
16 {
18  params.addClassDescription(
19  "Derived instance of the NSViscousFluxBase class for the momentum equations.");
20  params.addRequiredParam<unsigned int>("component", "");
21  return params;
22 }
23 
25  : NSKernel(parameters), _component(getParam<unsigned int>("component")), _vst_derivs(*this)
26 {
27 }
28 
29 Real
31 {
32  // Yay for less typing!
34 
35  // _component'th column of vst...
36  RealVectorValue vec(vst(0, _component), vst(1, _component), vst(2, _component));
37 
38  // ... dotted with grad(phi), note: sign is positive as this term was -div(tau) on the lhs
39  return vec * _grad_test[_i][_qp];
40 }
41 
42 Real
44 {
45  Real value = 0.0;
46 
47  // Set variable names as in the notes
48  const unsigned k = _component;
49  const unsigned m = _component + 1; // _component = 0,1,2 -> m = 1,2,3 global variable number
50 
51  // Use external templated friend class for common viscous stress
52  // tensor derivative computations.
53  for (unsigned int ell = 0; ell < LIBMESH_DIM; ++ell)
54  value += _vst_derivs.dtau(k, ell, m) * _grad_test[_i][_qp](ell);
55 
56  return value;
57 }
58 
59 Real
61 {
62  if (isNSVariable(jvar))
63  {
64  Real value = 0.0;
65 
66  // Set variable names as in the notes
67  const unsigned int k = _component;
68 
69  // Map jvar into the variable m for our problem, regardless of
70  // how Moose has numbered things.
71  unsigned int m = mapVarNumber(jvar);
72 
73  for (unsigned ell = 0; ell < LIBMESH_DIM; ++ell)
74  value += _vst_derivs.dtau(k, ell, m) * _grad_test[_i][_qp](ell);
75 
76  return value;
77  }
78  else
79  return 0.0;
80 }
static InputParameters validParams()
This class couples together all the variables for the compressible Navier-Stokes equations to allow t...
Definition: NSKernel.h:25
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.
registerMooseObject("NavierStokesApp", NSMomentumViscousFlux)
virtual Real computeQpResidual()
void addRequiredParam(const std::string &name, const std::string &doc_string)
TensorValue< Real > RealTensorValue
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:79
unsigned int _i
virtual const OutputTools< Real >::VariableValue & value()
const MaterialProperty< RealTensorValue > & _viscous_stress_tensor
Definition: NSKernel.h:60
NSViscStressTensorDerivs< NSMomentumViscousFlux > _vst_derivs
Derived instance of the NSViscousFluxBase class for the momentum equations.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const VariableTestGradient & _grad_test
void addClassDescription(const std::string &doc_string)
static InputParameters validParams()
Definition: NSKernel.C:23
virtual Real computeQpJacobian()
unsigned mapVarNumber(unsigned var)
Definition: NSKernel.C:89
static const std::string k
Definition: NS.h:124
void ErrorVector unsigned int
unsigned int _qp