35 #include <boost/core/ignore_unused.hpp>
44 namespace LocalRegions
55 ASSERTL1(IsBoundaryInteriorExpansion(),
56 "HybridDGHelmholtz matrix not set up "
57 "for non boundary-interior expansions");
62 int ncoeffs = GetNcoeffs();
64 int coordim = GetCoordim();
70 DNekMat LocMat(ncoeffs, ncoeffs);
78 for (i = 0; i < coordim; ++i)
82 Mat = Mat + Dmat * invMass *
Transpose(Dmat);
87 Mat = Mat + lambdaval * Mass;
93 for (i = 0; i < 2; ++i)
95 Mat(bmap[i], bmap[i]) = Mat(bmap[i], bmap[i]) + tau;
102 int nbndry = NumDGBndryCoeffs();
103 int ncoeffs = GetNcoeffs();
129 for (j = 0; j < nbndry; ++j)
141 for (k = 0; k < ncoeffs; ++k)
143 Umat(k, j) = Ulam[k];
155 int nbndry = NumDGBndryCoeffs();
156 int ncoeffs = GetNcoeffs();
200 ASSERTL0(
false,
"Direction not known");
207 for (j = 0; j < nbndry; ++j)
213 for (k = 0; k < ncoeffs; ++k)
215 Ulam[k] = lamToU(k, j);
223 AddNormTraceInt(dir, lambda, f);
230 &(Qmat.GetPtr())[0] + j * ncoeffs, 1);
237 int nbndry = NumBndryCoeffs();
247 GetBoundaryMap(bmap);
264 for (j = 0; j < nbndry; ++j)
268 (LamToU(bmap[0], j) - lam[j]);
273 for (j = 0; j < nbndry; ++j)
277 (LamToU(bmap[1], j) - lam[j]);
283 "This matrix type cannot be generated from this class");
290 void Expansion1D::AddNormTraceInt(
const int dir,
294 boost::ignore_unused(dir);
297 int nbndry = NumBndryCoeffs();
298 int nquad = GetNumPoints(0);
302 GetBoundaryMap(vmap);
306 for (k = 0; k < nbndry; ++k)
308 outarray[vmap[k]] += (
Basis[(vmap[k] + 1) * nquad - 1] *
309 Basis[(vmap[k] + 1) * nquad - 1] -
310 Basis[vmap[k] * nquad] *
Basis[vmap[k] * nquad]) *
315 void Expansion1D::AddHDGHelmholtzTraceTerms(
320 int nbndry = NumBndryCoeffs();
321 int nquad = GetNumPoints(0);
322 int ncoeffs = GetNcoeffs();
323 int coordim = GetCoordim();
326 ASSERTL0(&inarray[0] != &outarray[0],
327 "Input and output arrays use the same memory");
332 GetBoundaryMap(vmap);
335 for (i = 0; i < nbndry; ++i)
337 outarray[vmap[i]] += tau *
Basis[(vmap[i] + 1) * nquad - 1] *
338 Basis[(vmap[i] + 1) * nquad - 1] *
340 outarray[vmap[i]] += tau *
Basis[vmap[i] * nquad] *
341 Basis[vmap[i] * nquad] * inarray[vmap[i]];
355 for (n = 0; n < coordim; ++n)
358 for (i = 0; i < ncoeffs; ++i)
361 tmpcoeff[i] -= invMass(i, vmap[0]) *
Basis[vmap[0] * nquad] *
362 Basis[vmap[0] * nquad] * inarray[vmap[0]];
365 tmpcoeff[i] += invMass(i, vmap[1]) *
366 Basis[(vmap[1] + 1) * nquad - 1] *
367 Basis[(vmap[1] + 1) * nquad - 1] * inarray[vmap[1]];
371 Coeffs = Coeffs + Dmat * Tmpcoeff;
375 void Expansion1D::v_AddRobinMassMatrix(
379 ASSERTL0(IsBoundaryInteriorExpansion(),
380 "Robin boundary conditions are only implemented for "
381 "boundary-interior expanisons");
382 ASSERTL1(inoutmat->GetRows() == inoutmat->GetColumns(),
383 "Assuming that input matrix was square");
386 int map = GetVertexMap(vert);
396 int rows = inoutmat->GetRows();
398 if (rows == GetNcoeffs())
402 else if (rows == NumBndryCoeffs())
406 GetBoundaryMap(bmap);
408 for (i = 0; i < 2; ++i)
416 ASSERTL1(i != 2,
"Did not find number in map");
420 (*inoutmat)(map, map) += primCoeffs[0];
431 void Expansion1D::v_AddRobinTraceContribution(
435 ASSERTL1(IsBoundaryInteriorExpansion(),
436 "Not set up for non boundary-interior expansions");
438 int map = GetVertexMap(vert);
439 coeffs[map] += primCoeffs[0] * incoeffs[map];
446 GetLeftAdjacentElementExp()->GetTraceNormal(
447 GetLeftAdjacentElementTrace());
449 int nq = m_base[0]->GetNumPoints();
451 Vmath::Vmul(nq, &vec[0][0], 1, &normals[0][0], 1, &Fn[0], 1);
452 Vmath::Vvtvp(nq, &vec[1][0], 1, &normals[1][0], 1, &Fn[0], 1, &Fn[0], 1);
462 void Expansion1D::v_NormalTraceDerivFactors(
467 boost::ignore_unused(d0factors, d1factors);
468 int nquad = GetNumPoints(0);
470 m_metricinfo->GetDerivFactors(GetPointsKeys());
472 if (factors.size() <= 2)
487 factors[0][0] = gmat[0][nquad - 1] * normal_0[0][0];
488 factors[1][0] = gmat[0][0] * normal_1[0][0];
490 for (
int n = 1; n < normal_0.size(); ++n)
492 factors[0][0] += gmat[n][0] * normal_0[n][0];
493 factors[1][0] += gmat[n][nquad - 1] * normal_1[n][0];
498 factors[0][0] = gmat[0][0] * normal_0[0][0];
499 factors[1][0] = gmat[0][0] * normal_1[0][0];
501 for (
int n = 1; n < normal_0.size(); ++n)
503 factors[0][0] += gmat[n][0] * normal_0[n][0];
504 factors[1][0] += gmat[n][0] * normal_1[n][0];
513 boost::ignore_unused(orient, nq0, nq1);
515 if (idmap.size() != 1)
525 boost::ignore_unused(traceid);
526 h = GetGeom()->GetVertex(1)->dist(*GetGeom()->GetVertex(0));
#define ASSERTL0(condition, msg)
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Represents a basis of a given type.
const Array< OneD, const NekDouble > & GetBdata() const
Return basis definition array m_bdata.
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
MatrixType GetMatrixType() const
NekDouble GetConstFactor(const ConstFactorType &factor) const
@ eDeformed
Geometry is curved or has non-constant factors.
std::map< ConstFactorType, NekDouble > ConstFactorMap
The above copyright notice and this permission notice shall be included.
std::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
NekMatrix< InnerMatrixType, BlockMatrixTag > Transpose(NekMatrix< InnerMatrixType, BlockMatrixTag > &rhs)
std::shared_ptr< DNekMat > DNekMatSharedPtr
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 Neg(int n, T *x, const int incx)
Negate x = -x.
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 Zero(int n, T *x, const int incx)
Zero vector.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)