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

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

#include <NSTemperatureDerivs.h>

Public Member Functions

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

Private Attributes

T_data
 

Detailed Description

template<class T>
class NSTemperatureDerivs< T >

Class outside the Moose hierarchy that contains common functionality for computing derivatives of the temperature 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 NSTemperatureDerivs.h.

Constructor & Destructor Documentation

◆ NSTemperatureDerivs()

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

Definition at line 43 of file NSTemperatureDerivs.h.

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

Member Function Documentation

◆ get_grad()

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

The primary interfaces for computing temperature 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 NSTemperatureDerivs.h.

50{
51 // Convenience vars
52 const Real U0 = _data._rho[_data._qp];
53 const Real U1 = _data._rho_u[_data._qp];
54 const Real U2 = _data._rho_v[_data._qp];
55 const Real U3 = _data._rho_w[_data._qp];
56 const Real U4 = _data._rho_et[_data._qp];
57
58 const Real rho2 = U0 * U0;
59 const Real mom2 = U1 * U1 + U2 * U2 + U3 * U3;
60 const Real tmp = -1.0 / rho2 / _data._fp.cv();
61
62 switch (i)
63 {
64 case 0: // dT/d(rho)
65 return (U4 - (mom2 / U0)) * tmp;
66
67 case 1: // dT/d(rho*u)
68 return U1 * tmp;
69
70 case 2: // dT/d(rho*v)
71 return U2 * tmp;
72
73 case 3: // dT/d(rho*w)
74 return U3 * tmp;
75
76 case 4: // dT/d(rho*e)
77 return -U0 * tmp;
78
79 default:
80 mooseError("Should not get here!");
81 break;
82 }
83}
void mooseError(Args &&... args)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

Referenced by NSEnergyThermalFlux::computeJacobianHelper_value(), NSEnergyViscousBC::computeQpJacobian(), and NSEnergyViscousBC::computeQpOffDiagJacobian().

◆ get_hess()

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

Definition at line 87 of file NSTemperatureDerivs.h.

88{
89 // Convenience vars
90 const Real U0 = _data._rho[_data._qp];
91 const Real U1 = _data._rho_u[_data._qp];
92 const Real U2 = _data._rho_v[_data._qp];
93 const Real U3 = _data._rho_w[_data._qp];
94 const Real U4 = _data._rho_et[_data._qp];
95
96 const Real rho2 = U0 * U0;
97 const Real rho3 = rho2 * U0;
98 const Real rho4 = rho3 * U0;
99 const Real mom2 = U1 * U1 + U2 * U2 + U3 * U3;
100
101 const Real cv = _data._fp.cv();
102 const Real tmp = -1.0 / rho2 / cv;
103
104 // Only lower-triangle of matrix is defined, it is symmetric
105 if (i < j)
106 std::swap(i, j);
107
108 // Map (i,j) into row-major storage index, 5 entries per row
109 unsigned idx = 5 * i + j;
110
111 switch (idx)
112 {
113 // Row 0
114 case 0: // rho, rho derivative
115 return 2.0 * U4 / rho3 / cv - 3.0 * mom2 / rho4 / cv;
116
117 // Row 1
118 case 5: // rho*u, rho
119 return 2.0 * U1 / rho3 / cv;
120
121 case 6: // rho*u, rho*u
122 return tmp;
123
124 // Row 2
125 case 10: // rho*v, rho
126 return 2.0 * U2 / rho3 / cv;
127
128 case 12: // rho*v, rho*v
129 return tmp;
130
131 // Row 3
132 case 15: // rho*w, rho
133 return 2.0 * U3 / rho3 / cv;
134
135 case 18: // rho*w, rho*w
136 return tmp;
137
138 // Row 4
139 case 20: // rho*e, rho
140 return tmp;
141
142 case 11:
143 case 16:
144 case 17:
145 case 21:
146 case 22:
147 case 23:
148 case 24:
149 return 0.0;
150
151 default:
152 mooseError("Should not get here!");
153 break;
154 }
155
156 return 0.0;
157}
unsigned int idx(const ElemType type, const unsigned int nx, const unsigned int i, const unsigned int j)

Referenced by NSEnergyThermalFlux::computeJacobianHelper_value(), NSEnergyViscousBC::computeQpJacobian(), and NSEnergyViscousBC::computeQpOffDiagJacobian().

Member Data Documentation

◆ _data

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

Definition at line 39 of file NSTemperatureDerivs.h.


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