53 session->MatchSolverInfo(
"GJPStabilisation",
"Explicit", test,
false);
59 session->MatchSolverInfo(
"GJPStabilisation",
"Implicit", test,
false);
64 ASSERTL0(session->MatchSolverInfo(
"GlobalSysSoln",
"IterativeFull"),
65 "To use GJP Fully implicit stabilisation you must use a "
66 "Iterative Full solver");
69 session->MatchSolverInfo(
"GJPStabilisation",
"SemiImplicit", test,
false);
75 "Need a valid formualtion type for GradientJumpStabilisation: "
76 "Explicit, Implicit, SemiImplicit");
101 const std::shared_ptr<LocalRegions::ExpansionVector> exp =
108 for (
unsigned e = 0; e < (*exp).size(); ++e)
110 for (
unsigned t = 0; t < (*exp)[e]->GetNtraces(); ++t)
129 std::map<unsigned, std::pair<NekDouble, unsigned>> hpscale;
132 std::dynamic_pointer_cast<MultiRegions::DisContField>(
m_dgfield);
134 for (
int e = 0; e <
m_dgfield->GetExpSize(); ++e)
138 elmt->NormalTraceDerivFactors(dfactors[0], dfactors[1], dfactors[2]);
140 for (
int n = 0; n < elmt->GetNtraces(); ++n, ++cnt)
143 unsigned eid = dgfield->GetTraceElmtId(e, n);
146 elmt->GetLocTraceExp(n);
147 unsigned LocTracepts = LocTraceExp->GetTotPoints();
148 if (LocTracepts != dgtrace->GetExp(eid)->GetTotPoints())
151 std::make_pair(LocTraceExp, dgtrace->GetExp(eid));
163 m_traceFwd.push_back(dgfield->IsLeftAdjacentTrace(e, n));
166 elmt->TraceNormLen(n, h, p);
167 unsigned edgeid = elmt->GetTraceExp(n)->GetGeom()->GetGlobalID();
168 if (hpscale.count(edgeid))
170 auto hp = hpscale[edgeid];
171 hpscale[edgeid] = std::pair<NekDouble, unsigned>(
172 0.5 * (hp.first + h), (
int)(0.5 * (hp.second + p)));
176 hpscale[edgeid] = std::pair<NekDouble, unsigned>(h, p);
179 int nptrace = dfactors[0][n].size();
185 offset_phys += nptrace;
187 m_ntrace.push_back(elmt->GetNtraces());
193 for (
int e = 0; e <
m_dgfield->GetExpSize(); ++e)
196 for (
int n = 0; n < elmt->GetNtraces(); ++n, ++cnt)
198 unsigned edgeid = elmt->GetTraceExp(n)->GetGeom()->GetGlobalID();
200 ASSERTL1(hpscale.count(edgeid),
"Scale has not been defined");
201 auto hp = hpscale[edgeid];
203 unsigned p = hp.second;
205 (p == 1) ? 0.02 * h * h : 0.8 * pow(p + 1, -4.0) * h * h;
216 for (
int e = 0; e <
m_dgfield->GetExpSize(); ++e)
218 for (
unsigned j = 0; j <
m_ntrace[e]; ++j)
221 std::dynamic_pointer_cast<MultiRegions::DisContField>(
m_dgfield)
222 ->GetTraceElmtId(e, j);
232 dgtrace->GetExp(eid)->MultiplyByQuadratureMetric(
237 m_dgfield->GetExp(e)->ReOrientTracePhysVals(
238 m_dgfield->GetExp(e)->GetTraceOrient(j), e_tmp, e_tmp,
248 m_dgfield->GetExp(0)->StdDerivBaseOnTraceMat(TraceMat);
254 for (
int n = 1; n <
m_dgfield->GetExpSize(); ++n)
262 for (i = 0; i < base.size(); ++i)
264 if (base[i] != base_sav[i])
270 if (i == base.size())
281 m_dgfield->GetExp(n)->StdDerivBaseOnTraceMat(TraceMat);
283 base_sav =
m_dgfield->GetExp(n)->GetBase();
298 int nTracePts =
m_dgfield->GetTrace()->GetTotPoints();
324 m_dgfield->FwdTransLocalElmt(inarray, FilterCoeffs);
380 Vmath::Vadd(ncoeffs, CoeffsTmp, 1, FilterCoeffs, 1, FilterCoeffs,
397 Vmath::Vadd(ncoeffs, CoeffsTmp, 1, FilterCoeffs, 1, FilterCoeffs,
402 Vmath::Svtvp(ncoeffs, scale, FilterCoeffs, 1, outarray, 1, outarray, 1);
421 for (
unsigned e = 0; e <
m_dgfield->GetExpSize(); ++e)
423 for (
unsigned j = 0; j <
m_ntrace[e]; ++j)
437 it->second.first->PhysInterp(
439 tmp = store + offset,
443 m_dgfield->GetExp(e)->ReOrientTracePhysVals(
449 tmp = store + offset;
453 m_dgfield->GetExp(e)->ReOrientTracePhysVals(
463 for (
unsigned i = 0; i < locTracePts; ++i)
465 tmp[i] *= jumpScal *
m_scalTrace[dir][offset + i] *
469 offset += locTracePts;
485 for (
unsigned e = 0; e <
m_dgfield->GetExpSize(); ++e)
487 for (
unsigned j = 0; j <
m_ntrace[e]; ++j)
503 it->second.first->PhysInterp(
505 tmp = store + offset,
509 m_dgfield->GetExp(e)->ReOrientTracePhysVals(
518 m_dgfield->GetExp(e)->ReOrientTracePhysVals(
524 "GJPStab::Construct Trace:: Reorient", 10);
537 it->second.first->PhysInterp(
539 tmp = store + offset,
543 m_dgfield->GetExp(e)->ReOrientTracePhysVals(
552 m_dgfield->GetExp(e)->ReOrientTracePhysVals(
558 "GJPStab::Construct Trace:: Reorient", 10);
562 for (
unsigned i = 0; i < locTracePts; ++i)
564 tmp[i] *= jumpScal *
m_scalTrace[dir][offset + i] *
568 offset += locTracePts;
572 ASSERTL1(offset <= 2 * m_dgfield->GetTrace()->GetTotPoints(),
573 "Stroage is not large enough");
587 unsigned modes = it.second[dir]->GetRows();
588 unsigned tracepts = it.second[dir]->GetColumns();
590 Blas::Dgemm(
'N',
'N', modes, it.first, tracepts, 1.0,
591 &(it.second[dir]->GetPtr())[0], modes, &in[0] + cnt,
592 tracepts, 0.0, &out[0] + cnt1, modes);
594 cnt += tracepts * it.first;
595 cnt1 += modes * it.first;
607 for (
unsigned e = 0; e <
m_dgfield->GetExpSize(); ++e)
609 for (
unsigned j = 0; j <
m_ntrace[e]; ++j)
613 tmp = normderiv + offset;
614 ASSERTL0(offset < normderiv.size(),
"Issue");
616 m_dgfield->GetExp(e)->ReOrientTracePhysVals(
617 m_dgfield->GetExp(e)->GetTraceOrient(j), tmp, tmp,
632 it->second.second->PhysInterp(it->second.first, tmp, tmp1);
639 offset += locTracePts;
646 m_dgfield->FillBwdWithBoundCond(Fwd, Bwd,
true);
647 m_dgfield->GetTraceMap()->GetAssemblyCommDG()->PerformExchange(Fwd, Bwd);
661 unsigned modes = it.second[dir]->GetRows();
662 unsigned tracepts = it.second[dir]->GetColumns();
664 Blas::Dgemm(
'T',
'N', tracepts, it.first, modes, 1.0,
665 &(it.second[dir]->GetPtr())[0], modes, &in[0] + cnt, modes,
666 0.0, &out[0] + cnt1, tracepts);
668 cnt += modes * it.first;
669 cnt1 += tracepts * it.first;
679 for (
unsigned e = 0; e <
m_dgfield->GetExpSize(); ++e)
681 for (
unsigned n = 0; n <
m_dgfield->GetExp(e)->GetNtraces(); ++n)
#define ASSERTL0(condition, msg)
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
#define sign(a, b)
return the sign(b)*a
static std::string RegisterEnumValue(std::string pEnum, std::string pString, int pEnumValue)
Registers an enumeration value.
void AccumulateRegion(std::string, int iolevel=0)
Accumulate elapsed time for a region.
std::vector< unsigned > m_locTracePts1
npoints in local trace expannsion in dir 1
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
void StdDerivOnTraceFromModes(int i, Array< OneD, NekDouble > &in, Array< OneD, NekDouble > &out) const
void Apply(const Array< OneD, NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const Array< OneD, NekDouble > &pUnorm=NullNekDouble1DArray, const NekDouble scale=1.0) const
std::vector< unsigned > m_locTracePts0
npoints in local trace expannsion in dir 0
std::vector< std::pair< int, Array< OneD, DNekMatSharedPtr > > > m_StdDBaseOnTraceMat
void ConstructLocalTraceJump(const int dir, const Array< OneD, const NekDouble > &in, Array< OneD, NekDouble > &store) const
Array< OneD, NekDouble > GetTraceWeightVarFactors(void)
void TraceJumpFromLocTraceNormDeriv(Array< OneD, NekDouble > &normderiv, Array< OneD, NekDouble > &Fwd, Array< OneD, NekDouble > &Bwd) const
std::vector< unsigned > m_ntrace
list of the number of traces over an element;
GJPFormulation m_formulation
void IProductwrtStdDerivBaseOnTraceMat(int i, Array< OneD, NekDouble > &in, Array< OneD, NekDouble > &out) const
std::vector< bool > m_traceFwd
static std::string GJPStabilisationLookupIds[]
GJPStabilisation(ExpListSharedPtr field)
std::map< int, std::pair< LocalRegions::ExpansionSharedPtr, LocalRegions::ExpansionSharedPtr > > m_interpTrace
local trace and multiregion dg trace if different (i.e variable p and BC trace)
Array< OneD, NekDouble > m_locTraceWeights
void ConstructLocalTraceJumpSI(const int dir, const Array< OneD, const NekDouble > &Fwd, const Array< OneD, const NekDouble > &Bwd, Array< OneD, NekDouble > &store) const
std::vector< NekDouble > m_locEdgeScale
std::vector< unsigned > m_traceOffset
phys offset in trace expannsion of each trace as we loop over elmts
Array< OneD, Array< OneD, NekDouble > > m_scalTrace
Scale factor for phys values along trace involving the local normals and geometric factors.
MultiRegions::ExpListSharedPtr m_dgfield
DG expansion for projection evalaution along trace.
static void Dgemm(const char &transa, const char &transb, const int &m, const int &n, const int &k, const double &alpha, const double *a, const int &lda, const double *b, const int &ldb, const double &beta, double *c, const int &ldc)
BLAS level 3: Matrix-matrix multiply C = A x B where op(A)[m x k], op(B)[k x n], C[m x n] DGEMM perfo...
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< Expansion > ExpansionSharedPtr
std::shared_ptr< DisContField > DisContFieldSharedPtr
@ eFullImplicitGJPStabilisation
@ eSemiImplicitGJPStabilisation
@ eExplicitGJPStabilisation
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
@ eDir1FwdDir2_Dir2FwdDir1
static Array< OneD, NekDouble > NullNekDouble1DArray
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
void Svtvp(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Svtvp (scalar times vector plus vector): z = alpha*x + y.
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)