74 virtual void AssembleElementMatrix2(
const FiniteElement &trial_fe,
105 dim(vfes_.GetFE(0)->GetDim()),
109 Me_inv(vfes.GetFE(0)->GetDof(), vfes.GetFE(0)->GetDof(), vfes.GetNE()),
120 for (
int i = 0; i < vfes.
GetNE(); i++)
158 for (
int i = 0; i < vfes.
GetNE(); i++)
175 const double den = state(0);
177 const double den_energy = state(1 + dim);
180 for (
int d = 0; d <
dim; d++) { den_vel2 += den_vel(d) * den_vel(d); }
189 const double den = state(0);
191 const double den_energy = state(1 + dim);
197 for (
int d = 0; d <
dim; d++)
199 flux(0, d) = den_vel(d);
200 for (
int i = 0; i <
dim; i++)
202 flux(1+i, d) = den_vel(i) * den_vel(d) / den;
204 flux(1+d, d) += pres;
207 const double H = (den_energy + pres) / den;
208 for (
int d = 0; d <
dim; d++)
210 flux(1+dim, d) = den_vel(d) * H;
220 const double den = state(0);
222 const double den_energy = state(1 + dim);
229 for (
int d = 0; d <
dim; d++) { den_velN += den_vel(d) * nor(d); }
232 for (
int d = 0; d <
dim; d++)
234 fluxN(1+d) = den_velN * den_vel(d) / den + pres * nor(d);
237 const double H = (den_energy + pres) / den;
238 fluxN(1 + dim) = den_velN * H;
244 const double den = state(0);
248 for (
int d = 0; d <
dim; d++) { den_vel2 += den_vel(d) * den_vel(d); }
253 const double vel = sqrt(den_vel2 / den);
261 const int dof = flux.
SizeI();
262 const int dim = flux.
SizeJ();
264 for (
int i = 0; i < dof; i++)
266 for (
int k = 0; k <
num_equation; k++) { state(k) = x(i, k); }
269 for (
int d = 0; d < dim; d++)
273 flux(i, d, k) = f(k, d);
286 flux2(num_equation) { }
292 const int dim = nor.
Size();
300 const double maxE = max(maxE1, maxE2);
306 for (
int i = 0; i <
dim; i++)
308 normag += nor(i) * nor(i);
310 normag = sqrt(normag);
314 flux(i) = 0.5 * (flux1(i) + flux2(i))
315 - 0.5 * maxE * (state2(i) - state1(i)) * normag;
334 const int dof_trial = trial_fe.
GetDof();
335 const int dof_test = test_fe.
GetDof();
336 const int dim = trial_fe.
GetDim();
339 dshapedr.
SetSize(dof_test, dim);
340 dshapedx.
SetSize(dof_test, dim);
342 elmat.
SetSize(dof_test, dof_trial * dim);
346 const int intorder = 2 * maxorder;
362 for (
int d = 0; d <
dim; d++)
364 for (
int j = 0; j < dof_test; j++)
366 for (
int k = 0; k < dof_trial; k++)
368 elmat(j, k + d * dof_trial) += shape(k) * dshapedx(j, d);
378 funval1(num_equation),
379 funval2(num_equation),
381 fluxN(num_equation) { }
389 const int dof1 = el1.
GetDof();
390 const int dof2 = el2.
GetDof();
395 elvect.
SetSize((dof1 + dof2) * num_equation);
415 if (el1.
Space() == FunctionSpace::Pk)
432 elfun1_mat.MultTranspose(shape1, funval1);
433 elfun2_mat.MultTranspose(shape2, funval2);
437 const double mcs = rsolver.
Eval(funval1, funval2, nor, fluxN);
445 for (
int s = 0;
s < dof1;
s++)
447 elvect1_mat(
s, k) -= fluxN(k) * shape1(
s);
449 for (
int s = 0;
s < dof2;
s++)
451 elvect2_mat(
s, k) += fluxN(k) * shape2(
s);
460 const double den = state(0);
462 const double den_energy = state(1 + dim);
466 cout <<
"Negative density: ";
467 for (
int i = 0; i < state.
Size(); i++)
469 cout << state(i) <<
" ";
476 cout <<
"Negative energy: ";
477 for (
int i = 0; i < state.
Size(); i++)
479 cout << state(i) <<
" ";
486 for (
int i = 0; i <
dim; i++) { den_vel2 += den_vel(i) * den_vel(i); }
493 cout <<
"Negative pressure: " << pres <<
", state: ";
494 for (
int i = 0; i < state.
Size(); i++)
496 cout << state(i) <<
" ";
507 MFEM_ASSERT(x.
Size() == 2,
"");
509 double radius = 0, Minf = 0, beta = 0;
527 "Options are: 1 - fast vortex, 2 - slow vortex");
530 const double xc = 0.0, yc = 0.0;
533 const double vel_inf = 1.;
534 const double den_inf = 1.;
539 const double temp_inf = pres_inf / (den_inf *
gas_constant);
542 r2rad += (x(0) - xc) * (x(0) - xc);
543 r2rad += (x(1) - yc) * (x(1) - yc);
544 r2rad /= (radius * radius);
548 const double velX = vel_inf * (1 - beta * (x(1) - yc) / radius * exp(
550 const double velY = vel_inf * beta * (x(0) - xc) / radius * exp(-0.5 * r2rad);
551 const double vel2 = velX * velX + velY * velY;
554 const double temp = temp_inf - 0.5 * (vel_inf * beta) *
555 (vel_inf * beta) / specific_heat * exp(-r2rad);
557 const double den = den_inf * pow(temp/temp_inf, shrinv1);
559 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 GetDim() const
Returns the reference space dimension for the finite element.
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.
void GetElementVDofs(int i, Array< int > &vdofs) const
Returns indexes of degrees of freedom in array dofs for i'th element.
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)
Geometry::Type GetGeomType() const
Returns the Geometry::Type of the reference element.
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)
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Tr, DenseMatrix &elmat)
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.
DomainIntegrator(const int dim)
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.
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const =0
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
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)