35 #include <boost/core/ignore_unused.hpp>
44 namespace LocalRegions
49 std::map<int, NormalVector>::const_iterator x;
50 x = m_vertexNormals.find(edge);
51 ASSERTL1 (x != m_vertexNormals.end(),
52 "Vertex normal not computed.");
64 ASSERTL1(IsBoundaryInteriorExpansion(),
65 "HybridDGHelmholtz matrix not set up "
66 "for non boundary-interior expansions");
70 int ncoeffs = GetNcoeffs();
72 int coordim = GetCoordim();
78 DNekMat LocMat(ncoeffs,ncoeffs);
85 for(i=0; i < coordim; ++i)
94 Mat = Mat + lambdaval*Mass;
100 for(i = 0; i < 2; ++i)
102 Mat(bmap[i],bmap[i]) = Mat(bmap[i],bmap[i]) + tau;
109 int nbndry = NumDGBndryCoeffs();
110 int ncoeffs = GetNcoeffs();
132 for(j = 0; j < nbndry; ++j)
143 for(k = 0; k < ncoeffs; ++k)
157 int nbndry = NumDGBndryCoeffs();
158 int ncoeffs = GetNcoeffs();
198 ASSERTL0(
false,
"Direction not known");
205 for(j = 0; j < nbndry; ++j)
211 for(k = 0; k < ncoeffs; ++k)
213 Ulam[k] = lamToU(k,j);
222 AddNormTraceInt(dir,lambda,f);
228 Vmath::Vcopy(ncoeffs,&ulam[0],1,&(Qmat.GetPtr())[0]+j*ncoeffs,1);
235 int nbndry = NumBndryCoeffs();
243 GetBoundaryMap(bmap);
255 lam[0] = 1.0; lam[1] = 0.0;
256 for(j = 0; j < nbndry; ++j)
261 lam[0] = 0.0; lam[1] = 1.0;
262 for(j = 0; j < nbndry; ++j)
269 ASSERTL0(
false,
"This matrix type cannot be generated from this class");
276 void Expansion1D::AddNormTraceInt(
const int dir,
280 boost::ignore_unused(dir);
283 int nbndry = NumBndryCoeffs();
284 int nquad = GetNumPoints(0);
288 GetBoundaryMap(vmap);
292 for(k = 0; k < nbndry; ++k)
294 outarray[vmap[k]] += (
Basis[(vmap[k]+1)*nquad-1]*
Basis[(vmap[k]+1)*nquad-1] -
Basis[vmap[k]*nquad]*
Basis[vmap[k]*nquad])*inarray[vmap[k]];
298 void Expansion1D::AddHDGHelmholtzTraceTerms(
const NekDouble tau,
302 int nbndry = NumBndryCoeffs();
303 int nquad = GetNumPoints(0);
304 int ncoeffs = GetNcoeffs();
305 int coordim = GetCoordim();
308 ASSERTL0(&inarray[0] != &outarray[0],
"Input and output arrays use the same memory");
314 GetBoundaryMap(vmap);
317 for(i = 0; i < nbndry; ++i)
319 outarray[vmap[i]] += tau*
Basis[(vmap[i]+1)*nquad-1]*
Basis[(vmap[i]+1)*nquad-1]*inarray[vmap[i]];
320 outarray[vmap[i]] += tau*
Basis[vmap[i]*nquad]*
Basis[vmap[i]*nquad]*inarray[vmap[i]];
335 for(n = 0; n < coordim; ++n)
338 for(i = 0; i < ncoeffs; ++i)
341 tmpcoeff[i] -= invMass(i,vmap[0])*
Basis[vmap[0]*nquad]*
Basis[vmap[0]*nquad]*inarray[vmap[0]];
344 tmpcoeff[i] += invMass(i,vmap[1])*
Basis[(vmap[1]+1)*nquad-1]*
Basis[(vmap[1]+1)*nquad-1]*inarray[vmap[1]];
349 Coeffs = Coeffs + Dmat*Tmpcoeff;
355 ASSERTL0(IsBoundaryInteriorExpansion(),
"Robin boundary conditions are only implemented for boundary-interior expanisons");
356 ASSERTL1(inoutmat->GetRows() == inoutmat->GetColumns(),
357 "Assuming that input matrix was square");
360 int map = GetVertexMap(vert);
370 int rows = inoutmat->GetRows();
372 if (rows == GetNcoeffs())
376 else if(rows == NumBndryCoeffs())
380 GetBoundaryMap(bmap);
382 for(i = 0; i < 2; ++i)
390 ASSERTL1(i != 2,
"Did not find number in map");
394 (*inoutmat)(map,map) += primCoeffs[0];
406 void Expansion1D::v_AddRobinEdgeContribution(
const int vert,
411 ASSERTL1(IsBoundaryInteriorExpansion(),
412 "Not set up for non boundary-interior expansions");
414 int map = GetVertexMap(vert);
415 coeffs[map] += primCoeffs[0]*incoeffs[map];
422 &normals = GetLeftAdjacentElementExp()->
423 GetTraceNormal(GetLeftAdjacentElementTrace());
425 int nq = m_base[0]->GetNumPoints();
427 Vmath::Vmul (nq, &vec[0][0], 1, &normals[0][0], 1, &Fn[0], 1);
428 Vmath::Vvtvp(nq, &vec[1][0], 1, &normals[1][0], 1, &Fn[0], 1, &Fn[0], 1);
433 void Expansion1D::v_ReOrientTracePhysMap
436 const int nq0,
const int nq1)
438 boost::ignore_unused(orient, nq0, nq1);
440 if (idmap.size() != 2)
#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
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)