42 std::string NonSmoothShockCapture::className =
44 "NonSmooth", NonSmoothShockCapture::create,
45 "NonSmooth artificial diffusion for shock capture.");
47 NonSmoothShockCapture::NonSmoothShockCapture(
62 int nPts =
m_fields[0]->GetTotPoints();
63 int nElements =
m_fields[0]->GetExpSize();
69 m_varConv->GetSoundSpeed(physfield, soundspeed);
70 m_varConv->GetAbsoluteVelocity(physfield, absVelocity);
71 Vmath::Vadd(nPts, absVelocity, 1, soundspeed, 1, Lambda, 1);
79 for (
int e = 0; e < nElements; e++)
81 int physOffset =
m_fields[0]->GetPhys_Offset(e);
82 int nElmtPoints =
m_fields[0]->GetExp(e)->GetTotPoints();
86 LambdaElmt =
Vmath::Vmax(nElmtPoints, tmp = Lambda + physOffset, 1);
90 Vmath::Smul(nElmtPoints, LambdaElmt, tmp = mu + physOffset, 1,
91 tmp = mu + physOffset, 1);
Encapsulates the artificial diffusion used in shock capture.
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array of fields.
LibUtilities::SessionReaderSharedPtr m_session
Session reader.
NekDouble m_mu0
Constant scaling.
VariableConverterSharedPtr m_varConv
Auxiliary object to convert variables.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
virtual void v_GetArtificialViscosity(const Array< OneD, Array< OneD, NekDouble >> &physfield, Array< OneD, NekDouble > &mu) override
std::shared_ptr< SessionReader > SessionReaderSharedPtr
The above copyright notice and this permission notice shall be included.
ArtificialDiffusionFactory & GetArtificialDiffusionFactory()
Declaration of the artificial diffusion factory singleton.
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.
T Vmax(int n, const T *x, const int incx)
Return the maximum element in x – called vmax to avoid conflict with max.