84 dim(vfes_.GetFE(0)->GetDim()),
88 Me_inv(vfes.GetFE(0)->GetDof(), vfes.GetFE(0)->GetDof(), vfes.GetNE()),
99 for (
int i = 0; i < vfes.
GetNE(); i++)
137 for (
int i = 0; i < vfes.
GetNE(); i++)
154 const double den = state(0);
156 const double den_energy = state(1 + dim);
159 for (
int d = 0; d <
dim; d++) { den_vel2 += den_vel(d) * den_vel(d); }
168 const double den = state(0);
170 const double den_energy = state(1 + dim);
176 for (
int d = 0; d <
dim; d++)
178 flux(0, d) = den_vel(d);
179 for (
int i = 0; i <
dim; i++)
181 flux(1+i, d) = den_vel(i) * den_vel(d) / den;
183 flux(1+d, d) += pres;
186 const double H = (den_energy + pres) / den;
187 for (
int d = 0; d <
dim; d++)
189 flux(1+dim, d) = den_vel(d) * H;
199 const double den = state(0);
201 const double den_energy = state(1 + dim);
208 for (
int d = 0; d <
dim; d++) { den_velN += den_vel(d) * nor(d); }
211 for (
int d = 0; d <
dim; d++)
213 fluxN(1+d) = den_velN * den_vel(d) / den + pres * nor(d);
216 const double H = (den_energy + pres) / den;
217 fluxN(1 + dim) = den_velN * H;
223 const double den = state(0);
227 for (
int d = 0; d <
dim; d++) { den_vel2 += den_vel(d) * den_vel(d); }
232 const double vel = sqrt(den_vel2 / den);
240 const int flux_dof = flux_.
SizeI();
241 const int flux_dim = flux_.
SizeJ();
243 for (
int i = 0; i < flux_dof; i++)
245 for (
int k = 0; k <
num_equation; k++) { state(k) = x_(i, k); }
248 for (
int d = 0; d < flux_dim; d++)
252 flux_(i, d, k) = f(k, d);
265 flux2(num_equation) { }
279 const double maxE = max(maxE1, maxE2);
285 for (
int i = 0; i <
dim; i++)
287 normag += nor(i) * nor(i);
289 normag = sqrt(normag);
293 flux(i) = 0.5 * (flux1(i) + flux2(i))
294 - 0.5 * maxE * (state2(i) - state1(i)) * normag;
303 funval1(num_equation),
304 funval2(num_equation),
306 fluxN(num_equation) { }
314 const int dof1 = el1.
GetDof();
315 const int dof2 = el2.
GetDof();
320 elvect.
SetSize((dof1 + dof2) * num_equation);
340 if (el1.
Space() == FunctionSpace::Pk)
357 elfun1_mat.MultTranspose(shape1, funval1);
358 elfun2_mat.MultTranspose(shape2, funval2);
362 const double mcs = rsolver.
Eval(funval1, funval2, nor, fluxN);
370 for (
int s = 0;
s < dof1;
s++)
372 elvect1_mat(
s, k) -= fluxN(k) * shape1(
s);
374 for (
int s = 0;
s < dof2;
s++)
376 elvect2_mat(
s, k) += fluxN(k) * shape2(
s);
385 const double den = state(0);
387 const double den_energy = state(1 + dim);
391 cout <<
"Negative density: ";
392 for (
int i = 0; i < state.
Size(); i++)
394 cout << state(i) <<
" ";
401 cout <<
"Negative energy: ";
402 for (
int i = 0; i < state.
Size(); i++)
404 cout << state(i) <<
" ";
411 for (
int i = 0; i <
dim; i++) { den_vel2 += den_vel(i) * den_vel(i); }
418 cout <<
"Negative pressure: " << pres <<
", state: ";
419 for (
int i = 0; i < state.
Size(); i++)
421 cout << state(i) <<
" ";
432 MFEM_ASSERT(x.
Size() == 2,
"");
434 double radius = 0, Minf = 0, beta = 0;
452 "Options are: 1 - fast vortex, 2 - slow vortex");
455 const double xc = 0.0, yc = 0.0;
458 const double vel_inf = 1.;
459 const double den_inf = 1.;
464 const double temp_inf = pres_inf / (den_inf *
gas_constant);
467 r2rad += (x(0) - xc) * (x(0) - xc);
468 r2rad += (x(1) - yc) * (x(1) - yc);
469 r2rad /= (radius *
radius);
473 const double velX = vel_inf * (1 - beta * (x(1) - yc) / radius * exp(
475 const double velY = vel_inf * beta * (x(0) - xc) / radius * exp(-0.5 * r2rad);
476 const double vel2 = velX * velX + velY * velY;
479 const double temp = temp_inf - 0.5 * (vel_inf * beta) *
480 (vel_inf * beta) / specific_heat * exp(-r2rad);
482 const double den = den_inf * pow(temp/temp_inf, shrinv1);
484 const double energy = shrinv1 * pres / den + 0.5 * vel2;
int GetNPoints() const
Returns the number of the points in the integration rule.
Abstract class for all finite elements.
void SetSubVector(const Array< int > &dofs, const double value)
Set the entries listed in dofs to the given value.
int GetNDofs() const
Returns number of degrees of freedom.
Class for an integration rule - an Array of IntegrationPoint.
const IntegrationRule & Get(int GeomType, int Order)
Returns an integration rule for given GeomType and Order.
void SetSize(int s)
Resize the vector to size s.
Base abstract class for first order time dependent operators.
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
void GetSubVector(const Array< int > &dofs, Vector &elemvect) const
Extract entries listed in dofs to the output Vector elemvect.
int GetOrder() const
Returns the order of the finite element. In the case of anisotropic orders, returns the maximum order...
Data type dense matrix using column-major storage.
void AddMult(const Vector &x, Vector &y, const double a=1.0) const
y += A * x (default) or y += a * A * x
int Size() const
Returns the size of the vector.
FaceIntegrator(RiemannSolver &rsolver_, const int dim)
int Space() const
Returns the type of FunctionSpace on the element.
virtual void Mult(const Vector &x, Vector &y) const =0
Operator application: y=A(x).
void GetInverseMatrix(DenseMatrix &Ainv) const
Compute and return the inverse matrix in Ainv.
void Factor()
Factor the current DenseMatrix, *a.
double * GetData() const
Returns the matrix data array.
double * GetData() const
Return a pointer to the beginning of the Vector data.
void CalcOrtho(const DenseMatrix &J, Vector &n)
int GetNE() const
Returns number of elements in the mesh.
double Eval(const Vector &state1, const Vector &state2, const Vector &nor, Vector &flux)
IntegrationPoint & IntPoint(int i)
Returns a reference to the i-th integration point.
void ComputeFluxDotN(const Vector &state, const Vector &nor, Vector &fluxN)
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
DofTransformation * GetElementVDofs(int i, Array< int > &vdofs) const
Returns indexes of degrees of freedom in array dofs for i'th element.
void mfem_error(const char *msg)
Function called when an error is encountered. Used by the macros MFEM_ABORT, MFEM_ASSERT, MFEM_VERIFY.
const double specific_heat_ratio
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...
virtual void AssembleFaceVector(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Tr, const Vector &elfun, Vector &elvect)
Perform the local action of the NonlinearFormIntegrator resulting from a face integral term...
void ComputeFlux(const Vector &state, int dim, DenseMatrix &flux)
double ComputeMaxCharSpeed(const Vector &state, const int dim)
ElementTransformation * GetElementTransformation(int i) const
Returns ElementTransformation for the i-th element.
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
int GetDof() const
Returns the number of degrees of freedom in the finite element.
virtual void Mult(const Vector &x, Vector &y) const
Perform the action of the operator: y = k = f(x, t), where k solves the algebraic equation F(x...
FE_Evolution(FiniteElementSpace &vfes_, Operator &A_, SparseMatrix &Aflux_)
Class for integration point with weight.
void vel(const Vector &x, double t, Vector &u)
double ComputePressure(const Vector &state, int dim)
void InitialCondition(const Vector &x, Vector &y)
virtual const FiniteElement * GetFE(int i) const
Returns pointer to the FiniteElement in the FiniteElementCollection associated with i'th element in t...
bool StateIsPhysical(const Vector &state, const int dim)
void UseExternalData(double *d, int h, int w)
Change the data array and the size of the DenseMatrix.
const double gas_constant
Rank 3 tensor (array of matrices)
IntegrationRules IntRules(0, Quadrature1D::GaussLegendre)
A global object with all integration rules (defined in intrules.cpp)
double f(const Vector &p)