Nektar++
Public Member Functions | Protected Attributes | List of all members
Nektar::VariableConverter Class Reference

#include <VariableConverter.h>

Public Member Functions

 VariableConverter (const LibUtilities::SessionReaderSharedPtr &pSession, const int spaceDim)
 
 ~VariableConverter ()
 Destructor for VariableConverter class. More...
 
void GetInternalEnergy (const Array< OneD, const Array< OneD, NekDouble >> &physfield, Array< OneD, NekDouble > &energy)
 Compute the specific internal energy \( e = (E - rho*V^2/2)/rho \). More...
 
void GetEnthalpy (const Array< OneD, const Array< OneD, NekDouble >> &physfield, Array< OneD, NekDouble > &enthalpy)
 Compute the specific enthalpy \( h = e + p/rho \). More...
 
void GetVelocityVector (const Array< OneD, Array< OneD, NekDouble >> &physfield, Array< OneD, Array< OneD, NekDouble >> &velocity)
 Compute the velocity field \( \mathbf{v} \) given the momentum \( \rho\mathbf{v} \). More...
 
void GetMach (Array< OneD, Array< OneD, NekDouble >> &physfield, Array< OneD, NekDouble > &soundspeed, Array< OneD, NekDouble > &mach)
 Compute the mach number \( M = \| \mathbf{v} \|^2 / c \). More...
 
void GetDynamicViscosity (const Array< OneD, const NekDouble > &temperature, Array< OneD, NekDouble > &mu)
 Compute the dynamic viscosity using the Sutherland's law \( \mu = \mu_star * (T / T_star)^3/2 * (1 + C) / (T / T_star + C) \), where: = 1.7894 * 10^-5 Kg / (m * s) T_star = 288.15 K C = 110. / 288.15. More...
 
void GetAbsoluteVelocity (const Array< OneD, const Array< OneD, NekDouble >> &physfield, Array< OneD, NekDouble > &Vtot)
 
void GetSensor (const MultiRegions::ExpListSharedPtr &field, const Array< OneD, const Array< OneD, NekDouble >> &physarray, Array< OneD, NekDouble > &Sensor, Array< OneD, NekDouble > &SensorKappa, int offset=1)
 
void GetTemperature (const Array< OneD, const Array< OneD, NekDouble >> &physfield, Array< OneD, NekDouble > &temperature)
 Compute the temperature using the equation of state. More...
 
void GetPressure (const Array< OneD, const Array< OneD, NekDouble >> &physfield, Array< OneD, NekDouble > &pressure)
 Calculate the pressure using the equation of state. More...
 
void GetSoundSpeed (const Array< OneD, const Array< OneD, NekDouble >> &physfield, Array< OneD, NekDouble > &soundspeed)
 Compute the sound speed using the equation of state. More...
 
void GetEntropy (const Array< OneD, const Array< OneD, NekDouble >> &physfield, Array< OneD, NekDouble > &entropy)
 Compute the entropy using the equation of state. More...
 
void GetEFromRhoP (const Array< OneD, NekDouble > &rho, const Array< OneD, NekDouble > &pressure, Array< OneD, NekDouble > &energy)
 Compute \( e(rho,p) \) using the equation of state. More...
 
void GetRhoFromPT (const Array< OneD, NekDouble > &pressure, const Array< OneD, NekDouble > &temperature, Array< OneD, NekDouble > &rho)
 Compute \( rho(p,T) \) using the equation of state. More...
 

Protected Attributes

LibUtilities::SessionReaderSharedPtr m_session
 
EquationOfStateSharedPtr m_eos
 
int m_spacedim
 
NekDouble m_pInf
 
NekDouble m_rhoInf
 
NekDouble m_gasConstant
 
NekDouble m_mu
 
NekDouble m_Skappa
 
NekDouble m_Kappa
 

Detailed Description

Definition at line 50 of file VariableConverter.h.

Constructor & Destructor Documentation

◆ VariableConverter()

Nektar::VariableConverter::VariableConverter ( const LibUtilities::SessionReaderSharedPtr pSession,
const int  spaceDim 
)

Definition at line 44 of file VariableConverter.cpp.

References Nektar::LibUtilities::NekFactory< tKey, tBase, tParam >::CreateInstance(), Nektar::GetEquationOfStateFactory(), m_eos, m_gasConstant, m_Kappa, m_mu, m_pInf, m_rhoInf, m_session, and m_Skappa.

46  : m_session(pSession), m_spacedim(spaceDim)
47 {
48  // Create equation of state object
49  std::string eosType;
50  m_session->LoadSolverInfo("EquationOfState", eosType, "IdealGas");
52 
53  // Parameters for dynamic viscosity
54  m_session->LoadParameter("pInf", m_pInf, 101325);
55  m_session->LoadParameter("rhoInf", m_rhoInf, 1.225);
56  m_session->LoadParameter("GasConstant", m_gasConstant, 287.058);
57  m_session->LoadParameter("mu", m_mu, 1.78e-05);
58 
59  // Parameters for sensor
60  m_session->LoadParameter("Skappa", m_Skappa, -1.0);
61  m_session->LoadParameter("Kappa", m_Kappa, 0.25);
62 
63 }
EquationOfStateSharedPtr m_eos
LibUtilities::SessionReaderSharedPtr m_session
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
Definition: NekFactory.hpp:144
EquationOfStateFactory & GetEquationOfStateFactory()
Declaration of the equation of state factory singleton.

◆ ~VariableConverter()

Nektar::VariableConverter::~VariableConverter ( )

Destructor for VariableConverter class.

Definition at line 68 of file VariableConverter.cpp.

69 {
70 }

Member Function Documentation

◆ GetAbsoluteVelocity()

void Nektar::VariableConverter::GetAbsoluteVelocity ( const Array< OneD, const Array< OneD, NekDouble >> &  physfield,
Array< OneD, NekDouble > &  Vtot 
)

Definition at line 195 of file VariableConverter.cpp.

References GetVelocityVector(), m_spacedim, Vmath::Vsqrt(), Vmath::Vvtvp(), and Vmath::Zero().

198 {
199  const int nPts = physfield[0].num_elements();
200 
201  // Getting the velocity vector on the 2D normal space
202  Array<OneD, Array<OneD, NekDouble>> velocity(m_spacedim);
203 
204  Vmath::Zero(Vtot.num_elements(), Vtot, 1);
205 
206  for (int i = 0; i < m_spacedim; ++i)
207  {
208  velocity[i] = Array<OneD, NekDouble>(nPts);
209  }
210 
211  GetVelocityVector(physfield, velocity);
212 
213  for (int i = 0; i < m_spacedim; ++i)
214  {
215  Vmath::Vvtvp(nPts, velocity[i], 1, velocity[i], 1, Vtot, 1, Vtot, 1);
216  }
217 
218  Vmath::Vsqrt(nPts, Vtot, 1, Vtot, 1);
219 }
void Vsqrt(int n, const T *x, const int incx, T *y, const int incy)
sqrt y = sqrt(x)
Definition: Vmath.cpp:411
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
Definition: Vmath.cpp:445
void GetVelocityVector(const Array< OneD, Array< OneD, NekDouble >> &physfield, Array< OneD, Array< OneD, NekDouble >> &velocity)
Compute the velocity field given the momentum .
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:376

◆ GetDynamicViscosity()

void Nektar::VariableConverter::GetDynamicViscosity ( const Array< OneD, const NekDouble > &  temperature,
Array< OneD, NekDouble > &  mu 
)

Compute the dynamic viscosity using the Sutherland's law \( \mu = \mu_star * (T / T_star)^3/2 * (1 + C) / (T / T_star + C) \), where: = 1.7894 * 10^-5 Kg / (m * s) T_star = 288.15 K C = 110. / 288.15.

WARNING, if this routine is modified the same must be done in the FieldConvert utility ProcessWSS.cpp (this class should be restructured).

Parameters
physfieldInput physical field.
muThe resulting dynamic viscosity.

Definition at line 179 of file VariableConverter.cpp.

References m_gasConstant, m_mu, m_pInf, and m_rhoInf.

181 {
182  const int nPts = temperature.num_elements();
183  const NekDouble C = .38175;
184  NekDouble mu_star = m_mu;
185  NekDouble T_star = m_pInf / (m_rhoInf * m_gasConstant);
186  NekDouble ratio;
187 
188  for (int i = 0; i < nPts; ++i)
189  {
190  ratio = temperature[i] / T_star;
191  mu[i] = mu_star * ratio * sqrt(ratio) * (1 + C) / (ratio + C);
192  }
193 }
double NekDouble

◆ GetEFromRhoP()

void Nektar::VariableConverter::GetEFromRhoP ( const Array< OneD, NekDouble > &  rho,
const Array< OneD, NekDouble > &  pressure,
Array< OneD, NekDouble > &  energy 
)

Compute \( e(rho,p) \) using the equation of state.

Parameters
rhoInput density
pressureInput pressure
energyThe resulting internal energy.

Definition at line 405 of file VariableConverter.cpp.

References m_eos.

408 {
409  int nPts = rho.num_elements();
410 
411  for (int i = 0; i < nPts; ++i)
412  {
413  energy[i] = m_eos->GetEFromRhoP(rho[i], pressure[i]);
414  }
415 }
EquationOfStateSharedPtr m_eos

◆ GetEnthalpy()

void Nektar::VariableConverter::GetEnthalpy ( const Array< OneD, const Array< OneD, NekDouble >> &  physfield,
Array< OneD, NekDouble > &  enthalpy 
)

Compute the specific enthalpy \( h = e + p/rho \).

Definition at line 102 of file VariableConverter.cpp.

References GetInternalEnergy(), GetPressure(), CG_Iterations::pressure, Vmath::Vadd(), and Vmath::Vdiv().

105 {
106  int nPts = physfield[0].num_elements();
107  Array<OneD, NekDouble> energy(nPts, 0.0);
108  Array<OneD, NekDouble> pressure(nPts, 0.0);
109 
110  GetInternalEnergy(physfield, energy);
111  GetPressure(physfield, pressure);
112 
113  // Calculate p/rho
114  Vmath::Vdiv(nPts, pressure, 1, physfield[0], 1, enthalpy, 1);
115  // Calculate h = e + p/rho
116  Vmath::Vadd(nPts, energy, 1, enthalpy, 1, enthalpy, 1);
117 }
void GetPressure(const Array< OneD, const Array< OneD, NekDouble >> &physfield, Array< OneD, NekDouble > &pressure)
Calculate the pressure using the equation of state.
void Vdiv(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x/y.
Definition: Vmath.cpp:244
void GetInternalEnergy(const Array< OneD, const Array< OneD, NekDouble >> &physfield, Array< OneD, NekDouble > &energy)
Compute the specific internal energy .
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
Definition: Vmath.cpp:302

◆ GetEntropy()

void Nektar::VariableConverter::GetEntropy ( const Array< OneD, const Array< OneD, NekDouble >> &  physfield,
Array< OneD, NekDouble > &  entropy 
)

Compute the entropy using the equation of state.

Parameters
physfieldInput physical field
soundspeedThe resulting sound speed \( c \).

Definition at line 383 of file VariableConverter.cpp.

References GetInternalEnergy(), and m_eos.

386 {
387  int nPts = physfield[0].num_elements();
388 
389  Array<OneD, NekDouble> energy(nPts);
390  GetInternalEnergy(physfield, energy);
391 
392  for (int i = 0; i < nPts; ++i)
393  {
394  entropy[i] = m_eos->GetEntropy(physfield[0][i], energy[i]);
395  }
396 }
EquationOfStateSharedPtr m_eos
void GetInternalEnergy(const Array< OneD, const Array< OneD, NekDouble >> &physfield, Array< OneD, NekDouble > &energy)
Compute the specific internal energy .

◆ GetInternalEnergy()

void Nektar::VariableConverter::GetInternalEnergy ( const Array< OneD, const Array< OneD, NekDouble >> &  physfield,
Array< OneD, NekDouble > &  energy 
)

Compute the specific internal energy \( e = (E - rho*V^2/2)/rho \).

Definition at line 76 of file VariableConverter.cpp.

References m_spacedim, Vmath::Smul(), Vmath::Vdiv(), Vmath::Vsub(), and Vmath::Vvtvp().

Referenced by GetEnthalpy(), GetEntropy(), GetPressure(), GetSoundSpeed(), and GetTemperature().

79 {
80  int nPts = physfield[0].num_elements();
81  Array<OneD, NekDouble> tmp(nPts, 0.0);
82 
83  // tmp = (rho * u_i)^2
84  for (int i = 0; i < m_spacedim; ++i)
85  {
86  Vmath::Vvtvp(nPts, physfield[i + 1], 1, physfield[i + 1], 1, tmp, 1,
87  tmp, 1);
88  }
89  // Divide by rho and multiply by 0.5 --> tmp = 0.5 * rho * u^2
90  Vmath::Vdiv(nPts, tmp, 1, physfield[0], 1, tmp, 1);
91  Vmath::Smul(nPts, 0.5, tmp, 1, tmp, 1);
92 
93  // Calculate rhoe = E - rho*V^2/2
94  Vmath::Vsub(nPts, physfield[m_spacedim + 1], 1, tmp, 1, energy, 1);
95  // Divide by rho
96  Vmath::Vdiv(nPts, energy, 1, physfield[0], 1, energy, 1);
97 }
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
Definition: Vmath.cpp:445
void Vdiv(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x/y.
Definition: Vmath.cpp:244
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
Definition: Vmath.cpp:216
void Vsub(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Subtract vector z = x-y.
Definition: Vmath.cpp:346

◆ GetMach()

void Nektar::VariableConverter::GetMach ( Array< OneD, Array< OneD, NekDouble >> &  physfield,
Array< OneD, NekDouble > &  soundspeed,
Array< OneD, NekDouble > &  mach 
)

Compute the mach number \( M = \| \mathbf{v} \|^2 / c \).

Parameters
physfieldInput physical field.
soundfieldThe speed of sound corresponding to physfield.
machThe resulting mach number \( M \).

Definition at line 145 of file VariableConverter.cpp.

References m_spacedim, Vmath::Vdiv(), Vmath::Vmul(), Vmath::Vsqrt(), and Vmath::Vvtvp().

148 {
149  const int nPts = physfield[0].num_elements();
150 
151  Vmath::Vmul(nPts, physfield[1], 1, physfield[1], 1, mach, 1);
152 
153  for (int i = 1; i < m_spacedim; ++i)
154  {
155  Vmath::Vvtvp(nPts, physfield[1 + i], 1, physfield[1 + i], 1, mach, 1,
156  mach, 1);
157  }
158 
159  Vmath::Vdiv(nPts, mach, 1, physfield[0], 1, mach, 1);
160  Vmath::Vdiv(nPts, mach, 1, physfield[0], 1, mach, 1);
161  Vmath::Vsqrt(nPts, mach, 1, mach, 1);
162 
163  Vmath::Vdiv(nPts, mach, 1, soundspeed, 1, mach, 1);
164 }
void Vsqrt(int n, const T *x, const int incx, T *y, const int incy)
sqrt y = sqrt(x)
Definition: Vmath.cpp:411
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
Definition: Vmath.cpp:445
void Vdiv(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x/y.
Definition: Vmath.cpp:244
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
Definition: Vmath.cpp:186

◆ GetPressure()

void Nektar::VariableConverter::GetPressure ( const Array< OneD, const Array< OneD, NekDouble >> &  physfield,
Array< OneD, NekDouble > &  pressure 
)

Calculate the pressure using the equation of state.

Parameters
physfieldInput momentum.
pressureComputed pressure field.

Definition at line 320 of file VariableConverter.cpp.

References GetInternalEnergy(), and m_eos.

Referenced by GetEnthalpy().

323 {
324  int nPts = physfield[0].num_elements();
325 
326  Array<OneD, NekDouble> energy(nPts);
327  GetInternalEnergy(physfield, energy);
328 
329  for (int i = 0; i < nPts; ++i)
330  {
331  pressure[i] = m_eos->GetPressure(physfield[0][i], energy[i]);
332  }
333 }
EquationOfStateSharedPtr m_eos
void GetInternalEnergy(const Array< OneD, const Array< OneD, NekDouble >> &physfield, Array< OneD, NekDouble > &energy)
Compute the specific internal energy .

◆ GetRhoFromPT()

void Nektar::VariableConverter::GetRhoFromPT ( const Array< OneD, NekDouble > &  pressure,
const Array< OneD, NekDouble > &  temperature,
Array< OneD, NekDouble > &  rho 
)

Compute \( rho(p,T) \) using the equation of state.

Parameters
pressureInput pressure
temperatureInput temperature
rhoThe resulting density

Definition at line 424 of file VariableConverter.cpp.

References m_eos.

427 {
428  int nPts = pressure.num_elements();
429 
430  for (int i = 0; i < nPts; ++i)
431  {
432  rho[i] = m_eos->GetRhoFromPT(pressure[i], temperature[i]);
433  }
434 }
EquationOfStateSharedPtr m_eos

◆ GetSensor()

void Nektar::VariableConverter::GetSensor ( const MultiRegions::ExpListSharedPtr field,
const Array< OneD, const Array< OneD, NekDouble >> &  physarray,
Array< OneD, NekDouble > &  Sensor,
Array< OneD, NekDouble > &  SensorKappa,
int  offset = 1 
)

Definition at line 221 of file VariableConverter.cpp.

References Vmath::Dot(), Vmath::Fill(), Nektar::NekConstants::kNekSqrtTol, m_Kappa, m_Skappa, and Vmath::Vsub().

226 {
227  NekDouble Skappa;
228  NekDouble order;
229  Array<OneD, NekDouble> tmp;
230  Array<OneD, int> expOrderElement = field->EvalBasisNumModesMaxPerExp();
231 
232  for (int e = 0; e < field->GetExpSize(); e++)
233  {
234  int numModesElement = expOrderElement[e];
235  int nElmtPoints = field->GetExp(e)->GetTotPoints();
236  int physOffset = field->GetPhys_Offset(e);
237  int nElmtCoeffs = field->GetExp(e)->GetNcoeffs();
238  int numCutOff = numModesElement - offset;
239 
240  if (numModesElement <= offset)
241  {
242  Vmath::Fill(nElmtPoints, 0.0,
243  tmp = Sensor + physOffset, 1);
244  Vmath::Fill(nElmtPoints, 0.0,
245  tmp = SensorKappa + physOffset, 1);
246  continue;
247  }
248 
249  // create vector to save the solution points per element at P = p;
250  Array<OneD, NekDouble> elmtPhys(nElmtPoints,
251  tmp = physarray[0] + physOffset);
252  // Compute coefficients
253  Array<OneD, NekDouble> elmtCoeffs(nElmtCoeffs, 0.0);
254  field->GetExp(e)->FwdTrans(elmtPhys, elmtCoeffs);
255 
256  // ReduceOrderCoeffs reduces the polynomial order of the solution
257  // that is represented by the coeffs given as an inarray. This is
258  // done by projecting the higher order solution onto the orthogonal
259  // basis and padding the higher order coefficients with zeros.
260  Array<OneD, NekDouble> reducedElmtCoeffs(nElmtCoeffs, 0.0);
261  field->GetExp(e)->ReduceOrderCoeffs(numCutOff, elmtCoeffs,
262  reducedElmtCoeffs);
263 
264  Array<OneD, NekDouble> reducedElmtPhys(nElmtPoints, 0.0);
265  field->GetExp(e)->BwdTrans(reducedElmtCoeffs, reducedElmtPhys);
266 
267  NekDouble numerator = 0.0;
268  NekDouble denominator = 0.0;
269 
270  // Determining the norm of the numerator of the Sensor
271  Array<OneD, NekDouble> difference(nElmtPoints, 0.0);
272  Vmath::Vsub(nElmtPoints, elmtPhys, 1, reducedElmtPhys, 1, difference,
273  1);
274 
275  numerator = Vmath::Dot(nElmtPoints, difference, difference);
276  denominator = Vmath::Dot(nElmtPoints, elmtPhys, elmtPhys);
277 
278  NekDouble elmtSensor = sqrt(numerator / denominator);
279  elmtSensor = log10(max(elmtSensor, NekConstants::kNekSqrtTol));
280 
281  Vmath::Fill(nElmtPoints, elmtSensor, tmp = Sensor + physOffset, 1);
282 
283  // Compute reference value for sensor
284  order = max(numModesElement-1, 1);
285  if (order > 0 )
286  {
287  Skappa = m_Skappa - 4.25 * log10(static_cast<NekDouble>(order));
288  }
289  else
290  {
291  Skappa = 0.0;
292  }
293 
294  // Compute artificial viscosity
295  NekDouble elmtSensorKappa;
296  if (elmtSensor < (Skappa-m_Kappa))
297  {
298  elmtSensorKappa = 0;
299  }
300  else if (elmtSensor > (Skappa + m_Kappa))
301  {
302  elmtSensorKappa = 1.0;
303  }
304  else
305  {
306  elmtSensorKappa = 0.5 *
307  (1 + sin(M_PI * (elmtSensor - Skappa) / (2 * m_Kappa)));
308  }
309  Vmath::Fill(nElmtPoints, elmtSensorKappa,
310  tmp = SensorKappa + physOffset, 1);
311  }
312 }
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
Definition: Vmath.cpp:45
static const NekDouble kNekSqrtTol
double NekDouble
T Dot(int n, const T *w, const T *x)
vvtvp (vector times vector times vector): z = w*x*y
Definition: Vmath.cpp:917
void Vsub(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Subtract vector z = x-y.
Definition: Vmath.cpp:346

◆ GetSoundSpeed()

void Nektar::VariableConverter::GetSoundSpeed ( const Array< OneD, const Array< OneD, NekDouble >> &  physfield,
Array< OneD, NekDouble > &  soundspeed 
)

Compute the sound speed using the equation of state.

Parameters
physfieldInput physical field
soundspeedThe resulting sound speed \( c \).

Definition at line 362 of file VariableConverter.cpp.

References GetInternalEnergy(), and m_eos.

365 {
366  int nPts = physfield[0].num_elements();
367 
368  Array<OneD, NekDouble> energy(nPts);
369  GetInternalEnergy(physfield, energy);
370 
371  for (int i = 0; i < nPts; ++i)
372  {
373  soundspeed[i] = m_eos->GetSoundSpeed(physfield[0][i], energy[i]);
374  }
375 }
EquationOfStateSharedPtr m_eos
void GetInternalEnergy(const Array< OneD, const Array< OneD, NekDouble >> &physfield, Array< OneD, NekDouble > &energy)
Compute the specific internal energy .

◆ GetTemperature()

void Nektar::VariableConverter::GetTemperature ( const Array< OneD, const Array< OneD, NekDouble >> &  physfield,
Array< OneD, NekDouble > &  temperature 
)

Compute the temperature using the equation of state.

Parameters
physfieldInput physical field.
temperatureThe resulting temperature \( T \).

Definition at line 341 of file VariableConverter.cpp.

References GetInternalEnergy(), and m_eos.

344 {
345  int nPts = physfield[0].num_elements();
346 
347  Array<OneD, NekDouble> energy(nPts);
348  GetInternalEnergy(physfield, energy);
349 
350  for (int i = 0; i < nPts; ++i)
351  {
352  temperature[i] = m_eos->GetTemperature(physfield[0][i], energy[i]);
353  }
354 }
EquationOfStateSharedPtr m_eos
void GetInternalEnergy(const Array< OneD, const Array< OneD, NekDouble >> &physfield, Array< OneD, NekDouble > &energy)
Compute the specific internal energy .

◆ GetVelocityVector()

void Nektar::VariableConverter::GetVelocityVector ( const Array< OneD, Array< OneD, NekDouble >> &  physfield,
Array< OneD, Array< OneD, NekDouble >> &  velocity 
)

Compute the velocity field \( \mathbf{v} \) given the momentum \( \rho\mathbf{v} \).

Parameters
physfieldMomentum field.
velocityVelocity field.

Definition at line 126 of file VariableConverter.cpp.

References m_spacedim, and Vmath::Vdiv().

Referenced by GetAbsoluteVelocity().

129 {
130  const int nPts = physfield[0].num_elements();
131 
132  for (int i = 0; i < m_spacedim; ++i)
133  {
134  Vmath::Vdiv(nPts, physfield[1 + i], 1, physfield[0], 1, velocity[i], 1);
135  }
136 }
void Vdiv(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x/y.
Definition: Vmath.cpp:244

Member Data Documentation

◆ m_eos

EquationOfStateSharedPtr Nektar::VariableConverter::m_eos
protected

◆ m_gasConstant

NekDouble Nektar::VariableConverter::m_gasConstant
protected

Definition at line 103 of file VariableConverter.h.

Referenced by GetDynamicViscosity(), and VariableConverter().

◆ m_Kappa

NekDouble Nektar::VariableConverter::m_Kappa
protected

Definition at line 106 of file VariableConverter.h.

Referenced by GetSensor(), and VariableConverter().

◆ m_mu

NekDouble Nektar::VariableConverter::m_mu
protected

Definition at line 104 of file VariableConverter.h.

Referenced by GetDynamicViscosity(), and VariableConverter().

◆ m_pInf

NekDouble Nektar::VariableConverter::m_pInf
protected

Definition at line 101 of file VariableConverter.h.

Referenced by GetDynamicViscosity(), and VariableConverter().

◆ m_rhoInf

NekDouble Nektar::VariableConverter::m_rhoInf
protected

Definition at line 102 of file VariableConverter.h.

Referenced by GetDynamicViscosity(), and VariableConverter().

◆ m_session

LibUtilities::SessionReaderSharedPtr Nektar::VariableConverter::m_session
protected

Definition at line 98 of file VariableConverter.h.

Referenced by VariableConverter().

◆ m_Skappa

NekDouble Nektar::VariableConverter::m_Skappa
protected

Definition at line 105 of file VariableConverter.h.

Referenced by GetSensor(), and VariableConverter().

◆ m_spacedim

int Nektar::VariableConverter::m_spacedim
protected