28 const int dof = el.
GetDof();
30#ifdef MFEM_THREAD_SAFE
60 const int order = el.
GetOrder()*2 + IntOrderOffset;
78 max_char_speed = std::max(mcs, max_char_speed);
90 const int dof1 = el1.
GetDof();
91 const int dof2 = el2.
GetDof();
93#ifdef MFEM_THREAD_SAFE
129 const int order = 2*std::max(el1.
GetOrder(), el2.
GetOrder()) + IntOrderOffset;
160 const real_t speed = rsolver.
Eval(state1, state2, nor, Tr, fluxN);
163 max_char_speed = std::max(speed, max_char_speed);
173 const int IntOrderOffset)
176 fluxFunction(rsolver.GetFluxFunction()),
177 IntOrderOffset(IntOrderOffset),
178 num_equations(fluxFunction.num_equations)
180#ifndef MFEM_THREAD_SAFE
195#ifdef MFEM_THREAD_SAFE
199 flux.
Mult(normal, FUdotN);
208#ifdef MFEM_THREAD_SAFE
214 const real_t maxE = std::max(speed1, speed2);
216 const real_t scaledMaxE = maxE*std::sqrt(nor*nor);
217 for (
int i=0; i<state1.
Size(); i++)
219 flux[i] = 0.5*(scaledMaxE*(state1[i] - state2[i]) + (
fluxN1[i] +
fluxN2[i]));
221 return std::max(speed1, speed2);
229#ifdef MFEM_THREAD_SAFE
243 return std::fabs(U(0));
251 const real_t height = U(0);
254 const real_t energy = 0.5 * g * (height * height);
256 MFEM_ASSERT(height >= 0,
"Negative Height");
258 for (
int d = 0; d <
dim; d++)
261 for (
int i = 0; i <
dim; i++)
263 FU(1 + i, d) = h_vel(i) * h_vel(d) / height;
265 FU(1 + d, d) += energy;
268 const real_t sound = std::sqrt(g * height);
269 const real_t vel = std::sqrt(h_vel * h_vel) / height;
280 const real_t height = U(0);
283 const real_t energy = 0.5 * g * (height * height);
285 MFEM_ASSERT(height >= 0,
"Negative Height");
286 FUdotN(0) = h_vel * normal;
287 const real_t normal_vel = FUdotN(0) / height;
288 for (
int i = 0; i <
dim; i++)
290 FUdotN(1 + i) = normal_vel * h_vel(i) + energy * normal(i);
293 const real_t sound = std::sqrt(g * height);
294 const real_t vel = std::fabs(normal_vel) / std::sqrt(normal*normal);
305 const real_t density = U(0);
308 const real_t kinetic_energy = 0.5 * (momentum*momentum) / density;
310 const real_t pressure = (specific_heat_ratio - 1.0) *
311 (energy - kinetic_energy);
314 MFEM_ASSERT(density >= 0,
"Negative Density");
315 MFEM_ASSERT(pressure >= 0,
"Negative Pressure");
316 MFEM_ASSERT(energy >= 0,
"Negative Energy");
319 for (
int d = 0; d <
dim; d++)
321 FU(0, d) = momentum(d);
322 for (
int i = 0; i <
dim; i++)
325 FU(1 + i, d) = momentum(i) * momentum(d) / density;
328 FU(1 + d, d) += pressure;
331 const real_t H = (energy + pressure) / density;
332 for (
int d = 0; d <
dim; d++)
335 FU(1 +
dim, d) = momentum(d) * H;
341 const real_t sound = std::sqrt(specific_heat_ratio * pressure / density);
343 const real_t speed = std::sqrt(2.0 * kinetic_energy / density);
345 return speed + sound;
355 const real_t density = x(0);
358 const real_t kinetic_energy = 0.5 * (momentum*momentum) / density;
360 const real_t pressure = (specific_heat_ratio - 1.0) *
361 (energy - kinetic_energy);
364 MFEM_ASSERT(density >= 0,
"Negative Density");
365 MFEM_ASSERT(pressure >= 0,
"Negative Pressure");
366 MFEM_ASSERT(energy >= 0,
"Negative Energy");
370 FUdotN(0) = momentum * normal;
372 const real_t normal_velocity = FUdotN(0) / density;
373 for (
int d = 0; d <
dim; d++)
376 FUdotN(1 + d) = normal_velocity * momentum(d) + pressure * normal(d);
379 FUdotN(1 +
dim) = normal_velocity * (energy + pressure);
384 const real_t sound = std::sqrt(specific_heat_ratio * pressure / density);
386 const real_t speed = std::fabs(normal_velocity) / std::sqrt(normal*normal);
388 return speed + sound;
real_t ComputeFlux(const Vector &state, ElementTransformation &Tr, DenseMatrix &flux) const override
Compute F(u)
real_t ComputeFlux(const Vector &state, ElementTransformation &Tr, DenseMatrix &flux) const override
Compute F(u)
Data type dense matrix using column-major storage.
void Mult(const real_t *x, real_t *y) const
Matrix vector multiplication.
void MultTranspose(const real_t *x, real_t *y) const
Multiply a vector with the transpose matrix.
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
real_t ComputeFlux(const Vector &state, ElementTransformation &Tr, DenseMatrix &flux) const override
Compute F(ρ, ρu, E)
real_t ComputeFluxDotN(const Vector &x, const Vector &normal, FaceElementTransformations &Tr, Vector &fluxN) const override
Compute normal flux, F(ρ, ρu, E)n.
Abstract class for all finite elements.
int GetOrder() const
Returns the order of the finite element. In the case of anisotropic orders, returns the maximum order...
void CalcPhysDShape(ElementTransformation &Trans, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in physical space at the poi...
int GetDim() const
Returns the reference space dimension for the finite element.
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const =0
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
int GetDof() const
Returns the number of degrees of freedom in the finite element.
virtual real_t ComputeFlux(const Vector &state, ElementTransformation &Tr, DenseMatrix &flux) const =0
Compute flux F(u, x) for given state u and physical point x.
virtual real_t ComputeFluxDotN(const Vector &state, const Vector &normal, FaceElementTransformations &Tr, Vector &fluxDotN) const
Compute normal flux. Optionally overloaded in the derived class to avoid creating full dense matrix f...
Class for integration point with weight.
Class for an integration rule - an Array of IntegrationPoint.
int GetNPoints() const
Returns the number of the points in the integration rule.
IntegrationPoint & IntPoint(int i)
Returns a reference to the i-th integration point.
const IntegrationRule & Get(int GeomType, int Order)
Returns an integration rule for given GeomType and Order.
Abstract class for numerical flux for a system of hyperbolic conservation laws on a face with states,...
virtual real_t Eval(const Vector &state1, const Vector &state2, const Vector &nor, FaceElementTransformations &Tr, Vector &flux) const =0
Evaluates numerical flux for given states and fluxes. Must be overloaded in a derived class.
const FluxFunction & fluxFunction
real_t Eval(const Vector &state1, const Vector &state2, const Vector &nor, FaceElementTransformations &Tr, Vector &flux) const override
hat(F)n = ½(F(u⁺,x)n + F(u⁻,x)n) - ½λ(u⁺ - u⁻)
real_t ComputeFluxDotN(const Vector &state, const Vector &normal, FaceElementTransformations &Tr, Vector &fluxN) const override
Compute normal flux, F(h, hu)
real_t ComputeFlux(const Vector &state, ElementTransformation &Tr, DenseMatrix &flux) const override
Compute F(h, hu)
int GetVDim()
Returns dimension of the vector.
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)=0
Evaluate the vector coefficient in the element described by T at the point ip, storing the result in ...
real_t Norml2() const
Returns the l2 norm of the vector.
int Size() const
Returns the size of the vector.
void SetSize(int s)
Resize the vector to size s.
real_t * GetData() const
Return a pointer to the beginning of the Vector data.
void CalcOrtho(const DenseMatrix &J, Vector &n)
void AddMult_a_ABt(real_t a, const DenseMatrix &A, const DenseMatrix &B, DenseMatrix &ABt)
ABt += a * A * B^t.
void MultVWt(const Vector &v, const Vector &w, DenseMatrix &VWt)
void AddMult_a_VWt(const real_t a, const Vector &v, const Vector &w, DenseMatrix &VWt)
VWt += a * v w^t.
IntegrationRules IntRules(0, Quadrature1D::GaussLegendre)
A global object with all integration rules (defined in intrules.cpp)
void vel(const Vector &x, real_t t, Vector &u)