44 VariableConverter::VariableConverter(
46 : m_session(pSession), m_spacedim(spaceDim)
50 m_session->LoadSolverInfo(
"EquationOfState", eosType,
"IdealGas");
82 size_t nPts = physfield[
m_spacedim + 1].size();
88 Vmath::Vvtvp(nPts, physfield[i + 1], 1, physfield[i + 1], 1, energy, 1,
92 Vmath::Vdiv(nPts, energy, 1, physfield[0], 1, energy, 1);
104 int nPts = physfield[0].size();
112 Vmath::Vdiv(nPts, energy, 1, physfield[0], 1, energy, 1);
122 int nPts = physfield[0].size();
132 Vmath::Vadd(nPts, energy, 1, enthalpy, 1, enthalpy, 1);
146 const int nPts = physfield[0].size();
150 Vmath::Vdiv(nPts, physfield[1 + i], 1, physfield[0], 1, velocity[i], 1);
165 const int nPts = physfield[0].size();
167 Vmath::Vmul(nPts, physfield[1], 1, physfield[1], 1, mach, 1);
171 Vmath::Vvtvp(nPts, physfield[1 + i], 1, physfield[1 + i], 1, mach, 1,
175 Vmath::Vdiv(nPts, mach, 1, physfield[0], 1, mach, 1);
176 Vmath::Vdiv(nPts, mach, 1, physfield[0], 1, mach, 1);
179 Vmath::Vdiv(nPts, mach, 1, soundspeed, 1, mach, 1);
198 const int nPts = temperature.size();
200 for (
int i = 0; i < nPts; ++i)
220 const int nPts = temperature.size();
223 for (
int i = 0; i < nPts; ++i)
225 tmp = 0.5* (temperature[i]+3.0*110.0)/
226 (temperature[i]*(temperature[i]+110.0));
227 DmuDT[i] = mu[i]*tmp;
235 const int nPts = physfield[0].size();
251 Vmath::Vvtvp(nPts, velocity[i], 1, velocity[i], 1, Vtot, 1, Vtot, 1);
268 for (
int e = 0; e < field->GetExpSize(); e++)
270 int numModesElement = expOrderElement[e];
271 int nElmtPoints = field->GetExp(e)->GetTotPoints();
272 int physOffset = field->GetPhys_Offset(e);
273 int nElmtCoeffs = field->GetExp(e)->GetNcoeffs();
274 int numCutOff = numModesElement - offset;
276 if (numModesElement <= offset)
279 tmp = Sensor + physOffset, 1);
281 tmp = SensorKappa + physOffset, 1);
287 tmp = physarray[0] + physOffset);
290 field->GetExp(e)->FwdTrans(elmtPhys, elmtCoeffs);
297 field->GetExp(e)->ReduceOrderCoeffs(numCutOff, elmtCoeffs,
301 field->GetExp(e)->BwdTrans(reducedElmtCoeffs, reducedElmtPhys);
308 Vmath::Vsub(nElmtPoints, elmtPhys, 1, reducedElmtPhys, 1, difference,
311 numerator =
Vmath::Dot(nElmtPoints, difference, difference);
312 denominator =
Vmath::Dot(nElmtPoints, elmtPhys, elmtPhys);
317 Vmath::Fill(nElmtPoints, elmtSensor, tmp = Sensor + physOffset, 1);
320 order = max(numModesElement-1, 1);
332 if (elmtSensor < (Skappa-
m_Kappa))
336 else if (elmtSensor > (Skappa +
m_Kappa))
338 elmtSensorKappa = 1.0;
342 elmtSensorKappa = 0.5 *
343 (1 + sin(M_PI * (elmtSensor - Skappa) / (2 *
m_Kappa)));
346 tmp = SensorKappa + physOffset, 1);
360 int nPts = physfield[0].size();
365 for (
int i = 0; i < nPts; ++i)
367 pressure[i] =
m_eos->GetPressure(physfield[0][i], energy[i]);
381 int nPts = physfield[0].size();
386 for (
int i = 0; i < nPts; ++i)
388 temperature[i] =
m_eos->GetTemperature(physfield[0][i], energy[i]);
402 int nPts = physfield[0].size();
407 for (
int i = 0; i < nPts; ++i)
409 soundspeed[i] =
m_eos->GetSoundSpeed(physfield[0][i], energy[i]);
423 int nPts = physfield[0].size();
428 for (
int i = 0; i < nPts; ++i)
430 entropy[i] =
m_eos->GetEntropy(physfield[0][i], energy[i]);
445 int nPts = rho.size();
447 for (
int i = 0; i < nPts; ++i)
466 for (
int i = 0; i < nPts; ++i)
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
EquationOfStateSharedPtr m_eos
void GetDynamicEnergy(const Array< OneD, const Array< OneD, NekDouble >> &physfield, Array< OneD, NekDouble > &energy)
Compute the dynamic energy .
void GetRhoFromPT(const Array< OneD, NekDouble > &pressure, const Array< OneD, NekDouble > &temperature, Array< OneD, NekDouble > &rho)
Compute using the equation of state.
void GetTemperature(const Array< OneD, const Array< OneD, NekDouble >> &physfield, Array< OneD, NekDouble > &temperature)
Compute the temperature using the equation of state.
void GetDmuDT(const Array< OneD, const NekDouble > &temperature, const Array< OneD, const NekDouble > &mu, Array< OneD, NekDouble > &DmuDT)
Compute the dynamic viscosity using the Sutherland's law , where: \mu_star = 1.7894 * 10^-5 Kg / (m *...
void GetEnthalpy(const Array< OneD, const Array< OneD, NekDouble >> &physfield, Array< OneD, NekDouble > &enthalpy)
Compute the specific enthalpy .
void GetEFromRhoP(const Array< OneD, NekDouble > &rho, const Array< OneD, NekDouble > &pressure, Array< OneD, NekDouble > &energy)
Compute using the equation of state.
LibUtilities::SessionReaderSharedPtr m_session
NekDouble m_oneOverT_star
void GetPressure(const Array< OneD, const Array< OneD, NekDouble >> &physfield, Array< OneD, NekDouble > &pressure)
Calculate the pressure using the equation of state.
void GetSoundSpeed(const Array< OneD, const Array< OneD, NekDouble >> &physfield, Array< OneD, NekDouble > &soundspeed)
Compute the sound speed using the equation of state.
void GetAbsoluteVelocity(const Array< OneD, const Array< OneD, NekDouble >> &physfield, Array< OneD, NekDouble > &Vtot)
void GetEntropy(const Array< OneD, const Array< OneD, NekDouble >> &physfield, Array< OneD, NekDouble > &entropy)
Compute the entropy using the equation of state.
void GetVelocityVector(const Array< OneD, Array< OneD, NekDouble >> &physfield, Array< OneD, Array< OneD, NekDouble >> &velocity)
Compute the velocity field given the momentum .
void GetMach(Array< OneD, Array< OneD, NekDouble >> &physfield, Array< OneD, NekDouble > &soundspeed, Array< OneD, NekDouble > &mach)
Compute the mach number .
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)
~VariableConverter()
Destructor for VariableConverter class.
void GetInternalEnergy(const Array< OneD, const Array< OneD, NekDouble >> &physfield, Array< OneD, NekDouble > &energy)
Compute the specific internal energy .
void GetDynamicViscosity(const Array< OneD, const NekDouble > &temperature, Array< OneD, NekDouble > &mu)
Compute the dynamic viscosity using the Sutherland's law , where: \mu_star = 1.7894 * 10^-5 Kg / (m *...
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
static const NekDouble kNekSqrtTol
The above copyright notice and this permission notice shall be included.
EquationOfStateFactory & GetEquationOfStateFactory()
Declaration of the equation of state factory singleton.
void Vsqrt(int n, const T *x, const int incx, T *y, const int incy)
sqrt y = sqrt(x)
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.
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
T Dot(int n, const T *w, const T *x)
vvtvp (vector times vector times vector): z = w*x*y
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.
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.
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.
void Zero(int n, T *x, const int incx)
Zero vector.
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
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.
scalarT< T > sqrt(scalarT< T > in)