https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
NSPressureDerivs< T > Class Template Reference

Class outside the Moose hierarchy that contains common functionality for computing derivatives of the pressure variable. More...

#include <NSPressureDerivs.h>

Public Member Functions

 NSPressureDerivs (T &x)
 
Real get_grad (unsigned i)
 The primary interfaces for computing pressure derivatives.
 
Real get_hess (unsigned i, unsigned j)
 

Private Attributes

T_data
 

Detailed Description

template<class T>
class NSPressureDerivs< T >

Class outside the Moose hierarchy that contains common functionality for computing derivatives of the pressure variable.

This class is templated so that it can be used by either a Kernel object or a BC object.

Definition at line 24 of file NSPressureDerivs.h.

Constructor & Destructor Documentation

◆ NSPressureDerivs()

template<class T >
NSPressureDerivs< T >::NSPressureDerivs ( T x)

Definition at line 43 of file NSPressureDerivs.h.

43 : _data(x)
44{
45}
const std::vector< double > x

Member Function Documentation

◆ get_grad()

template<class T >
Real NSPressureDerivs< T >::get_grad ( unsigned  i)

The primary interfaces for computing pressure derivatives.

Requires access to protected values from the _data reference. The indices input to these functions are in terms of the "canonical" variable numbering.

Definition at line 49 of file NSPressureDerivs.h.

50{
51 // Convenience vars
52 const Real u = _data._u_vel[_data._qp];
53 const Real v = _data._v_vel[_data._qp];
54 const Real w = _data._w_vel[_data._qp];
55
56 const Real vel2 = (u * u + v * v + w * w);
57 const Real gam = _data._fp.gamma();
58
59 switch (i)
60 {
61 case 0: // dP/d(rho)
62 return 0.5 * (gam - 1.0) * vel2;
63
64 case 1: // dP/d(rho*u)
65 return (1.0 - gam) * u;
66
67 case 2: // dP/d(rho*v)
68 return (1.0 - gam) * v;
69
70 case 3: // dP/d(rho*w)
71 return (1.0 - gam) * w;
72
73 case 4: // dP/d(rho*e)
74 return gam - 1.;
75
76 default:
77 mooseError("Should not get here!");
78 break;
79 }
80}
const double v
void mooseError(Args &&... args)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

Referenced by NSPressureNeumannBC::computeJacobianHelper(), NSMomentumInviscidBC::pressureQpJacobianHelper(), NSMomentumInviscidFluxWithGradP::pressureQpJacobianHelper(), and NSEnergyInviscidBC::qpJacobianTermC().

◆ get_hess()

template<class T >
Real NSPressureDerivs< T >::get_hess ( unsigned  i,
unsigned  j 
)

Definition at line 84 of file NSPressureDerivs.h.

85{
86 // Convenience variables
87 const Real U0 = _data._rho[_data._qp];
88
89 const Real u = _data._u_vel[_data._qp];
90 const Real v = _data._v_vel[_data._qp];
91 const Real w = _data._w_vel[_data._qp];
92 const Real vel2 = (u * u + v * v + w * w);
93
94 // Save some typing...
95 const Real gam = _data._fp.gamma();
96
97 // A frequently-used variable
98 const Real tmp = (1.0 - gam) / U0;
99
100 // Only lower-triangle of matrix is defined, it is symmetric
101 if (i < j)
102 std::swap(i, j);
103
104 // Map (i,j) into row-major storage index, 5 entries per row
105 const unsigned int idx = 5 * i + j;
106
107 switch (idx)
108 {
109 // Row 0
110 case 0: // rho, rho derivative
111 return tmp * vel2;
112
113 // Row 1
114 case 5: // rho*u, rho
115 return -tmp * u;
116
117 case 6: // rho*u, rho*u
118 return tmp;
119
120 // Row 2
121 case 10: // rho*v, rho
122 return -tmp * v;
123
124 case 12: // rho*v, rho*v
125 return tmp;
126
127 // Row 3
128 case 15: // rho*w, rho
129 return -tmp * w;
130
131 case 18: // rho*w, rho*w
132 return tmp;
133
134 case 11:
135 case 16:
136 case 17:
137 case 20:
138 case 21:
139 case 22:
140 case 23:
141 case 24:
142 return 0.;
143
144 default:
145 mooseError("Should not get here!");
146 break;
147 }
148
149 return 0.0;
150}
unsigned int idx(const ElemType type, const unsigned int nx, const unsigned int i, const unsigned int j)

Referenced by NSMomentumInviscidFluxWithGradP::pressureQpJacobianHelper().

Member Data Documentation

◆ _data

template<class T >
T& NSPressureDerivs< T >::_data
private

Definition at line 39 of file NSPressureDerivs.h.


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