www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
NSMomentumInviscidBC Class Reference

This class corresponds to the inviscid part of the "natural" boundary condition for the momentum equations, i.e. More...

#include <NSMomentumInviscidBC.h>

Inheritance diagram for NSMomentumInviscidBC:
[legend]

Public Member Functions

 NSMomentumInviscidBC (const InputParameters &parameters)
 

Protected Member Functions

Real pressureQpResidualHelper (Real pressure)
 
Real pressureQpJacobianHelper (unsigned var_number)
 
Real convectiveQpResidualHelper (Real rhou_udotn)
 
Real convectiveQpJacobianHelper (unsigned var_number)
 
bool isNSVariable (unsigned var)
 
unsigned mapVarNumber (unsigned var)
 

Protected Attributes

const unsigned _component
 
NSPressureDerivs< NSMomentumInviscidBC_pressure_derivs
 
const VariableValue & _u_vel
 
const VariableValue & _v_vel
 
const VariableValue & _w_vel
 
const VariableValue & _rho
 
const VariableValue & _rho_u
 
const VariableValue & _rho_v
 
const VariableValue & _rho_w
 
const VariableValue & _rho_E
 
const VariableGradient & _grad_rho
 
const VariableGradient & _grad_rho_u
 
const VariableGradient & _grad_rho_v
 
const VariableGradient & _grad_rho_w
 
const VariableGradient & _grad_rho_E
 
unsigned _rho_var_number
 
unsigned _rhou_var_number
 
unsigned _rhov_var_number
 
unsigned _rhow_var_number
 
unsigned _rhoE_var_number
 
const MaterialProperty< Real > & _dynamic_viscosity
 
const MaterialProperty< RealTensorValue > & _viscous_stress_tensor
 
const IdealGasFluidProperties_fp
 

Friends

template<class U >
class NSPressureDerivs
 

Detailed Description

This class corresponds to the inviscid part of the "natural" boundary condition for the momentum equations, i.e.

int_{Gamma} n . (rho*uu + Ip) . v

While this kernel implements the convective and pressure term residuals and jacobians, it does not itself implement any of the computeQp* functions. For that, use one of the derived classes: 1.) NSMomentumInviscidSpecifiedPressureBC 2.) NSMomentumInviscidSpecifiedNormalFlowBC 3.) NSMomentumInviscidNoPressureImplicitFlowBC

The first kernel above would be used for a subsonic outflow BC in the Euler or Navier-Stokes equations in which one physical value (the pressure) is specified. In this case, the residual and Jacobian contrbutions of the n.(rho*u)(u.v) term are computed and added to the matrix/rhs. For the pressure term, the residual contribution due to the specified pressure is computed but there is no corresponding Jacobian entry since the value is given.

The second kernel above would be used if, instead of the pressure, the value of the vector (rho*u)(u.n) is given. This situation is not common, but a special case of it, u.n=0, is very common for implementing a free-slip boundary: in that situation the pressure is an unknown and u.n = 0 would be imposed by the kernel (though in this trivial case you could omit the term completely).

The third kernel above would be used when the pressure term has not been integrated by parts in the momentum equations, and therefore there is no pressure in the boundary term at all.

We note that other combinations are also theoretically possible (e.g. unspecified pressure and normal flow, fully-specified pressure and normal flow) however they have not yet been implemented since I'm not sure if they are physically-relevant.

Definition at line 57 of file NSMomentumInviscidBC.h.

Constructor & Destructor Documentation

NSMomentumInviscidBC::NSMomentumInviscidBC ( const InputParameters &  parameters)

Definition at line 21 of file NSMomentumInviscidBC.C.

22  : NSIntegratedBC(parameters),
23  _component(getParam<unsigned>("component")),
24  // Object for computing deriviatives of pressure
25  _pressure_derivs(*this)
26 {
27 }
NSIntegratedBC(const InputParameters &parameters)
NSPressureDerivs< NSMomentumInviscidBC > _pressure_derivs

Member Function Documentation

Real NSMomentumInviscidBC::convectiveQpJacobianHelper ( unsigned  var_number)
protected

Definition at line 61 of file NSMomentumInviscidBC.C.

Referenced by NSMomentumInviscidNoPressureImplicitFlowBC::computeQpJacobian(), NSMomentumInviscidSpecifiedPressureBC::computeQpJacobian(), NSMomentumInviscidSpecifiedPressureBC::computeQpOffDiagJacobian(), and NSMomentumInviscidNoPressureImplicitFlowBC::computeQpOffDiagJacobian().

62 {
63  // Velocity vector object
64  RealVectorValue vel(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);
65 
66  // Variable to store convective contribution to boundary integral.
67  Real conv_term = 0.0;
68 
69  // Inviscid components
70  switch (var_number)
71  {
72  case 0: // density
73  // Note: the minus sign here is correct, it comes from differentiating wrt U_0
74  // (rho) which is in the denominator.
75  conv_term = -vel(_component) * (vel * _normals[_qp]) * _phi[_j][_qp] * _test[_i][_qp];
76  break;
77 
78  case 1:
79  case 2:
80  case 3: // momentums
81  if (var_number - 1 == _component)
82  // See Eqn. (68) from the notes for the inviscid boundary terms
83  conv_term = ((vel * _normals[_qp]) + vel(_component) * _normals[_qp](_component)) *
84  _phi[_j][_qp] * _test[_i][_qp];
85  else
86  // off-diagonal
87  conv_term =
88  vel(_component) * _normals[_qp](var_number - 1) * _phi[_j][_qp] * _test[_i][_qp];
89  break;
90 
91  case 4: // energy
92  // No derivative wrt energy
93  conv_term = 0.0;
94  break;
95 
96  default:
97  mooseError("Shouldn't get here!");
98  break;
99  }
100 
101  // Return the result. We could return it directly from the switch statement, but this is
102  // convenient for printing...
103  return conv_term;
104 }
const VariableValue & _w_vel
const VariableValue & _v_vel
const VariableValue & _u_vel
Real NSMomentumInviscidBC::convectiveQpResidualHelper ( Real  rhou_udotn)
protected

Definition at line 49 of file NSMomentumInviscidBC.C.

Referenced by NSMomentumInviscidSpecifiedNormalFlowBC::computeQpResidual(), NSMomentumInviscidSpecifiedPressureBC::computeQpResidual(), and NSMomentumInviscidNoPressureImplicitFlowBC::computeQpResidual().

50 {
51  // n . (rho*uu) . v = rho*(u.n)*(u.v) = (rho*u)(u.n) . v
52 
53  // The "inviscid" contribution: (rho*u)(u.n) . v
54  Real conv_term = rhou_udotn * _test[_i][_qp];
55 
56  // Return value, or print it first if debugging...
57  return conv_term;
58 }
bool NSIntegratedBC::isNSVariable ( unsigned  var)
protectedinherited
unsigned NSIntegratedBC::mapVarNumber ( unsigned  var)
protectedinherited

Definition at line 87 of file NSIntegratedBC.C.

Referenced by NSEnergyInviscidSpecifiedBC::computeQpOffDiagJacobian(), NSEnergyInviscidSpecifiedNormalFlowBC::computeQpOffDiagJacobian(), NSEnergyInviscidUnspecifiedBC::computeQpOffDiagJacobian(), NSEnergyInviscidSpecifiedPressureBC::computeQpOffDiagJacobian(), NSMomentumInviscidSpecifiedNormalFlowBC::computeQpOffDiagJacobian(), NSMassUnspecifiedNormalFlowBC::computeQpOffDiagJacobian(), NSMomentumInviscidSpecifiedPressureBC::computeQpOffDiagJacobian(), NSMomentumInviscidNoPressureImplicitFlowBC::computeQpOffDiagJacobian(), NSPressureNeumannBC::computeQpOffDiagJacobian(), NSMomentumViscousBC::computeQpOffDiagJacobian(), and NSEnergyViscousBC::computeQpOffDiagJacobian().

88 {
89  // Convert the Moose numbering to:
90  // 0 for rho
91  // 1 for rho*u
92  // 2 for rho*v
93  // 3 for rho*w
94  // 4 for rho*e
95  // regardless of the problem dimension, etc.
96  unsigned int mapped_var_number;
97 
98  if (var == _rho_var_number)
99  mapped_var_number = 0;
100  else if (var == _rhou_var_number)
101  mapped_var_number = 1;
102  else if (var == _rhov_var_number)
103  mapped_var_number = 2;
104  else if (var == _rhow_var_number)
105  mapped_var_number = 3;
106  else if (var == _rhoE_var_number)
107  mapped_var_number = 4;
108  else
109  mooseError("Invalid var!");
110 
111  return mapped_var_number;
112 }
unsigned _rhov_var_number
unsigned _rhou_var_number
unsigned _rhow_var_number
unsigned _rho_var_number
unsigned _rhoE_var_number
Real NSMomentumInviscidBC::pressureQpJacobianHelper ( unsigned  var_number)
protected

Definition at line 42 of file NSMomentumInviscidBC.C.

Referenced by NSMomentumInviscidSpecifiedNormalFlowBC::computeQpJacobian(), and NSMomentumInviscidSpecifiedNormalFlowBC::computeQpOffDiagJacobian().

43 {
44  return _normals[_qp](_component) * _pressure_derivs.get_grad(var_number) * _phi[_j][_qp] *
45  _test[_i][_qp];
46 }
Real get_grad(unsigned i)
The primary interfaces for computing pressure derivatives.
NSPressureDerivs< NSMomentumInviscidBC > _pressure_derivs
Real NSMomentumInviscidBC::pressureQpResidualHelper ( Real  pressure)
protected

Definition at line 30 of file NSMomentumInviscidBC.C.

Referenced by NSMomentumInviscidSpecifiedNormalFlowBC::computeQpResidual(), and NSMomentumInviscidSpecifiedPressureBC::computeQpResidual().

31 {
32  // n . (Ip) . v
33 
34  // The pressure contribution: p * n(component) * phi_i
35  Real press_term = pressure * _normals[_qp](_component) * _test[_i][_qp];
36 
37  // Return value, or print it first if debugging...
38  return press_term;
39 }
const std::string pressure
Definition: NS.h:24

Friends And Related Function Documentation

template<class U >
friend class NSPressureDerivs
friend

Definition at line 73 of file NSMomentumInviscidBC.h.

Member Data Documentation

const unsigned NSMomentumInviscidBC::_component
protected
const MaterialProperty<Real>& NSIntegratedBC::_dynamic_viscosity
protectedinherited

Definition at line 56 of file NSIntegratedBC.h.

const IdealGasFluidProperties& NSIntegratedBC::_fp
protectedinherited
const VariableGradient& NSIntegratedBC::_grad_rho
protectedinherited

Definition at line 43 of file NSIntegratedBC.h.

Referenced by NSEnergyViscousBC::NSEnergyViscousBC().

const VariableGradient& NSIntegratedBC::_grad_rho_E
protectedinherited

Definition at line 47 of file NSIntegratedBC.h.

Referenced by NSEnergyViscousBC::NSEnergyViscousBC().

const VariableGradient& NSIntegratedBC::_grad_rho_u
protectedinherited

Definition at line 44 of file NSIntegratedBC.h.

Referenced by NSEnergyViscousBC::NSEnergyViscousBC().

const VariableGradient& NSIntegratedBC::_grad_rho_v
protectedinherited

Definition at line 45 of file NSIntegratedBC.h.

Referenced by NSEnergyViscousBC::NSEnergyViscousBC().

const VariableGradient& NSIntegratedBC::_grad_rho_w
protectedinherited

Definition at line 46 of file NSIntegratedBC.h.

Referenced by NSEnergyViscousBC::NSEnergyViscousBC().

NSPressureDerivs<NSMomentumInviscidBC> NSMomentumInviscidBC::_pressure_derivs
protected

Definition at line 69 of file NSMomentumInviscidBC.h.

Referenced by pressureQpJacobianHelper().

const VariableValue& NSIntegratedBC::_rho
protectedinherited
const VariableValue& NSIntegratedBC::_rho_E
protectedinherited
const VariableValue& NSIntegratedBC::_rho_u
protectedinherited
const VariableValue& NSIntegratedBC::_rho_v
protectedinherited
unsigned NSIntegratedBC::_rho_var_number
protectedinherited

Definition at line 49 of file NSIntegratedBC.h.

Referenced by NSIntegratedBC::isNSVariable(), and NSIntegratedBC::mapVarNumber().

const VariableValue& NSIntegratedBC::_rho_w
protectedinherited
unsigned NSIntegratedBC::_rhoE_var_number
protectedinherited

Definition at line 53 of file NSIntegratedBC.h.

Referenced by NSIntegratedBC::isNSVariable(), and NSIntegratedBC::mapVarNumber().

unsigned NSIntegratedBC::_rhou_var_number
protectedinherited

Definition at line 50 of file NSIntegratedBC.h.

Referenced by NSIntegratedBC::isNSVariable(), and NSIntegratedBC::mapVarNumber().

unsigned NSIntegratedBC::_rhov_var_number
protectedinherited

Definition at line 51 of file NSIntegratedBC.h.

Referenced by NSIntegratedBC::isNSVariable(), and NSIntegratedBC::mapVarNumber().

unsigned NSIntegratedBC::_rhow_var_number
protectedinherited

Definition at line 52 of file NSIntegratedBC.h.

Referenced by NSIntegratedBC::isNSVariable(), and NSIntegratedBC::mapVarNumber().

const VariableValue& NSIntegratedBC::_u_vel
protectedinherited
const VariableValue& NSIntegratedBC::_v_vel
protectedinherited
const MaterialProperty<RealTensorValue>& NSIntegratedBC::_viscous_stress_tensor
protectedinherited
const VariableValue& NSIntegratedBC::_w_vel
protectedinherited

The documentation for this class was generated from the following files: