https://mooseframework.inl.gov
Loading...
Searching...
No Matches
NSMomentumViscousBC.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
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
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
33Real
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
49Real
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
70Real
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}
registerMooseObject("NavierStokesApp", NSMomentumViscousBC)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
unsigned int _qp
unsigned int _i
const MooseArray< Point > & _normals
const VariableTestValue & _test
This class couples together all the variables for the compressible Navier-Stokes equations to allow t...
static InputParameters validParams()
bool isNSVariable(unsigned var)
const MaterialProperty< RealTensorValue > & _viscous_stress_tensor
unsigned mapVarNumber(unsigned var)
This class corresponds to the viscous part of the "natural" boundary condition for the momentum equat...
virtual Real computeQpJacobian()
static InputParameters validParams()
virtual Real computeQpResidual()
Just like other kernels, we must overload the Residual and Jacobian contributions....
NSMomentumViscousBC(const InputParameters &parameters)
NSViscStressTensorDerivs< NSMomentumViscousBC > _vst_derivs
virtual Real computeQpOffDiagJacobian(unsigned jvar)
Real dtau(unsigned k, unsigned ell, unsigned m)
The primary interface for computing viscous stress tensor derivatives.