44 RegisterCreatorFunction(
"Smooth",
45 SmoothShockCapture::create,
46 "Smooth artificial diffusion for shock capture.");
54 "Not enough variables for smooth shock capturing; "
55 "make sure you have added eps to variable list.");
63 int nvariables = inarray.num_elements();
64 int npoints =
m_fields[0]->GetNpoints();
68 for (i = 0; i < nvariables; ++i)
84 m_varConv->GetSoundSpeed(inarray, tmp, a_vel);
85 m_varConv->GetAbsoluteVelocity(inarray, u_abs);
95 outarrayDiff[nvariables-1], 1,
96 outarrayDiff[nvariables-1], 1);
98 for (i = 0; i < nvariables; ++i)
108 for (i = 0; i < nvariables; ++i)
115 for (i = 0; i < nvariables; ++i)
120 outarrayForcing[i], 1,
129 int nvariables = physfield.num_elements();
130 int nPts =
m_fields[0]->GetTotPoints();
144 for (
int e = 0; e < mu.num_elements(); e++)
146 if (physfield[nvariables-1][e] <= (Phi0 - DeltaPhi))
150 else if(physfield[nvariables-1][e] >= (Phi0 + DeltaPhi))
154 else if(abs(physfield[nvariables-1][e]-Phi0) < DeltaPhi)
156 mu[e] =
m_mu0/2*(1+sin(M_PI*
157 (physfield[nvariables-1][e]-Phi0)/(2*DeltaPhi)));
166 const int nPts =
m_fields[0]->GetTotPoints();
167 const int nvariables =
m_fields.num_elements();
168 const int nElements =
m_fields[0]->GetExpSize();
182 m_varConv->GetPressure(inarray, pressure);
183 m_varConv->GetSoundSpeed(inarray, pressure, soundspeed);
184 m_varConv->GetAbsoluteVelocity(inarray, absVelocity);
188 Vmath::Vadd(nPts, absVelocity, 1, soundspeed, 1, Lambda, 1);
194 for (
int e = 0; e < nElements; e++)
196 int nQuadPointsElement =
m_fields[0]->GetExp(e)->GetTotPoints();
198 for (
int n = 0; n < nQuadPointsElement; n++)
200 pOrder[n + PointCount] = pOrderElmt[e];
203 Tau[n + PointCount] =
204 1.0 / (
m_C1*pOrder[n + PointCount]*LambdaMax);
206 outarrayForcing[nvariables-1][n + PointCount] =
207 1 / Tau[n + PointCount] * (
m_hFactor * LambdaMax /
208 pOrder[n + PointCount] *
209 SensorKappa[n + PointCount] -
210 inarray[nvariables-1][n + PointCount]);
212 PointCount += nQuadPointsElement;
#define ASSERTL0(condition, msg)
virtual void v_DoArtificialDiffusion(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
T Vmax(int n, const T *x, const int incx)
Return the maximum element in x – called vmax to avoid conflict with max.
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
Encapsulates the artificial diffusion used in shock capture.
SolverUtils::DiffusionSharedPtr m_diffusion
LDG Diffusion operator.
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
ArtificialDiffusionFactory & GetArtificialDiffusionFactory()
Declaration of the artificial diffusion factory singleton.
virtual void v_GetArtificialViscosity(const Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &mu)
void GetForcingTerm(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > outarrayForcing)
NekDouble m_FacL
Parameters.
VariableConverterSharedPtr m_varConv
Auxiliary object to convert variables.
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array of fields.
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.