Skip to content

Commit

Permalink
HyperReductionIntegrators for unsteady Navier-Stokes equation (#37)
Browse files Browse the repository at this point in the history
* DGLaxFriedrichsFluxIntegrator::AssembleQuadVector

* IncompressibleInviscidFluxNLFIntegrator::AssembleQuadVector

* IncompressibleInviscidFluxNLFIntegrator::AssembleQuadratureGrad

* DGLaxFriedrichsFluxIntegrator::AssembleQuadratureGrad

* ROMNonlinearForm::SetupEQPSystemForInteriorFaceIntegrator tested without precomputation.

* DGLaxFriedrichsFluxIntegrator::AddAssembleVector_Fast

* DGLaxFriedrichsFluxIntegrator::AddAssembleGrad_Fast needs a debugging.

* DGLaxFriedrichsFluxIntegrator::AddAssembleGrad_Fast debugged and verified.

* ROMNonlinearForm::SetupEQPSystemForBdrFaceIntegrator tested.

* DGLaxFriedrichsFluxIntegrator boundary operator verified

* IncompressibleInviscidFluxNLFIntegrator::AppendPrecomputeDomainCoeffs , AddAssembleVector_Fast tested.

* IncompressibleInviscidFluxNLFIntegrator::AddAssembleGrad_Fast verified
  • Loading branch information
dreamer2368 authored May 7, 2024
1 parent 733eb85 commit 4586b27
Show file tree
Hide file tree
Showing 4 changed files with 1,723 additions and 115 deletions.
81 changes: 77 additions & 4 deletions include/hyperreduction_integ.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,13 @@ class HyperReductionIntegrator : virtual public NonlinearFormIntegrator
const Vector &eltest,
DenseMatrix &quadmat);

virtual void AppendPrecomputeCoefficients(const FiniteElementSpace *fes,
virtual void AppendPrecomputeDomainCoeffs(const FiniteElementSpace *fes,
DenseMatrix &basis,
const SampleInfo &sample);
virtual void AppendPrecomputeInteriorFaceCoeffs(const FiniteElementSpace *fes,
DenseMatrix &basis,
const SampleInfo &sample);
virtual void AppendPrecomputeBdrFaceCoeffs(const FiniteElementSpace *fes,
DenseMatrix &basis,
const SampleInfo &sample);

Expand Down Expand Up @@ -146,7 +152,7 @@ class VectorConvectionTrilinearFormIntegrator : virtual public HyperReductionInt
const Vector &elfun,
DenseMatrix &elmat) override;

virtual void AppendPrecomputeCoefficients(const FiniteElementSpace *fes,
virtual void AppendPrecomputeDomainCoeffs(const FiniteElementSpace *fes,
DenseMatrix &basis,
const SampleInfo &sample) override;

Expand All @@ -170,6 +176,9 @@ class IncompressibleInviscidFluxNLFIntegrator :
DenseMatrix dshape, dshapex, EF, uu, ELV, elmat_comp;
Vector shape;

// precomputed basis value at the sample point.
Array<DenseMatrix *> shapes;
Array<Array<DenseMatrix *> *> dshapes;
public:
IncompressibleInviscidFluxNLFIntegrator(Coefficient &q)
: HyperReductionIntegrator(true), Q(&q) { }
Expand All @@ -188,6 +197,31 @@ class IncompressibleInviscidFluxNLFIntegrator :
ElementTransformation &trans,
const Vector &elfun,
DenseMatrix &elmat) override;

void AssembleQuadratureVector(const FiniteElement &el,
ElementTransformation &T,
const IntegrationPoint &ip,
const double &iw,
const Vector &eltest,
Vector &elquad) override;

void AssembleQuadratureGrad(const FiniteElement &el,
ElementTransformation &trans,
const IntegrationPoint &ip,
const double &iw,
const Vector &elfun,
DenseMatrix &elmat);

void AppendPrecomputeDomainCoeffs(const FiniteElementSpace *fes,
DenseMatrix &basis,
const SampleInfo &sample) override;

void AddAssembleVector_Fast(const int s, const double qw,
ElementTransformation &T, const IntegrationPoint &ip,
const Vector &x, Vector &y) override;
void AddAssembleGrad_Fast(const int s, const double qw,
ElementTransformation &T, const IntegrationPoint &ip,
const Vector &x, DenseMatrix &jac) override;
};

/*
Expand All @@ -202,9 +236,12 @@ class DGLaxFriedrichsFluxIntegrator : public HyperReductionIntegrator
double w, un1, un2, un;
Coefficient *Q{};

Vector nor, flux, shape1, shape2, u1, u2;
Vector nor, flux, shape1, shape2, u1, u2, tmp_vec;
DenseMatrix udof1, udof2, elv1, elv2;
DenseMatrix elmat_comp11, elmat_comp12, elmat_comp21, elmat_comp22;
DenseMatrix elmat_comp11, elmat_comp12, elmat_comp21, elmat_comp22, tmp;

// precomputed basis value at the sample point.
Array<DenseMatrix *> shapes1, shapes2;
public:
DGLaxFriedrichsFluxIntegrator(Coefficient &q)
: HyperReductionIntegrator(true), Q(&q) {}
Expand All @@ -221,6 +258,42 @@ class DGLaxFriedrichsFluxIntegrator : public HyperReductionIntegrator
FaceElementTransformations &Tr,
const Vector &elfun, DenseMatrix &elmat) override;

void AssembleQuadratureVector(const FiniteElement &el1,
const FiniteElement &el2,
FaceElementTransformations &T,
const IntegrationPoint &ip,
const double &iw,
const Vector &eltest,
Vector &elquad) override;

void AssembleQuadratureGrad(const FiniteElement &el1,
const FiniteElement &el2,
FaceElementTransformations &T,
const IntegrationPoint &ip,
const double &iw,
const Vector &eltest,
DenseMatrix &quadmat) override;

void AppendPrecomputeInteriorFaceCoeffs(const FiniteElementSpace *fes,
DenseMatrix &basis,
const SampleInfo &sample) override;
void AppendPrecomputeBdrFaceCoeffs(const FiniteElementSpace *fes,
DenseMatrix &basis,
const SampleInfo &sample) override;

void AddAssembleVector_Fast(const int s, const double qw,
FaceElementTransformations &T, const IntegrationPoint &ip,
const Vector &x, Vector &y) override;
void AddAssembleGrad_Fast(const int s, const double qw,
FaceElementTransformations &T, const IntegrationPoint &ip,
const Vector &x, DenseMatrix &jac) override;

private:
void AppendPrecomputeFaceCoeffs(const FiniteElementSpace *fes,
FaceElementTransformations *T,
DenseMatrix &basis,
const SampleInfo &sample);

};

} // namespace mfem
Expand Down
Loading

0 comments on commit 4586b27

Please sign in to comment.