74 virtual void AssembleElementMatrix2(
const FiniteElement &trial_fe,
107 dim(_vfes.GetFE(0)->GetDim()),
111 Me_inv(vfes.GetFE(0)->GetDof(), vfes.GetFE(0)->GetDof(), vfes.GetNE()),
122 for (
int i = 0; i < vfes.
GetNE(); i++)
160 for (
int i = 0; i < vfes.
GetNE(); i++)
177 const double den = state(0);
179 const double den_energy = state(1 + dim);
182 for (
int d = 0; d <
dim; d++) { den_vel2 += den_vel(d) * den_vel(d); }
191 const double den = state(0);
193 const double den_energy = state(1 + dim);
199 for (
int d = 0; d <
dim; d++)
201 flux(0, d) = den_vel(d);
202 for (
int i = 0; i <
dim; i++)
204 flux(1+i, d) = den_vel(i) * den_vel(d) / den;
206 flux(1+d, d) += pres;
209 const double H = (den_energy + pres) / den;
210 for (
int d = 0; d <
dim; d++)
212 flux(1+dim, d) = den_vel(d) * H;
222 const double den = state(0);
224 const double den_energy = state(1 + dim);
231 for (
int d = 0; d <
dim; d++) { den_velN += den_vel(d) * nor(d); }
234 for (
int d = 0; d <
dim; d++)
236 fluxN(1+d) = den_velN * den_vel(d) / den + pres * nor(d);
239 const double H = (den_energy + pres) / den;
240 fluxN(1 + dim) = den_velN * H;
246 const double den = state(0);
250 for (
int d = 0; d <
dim; d++) { den_vel2 += den_vel(d) * den_vel(d); }
255 const double vel = sqrt(den_vel2 / den);
263 const int dof = flux.
SizeI();
264 const int dim = flux.
SizeJ();
266 for (
int i = 0; i < dof; i++)
268 for (
int k = 0; k <
num_equation; k++) { state(k) = x(i, k); }
271 for (
int d = 0; d < dim; d++)
275 flux(i, d, k) = f(k, d);
288 flux2(num_equation) { }
294 const int dim = nor.
Size();
302 const double maxE = max(maxE1, maxE2);
308 for (
int i = 0; i <
dim; i++)
310 normag += nor(i) * nor(i);
312 normag = sqrt(normag);
316 flux(i) = 0.5 * (flux1(i) + flux2(i))
317 - 0.5 * maxE * (state2(i) - state1(i)) * normag;
336 const int dof_trial = trial_fe.
GetDof();
337 const int dof_test = test_fe.
GetDof();
338 const int dim = trial_fe.
GetDim();
341 dshapedr.
SetSize(dof_test, dim);
342 dshapedx.
SetSize(dof_test, dim);
344 elmat.
SetSize(dof_test, dof_trial * dim);
348 const int intorder = 2 * maxorder;
364 for (
int d = 0; d <
dim; d++)
366 for (
int j = 0; j < dof_test; j++)
368 for (
int k = 0; k < dof_trial; k++)
370 elmat(j, k + d * dof_trial) += shape(k) * dshapedx(j, d);
380 funval1(num_equation),
381 funval2(num_equation),
383 fluxN(num_equation) { }
391 const int dof1 = el1.
GetDof();
392 const int dof2 = el2.
GetDof();
397 elvect.
SetSize((dof1 + dof2) * num_equation);
417 if (el1.
Space() == FunctionSpace::Pk)
435 elfun1_mat.MultTranspose(shape1, funval1);
436 elfun2_mat.MultTranspose(shape2, funval2);
442 const double mcs = rsolver.
Eval(funval1, funval2, nor, fluxN);
450 for (
int s = 0; s < dof1; s++)
452 elvect1_mat(s, k) -= fluxN(k) * shape1(s);
454 for (
int s = 0; s < dof2; s++)
456 elvect2_mat(s, k) += fluxN(k) * shape2(s);
465 const double den = state(0);
467 const double den_energy = state(1 + dim);
471 cout <<
"Negative density: ";
472 for (
int i = 0; i < state.
Size(); i++)
474 cout << state(i) <<
" ";
481 cout <<
"Negative energy: ";
482 for (
int i = 0; i < state.
Size(); i++)
484 cout << state(i) <<
" ";
491 for (
int i = 0; i <
dim; i++) { den_vel2 += den_vel(i) * den_vel(i); }
498 cout <<
"Negative pressure: " << pres <<
", state: ";
499 for (
int i = 0; i < state.
Size(); i++)
501 cout << state(i) <<
" ";
512 MFEM_ASSERT(x.
Size() == 2,
"");
514 double radius = 0, Minf = 0, beta = 0;
532 "Options are: 1 - fast vortex, 2 - slow vortex");
535 const double xc = 0.0, yc = 0.0;
538 const double vel_inf = 1.;
539 const double den_inf = 1.;
544 const double temp_inf = pres_inf / (den_inf *
gas_constant);
547 r2rad += (x(0) - xc) * (x(0) - xc);
548 r2rad += (x(1) - yc) * (x(1) - yc);
549 r2rad /= (radius * radius);
553 const double velX = vel_inf * (1 - beta * (x(1) - yc) / radius * exp(
555 const double velY = vel_inf * beta * (x(0) - xc) / radius * exp(-0.5 * r2rad);
556 const double vel2 = velX * velX + velY * velY;
559 const double temp = temp_inf - 0.5 * (vel_inf * beta) *
560 (vel_inf * beta) / specific_heat * exp(-r2rad);
562 const double den = den_inf * pow(temp/temp_inf, shrinv1);
564 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 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 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
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 space on each 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)
FE_Evolution(FiniteElementSpace &_vfes, Operator &_A, SparseMatrix &_Aflux)
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...
Class for integration point with weight.
double ComputePressure(const Vector &state, int dim)
void InitialCondition(const Vector &x, Vector &y)
const FiniteElement * GetFE(int i) const
Returns pointer to the FiniteElement associated with i'th element.
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)