35 #ifndef NEKTAR_SOLVERS_COMPRESSIBLEFLOWSOLVER_EQUATIONSYSTEMS_NAVIERSTOKESCFE_H
36 #define NEKTAR_SOLVERS_COMPRESSIBLEFLOWSOLVER_EQUATIONSYSTEMS_NAVIERSTOKESCFE_H
134 std::vector<std::string> &variables);
169 template <
class T,
typename =
typename std::enable_if
171 std::is_floating_point<T>::value ||
176 const T& temperature, T& mu, T& thermalCond)
180 thermalCond = tRa * mu;
183 template <
class T,
typename =
typename std::enable_if
185 std::is_floating_point<T>::value ||
190 const T& temperature, T& mu)
195 mu =
m_varConv->GetDynamicViscosity(temperature);
211 template <
class T,
typename =
typename std::enable_if
213 std::is_floating_point<T>::value ||
218 const unsigned short nDim,
219 const unsigned short FluxDirection,
220 const unsigned short DerivDirection,
228 unsigned short nDim_plus_one = nDim + 1;
229 unsigned short FluxDirection_plus_one = FluxDirection + 1;
230 unsigned short DerivDirection_plus_one = DerivDirection + 1;
233 NekDouble one_minus_gammaoPr = 1.0 - gammaoPr;
236 constexpr
NekDouble TwoThird = 2. * OneThird;
237 constexpr
NekDouble FourThird = 4. * OneThird;
240 if (DerivDirection == FluxDirection)
246 T oneOrho = 1.0 / inaverg[0];
248 std::array<T, 3> u = {{0.0, 0.0, 0.0}};
249 std::array<T, 3> u2 = {{0.0, 0.0, 0.0}};
251 for (
unsigned short d = 0; d < nDim; ++d)
253 u[d] = inaverg[d+1] * oneOrho;
259 T E_minus_u2sum = inaverg[nDim_plus_one];
260 E_minus_u2sum *= oneOrho;
261 E_minus_u2sum -= u2sum;
268 T tmp1 = OneThird * u2[FluxDirection] + u2sum;
269 tmp1 += gammaoPr * E_minus_u2sum;
272 T tmp2 = gammaoPr * injumpp[nDim_plus_one] - tmp1;
276 for (
unsigned short d = 0; d < nDim; ++d)
278 unsigned short d_plus_one = d + 1;
280 T outTmpD = injumpp[d_plus_one] - u[d] * injumpp[0];
283 T tmp3 = one_minus_gammaoPr * u[d];
284 outTmpE += tmp3 * injumpp[d_plus_one];
286 if (d == FluxDirection)
288 outTmpD *= FourThird;
289 T tmp4 = OneThird * u[FluxDirection];
290 outTmpE += tmp4 * injumpp[FluxDirection_plus_one];
293 outarray[d_plus_one] = outTmpD;
298 outarray[nDim_plus_one] = outTmpE;
307 T oneOrho = 1.0 / inaverg[0];
309 std::array<T, 3> u, u2;
311 for (
unsigned short d = 0; d < nDim; ++d)
313 unsigned short d_plus_one = d + 1;
314 u[d] = inaverg[d_plus_one] * oneOrho;
319 outarray[d_plus_one] = 0.0;
323 T E_minus_u2sum = inaverg[nDim_plus_one];
324 E_minus_u2sum *= oneOrho;
325 E_minus_u2sum -= u2sum;
332 T tmp1 = u[DerivDirection] * injumpp[0] -
333 injumpp[DerivDirection_plus_one];
335 outarray[FluxDirection_plus_one] = nu * tmp1;
337 tmp1 = injumpp[FluxDirection_plus_one] - u[FluxDirection] * injumpp[0];
338 outarray[DerivDirection_plus_one] = nu * tmp1;
340 tmp1 = OneThird * u[FluxDirection] * u[DerivDirection];
343 T tmp2 = TwoThird * u[FluxDirection] *
344 injumpp[DerivDirection_plus_one];
348 tmp1 = u[DerivDirection] * injumpp[FluxDirection_plus_one] -
350 outarray[nDim_plus_one] = nu * tmp1;
361 template<
bool IS_TRACE>
371 size_t nConvectiveFields = inarray.size();
372 size_t nPts = inarray[0].size();
373 size_t n_nonZero = nConvectiveFields - 1;
376 constexpr
unsigned short nOutMax = 3 - 2 * IS_TRACE;
377 constexpr
unsigned short nVarMax = 5;
378 constexpr
unsigned short nDimMax = 3;
383 size_t sizeVec = (nPts / vec_t::width) * vec_t::width;
386 for (;
p < sizeVec;
p += vec_t::width)
389 alignas(vec_t::alignment) std::array<vec_t, nVarMax> inTmp,
391 alignas(vec_t::alignment) std::array<vec_t, nDimMax> normalTmp;
392 alignas(vec_t::alignment) std::array<vec_t, nVarMax * nOutMax>
396 for (
size_t f = 0; f < nConvectiveFields; ++f)
406 for (
int d = 0; d < nDim; ++d)
408 outArrTmp[f + nConvectiveFields * d] = 0.0;
414 for (
size_t d = 0; d < nDim; ++d)
426 for (
size_t nderiv = 0; nderiv < nDim; ++nderiv)
429 for (
size_t f = 0; f < nConvectiveFields; ++f)
434 for (
size_t d = 0; d < nDim; ++d)
437 inTmp.data(), qfieldsTmp.data(), mu, outTmp.data());
441 for (
size_t f = 0; f < nConvectiveFields; ++f)
443 outArrTmp[f] += normalTmp[d] * outTmp[f];
448 for (
size_t f = 0; f < nConvectiveFields; ++f)
450 outArrTmp[f + nConvectiveFields * d] += outTmp[f];
459 for (
int f = 0; f < nConvectiveFields; ++f)
466 for (
int d = 0; d < nDim; ++d)
468 for (
int f = 0; f < nConvectiveFields; ++f)
470 outArrTmp[f + nConvectiveFields * d].store(
478 for (;
p < nPts; ++
p)
480 std::array<NekDouble, nVarMax> inTmp, qfieldsTmp, outTmp;
481 std::array<NekDouble, nDimMax> normalTmp;
482 std::array<NekDouble, nVarMax * nOutMax> outArrTmp{{}};
484 for (
int f = 0; f < nConvectiveFields; ++f)
486 inTmp[f] = inarray[f][
p];
494 for (
int d = 0; d < nDim; ++d)
496 outArrTmp[f + nConvectiveFields * d] = 0.0;
504 for (
int d = 0; d < nDim; ++d)
506 normalTmp[d] = normal[d][
p];
516 for (
int nderiv = 0; nderiv < nDim; ++nderiv)
519 for (
int f = 0; f < nConvectiveFields; ++f)
521 qfieldsTmp[f] = qfields[nderiv][f][
p];
524 for (
int d = 0; d < nDim; ++d)
527 inTmp.data(), qfieldsTmp.data(), mu, outTmp.data());
531 for (
size_t f = 0; f < nConvectiveFields; ++f)
533 outArrTmp[f] += normalTmp[d] * outTmp[f];
538 for (
size_t f = 0; f < nConvectiveFields; ++f)
540 outArrTmp[f + nConvectiveFields * d] += outTmp[f];
550 for (
int f = 0; f < nConvectiveFields; ++f)
552 outarray[0][f][
p] = outArrTmp[f];
557 for (
int d = 0; d < nDim; ++d)
559 for (
int f = 0; f < nConvectiveFields; ++f)
561 outarray[d][f][
p] = outArrTmp[f + nConvectiveFields * d];
570 if (ArtifDiffFactor.size())
572 n_nonZero = nConvectiveFields;
574 for (
size_t p = 0;
p < nPts; ++
p)
576 for (
int d = 0; d < nDim; ++d)
582 for (
int j = 0; j < nConvectiveFields; ++j)
584 outarray[0][j][
p] += tmp * qfields[d][j][
p];
589 for (
int j = 0; j < nConvectiveFields; ++j)
591 outarray[d][j][
p] += ArtifDiffFactor[
p] * qfields[d][j][
p];
600 for (
int i = 1; i < n_nonZero + 1; ++i)
602 nonZeroIndex[n_nonZero - i] = nConvectiveFields - i;
VariableConverterSharedPtr m_varConv
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
void CalcViscosity(const Array< OneD, const Array< OneD, NekDouble >> &inaverg, Array< OneD, NekDouble > &mu)
virtual ~NavierStokesCFE()
EquationOfStateSharedPtr m_eos
Equation of system for computing temperature.
NavierStokesCFE(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
virtual void v_GetViscousFluxVector(const Array< OneD, const Array< OneD, NekDouble >> &physfield, TensorOfArray3D< NekDouble > &derivatives, TensorOfArray3D< NekDouble > &viscousTensor)
Return the flux vector for the LDG diffusion problem.
void SpecialBndTreat(Array< OneD, Array< OneD, NekDouble > > &consvar)
For very special treatment. For general boundaries it does nothing But for WallViscous and WallAdiaba...
static SolverUtils::EquationSystemSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
void GetViscousSymmtrFluxConservVar(const int nSpaceDim, const Array< OneD, Array< OneD, NekDouble > > &inaverg, const Array< OneD, Array< OneD, NekDouble > > &inarray, TensorOfArray3D< NekDouble > &outarray, Array< OneD, int > &nonZeroIndex, const Array< OneD, Array< OneD, NekDouble > > &normals)
Calculate and return the Symmetric flux in IP method.
Array< OneD, NekDouble > m_thermalConductivity
void GetPhysicalAV(const Array< OneD, const Array< OneD, NekDouble >> &physfield)
Calculate the physical artificial viscosity.
static std::string className
void GetViscousFluxVectorConservVar(const int nDim, const Array< OneD, Array< OneD, NekDouble > > &inarray, const TensorOfArray3D< NekDouble > &qfields, TensorOfArray3D< NekDouble > &outarray, Array< OneD, int > &nonZeroIndex, const Array< OneD, Array< OneD, NekDouble > > &normal, const Array< OneD, NekDouble > &ArtifDiffFactor)
Return the flux vector for the IP diffusion problem, based on conservative variables.
void InitObject_Explicit()
std::string m_physicalSensorType
NekDouble m_thermalConductivityRef
bool m_is_mu_variable
flag to switch between constant viscosity and Sutherland an enum could be added for more options
virtual void v_ExtraFldOutput(std::vector< Array< OneD, NekDouble >> &fieldcoeffs, std::vector< std::string > &variables)
virtual void v_GetViscousFluxVectorDeAlias(const Array< OneD, const Array< OneD, NekDouble >> &physfield, TensorOfArray3D< NekDouble > &derivatives, TensorOfArray3D< NekDouble > &viscousTensor)
Return the flux vector for the LDG diffusion problem.
MultiRegions::ContFieldSharedPtr m_C0ProjectExp
void GetViscosityAndThermalCondFromTemp(const Array< OneD, NekDouble > &temperature, Array< OneD, NekDouble > &mu, Array< OneD, NekDouble > &thermalCond)
Update viscosity todo: add artificial viscosity here.
void C0Smooth(Array< OneD, NekDouble > &field)
Make field C0.
virtual void v_DoDiffusion(const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const Array< OneD, const Array< OneD, NekDouble >> &pFwd, const Array< OneD, const Array< OneD, NekDouble >> &pBwd)
bool m_is_diffIP
flag to switch between IP and LDG an enum could be added for more options
void Ducros(Array< OneD, NekDouble > &field)
Applied Ducros (anti-vorticity) sensor.
void GetViscousFluxVectorConservVar(const int nDim, const Array< OneD, Array< OneD, NekDouble > > &inarray, const TensorOfArray3D< NekDouble > &qfields, TensorOfArray3D< NekDouble > &outarray, Array< OneD, int > &nonZeroIndex=NullInt1DArray, const Array< OneD, Array< OneD, NekDouble >> &normal=NullNekDoubleArrayOfArray, const Array< OneD, NekDouble > &ArtifDiffFactor=NullNekDouble1DArray)
Array< OneD, NekDouble > m_mu
void GetViscousFluxBilinearFormKernel(const unsigned short nDim, const unsigned short FluxDirection, const unsigned short DerivDirection, const T *inaverg, const T *injumpp, const T &mu, T *outarray)
Calculate diffusion flux using the Jacobian form.
void GetViscosityFromTempKernel(const T &temperature, T &mu)
virtual void v_GetFluxPenalty(const Array< OneD, const Array< OneD, NekDouble >> &uFwd, const Array< OneD, const Array< OneD, NekDouble >> &uBwd, Array< OneD, Array< OneD, NekDouble >> &penaltyCoeff)
Return the penalty vector for the LDGNS diffusion problem.
void GetArtificialViscosity(const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, NekDouble > &muav)
Calculate and return the ArtificialViscosity for shock-capturing.
void GetViscosityAndThermalCondFromTempKernel(const T &temperature, T &mu, T &thermalCond)
virtual void v_InitObject()
Initialization object for CompressibleFlowSystem class.
std::string m_ViscosityType
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< ContField > ContFieldSharedPtr
std::shared_ptr< EquationSystem > EquationSystemSharedPtr
A shared pointer to an EquationSystem object.
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
The above copyright notice and this permission notice shall be included.
static Array< OneD, int > NullInt1DArray
static Array< OneD, Array< OneD, NekDouble > > NullNekDoubleArrayOfArray
std::shared_ptr< EquationOfState > EquationOfStateSharedPtr
A shared pointer to an equation of state object.
static Array< OneD, NekDouble > NullNekDouble1DArray
tinysimd::simd< NekDouble > vec_t
static constexpr struct tinysimd::is_not_aligned_t is_not_aligned
typename abi< ScalarType >::type simd