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