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