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 60 of file NSMomentumInviscidBC.h.

Constructor & Destructor Documentation

◆ NSMomentumInviscidBC()

NSMomentumInviscidBC::NSMomentumInviscidBC ( const InputParameters &  parameters)

Definition at line 24 of file NSMomentumInviscidBC.C.

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

Member Function Documentation

◆ convectiveQpJacobianHelper()

Real NSMomentumInviscidBC::convectiveQpJacobianHelper ( unsigned  var_number)
protected

Definition at line 64 of file NSMomentumInviscidBC.C.

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

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

◆ convectiveQpResidualHelper()

Real NSMomentumInviscidBC::convectiveQpResidualHelper ( Real  rhou_udotn)
protected

Definition at line 52 of file NSMomentumInviscidBC.C.

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

53 {
54  // n . (rho*uu) . v = rho*(u.n)*(u.v) = (rho*u)(u.n) . v
55 
56  // The "inviscid" contribution: (rho*u)(u.n) . v
57  Real conv_term = rhou_udotn * _test[_i][_qp];
58 
59  // Return value, or print it first if debugging...
60  return conv_term;
61 }

◆ isNSVariable()

bool NSIntegratedBC::isNSVariable ( unsigned  var)
protectedinherited

◆ mapVarNumber()

unsigned NSIntegratedBC::mapVarNumber ( unsigned  var)
protectedinherited

Definition at line 90 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().

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

◆ pressureQpJacobianHelper()

Real NSMomentumInviscidBC::pressureQpJacobianHelper ( unsigned  var_number)
protected

Definition at line 45 of file NSMomentumInviscidBC.C.

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

46 {
47  return _normals[_qp](_component) * _pressure_derivs.get_grad(var_number) * _phi[_j][_qp] *
48  _test[_i][_qp];
49 }
Real get_grad(unsigned i)
The primary interfaces for computing pressure derivatives.
NSPressureDerivs< NSMomentumInviscidBC > _pressure_derivs

◆ pressureQpResidualHelper()

Real NSMomentumInviscidBC::pressureQpResidualHelper ( Real  pressure)
protected

Definition at line 33 of file NSMomentumInviscidBC.C.

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

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

Friends And Related Function Documentation

◆ NSPressureDerivs

template<class U >
friend class NSPressureDerivs
friend

Definition at line 76 of file NSMomentumInviscidBC.h.

Member Data Documentation

◆ _component

const unsigned NSMomentumInviscidBC::_component
protected

◆ _dynamic_viscosity

const MaterialProperty<Real>& NSIntegratedBC::_dynamic_viscosity
protectedinherited

Definition at line 59 of file NSIntegratedBC.h.

◆ _fp

const IdealGasFluidProperties& NSIntegratedBC::_fp
protectedinherited

◆ _grad_rho

const VariableGradient& NSIntegratedBC::_grad_rho
protectedinherited

Definition at line 46 of file NSIntegratedBC.h.

Referenced by NSEnergyViscousBC::NSEnergyViscousBC().

◆ _grad_rho_E

const VariableGradient& NSIntegratedBC::_grad_rho_E
protectedinherited

Definition at line 50 of file NSIntegratedBC.h.

Referenced by NSEnergyViscousBC::NSEnergyViscousBC().

◆ _grad_rho_u

const VariableGradient& NSIntegratedBC::_grad_rho_u
protectedinherited

Definition at line 47 of file NSIntegratedBC.h.

Referenced by NSEnergyViscousBC::NSEnergyViscousBC().

◆ _grad_rho_v

const VariableGradient& NSIntegratedBC::_grad_rho_v
protectedinherited

Definition at line 48 of file NSIntegratedBC.h.

Referenced by NSEnergyViscousBC::NSEnergyViscousBC().

◆ _grad_rho_w

const VariableGradient& NSIntegratedBC::_grad_rho_w
protectedinherited

Definition at line 49 of file NSIntegratedBC.h.

Referenced by NSEnergyViscousBC::NSEnergyViscousBC().

◆ _pressure_derivs

NSPressureDerivs<NSMomentumInviscidBC> NSMomentumInviscidBC::_pressure_derivs
protected

Definition at line 72 of file NSMomentumInviscidBC.h.

Referenced by pressureQpJacobianHelper().

◆ _rho

const VariableValue& NSIntegratedBC::_rho
protectedinherited

◆ _rho_E

const VariableValue& NSIntegratedBC::_rho_E
protectedinherited

◆ _rho_u

const VariableValue& NSIntegratedBC::_rho_u
protectedinherited

◆ _rho_v

const VariableValue& NSIntegratedBC::_rho_v
protectedinherited

◆ _rho_var_number

unsigned NSIntegratedBC::_rho_var_number
protectedinherited

Definition at line 52 of file NSIntegratedBC.h.

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

◆ _rho_w

const VariableValue& NSIntegratedBC::_rho_w
protectedinherited

◆ _rhoE_var_number

unsigned NSIntegratedBC::_rhoE_var_number
protectedinherited

Definition at line 56 of file NSIntegratedBC.h.

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

◆ _rhou_var_number

unsigned NSIntegratedBC::_rhou_var_number
protectedinherited

Definition at line 53 of file NSIntegratedBC.h.

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

◆ _rhov_var_number

unsigned NSIntegratedBC::_rhov_var_number
protectedinherited

Definition at line 54 of file NSIntegratedBC.h.

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

◆ _rhow_var_number

unsigned NSIntegratedBC::_rhow_var_number
protectedinherited

Definition at line 55 of file NSIntegratedBC.h.

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

◆ _u_vel

const VariableValue& NSIntegratedBC::_u_vel
protectedinherited

◆ _v_vel

const VariableValue& NSIntegratedBC::_v_vel
protectedinherited

◆ _viscous_stress_tensor

const MaterialProperty<RealTensorValue>& NSIntegratedBC::_viscous_stress_tensor
protectedinherited

◆ _w_vel

const VariableValue& NSIntegratedBC::_w_vel
protectedinherited

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