45 VariableConverter::VariableConverter(
48 : m_session(pSession),
57 if(
m_session->DefinesParameter(
"thermalConductivity"))
60 "Cannot define both Pr and thermalConductivity.");
62 m_session->LoadParameter (
"thermalConductivity",
100 int nPts = physfield[0].num_elements();
104 Vmath::Vmul(nPts, physfield[1], 1, physfield[1], 1, pressure, 1);
107 Vmath::Vvtvp(nPts, physfield[1+i], 1, physfield[1+i], 1,
108 pressure, 1, pressure, 1);
111 Vmath::Vdiv (nPts, pressure, 1, physfield[0], 1, pressure, 1);
114 pressure, 1, physfield[m_spacedim+1], 1, pressure, 1);
137 int nPts = physfield[0].num_elements();
141 Vmath::Vmul (nPts, velocity[0], 1, physfield[1], 1, pressure, 1);
145 pressure, 1, pressure, 1);
149 pressure, 1, physfield[m_spacedim+1], 1, pressure, 1);
162 int nPts = physfield[0].num_elements();
168 Vmath::Vdiv(nPts, pressure, 1, physfield[0], 1, enthalpy, 1);
170 Vmath::Vadd(nPts, tmp, 1, enthalpy, 1, enthalpy, 1);
181 const Array<OneD, Array<OneD, NekDouble> > &physfield,
182 Array<OneD, Array<OneD, NekDouble> > &velocity)
184 const int nPts = physfield[0].num_elements();
188 Vmath::Vdiv(nPts, physfield[1+i], 1, physfield[0], 1,
201 const Array<OneD,
const Array<OneD, NekDouble> > &physfield,
202 Array<OneD, NekDouble > &pressure,
203 Array<OneD, NekDouble > &temperature)
205 const int nPts = physfield[0].num_elements();
207 Vmath::Vdiv(nPts, pressure, 1, physfield[0], 1, temperature, 1);
219 const Array<OneD, Array<OneD, NekDouble> > &physfield,
220 Array<OneD, NekDouble > &pressure,
221 Array<OneD, NekDouble > &soundspeed)
223 const int nPts = physfield[0].num_elements();
224 Vmath::Vdiv (nPts, pressure, 1, physfield[0], 1, soundspeed, 1);
237 Array<OneD, Array<OneD, NekDouble> > &physfield,
238 Array<OneD, NekDouble > &soundspeed,
239 Array<OneD, NekDouble > &mach)
241 const int nPts = physfield[0].num_elements();
243 Vmath::Vmul(nPts, physfield[1], 1, physfield[1], 1, mach, 1);
247 Vmath::Vvtvp(nPts, physfield[1+i], 1, physfield[1+i], 1,
251 Vmath::Vdiv(nPts, mach, 1, physfield[0], 1, mach, 1);
252 Vmath::Vdiv(nPts, mach, 1, physfield[0], 1, mach, 1);
255 Vmath::Vdiv(nPts, mach, 1, soundspeed, 1, mach, 1);
268 const Array<OneD, const NekDouble> &temperature,
269 Array<OneD, NekDouble> &mu)
271 const int nPts = temperature.num_elements();
276 for (
int i = 0; i < nPts; ++i)
278 ratio = temperature[i] / T_star;
279 mu[i] = mu_star * ratio * sqrt(ratio) *
280 (T_star + 110.0) / (temperature[i] + 110.0);
288 const Array<OneD,
const Array<OneD, NekDouble> > &physfield,
289 const Array<OneD, const NekDouble> &pressure,
290 const Array<OneD, const NekDouble> &temperature,
291 Array<OneD, NekDouble> &entropy)
293 const int nPts = physfield[0].num_elements();
296 for (
int i = 0; i < nPts; ++i)
300 log(pressure[i] /
m_pInf);
305 const Array<OneD,
const Array<OneD, NekDouble> > &inarray,
306 Array<OneD, NekDouble> &Vtot)
308 const int nPts = inarray[0].num_elements();
311 Array<OneD, Array<OneD, NekDouble> > velocity (
m_spacedim);
317 velocity[i] = Array<OneD, NekDouble>(nPts);
336 const Array<OneD,
const Array<OneD, NekDouble> > &physarray,
337 Array<OneD, NekDouble> &Sensor,
338 Array<OneD, NekDouble> &SensorKappa)
340 int e, NumModesElement, nQuadPointsElement;
341 int nTotQuadPoints = field->GetTotPoints();
342 int nElements = field->GetExpSize();
347 Array<OneD,int> ExpOrderElement = field->EvalBasisNumModesMaxPerExp();
349 Array<OneD, NekDouble> SolP (nTotQuadPoints, 0.0);
350 Array<OneD, NekDouble> SolPmOne(nTotQuadPoints, 0.0);
351 Array<OneD, NekDouble> SolNorm (nTotQuadPoints, 0.0);
357 for (e = 0; e < nElements; e++)
359 NumModesElement = ExpOrderElement[e];
360 int nQuadPointsElement = field->GetExp(e)->GetTotPoints();
361 int nCoeffsElement = field->GetExp(e)->GetNcoeffs();
362 int numCutOff = NumModesElement - 1;
367 Array<OneD, NekDouble> SolPElementPhys (nQuadPointsElement, 0.0);
368 Array<OneD, NekDouble> SolPElementCoeffs(nCoeffsElement, 0.0);
370 Array<OneD, NekDouble> SolPmOneElementPhys(nQuadPointsElement, 0.0);
371 Array<OneD, NekDouble> SolPmOneElementCoeffs(nCoeffsElement, 0.0);
375 for (
int i = 0; i < nQuadPointsElement; i++)
377 SolPElementPhys[i] = SolP[CoeffsCount+i];
380 field->GetExp(e)->FwdTrans(SolPElementPhys,
388 field->GetExp(e)->ReduceOrderCoeffs(numCutOff,
390 SolPmOneElementCoeffs);
392 field->GetExp(e)->BwdTrans(SolPmOneElementCoeffs,
393 SolPmOneElementPhys);
395 for (
int i = 0; i < nQuadPointsElement; i++)
397 SolPmOne[CoeffsCount+i] = SolPmOneElementPhys[i];
407 SolPmOneElementPhys, 1,
415 for (
int i = 0; i < nQuadPointsElement; i++)
417 SolPmeanNumerator += SolNorm[i];
418 SolPmeanDenumerator += SolPElementPhys[i];
421 for (
int i = 0; i < nQuadPointsElement; ++i)
423 Sensor[CoeffsCount+i] =
424 sqrt(SolPmeanNumerator / nQuadPointsElement) /
425 sqrt(SolPmeanDenumerator / nQuadPointsElement);
427 Sensor[CoeffsCount+i] = log10(Sensor[CoeffsCount+i]);
429 CoeffsCount += nQuadPointsElement;
434 for (e = 0; e < nElements; e++)
436 NumModesElement = ExpOrderElement[e];
440 nQuadPointsElement = field->GetExp(e)->GetTotPoints();
442 for (
int i = 0; i < nQuadPointsElement; i++)
444 if (Sensor[CoeffsCount+i] <= (Phi0 - DeltaPhi))
446 SensorKappa[CoeffsCount+i] = 0;
448 else if(Sensor[CoeffsCount+i] >= (Phi0 + DeltaPhi))
450 SensorKappa[CoeffsCount+i] = ThetaS;
452 else if(abs(Sensor[CoeffsCount+i]-Phi0) < DeltaPhi)
454 SensorKappa[CoeffsCount+i] =
455 ThetaS / 2 * (1 + sin(M_PI * (Sensor[CoeffsCount+i] -
456 Phi0) / (2 * DeltaPhi)));
460 CoeffsCount += nQuadPointsElement;
#define ASSERTL0(condition, msg)
void Vsqrt(int n, const T *x, const int incx, T *y, const int incy)
sqrt y = sqrt(x)
void Svtvp(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
svtvp (scalar times vector plus vector): z = alpha*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
void GetEnthalpy(const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &pressure, Array< OneD, NekDouble > &enthalpy)
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.
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
LibUtilities::SessionReaderSharedPtr m_session
void GetDynamicViscosity(const Array< OneD, const NekDouble > &temperature, Array< OneD, NekDouble > &mu)
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
void GetAbsoluteVelocity(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, NekDouble > &Vtot)
void GetSoundSpeed(const Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &pressure, Array< OneD, NekDouble > &soundspeed)
~VariableConverter()
Destructor for VariableConverter class.
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
void GetSensor(const MultiRegions::ExpListSharedPtr &field, const Array< OneD, const Array< OneD, NekDouble > > &physarray, Array< OneD, NekDouble > &Sensor, Array< OneD, NekDouble > &SensorKappa)
void GetVelocityVector(const Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &velocity)
void GetEntropy(const Array< OneD, const Array< OneD, NekDouble > > &physfield, const Array< OneD, const NekDouble > &pressure, const Array< OneD, const NekDouble > &temperature, Array< OneD, NekDouble > &entropy)
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.
void GetMach(Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &soundspeed, Array< OneD, NekDouble > &mach)
void GetPressure(const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &pressure)
Calculate the pressure field assuming an ideal gas law.
void GetTemperature(const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &pressure, Array< OneD, NekDouble > &temperature)
void Zero(int n, T *x, const int incx)
Zero vector.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
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 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.
NekDouble m_thermalConductivity