Nektar++
Loading...
Searching...
No Matches
HexExp.cpp
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: HexExp.cpp
4//
5// For more information, please see: http://www.nektar.info
6//
7// The MIT License
8//
9// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10// Department of Aeronautics, Imperial College London (UK), and Scientific
11// Computing and Imaging Institute, University of Utah (USA).
12//
13// Permission is hereby granted, free of charge, to any person obtaining a
14// copy of this software and associated documentation files (the "Software"),
15// to deal in the Software without restriction, including without limitation
16// the rights to use, copy, modify, merge, publish, distribute, sublicense,
17// and/or sell copies of the Software, and to permit persons to whom the
18// Software is furnished to do so, subject to the following conditions:
19//
20// The above copyright notice and this permission notice shall be included
21// in all copies or substantial portions of the Software.
22//
23// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29// DEALINGS IN THE SOFTWARE.
30//
31// Description: Methods for Hex expansion in local regoins
32//
33///////////////////////////////////////////////////////////////////////////////
34
37#include <LocalRegions/HexExp.h>
39
40using namespace std;
41
43{
44/**
45 * @class HexExp
46 * Defines a hexahedral local expansion.
47 */
48
49/**
50 * \brief Constructor using BasisKey class for quadrature points and
51 * order definition
52 *
53 * @param Ba Basis key for first coordinate.
54 * @param Bb Basis key for second coordinate.
55 * @param Bc Basis key for third coordinate.
56 */
58 const LibUtilities::BasisKey &Bb,
59 const LibUtilities::BasisKey &Bc,
61 : StdExpansion(Ba.GetNumModes() * Bb.GetNumModes() * Bc.GetNumModes(), 3,
62 Ba, Bb, Bc),
63 StdExpansion3D(Ba.GetNumModes() * Bb.GetNumModes() * Bc.GetNumModes(), Ba,
64 Bb, Bc),
65 StdHexExp(Ba, Bb, Bc), Expansion(geom), Expansion3D(geom),
66 m_matrixManager(
67 std::bind(&Expansion3D::CreateMatrix, this, std::placeholders::_1)),
68 m_staticCondMatrixManager(std::bind(&Expansion::CreateStaticCondMatrix,
69 this, std::placeholders::_1))
70{
71}
72
73/**
74 * \brief Copy Constructor
75 *
76 * @param T HexExp to copy.
77 */
79 : StdExpansion(T), StdExpansion3D(T), StdHexExp(T), Expansion(T),
80 Expansion3D(T), m_matrixManager(T.m_matrixManager),
81 m_staticCondMatrixManager(T.m_staticCondMatrixManager)
82{
83}
84
85//-----------------------------
86// Inner product functions
87//-----------------------------
88/**
89 * @brief Calculates the inner product \f$ I_{pqr} = (u,
90 * \partial_{x_i} \phi_{pqr}) \f$.
91 *
92 * The derivative of the basis functions is performed using the chain
93 * rule in order to incorporate the geometric factors. Assuming that
94 * the basis functions are a tensor product
95 * \f$\phi_{pqr}(\xi_1,\xi_2,\xi_3) =
96 * \phi_1(\xi_1)\phi_2(\xi_2)\phi_3(\xi_3)\f$, in the hexahedral
97 * element, this is straightforward and yields the result
98 *
99 * \f[
100 * I_{pqr} = \sum_{k=1}^3 \left(u, \frac{\partial u}{\partial \xi_k}
101 * \frac{\partial \xi_k}{\partial x_i}\right)
102 * \f]
103 *
104 * @param dir Direction in which to take the derivative.
105 * @param inarray The function \f$ u \f$.
106 * @param outarray Value of the inner product.
107 */
109 const Array<OneD, const NekDouble> &inarray,
110 Array<OneD, NekDouble> &outarray)
111{
112 ASSERTL1((dir == 0) || (dir == 1) || (dir == 2), "Invalid direction.");
113
114 const int nq0 = m_base[0]->GetNumPoints();
115 const int nq1 = m_base[1]->GetNumPoints();
116 const int nq2 = m_base[2]->GetNumPoints();
117 const int nq = nq0 * nq1 * nq2;
118
119 Array<OneD, NekDouble> tmp2(nq); // Dir1 metric
120 Array<OneD, NekDouble> tmp3(nq); // Dir2 metric
121 Array<OneD, NekDouble> tmp4(nq); // Dir3 metric
122 Array<OneD, NekDouble> tmp5(m_ncoeffs); // iprod tmp
123
125 tmp2D[0] = tmp2;
126 tmp2D[1] = tmp3;
127 tmp2D[2] = tmp4;
128
129 const Array<OneD, const NekDouble> &jac = m_geomFactors->GetJac();
130 bool Deformed = (m_geomFactors->GetGtype() == SpatialDomains::eDeformed);
131
132 const bool CollDir0 = m_base[0]->Collocation();
133 const bool CollDir1 = m_base[1]->Collocation();
134 const bool CollDir2 = m_base[2]->Collocation();
135
136 HexExp::v_AlignVectorToCollapsedDir(dir, inarray, tmp2D);
137
138 v_IProductWRTBaseKernel(m_base[0]->GetDbdata(), m_base[1]->GetBdata(),
139 m_base[2]->GetBdata(), tmp2, outarray, jac,
140 Deformed, false, CollDir1, CollDir2);
141
142 v_IProductWRTBaseKernel(m_base[0]->GetBdata(), m_base[1]->GetDbdata(),
143 m_base[2]->GetBdata(), tmp3, tmp5, jac, Deformed,
144 CollDir0, false, CollDir2);
145 Vmath::Vadd(m_ncoeffs, tmp5, 1, outarray, 1, outarray, 1);
146
147 v_IProductWRTBaseKernel(m_base[0]->GetBdata(), m_base[1]->GetBdata(),
148 m_base[2]->GetDbdata(), tmp4, tmp5, jac, Deformed,
149 CollDir0, CollDir1, false);
150 Vmath::Vadd(m_ncoeffs, tmp5, 1, outarray, 1, outarray, 1);
151}
152
154 const int dir, const Array<OneD, const NekDouble> &inarray,
156{
157 ASSERTL1((dir == 0) || (dir == 1) || (dir == 2), "Invalid direction.");
158
159 const int nq0 = m_base[0]->GetNumPoints();
160 const int nq1 = m_base[1]->GetNumPoints();
161 const int nq2 = m_base[2]->GetNumPoints();
162 const int nq = nq0 * nq1 * nq2;
163
164 const Array<TwoD, const NekDouble> &df = m_geomFactors->GetDerivFactors();
165
166 Array<OneD, NekDouble> tmp1(nq); // Quad metric
167
168 Array<OneD, NekDouble> tmp2 = outarray[0]; // Dir1 metric
169 Array<OneD, NekDouble> tmp3 = outarray[1]; // Dir2 metric
170 Array<OneD, NekDouble> tmp4 = outarray[2];
171
172 Vmath::Vcopy(nq, inarray, 1, tmp1, 1); // Dir3 metric
173
174 if (m_geomFactors->GetGtype() == SpatialDomains::eDeformed)
175 {
176 Vmath::Vmul(nq, &df[3 * dir][0], 1, tmp1.data(), 1, tmp2.data(), 1);
177 Vmath::Vmul(nq, &df[3 * dir + 1][0], 1, tmp1.data(), 1, tmp3.data(), 1);
178 Vmath::Vmul(nq, &df[3 * dir + 2][0], 1, tmp1.data(), 1, tmp4.data(), 1);
179 }
180 else
181 {
182 Vmath::Smul(nq, df[3 * dir][0], tmp1.data(), 1, tmp2.data(), 1);
183 Vmath::Smul(nq, df[3 * dir + 1][0], tmp1.data(), 1, tmp3.data(), 1);
184 Vmath::Smul(nq, df[3 * dir + 2][0], tmp1.data(), 1, tmp4.data(), 1);
185 }
186}
187
188/**
189 *
190 * @param dir Vector direction in which to take the derivative.
191 * @param inarray The function \f$ u \f$.
192 * @param outarray Value of the inner product.
193 */
195 const Array<OneD, const NekDouble> &direction,
196 const Array<OneD, const NekDouble> &inarray,
197 Array<OneD, NekDouble> &outarray)
198{
199 int shapedim = 3;
200 const int nq0 = m_base[0]->GetNumPoints();
201 const int nq1 = m_base[1]->GetNumPoints();
202 const int nq2 = m_base[2]->GetNumPoints();
203 const int nq = nq0 * nq1 * nq2;
204
205 Array<OneD, NekDouble> tmp2(nq); // Dir1 metric
206 Array<OneD, NekDouble> tmp3(nq); // Dir2 metric
207 Array<OneD, NekDouble> tmp4(nq); // Dir3 metric
208 Array<OneD, NekDouble> tmp5(m_ncoeffs); // iprod tmp
209
211 tmp2D[0] = tmp2;
212 tmp2D[1] = tmp3;
213 tmp2D[2] = tmp4;
214
215 const Array<OneD, const NekDouble> &jac = m_geomFactors->GetJac();
216 bool Deformed = (m_geomFactors->GetGtype() == SpatialDomains::eDeformed);
217
218 const bool CollDir0 = m_base[0]->Collocation();
219 const bool CollDir1 = m_base[1]->Collocation();
220 const bool CollDir2 = m_base[2]->Collocation();
221
222 const Array<TwoD, const NekDouble> &df = m_geomFactors->GetDerivFactors();
223
224 Array<OneD, Array<OneD, NekDouble>> dfdir(shapedim);
225 Expansion::ComputeGmatcdotMF(df, direction, dfdir);
226
227 Vmath::Vmul(nq, &dfdir[0][0], 1, inarray.data(), 1, tmp2.data(), 1);
228 Vmath::Vmul(nq, &dfdir[1][0], 1, inarray.data(), 1, tmp3.data(), 1);
229 Vmath::Vmul(nq, &dfdir[2][0], 1, inarray.data(), 1, tmp4.data(), 1);
230
231 v_IProductWRTBaseKernel(m_base[0]->GetDbdata(), m_base[1]->GetBdata(),
232 m_base[2]->GetBdata(), tmp2, outarray, jac,
233 Deformed, false, CollDir1, CollDir2);
234
235 v_IProductWRTBaseKernel(m_base[0]->GetBdata(), m_base[1]->GetDbdata(),
236 m_base[2]->GetBdata(), tmp3, tmp5, jac, Deformed,
237 CollDir0, false, CollDir2);
238 Vmath::Vadd(m_ncoeffs, tmp5, 1, outarray, 1, outarray, 1);
239
240 v_IProductWRTBaseKernel(m_base[0]->GetBdata(), m_base[1]->GetBdata(),
241 m_base[2]->GetDbdata(), tmp4, tmp5, jac, Deformed,
242 CollDir0, CollDir1, false);
243 Vmath::Vadd(m_ncoeffs, tmp5, 1, outarray, 1, outarray, 1);
244}
245
246//-----------------------------
247// Evaluation functions
248//-----------------------------
250 const Array<OneD, NekDouble> &coord,
251 const Array<OneD, const NekDouble> &inarray,
252 std::array<NekDouble, 3> &firstOrderDerivs)
253{
254 Array<OneD, NekDouble> Lcoord(3);
255 ASSERTL0(m_geom, "m_geom not defined");
256 m_geom->GetLocCoords(coord, Lcoord);
257 return StdHexExp::v_PhysEvalFirstDeriv(Lcoord, inarray, firstOrderDerivs);
258}
259
261{
263 m_base[0]->GetBasisKey(), m_base[1]->GetBasisKey(),
264 m_base[2]->GetBasisKey());
265}
266
268{
270 m_base[0]->GetPointsKey());
272 m_base[1]->GetPointsKey());
274 m_base[2]->GetPointsKey());
275
277 bkey2);
278}
279
280/**
281 * \brief Retrieves the physical coordinates of a given set of
282 * reference coordinates.
283 *
284 * @param Lcoords Local coordinates in reference space.
285 * @param coords Corresponding coordinates in physical space.
286 */
289{
290 int i;
291
292 ASSERTL1(Lcoords[0] >= -1.0 && Lcoords[0] <= 1.0 && Lcoords[1] >= -1.0 &&
293 Lcoords[1] <= 1.0 && Lcoords[2] >= -1.0 && Lcoords[2] <= 1.0,
294 "Local coordinates are not in region [-1,1]");
295
296 m_geom->FillGeom();
297
298 for (i = 0; i < m_geom->GetCoordim(); ++i)
299 {
300 coords[i] = m_geom->GetCoord(i, Lcoords);
301 }
302}
303
305 Array<OneD, NekDouble> &coords_1,
306 Array<OneD, NekDouble> &coords_2)
307{
308 Expansion::v_GetCoords(coords_0, coords_1, coords_2);
309}
310
311//-----------------------------
312// Helper functions
313//-----------------------------
315 const NekDouble *data, const std::vector<unsigned int> &nummodes,
316 const int mode_offset, NekDouble *coeffs,
317 std::vector<LibUtilities::BasisType> &fromType)
318{
319 int data_order0 = nummodes[mode_offset];
320 int fillorder0 = min(m_base[0]->GetNumModes(), data_order0);
321 int data_order1 = nummodes[mode_offset + 1];
322 int order1 = m_base[1]->GetNumModes();
323 int fillorder1 = min(order1, data_order1);
324 int data_order2 = nummodes[mode_offset + 2];
325 int order2 = m_base[2]->GetNumModes();
326 int fillorder2 = min(order2, data_order2);
327
328 // Check if same basis
329 if (fromType[0] != m_base[0]->GetBasisType() ||
330 fromType[1] != m_base[1]->GetBasisType() ||
331 fromType[2] != m_base[2]->GetBasisType())
332 {
333 // Construct a hex with the appropriate basis type at our
334 // quadrature points, and one more to do a forwards
335 // transform. We can then copy the output to coeffs.
337 LibUtilities::BasisKey(fromType[0], data_order0,
338 m_base[0]->GetPointsKey()),
339 LibUtilities::BasisKey(fromType[1], data_order1,
340 m_base[1]->GetPointsKey()),
341 LibUtilities::BasisKey(fromType[2], data_order2,
342 m_base[2]->GetPointsKey()));
343 StdRegions::StdHexExp tmpHex2(m_base[0]->GetBasisKey(),
344 m_base[1]->GetBasisKey(),
345 m_base[2]->GetBasisKey());
346
347 Array<OneD, const NekDouble> tmpData(tmpHex.GetNcoeffs(), data);
348 Array<OneD, NekDouble> tmpBwd(tmpHex2.GetTotPoints());
349 Array<OneD, NekDouble> tmpOut(tmpHex2.GetNcoeffs());
350
351 tmpHex.BwdTrans(tmpData, tmpBwd);
352 tmpHex2.FwdTrans(tmpBwd, tmpOut);
353 Vmath::Vcopy(tmpOut.size(), &tmpOut[0], 1, coeffs, 1);
354
355 return;
356 }
357
358 switch (m_base[0]->GetBasisType())
359 {
361 {
362 int i, j;
363 int cnt = 0;
364 int cnt1 = 0;
365
367 "Extraction routine not set up for this basis");
369 "Extraction routine not set up for this basis");
370
371 Vmath::Zero(m_ncoeffs, coeffs, 1);
372 for (j = 0; j < fillorder0; ++j)
373 {
374 for (i = 0; i < fillorder1; ++i)
375 {
376 Vmath::Vcopy(fillorder2, &data[cnt], 1, &coeffs[cnt1], 1);
377 cnt += data_order2;
378 cnt1 += order2;
379 }
380
381 // count out data for j iteration
382 for (i = fillorder1; i < data_order1; ++i)
383 {
384 cnt += data_order2;
385 }
386
387 for (i = fillorder1; i < order1; ++i)
388 {
389 cnt1 += order2;
390 }
391 }
392 break;
393 }
395 {
396 LibUtilities::PointsKey p0(nummodes[0],
398 LibUtilities::PointsKey p1(nummodes[1],
400 LibUtilities::PointsKey p2(nummodes[2],
402 LibUtilities::PointsKey t0(m_base[0]->GetNumModes(),
404 LibUtilities::PointsKey t1(m_base[1]->GetNumModes(),
406 LibUtilities::PointsKey t2(m_base[2]->GetNumModes(),
408 LibUtilities::Interp3D(p0, p1, p2, data, t0, t1, t2, coeffs);
409 }
410 break;
411 default:
412 ASSERTL0(false, "basis is either not set up or not "
413 "hierarchicial");
414 }
415}
416
417void HexExp::v_GetTracePhysMap(const int face, Array<OneD, int> &outarray)
418{
419 int nquad0 = m_base[0]->GetNumPoints();
420 int nquad1 = m_base[1]->GetNumPoints();
421 int nquad2 = m_base[2]->GetNumPoints();
422
423 int nq0 = 0;
424 int nq1 = 0;
425
426 switch (face)
427 {
428 case 0:
429 nq0 = nquad0;
430 nq1 = nquad1;
431
432 // Directions A and B positive
433 if (outarray.size() != nq0 * nq1)
434 {
435 outarray = Array<OneD, int>(nq0 * nq1);
436 }
437
438 for (int i = 0; i < nquad0 * nquad1; ++i)
439 {
440 outarray[i] = i;
441 }
442
443 break;
444 case 1:
445 nq0 = nquad0;
446 nq1 = nquad2;
447 // Direction A and B positive
448 if (outarray.size() != nq0 * nq1)
449 {
450 outarray = Array<OneD, int>(nq0 * nq1);
451 }
452
453 // Direction A and B positive
454 for (int k = 0; k < nquad2; k++)
455 {
456 for (int i = 0; i < nquad0; ++i)
457 {
458 outarray[k * nquad0 + i] = nquad0 * nquad1 * k + i;
459 }
460 }
461 break;
462 case 2:
463 nq0 = nquad1;
464 nq1 = nquad2;
465
466 // Direction A and B positive
467 if (outarray.size() != nq0 * nq1)
468 {
469 outarray = Array<OneD, int>(nq0 * nq1);
470 }
471
472 for (int i = 0; i < nquad1 * nquad2; i++)
473 {
474 outarray[i] = nquad0 - 1 + i * nquad0;
475 }
476 break;
477 case 3:
478 nq0 = nquad0;
479 nq1 = nquad2;
480
481 // Direction A and B positive
482 if (outarray.size() != nq0 * nq1)
483 {
484 outarray = Array<OneD, int>(nq0 * nq1);
485 }
486
487 for (int k = 0; k < nquad2; k++)
488 {
489 for (int i = 0; i < nquad0; i++)
490 {
491 outarray[k * nquad0 + i] =
492 (nquad0 * (nquad1 - 1)) + (k * nquad0 * nquad1) + i;
493 }
494 }
495 break;
496 case 4:
497 nq0 = nquad1;
498 nq1 = nquad2;
499
500 // Direction A and B positive
501 if (outarray.size() != nq0 * nq1)
502 {
503 outarray = Array<OneD, int>(nq0 * nq1);
504 }
505
506 for (int i = 0; i < nquad1 * nquad2; i++)
507 {
508 outarray[i] = i * nquad0;
509 }
510 break;
511 case 5:
512 nq0 = nquad0;
513 nq1 = nquad1;
514 // Directions A and B positive
515 if (outarray.size() != nq0 * nq1)
516 {
517 outarray = Array<OneD, int>(nq0 * nq1);
518 }
519
520 for (int i = 0; i < nquad0 * nquad1; i++)
521 {
522 outarray[i] = nquad0 * nquad1 * (nquad2 - 1) + i;
523 }
524
525 break;
526 default:
527 ASSERTL0(false, "face value (> 5) is out of range");
528 break;
529 }
530}
531
533{
534 int i;
535 SpatialDomains::GeomType type = m_geomFactors->GetGtype();
536
538 for (i = 0; i < ptsKeys.size(); ++i)
539 {
540 // Need at least 2 points for computing normals
541 if (ptsKeys[i].GetNumPoints() == 1)
542 {
543 LibUtilities::PointsKey pKey(2, ptsKeys[i].GetPointsType());
544 ptsKeys[i] = pKey;
545 }
546 }
547
549 m_geomFactors->ComputeDerivFactors(ptsKeys);
551 m_geomFactors->ComputeJac(ptsKeys);
552
553 LibUtilities::BasisKey tobasis0 = GetTraceBasisKey(face, 0);
554 LibUtilities::BasisKey tobasis1 = GetTraceBasisKey(face, 1);
555
556 // Number of quadrature points in face expansion.
557 int nq_face = tobasis0.GetNumPoints() * tobasis1.GetNumPoints();
558
559 int vCoordDim = GetCoordim();
560
563 for (i = 0; i < vCoordDim; ++i)
564 {
565 normal[i] = Array<OneD, NekDouble>(nq_face);
566 }
567
568 size_t nqb = nq_face;
569 size_t nbnd = face;
572
573 // Regular geometry case
574 if ((type == SpatialDomains::eRegular) ||
576 {
577 NekDouble fac;
578 // Set up normals
579 switch (face)
580 {
581 case 0:
582 for (i = 0; i < vCoordDim; ++i)
583 {
584 normal[i][0] = -df[3 * i + 2][0];
585 }
586 break;
587 case 1:
588 for (i = 0; i < vCoordDim; ++i)
589 {
590 normal[i][0] = -df[3 * i + 1][0];
591 }
592 break;
593 case 2:
594 for (i = 0; i < vCoordDim; ++i)
595 {
596 normal[i][0] = df[3 * i][0];
597 }
598 break;
599 case 3:
600 for (i = 0; i < vCoordDim; ++i)
601 {
602 normal[i][0] = df[3 * i + 1][0];
603 }
604 break;
605 case 4:
606 for (i = 0; i < vCoordDim; ++i)
607 {
608 normal[i][0] = -df[3 * i][0];
609 }
610 break;
611 case 5:
612 for (i = 0; i < vCoordDim; ++i)
613 {
614 normal[i][0] = df[3 * i + 2][0];
615 }
616 break;
617 default:
618 ASSERTL0(false, "face is out of range (edge < 5)");
619 }
620
621 // normalise
622 fac = 0.0;
623 for (i = 0; i < vCoordDim; ++i)
624 {
625 fac += normal[i][0] * normal[i][0];
626 }
627 fac = 1.0 / sqrt(fac);
628
629 Vmath::Fill(nqb, fac, length, 1);
630 for (i = 0; i < vCoordDim; ++i)
631 {
632 Vmath::Fill(nq_face, fac * normal[i][0], normal[i], 1);
633 }
634 }
635 else // Set up deformed normals
636 {
637 int j, k;
638
639 int nqe0 = ptsKeys[0].GetNumPoints();
640 int nqe1 = ptsKeys[1].GetNumPoints();
641 int nqe2 = ptsKeys[2].GetNumPoints();
642 int nqe01 = nqe0 * nqe1;
643 int nqe02 = nqe0 * nqe2;
644 int nqe12 = nqe1 * nqe2;
645
646 int nqe;
647 if (face == 0 || face == 5)
648 {
649 nqe = nqe01;
650 }
651 else if (face == 1 || face == 3)
652 {
653 nqe = nqe02;
654 }
655 else
656 {
657 nqe = nqe12;
658 }
659
662
663 Array<OneD, NekDouble> faceJac(nqe);
664 Array<OneD, NekDouble> normals(vCoordDim * nqe, 0.0);
665
666 // Extract Jacobian along face and recover local
667 // derivates (dx/dr) for polynomial interpolation by
668 // multiplying m_gmat by jacobian
669 switch (face)
670 {
671 case 0:
672 for (j = 0; j < nqe; ++j)
673 {
674 normals[j] = -df[2][j] * jac[j];
675 normals[nqe + j] = -df[5][j] * jac[j];
676 normals[2 * nqe + j] = -df[8][j] * jac[j];
677 faceJac[j] = jac[j];
678 }
679
680 points0 = ptsKeys[0];
681 points1 = ptsKeys[1];
682 break;
683 case 1:
684 for (j = 0; j < nqe0; ++j)
685 {
686 for (k = 0; k < nqe2; ++k)
687 {
688 int idx = j + nqe01 * k;
689 normals[j + k * nqe0] = -df[1][idx] * jac[idx];
690 normals[nqe + j + k * nqe0] = -df[4][idx] * jac[idx];
691 normals[2 * nqe + j + k * nqe0] =
692 -df[7][idx] * jac[idx];
693 faceJac[j + k * nqe0] = jac[idx];
694 }
695 }
696 points0 = ptsKeys[0];
697 points1 = ptsKeys[2];
698 break;
699 case 2:
700 for (j = 0; j < nqe1; ++j)
701 {
702 for (k = 0; k < nqe2; ++k)
703 {
704 int idx = nqe0 - 1 + nqe0 * j + nqe01 * k;
705 normals[j + k * nqe1] = df[0][idx] * jac[idx];
706 normals[nqe + j + k * nqe1] = df[3][idx] * jac[idx];
707 normals[2 * nqe + j + k * nqe1] = df[6][idx] * jac[idx];
708 faceJac[j + k * nqe1] = jac[idx];
709 }
710 }
711 points0 = ptsKeys[1];
712 points1 = ptsKeys[2];
713 break;
714 case 3:
715 for (j = 0; j < nqe0; ++j)
716 {
717 for (k = 0; k < nqe2; ++k)
718 {
719 int idx = nqe0 * (nqe1 - 1) + j + nqe01 * k;
720 normals[j + k * nqe0] = df[1][idx] * jac[idx];
721 normals[nqe + j + k * nqe0] = df[4][idx] * jac[idx];
722 normals[2 * nqe + j + k * nqe0] = df[7][idx] * jac[idx];
723 faceJac[j + k * nqe0] = jac[idx];
724 }
725 }
726 points0 = ptsKeys[0];
727 points1 = ptsKeys[2];
728 break;
729 case 4:
730 for (j = 0; j < nqe1; ++j)
731 {
732 for (k = 0; k < nqe2; ++k)
733 {
734 int idx = j * nqe0 + nqe01 * k;
735 normals[j + k * nqe1] = -df[0][idx] * jac[idx];
736 normals[nqe + j + k * nqe1] = -df[3][idx] * jac[idx];
737 normals[2 * nqe + j + k * nqe1] =
738 -df[6][idx] * jac[idx];
739 faceJac[j + k * nqe1] = jac[idx];
740 }
741 }
742 points0 = ptsKeys[1];
743 points1 = ptsKeys[2];
744 break;
745 case 5:
746 for (j = 0; j < nqe01; ++j)
747 {
748 int idx = j + nqe01 * (nqe2 - 1);
749 normals[j] = df[2][idx] * jac[idx];
750 normals[nqe + j] = df[5][idx] * jac[idx];
751 normals[2 * nqe + j] = df[8][idx] * jac[idx];
752 faceJac[j] = jac[idx];
753 }
754 points0 = ptsKeys[0];
755 points1 = ptsKeys[1];
756 break;
757 default:
758 ASSERTL0(false, "face is out of range (face < 5)");
759 }
760
761 Array<OneD, NekDouble> work(nq_face, 0.0);
762 // Interpolate Jacobian and invert
763 LibUtilities::Interp2D(points0, points1, faceJac,
764 tobasis0.GetPointsKey(), tobasis1.GetPointsKey(),
765 work);
766
767 Vmath::Sdiv(nq_face, 1.0, &work[0], 1, &work[0], 1);
768
769 // interpolate
770 for (i = 0; i < GetCoordim(); ++i)
771 {
772 LibUtilities::Interp2D(points0, points1, &normals[i * nqe],
773 tobasis0.GetPointsKey(),
774 tobasis1.GetPointsKey(), &normal[i][0]);
775 Vmath::Vmul(nq_face, work, 1, normal[i], 1, normal[i], 1);
776 }
777
778 // normalise normal vectors
779 Vmath::Zero(nq_face, work, 1);
780 for (i = 0; i < GetCoordim(); ++i)
781 {
782 Vmath::Vvtvp(nq_face, normal[i], 1, normal[i], 1, work, 1, work, 1);
783 }
784
785 Vmath::Vsqrt(nq_face, work, 1, work, 1);
786 Vmath::Sdiv(nq_face, 1.0, work, 1, work, 1);
787
788 Vmath::Vcopy(nqb, work, 1, length, 1);
789
790 for (i = 0; i < GetCoordim(); ++i)
791 {
792 Vmath::Vmul(nq_face, normal[i], 1, work, 1, normal[i], 1);
793 }
794 }
795}
796
797//-----------------------------
798// Operator creation functions
799//-----------------------------
801 Array<OneD, NekDouble> &outarray,
802 const StdRegions::StdMatrixKey &mkey)
803{
804 StdExpansion::MassMatrixOp_MatFree(inarray, outarray, mkey);
805}
806
808 Array<OneD, NekDouble> &outarray,
809 const StdRegions::StdMatrixKey &mkey)
810{
811 HexExp::v_LaplacianMatrixOp_MatFree(inarray, outarray, mkey);
812}
813
814void HexExp::v_LaplacianMatrixOp(const int k1, const int k2,
815 const Array<OneD, const NekDouble> &inarray,
816 Array<OneD, NekDouble> &outarray,
817 const StdRegions::StdMatrixKey &mkey)
818{
819 StdExpansion::LaplacianMatrixOp_MatFree(k1, k2, inarray, outarray, mkey);
820}
821
823 const Array<OneD, const NekDouble> &inarray,
824 Array<OneD, NekDouble> &outarray,
825 const StdRegions::StdMatrixKey &mkey)
826{
827 StdExpansion::WeakDerivMatrixOp_MatFree(i, inarray, outarray, mkey);
828}
829
831 const Array<OneD, const NekDouble> &inarray,
833{
834 StdExpansion::WeakDirectionalDerivMatrixOp_MatFree(inarray, outarray, mkey);
835}
836
838 const Array<OneD, const NekDouble> &inarray,
840{
841 StdExpansion::MassLevelCurvatureMatrixOp_MatFree(inarray, outarray, mkey);
842}
843
845 Array<OneD, NekDouble> &outarray,
846 const StdRegions::StdMatrixKey &mkey)
847{
848 HexExp::v_HelmholtzMatrixOp_MatFree(inarray, outarray, mkey);
849}
850
851/**
852 * This function is used to compute exactly the advective numerical flux
853 * on the interface of two elements with different expansions, hence an
854 * appropriate number of Gauss points has to be used. The number of
855 * Gauss points has to be equal to the number used by the highest
856 * polynomial degree of the two adjacent elements
857 *
858 * @param numMin Is the reduced polynomial order
859 * @param inarray Input array of coefficients
860 * @param dumpVar Output array of reduced coefficients.
861 */
863 const Array<OneD, const NekDouble> &inarray,
864 Array<OneD, NekDouble> &outarray)
865{
866 int n_coeffs = inarray.size();
867 int nmodes0 = m_base[0]->GetNumModes();
868 int nmodes1 = m_base[1]->GetNumModes();
869 int nmodes2 = m_base[2]->GetNumModes();
870 int numMax = nmodes0;
871
872 Array<OneD, NekDouble> coeff(n_coeffs);
873 Array<OneD, NekDouble> coeff_tmp1(nmodes0 * nmodes1, 0.0);
874 Array<OneD, NekDouble> coeff_tmp2(n_coeffs, 0.0);
875 Array<OneD, NekDouble> tmp, tmp2, tmp3, tmp4;
876
877 Vmath::Vcopy(n_coeffs, inarray, 1, coeff_tmp2, 1);
878
879 const LibUtilities::PointsKey Pkey0(nmodes0,
881 const LibUtilities::PointsKey Pkey1(nmodes1,
883 const LibUtilities::PointsKey Pkey2(nmodes2,
885
886 LibUtilities::BasisKey b0(m_base[0]->GetBasisType(), nmodes0, Pkey0);
887 LibUtilities::BasisKey b1(m_base[1]->GetBasisType(), nmodes1, Pkey1);
888 LibUtilities::BasisKey b2(m_base[2]->GetBasisType(), nmodes2, Pkey2);
889 LibUtilities::BasisKey bortho0(LibUtilities::eOrtho_A, nmodes0, Pkey0);
890 LibUtilities::BasisKey bortho1(LibUtilities::eOrtho_A, nmodes1, Pkey1);
891 LibUtilities::BasisKey bortho2(LibUtilities::eOrtho_A, nmodes2, Pkey2);
892
893 LibUtilities::InterpCoeff3D(b0, b1, b2, coeff_tmp2, bortho0, bortho1,
894 bortho2, coeff);
895
896 Vmath::Zero(n_coeffs, coeff_tmp2, 1);
897
898 int cnt = 0, cnt2 = 0;
899
900 for (int u = 0; u < numMin + 1; ++u)
901 {
902 for (int i = 0; i < numMin; ++i)
903 {
904 Vmath::Vcopy(numMin, tmp = coeff + cnt + cnt2, 1,
905 tmp2 = coeff_tmp1 + cnt, 1);
906
907 cnt = i * numMax;
908 }
909
910 Vmath::Vcopy(nmodes0 * nmodes1, tmp3 = coeff_tmp1, 1,
911 tmp4 = coeff_tmp2 + cnt2, 1);
912
913 cnt2 = u * nmodes0 * nmodes1;
914 }
915
916 LibUtilities::InterpCoeff3D(bortho0, bortho1, bortho2, coeff_tmp2, b0, b1,
917 b2, outarray);
918}
919
921 const StdRegions::StdMatrixKey &mkey)
922{
923 int nq = GetTotPoints();
924
925 // Calculate sqrt of the Jacobian
927 Array<OneD, NekDouble> sqrt_jac(nq);
928 if (m_geomFactors->GetGtype() == SpatialDomains::eDeformed)
929 {
930 Vmath::Vsqrt(nq, jac, 1, sqrt_jac, 1);
931 }
932 else
933 {
934 Vmath::Fill(nq, sqrt(jac[0]), sqrt_jac, 1);
935 }
936
937 // Multiply array by sqrt(Jac)
938 Vmath::Vmul(nq, sqrt_jac, 1, array, 1, array, 1);
939
940 // Apply std region filter
941 StdHexExp::v_SVVLaplacianFilter(array, mkey);
942
943 // Divide by sqrt(Jac)
944 Vmath::Vdiv(nq, array, 1, sqrt_jac, 1, array, 1);
945}
946
947//-----------------------------
948// Matrix creation functions
949//-----------------------------
951{
952 DNekMatSharedPtr returnval;
953
954 switch (mkey.GetMatrixType())
955 {
963 returnval = Expansion3D::v_GenMatrix(mkey);
964 break;
965 default:
966 returnval = StdHexExp::v_GenMatrix(mkey);
967 }
968
969 return returnval;
970}
971
973{
974 LibUtilities::BasisKey bkey0 = m_base[0]->GetBasisKey();
975 LibUtilities::BasisKey bkey1 = m_base[1]->GetBasisKey();
976 LibUtilities::BasisKey bkey2 = m_base[2]->GetBasisKey();
977
980
981 return tmp->GetStdMatrix(mkey);
982}
983
988
990{
991 m_matrixManager.DeleteObject(mkey);
992}
993
998
1000{
1001 m_staticCondMatrixManager.DeleteObject(mkey);
1002}
1003
1005 const Array<OneD, const NekDouble> &inarray,
1007{
1008 // This implementation is only valid when there are no
1009 // coefficients associated to the Laplacian operator
1010 if (m_metrics.count(eMetricLaplacian00) == 0)
1011 {
1013 }
1014
1015 int nquad0 = m_base[0]->GetNumPoints();
1016 int nquad1 = m_base[1]->GetNumPoints();
1017 int nquad2 = m_base[2]->GetNumPoints();
1018 int nqtot = nquad0 * nquad1 * nquad2;
1019
1020 ASSERTL1(wsp.size() >= 6 * nqtot, "Insufficient workspace size.");
1021
1022 const Array<OneD, const NekDouble> &base0 = m_base[0]->GetBdata();
1023 const Array<OneD, const NekDouble> &base1 = m_base[1]->GetBdata();
1024 const Array<OneD, const NekDouble> &base2 = m_base[2]->GetBdata();
1025 const Array<OneD, const NekDouble> &dbase0 = m_base[0]->GetDbdata();
1026 const Array<OneD, const NekDouble> &dbase1 = m_base[1]->GetDbdata();
1027 const Array<OneD, const NekDouble> &dbase2 = m_base[2]->GetDbdata();
1028 const Array<OneD, const NekDouble> &metric00 =
1030 const Array<OneD, const NekDouble> &metric01 =
1032 const Array<OneD, const NekDouble> &metric02 =
1034 const Array<OneD, const NekDouble> &metric11 =
1036 const Array<OneD, const NekDouble> &metric12 =
1038 const Array<OneD, const NekDouble> &metric22 =
1040
1041 // Allocate temporary storage
1042 Array<OneD, NekDouble> wsp0(wsp);
1043 Array<OneD, NekDouble> wsp1(wsp + 1 * nqtot);
1044 Array<OneD, NekDouble> wsp2(wsp + 2 * nqtot);
1045 Array<OneD, NekDouble> wsp3(wsp + 3 * nqtot);
1046 Array<OneD, NekDouble> wsp4(wsp + 4 * nqtot);
1047 Array<OneD, NekDouble> wsp5(wsp + 5 * nqtot);
1048
1049 PhysTensorDeriv(inarray, wsp0, wsp1, wsp2);
1050
1051 // wsp0 = k = g0 * wsp1 + g1 * wsp2 = g0 * du_dxi1 + g1 * du_dxi2
1052 // wsp2 = l = g1 * wsp1 + g2 * wsp2 = g0 * du_dxi1 + g1 * du_dxi2
1053 // where g0, g1 and g2 are the metric terms set up in the GeomFactors class
1054 // especially for this purpose
1055 Vmath::Vvtvvtp(nqtot, &metric00[0], 1, &wsp0[0], 1, &metric01[0], 1,
1056 &wsp1[0], 1, &wsp3[0], 1);
1057 Vmath::Vvtvp(nqtot, &metric02[0], 1, &wsp2[0], 1, &wsp3[0], 1, &wsp3[0], 1);
1058 Vmath::Vvtvvtp(nqtot, &metric01[0], 1, &wsp0[0], 1, &metric11[0], 1,
1059 &wsp1[0], 1, &wsp4[0], 1);
1060 Vmath::Vvtvp(nqtot, &metric12[0], 1, &wsp2[0], 1, &wsp4[0], 1, &wsp4[0], 1);
1061 Vmath::Vvtvvtp(nqtot, &metric02[0], 1, &wsp0[0], 1, &metric12[0], 1,
1062 &wsp1[0], 1, &wsp5[0], 1);
1063 Vmath::Vvtvp(nqtot, &metric22[0], 1, &wsp2[0], 1, &wsp5[0], 1, &wsp5[0], 1);
1064
1065 const bool CollDir0 = m_base[0]->Collocation();
1066 const bool CollDir1 = m_base[1]->Collocation();
1067 const bool CollDir2 = m_base[2]->Collocation();
1068
1069 const Array<OneD, const NekDouble> &jac = m_geomFactors->GetJac();
1070 bool Deformed = (m_geomFactors->GetGtype() == SpatialDomains::eDeformed);
1071
1072 // outarray = m = (D_xi1 * B)^T * k
1073 // wsp1 = n = (D_xi2 * B)^T * l
1074 v_IProductWRTBaseKernel(dbase0, base1, base2, wsp3, outarray, jac, Deformed,
1075 false, CollDir1, CollDir2);
1076 v_IProductWRTBaseKernel(base0, dbase1, base2, wsp4, wsp2, jac, Deformed,
1077 CollDir0, false, CollDir2);
1078 Vmath::Vadd(m_ncoeffs, wsp2.data(), 1, outarray.data(), 1, outarray.data(),
1079 1);
1080 v_IProductWRTBaseKernel(base0, base1, dbase2, wsp5, wsp2, jac, Deformed,
1081 CollDir0, CollDir1, false);
1082 Vmath::Vadd(m_ncoeffs, wsp2.data(), 1, outarray.data(), 1, outarray.data(),
1083 1);
1084}
1085
1087{
1088 const SpatialDomains::GeomType type = m_geomFactors->GetGtype();
1089 const unsigned int nqtot = GetTotPoints();
1090 const unsigned int dim = 3;
1091 const MetricType m[3][3] = {
1095
1096 for (unsigned int i = 0; i < dim; ++i)
1097 {
1098 for (unsigned int j = i; j < dim; ++j)
1099 {
1100 m_metrics[m[i][j]] = Array<OneD, NekDouble>(nqtot);
1101 const Array<TwoD, const NekDouble> &gmat =
1102 m_geomFactors->GetGmat(GetPointsKeys());
1103 if (type == SpatialDomains::eDeformed)
1104 {
1105 Vmath::Vcopy(nqtot, &gmat[i * dim + j][0], 1,
1106 &m_metrics[m[i][j]][0], 1);
1107 }
1108 else
1109 {
1110 Vmath::Fill(nqtot, gmat[i * dim + j][0], &m_metrics[m[i][j]][0],
1111 1);
1112 }
1113 }
1114 }
1115}
1116
1117} // namespace Nektar::LocalRegions
#define ASSERTL0(condition, msg)
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Describes the specification for a Basis.
Definition Basis.h:45
int GetNumPoints() const
Return points order at which basis is defined.
Definition Basis.h:120
PointsKey GetPointsKey() const
Return distribution of points.
Definition Basis.h:137
Defines a specification for a set of points.
Definition Points.h:50
DNekMatSharedPtr v_GenMatrix(const StdRegions::StdMatrixKey &mkey) override
std::map< int, NormalVector > m_traceNormals
Definition Expansion.h:309
std::map< int, Array< OneD, NekDouble > > m_elmtBndNormDirElmtLen
the element length in each element boundary(Vertex, edge or face) normal direction calculated based o...
Definition Expansion.h:319
SpatialDomains::Geometry * m_geom
Definition Expansion.h:306
void ComputeGmatcdotMF(const Array< TwoD, const NekDouble > &df, const Array< OneD, const NekDouble > &direction, Array< OneD, Array< OneD, NekDouble > > &dfdir)
void v_GetCoords(Array< OneD, NekDouble > &coords_1, Array< OneD, NekDouble > &coords_2, Array< OneD, NekDouble > &coords_3) override
SpatialDomains::GeomFactorsUniquePtr m_geomFactors
Definition Expansion.h:307
void v_WeakDirectionalDerivMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition HexExp.cpp:830
void v_GetCoords(Array< OneD, NekDouble > &coords_1, Array< OneD, NekDouble > &coords_2, Array< OneD, NekDouble > &coords_3) override
Definition HexExp.cpp:304
LibUtilities::NekManager< MatrixKey, DNekScalMat, MatrixKey::opLess > m_matrixManager
Definition HexExp.h:180
NekDouble v_PhysEvalFirstDeriv(const Array< OneD, NekDouble > &coord, const Array< OneD, const NekDouble > &inarray, std::array< NekDouble, 3 > &firstOrderDerivs) override
Definition HexExp.cpp:249
void v_MassMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition HexExp.cpp:800
void v_LaplacianMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition HexExp.cpp:807
void v_IProductWRTDirectionalDerivBase(const Array< OneD, const NekDouble > &direction, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition HexExp.cpp:194
HexExp(const LibUtilities::BasisKey &Ba, const LibUtilities::BasisKey &Bb, const LibUtilities::BasisKey &Bc, SpatialDomains::Geometry3D *geom)
Constructor using BasisKey class for quadrature points and order definition.
Definition HexExp.cpp:57
DNekMatSharedPtr v_GenMatrix(const StdRegions::StdMatrixKey &mkey) override
Definition HexExp.cpp:950
DNekMatSharedPtr v_CreateStdMatrix(const StdRegions::StdMatrixKey &mkey) override
Definition HexExp.cpp:972
LibUtilities::NekManager< MatrixKey, DNekScalBlkMat, MatrixKey::opLess > m_staticCondMatrixManager
Definition HexExp.h:182
void v_HelmholtzMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition HexExp.cpp:844
void v_DropLocStaticCondMatrix(const MatrixKey &mkey) override
Definition HexExp.cpp:999
DNekScalMatSharedPtr v_GetLocMatrix(const MatrixKey &mkey) override
Definition HexExp.cpp:984
void v_SVVLaplacianFilter(Array< OneD, NekDouble > &array, const StdRegions::StdMatrixKey &mkey) override
Definition HexExp.cpp:920
void v_ComputeTraceNormal(const int face) override
Definition HexExp.cpp:532
void v_ComputeLaplacianMetric() override
Definition HexExp.cpp:1086
void v_ExtractDataToCoeffs(const NekDouble *data, const std::vector< unsigned int > &nummodes, const int mode_offset, NekDouble *coeffs, std::vector< LibUtilities::BasisType > &fromType) override
Definition HexExp.cpp:314
void v_LaplacianMatrixOp_MatFree_Kernel(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp) override
Definition HexExp.cpp:1004
void v_DropLocMatrix(const MatrixKey &mkey) override
Definition HexExp.cpp:989
void v_IProductWRTDerivBase(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Calculates the inner product .
Definition HexExp.cpp:108
void v_GetCoord(const Array< OneD, const NekDouble > &Lcoords, Array< OneD, NekDouble > &coords) override
Retrieves the physical coordinates of a given set of reference coordinates.
Definition HexExp.cpp:287
void v_AlignVectorToCollapsedDir(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray) override
Definition HexExp.cpp:153
DNekScalBlkMatSharedPtr v_GetLocStaticCondMatrix(const MatrixKey &mkey) override
Definition HexExp.cpp:994
void v_GetTracePhysMap(const int face, Array< OneD, int > &outarray) override
Definition HexExp.cpp:417
void v_ReduceOrderCoeffs(int numMin, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition HexExp.cpp:862
void v_WeakDerivMatrixOp(const int i, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition HexExp.cpp:822
StdRegions::StdExpansionSharedPtr v_GetStdExp(void) const override
Definition HexExp.cpp:260
StdRegions::StdExpansionSharedPtr v_GetLinStdExp(void) const override
Definition HexExp.cpp:267
void v_MassLevelCurvatureMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition HexExp.cpp:837
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
3D geometry information
Definition Geometry3D.h:50
NekDouble GetCoord(const int i, const Array< OneD, const NekDouble > &Lcoord)
Given local collapsed coordinate Lcoord, return the value of physical coordinate in direction i.
Definition Geometry.h:559
NekDouble GetLocCoords(const Array< OneD, const NekDouble > &coords, Array< OneD, NekDouble > &Lcoords)
Determine the local collapsed coordinates that correspond to a given Cartesian coordinate for this ge...
Definition Geometry.h:549
int GetCoordim() const
Return the coordinate dimension of this object (i.e. the dimension of the space in which this object ...
Definition Geometry.h:277
void FillGeom()
Populate the coordinate mapping Geometry::m_coeffs information from any children geometry elements.
Definition Geometry.h:461
void PhysTensorDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1, Array< OneD, NekDouble > &out_d2)
Calculate the 3D derivative in the local tensor/collapsed coordinate at the physical points.
virtual void v_LaplacianMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
int GetNcoeffs(void) const
This function returns the total number of coefficients used in the expansion.
int GetTotPoints() const
This function returns the total number of quadrature points used in the element.
LibUtilities::BasisType GetBasisType(const int dir) const
This function returns the type of basis used in the dir direction.
const LibUtilities::PointsKeyVector GetPointsKeys() const
virtual void v_HelmholtzMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
void BwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
This function performs the Backward transformation from coefficient space to physical space.
LibUtilities::PointsType GetPointsType(const int dir) const
This function returns the type of quadrature points used in the dir direction.
void FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
int GetNumPoints(const int dir) const
This function returns the number of quadrature points in the dir direction.
const LibUtilities::BasisKey GetTraceBasisKey(const int i, int k=-1, bool UseGLL=false) const
This function returns the basis key belonging to the i-th trace.
Array< OneD, LibUtilities::BasisSharedPtr > m_base
Class representing a hexehedral element in reference space.
Definition StdHexExp.h:44
void v_IProductWRTBaseKernel(const Array< OneD, const NekDouble > &base0, const Array< OneD, const NekDouble > &base1, const Array< OneD, const NekDouble > &base2, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const Array< OneD, NekDouble > &jac, const bool Deformed, bool CollDir0=false, bool CollDir1=false, bool CollDir2=false) override
Inner product of inarray over region with respect to the expansion basis (this)->m_base[0] and return...
MatrixType GetMatrixType() const
void Interp3D(const BasisKey &fbasis0, const BasisKey &fbasis1, const BasisKey &fbasis2, const Array< OneD, const NekDouble > &from, const BasisKey &tbasis0, const BasisKey &tbasis1, const BasisKey &tbasis2, Array< OneD, NekDouble > &to)
this function interpolates a 3D function evaluated at the quadrature points of the 3D basis,...
Definition Interp.cpp:162
void InterpCoeff3D(const BasisKey &fbasis0, const BasisKey &fbasis1, const BasisKey &fbasis2, const Array< OneD, const NekDouble > &from, const BasisKey &tbasis0, const BasisKey &tbasis1, const BasisKey &tbasis2, Array< OneD, NekDouble > &to)
void Interp2D(const BasisKey &fbasis0, const BasisKey &fbasis1, const Array< OneD, const NekDouble > &from, const BasisKey &tbasis0, const BasisKey &tbasis1, Array< OneD, NekDouble > &to)
this function interpolates a 2D function evaluated at the quadrature points of the 2D basis,...
Definition Interp.cpp:101
std::vector< PointsKey > PointsKeyVector
Definition Points.h:313
@ eGaussLobattoLegendre
1D Gauss-Lobatto-Legendre quadrature points
Definition PointsType.h:51
@ eOrtho_A
Principle Orthogonal Functions .
Definition BasisType.h:42
@ eGLL_Lagrange
Lagrange for SEM basis .
Definition BasisType.h:56
@ eModified_A
Principle Modified Functions .
Definition BasisType.h:48
GeomType
Indicates the type of element geometry.
@ eRegular
Geometry is straight-sided with constant geometric factors.
@ eMovingRegular
Currently unused.
@ eDeformed
Geometry is curved or has non-constant factors.
std::shared_ptr< StdExpansion > StdExpansionSharedPtr
std::shared_ptr< StdHexExp > StdHexExpSharedPtr
Definition StdHexExp.h:193
std::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
std::shared_ptr< DNekScalBlkMat > DNekScalBlkMatSharedPtr
std::shared_ptr< DNekMat > DNekMatSharedPtr
void Vsqrt(int n, const T *x, const int incx, T *y, const int incy)
sqrt y = sqrt(x)
Definition Vmath.hpp:340
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.
Definition Vmath.hpp:72
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
Definition Vmath.hpp:366
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.
Definition Vmath.hpp:180
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.
Definition Vmath.hpp:100
void Sdiv(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha/x.
Definition Vmath.hpp:154
void Vdiv(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x/y.
Definition Vmath.hpp:126
void Zero(int n, T *x, const int incx)
Zero vector.
Definition Vmath.hpp:273
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
Definition Vmath.hpp:54
void Vvtvvtp(int n, const T *v, int incv, const T *w, int incw, const T *x, int incx, const T *y, int incy, T *z, int incz)
vvtvvtp (vector times vector plus vector times vector):
Definition Vmath.hpp:439
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition Vmath.hpp:825
STL namespace.
scalarT< T > min(scalarT< T > lhs, scalarT< T > rhs)
Definition scalar.hpp:300
scalarT< T > sqrt(scalarT< T > in)
Definition scalar.hpp:290