Nektar++
PrismExp.cpp
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: PrismExp.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: PrismExp routines
32//
33///////////////////////////////////////////////////////////////////////////////
34
39
40using namespace std;
41
43{
44
46 const LibUtilities::BasisKey &Bb,
47 const LibUtilities::BasisKey &Bc,
49 : StdExpansion(LibUtilities::StdPrismData::getNumberOfCoefficients(
50 Ba.GetNumModes(), Bb.GetNumModes(), Bc.GetNumModes()),
51 3, Ba, Bb, Bc),
52 StdExpansion3D(LibUtilities::StdPrismData::getNumberOfCoefficients(
53 Ba.GetNumModes(), Bb.GetNumModes(), Bc.GetNumModes()),
54 Ba, Bb, Bc),
55 StdPrismExp(Ba, Bb, Bc), Expansion(geom), Expansion3D(geom),
56 m_matrixManager(
57 std::bind(&Expansion3D::CreateMatrix, this, std::placeholders::_1),
58 std::string("PrismExpMatrix")),
59 m_staticCondMatrixManager(std::bind(&Expansion::CreateStaticCondMatrix,
60 this, std::placeholders::_1),
61 std::string("PrismExpStaticCondMatrix"))
62{
63}
64
66 : StdExpansion(T), StdExpansion3D(T), StdPrismExp(T), Expansion(T),
67 Expansion3D(T), m_matrixManager(T.m_matrixManager),
68 m_staticCondMatrixManager(T.m_staticCondMatrixManager)
69{
70}
71
72//-------------------------------
73// Integration Methods
74//-------------------------------
75
76/**
77 * \brief Integrate the physical point list \a inarray over prismatic
78 * region and return the value.
79 *
80 * Inputs:\n
81 *
82 * - \a inarray: definition of function to be returned at quadrature
83 * point of expansion.
84 *
85 * Outputs:\n
86 *
87 * - returns \f$\int^1_{-1}\int^1_{-1}\int^1_{-1} u(\bar \eta_1,
88 * \xi_2, \xi_3) J[i,j,k] d \bar \eta_1 d \xi_2 d \xi_3 \f$ \n \f$ =
89 * \sum_{i=0}^{Q_1 - 1} \sum_{j=0}^{Q_2 - 1} \sum_{k=0}^{Q_3 - 1}
90 * u(\bar \eta_{1i}^{0,0}, \xi_{2j}^{0,0},\xi_{3k}^{1,0})w_{i}^{0,0}
91 * w_{j}^{0,0} \hat w_{k}^{1,0} \f$ \n where \f$ inarray[i,j, k] =
92 * u(\bar \eta_{1i}^{0,0}, \xi_{2j}^{0,0},\xi_{3k}^{1,0}) \f$, \n
93 * \f$\hat w_{i}^{1,0} = \frac {w_{j}^{1,0}} {2} \f$ \n and \f$
94 * J[i,j,k] \f$ is the Jacobian evaluated at the quadrature point.
95 */
97{
98 int nquad0 = m_base[0]->GetNumPoints();
99 int nquad1 = m_base[1]->GetNumPoints();
100 int nquad2 = m_base[2]->GetNumPoints();
102 Array<OneD, NekDouble> tmp(nquad0 * nquad1 * nquad2);
103
104 // Multiply inarray with Jacobian
105 if (m_metricinfo->GetGtype() == SpatialDomains::eDeformed)
106 {
107 Vmath::Vmul(nquad0 * nquad1 * nquad2, &jac[0], 1,
108 (NekDouble *)&inarray[0], 1, &tmp[0], 1);
109 }
110 else
111 {
112 Vmath::Smul(nquad0 * nquad1 * nquad2, (NekDouble)jac[0],
113 (NekDouble *)&inarray[0], 1, &tmp[0], 1);
114 }
115
116 // Call StdPrismExp version.
117 return StdPrismExp::v_Integral(tmp);
118}
119
120//----------------------------
121// Differentiation Methods
122//----------------------------
127{
128 int nqtot = GetTotPoints();
129
131 m_metricinfo->GetDerivFactors(GetPointsKeys());
132 Array<OneD, NekDouble> diff0(nqtot);
133 Array<OneD, NekDouble> diff1(nqtot);
134 Array<OneD, NekDouble> diff2(nqtot);
135
136 StdPrismExp::v_PhysDeriv(inarray, diff0, diff1, diff2);
137
138 if (m_metricinfo->GetGtype() == SpatialDomains::eDeformed)
139 {
140 if (out_d0.size())
141 {
142 Vmath::Vmul(nqtot, &df[0][0], 1, &diff0[0], 1, &out_d0[0], 1);
143 Vmath::Vvtvp(nqtot, &df[1][0], 1, &diff1[0], 1, &out_d0[0], 1,
144 &out_d0[0], 1);
145 Vmath::Vvtvp(nqtot, &df[2][0], 1, &diff2[0], 1, &out_d0[0], 1,
146 &out_d0[0], 1);
147 }
148
149 if (out_d1.size())
150 {
151 Vmath::Vmul(nqtot, &df[3][0], 1, &diff0[0], 1, &out_d1[0], 1);
152 Vmath::Vvtvp(nqtot, &df[4][0], 1, &diff1[0], 1, &out_d1[0], 1,
153 &out_d1[0], 1);
154 Vmath::Vvtvp(nqtot, &df[5][0], 1, &diff2[0], 1, &out_d1[0], 1,
155 &out_d1[0], 1);
156 }
157
158 if (out_d2.size())
159 {
160 Vmath::Vmul(nqtot, &df[6][0], 1, &diff0[0], 1, &out_d2[0], 1);
161 Vmath::Vvtvp(nqtot, &df[7][0], 1, &diff1[0], 1, &out_d2[0], 1,
162 &out_d2[0], 1);
163 Vmath::Vvtvp(nqtot, &df[8][0], 1, &diff2[0], 1, &out_d2[0], 1,
164 &out_d2[0], 1);
165 }
166 }
167 else // regular geometry
168 {
169 if (out_d0.size())
170 {
171 Vmath::Smul(nqtot, df[0][0], &diff0[0], 1, &out_d0[0], 1);
172 Blas::Daxpy(nqtot, df[1][0], &diff1[0], 1, &out_d0[0], 1);
173 Blas::Daxpy(nqtot, df[2][0], &diff2[0], 1, &out_d0[0], 1);
174 }
175
176 if (out_d1.size())
177 {
178 Vmath::Smul(nqtot, df[3][0], &diff0[0], 1, &out_d1[0], 1);
179 Blas::Daxpy(nqtot, df[4][0], &diff1[0], 1, &out_d1[0], 1);
180 Blas::Daxpy(nqtot, df[5][0], &diff2[0], 1, &out_d1[0], 1);
181 }
182
183 if (out_d2.size())
184 {
185 Vmath::Smul(nqtot, df[6][0], &diff0[0], 1, &out_d2[0], 1);
186 Blas::Daxpy(nqtot, df[7][0], &diff1[0], 1, &out_d2[0], 1);
187 Blas::Daxpy(nqtot, df[8][0], &diff2[0], 1, &out_d2[0], 1);
188 }
189 }
190}
191
192//---------------------------------------
193// Transforms
194//---------------------------------------
195
196/**
197 * \brief Forward transform from physical quadrature space stored in
198 * \a inarray and evaluate the expansion coefficients and store in \a
199 * (this)->m_coeffs
200 *
201 * Inputs:\n
202 *
203 * - \a inarray: array of physical quadrature points to be transformed
204 *
205 * Outputs:\n
206 *
207 * - (this)->_coeffs: updated array of expansion coefficients.
208 */
210 Array<OneD, NekDouble> &outarray)
211{
212 if (m_base[0]->Collocation() && m_base[1]->Collocation() &&
213 m_base[2]->Collocation())
214 {
215 Vmath::Vcopy(GetNcoeffs(), &inarray[0], 1, &outarray[0], 1);
216 }
217 else
218 {
219 v_IProductWRTBase(inarray, outarray);
220
221 // get Mass matrix inverse
223 DNekScalMatSharedPtr matsys = m_matrixManager[masskey];
224
225 // copy inarray in case inarray == outarray
226 DNekVec in(m_ncoeffs, outarray);
227 DNekVec out(m_ncoeffs, outarray, eWrapper);
228
229 out = (*matsys) * in;
230 }
231}
232
233//---------------------------------------
234// Inner product functions
235//---------------------------------------
236
237/**
238 * \brief Calculate the inner product of inarray with respect to the
239 * basis B=base0*base1*base2 and put into outarray:
240 *
241 * \f$ \begin{array}{rcl} I_{pqr} = (\phi_{pqr}, u)_{\delta} & = &
242 * \sum_{i=0}^{nq_0} \sum_{j=0}^{nq_1} \sum_{k=0}^{nq_2} \psi_{p}^{a}
243 * (\bar \eta_{1i}) \psi_{q}^{a} (\xi_{2j}) \psi_{pr}^{b} (\xi_{3k})
244 * w_i w_j w_k u(\bar \eta_{1,i} \xi_{2,j} \xi_{3,k}) J_{i,j,k}\\ & =
245 * & \sum_{i=0}^{nq_0} \psi_p^a(\bar \eta_{1,i}) \sum_{j=0}^{nq_1}
246 * \psi_{q}^a(\xi_{2,j}) \sum_{k=0}^{nq_2} \psi_{pr}^b u(\bar
247 * \eta_{1i},\xi_{2j},\xi_{3k}) J_{i,j,k} \end{array} \f$ \n
248 *
249 * where
250 *
251 * \f$ \phi_{pqr} (\xi_1 , \xi_2 , \xi_3) = \psi_p^a (\bar \eta_1)
252 * \psi_{q}^a (\xi_2) \psi_{pr}^b (\xi_3) \f$ \n
253 *
254 * which can be implemented as \n \f$f_{pr} (\xi_{3k}) =
255 * \sum_{k=0}^{nq_3} \psi_{pr}^b u(\bar \eta_{1i},\xi_{2j},\xi_{3k})
256 * J_{i,j,k} = {\bf B_3 U} \f$ \n \f$ g_{q} (\xi_{3k}) =
257 * \sum_{j=0}^{nq_1} \psi_{q}^a (\xi_{2j}) f_{pr} (\xi_{3k}) = {\bf
258 * B_2 F} \f$ \n \f$ (\phi_{pqr}, u)_{\delta} = \sum_{k=0}^{nq_0}
259 * \psi_{p}^a (\xi_{3k}) g_{q} (\xi_{3k}) = {\bf B_1 G} \f$
260 */
262 Array<OneD, NekDouble> &outarray)
263{
264 v_IProductWRTBase_SumFac(inarray, outarray);
265}
266
268 const Array<OneD, const NekDouble> &inarray,
269 Array<OneD, NekDouble> &outarray, bool multiplybyweights)
270{
271 const int nquad0 = m_base[0]->GetNumPoints();
272 const int nquad1 = m_base[1]->GetNumPoints();
273 const int nquad2 = m_base[2]->GetNumPoints();
274 const int order0 = m_base[0]->GetNumModes();
275 const int order1 = m_base[1]->GetNumModes();
276
277 Array<OneD, NekDouble> wsp(order0 * nquad2 * (nquad1 + order1));
278
279 if (multiplybyweights)
280 {
281 Array<OneD, NekDouble> tmp(nquad0 * nquad1 * nquad2);
282
283 MultiplyByQuadratureMetric(inarray, tmp);
284
286 m_base[0]->GetBdata(), m_base[1]->GetBdata(), m_base[2]->GetBdata(),
287 tmp, outarray, wsp, true, true, true);
288 }
289 else
290 {
292 m_base[0]->GetBdata(), m_base[1]->GetBdata(), m_base[2]->GetBdata(),
293 inarray, outarray, wsp, true, true, true);
294 }
295}
296
297/**
298 * @brief Calculates the inner product \f$ I_{pqr} = (u,
299 * \partial_{x_i} \phi_{pqr}) \f$.
300 *
301 * The derivative of the basis functions is performed using the chain
302 * rule in order to incorporate the geometric factors. Assuming that
303 * the basis functions are a tensor product
304 * \f$\phi_{pqr}(\eta_1,\eta_2,\eta_3) =
305 * \phi_1(\eta_1)\phi_2(\eta_2)\phi_3(\eta_3)\f$, this yields the
306 * result
307 *
308 * \f[
309 * I_{pqr} = \sum_{j=1}^3 \left(u, \frac{\partial u}{\partial \eta_j}
310 * \frac{\partial \eta_j}{\partial x_i}\right)
311 * \f]
312 *
313 * In the tetrahedral element, we must also incorporate a second set
314 * of geometric factors which incorporate the collapsed co-ordinate
315 * system, so that
316 *
317 * \f[ \frac{\partial\eta_j}{\partial x_i} = \sum_{k=1}^3
318 * \frac{\partial\eta_j}{\partial\xi_k}\frac{\partial\xi_k}{\partial
319 * x_i} \f]
320 *
321 * These derivatives can be found on p152 of Sherwin & Karniadakis.
322 *
323 * @param dir Direction in which to take the derivative.
324 * @param inarray The function \f$ u \f$.
325 * @param outarray Value of the inner product.
326 */
328 const int dir, const Array<OneD, const NekDouble> &inarray,
329 Array<OneD, NekDouble> &outarray)
330{
331 v_IProductWRTDerivBase_SumFac(dir, inarray, outarray);
332}
333
335 const int dir, const Array<OneD, const NekDouble> &inarray,
336 Array<OneD, NekDouble> &outarray)
337{
338 const int nquad0 = m_base[0]->GetNumPoints();
339 const int nquad1 = m_base[1]->GetNumPoints();
340 const int nquad2 = m_base[2]->GetNumPoints();
341 const int order0 = m_base[0]->GetNumModes();
342 const int order1 = m_base[1]->GetNumModes();
343 const int nqtot = nquad0 * nquad1 * nquad2;
344
345 Array<OneD, NekDouble> tmp1(nqtot);
346 Array<OneD, NekDouble> tmp2(nqtot);
347 Array<OneD, NekDouble> tmp3(nqtot);
348 Array<OneD, NekDouble> tmp4(nqtot);
350 Array<OneD, NekDouble> wsp(order0 * nquad2 * (nquad1 + order1));
351
352 MultiplyByQuadratureMetric(inarray, tmp1);
353
355 tmp2D[0] = tmp2;
356 tmp2D[1] = tmp3;
357 tmp2D[2] = tmp4;
358
360
361 IProductWRTBase_SumFacKernel(m_base[0]->GetDbdata(), m_base[1]->GetBdata(),
362 m_base[2]->GetBdata(), tmp2, outarray, wsp,
363 true, true, true);
364
365 IProductWRTBase_SumFacKernel(m_base[0]->GetBdata(), m_base[1]->GetDbdata(),
366 m_base[2]->GetBdata(), tmp3, tmp6, wsp, true,
367 true, true);
368
369 Vmath::Vadd(m_ncoeffs, tmp6, 1, outarray, 1, outarray, 1);
370
371 IProductWRTBase_SumFacKernel(m_base[0]->GetBdata(), m_base[1]->GetBdata(),
372 m_base[2]->GetDbdata(), tmp4, tmp6, wsp, true,
373 true, true);
374
375 Vmath::Vadd(m_ncoeffs, tmp6, 1, outarray, 1, outarray, 1);
376}
377
379 const int dir, const Array<OneD, const NekDouble> &inarray,
381{
382 const int nquad0 = m_base[0]->GetNumPoints();
383 const int nquad1 = m_base[1]->GetNumPoints();
384 const int nquad2 = m_base[2]->GetNumPoints();
385 const int order0 = m_base[0]->GetNumModes();
386 const int order1 = m_base[1]->GetNumModes();
387 const int nqtot = nquad0 * nquad1 * nquad2;
388
389 const Array<OneD, const NekDouble> &z0 = m_base[0]->GetZ();
390 const Array<OneD, const NekDouble> &z2 = m_base[2]->GetZ();
391
392 Array<OneD, NekDouble> gfac0(nquad0);
393 Array<OneD, NekDouble> gfac2(nquad2);
394 Array<OneD, NekDouble> tmp1(nqtot);
395 Array<OneD, NekDouble> tmp5(nqtot);
397 Array<OneD, NekDouble> wsp(order0 * nquad2 * (nquad1 + order1));
398
399 Array<OneD, NekDouble> tmp2 = outarray[0];
400 Array<OneD, NekDouble> tmp3 = outarray[1];
401 Array<OneD, NekDouble> tmp4 = outarray[2];
402
404 m_metricinfo->GetDerivFactors(GetPointsKeys());
405
406 Vmath::Vcopy(nqtot, inarray, 1, tmp1, 1); // Dir3 metric
407
408 if (m_metricinfo->GetGtype() == SpatialDomains::eDeformed)
409 {
410 Vmath::Vmul(nqtot, &df[3 * dir][0], 1, tmp1.get(), 1, tmp2.get(), 1);
411 Vmath::Vmul(nqtot, &df[3 * dir + 1][0], 1, tmp1.get(), 1, tmp3.get(),
412 1);
413 Vmath::Vmul(nqtot, &df[3 * dir + 2][0], 1, tmp1.get(), 1, tmp4.get(),
414 1);
415 }
416 else
417 {
418 Vmath::Smul(nqtot, df[3 * dir][0], tmp1.get(), 1, tmp2.get(), 1);
419 Vmath::Smul(nqtot, df[3 * dir + 1][0], tmp1.get(), 1, tmp3.get(), 1);
420 Vmath::Smul(nqtot, df[3 * dir + 2][0], tmp1.get(), 1, tmp4.get(), 1);
421 }
422
423 // set up geometric factor: (1+z0)/2
424 for (int i = 0; i < nquad0; ++i)
425 {
426 gfac0[i] = 0.5 * (1 + z0[i]);
427 }
428
429 // Set up geometric factor: 2/(1-z2)
430 for (int i = 0; i < nquad2; ++i)
431 {
432 gfac2[i] = 2.0 / (1 - z2[i]);
433 }
434
435 const int nq01 = nquad0 * nquad1;
436
437 for (int i = 0; i < nquad2; ++i)
438 {
439 Vmath::Smul(nq01, gfac2[i], &tmp2[0] + i * nq01, 1, &tmp2[0] + i * nq01,
440 1);
441 Vmath::Smul(nq01, gfac2[i], &tmp4[0] + i * nq01, 1, &tmp5[0] + i * nq01,
442 1);
443 }
444
445 for (int i = 0; i < nquad1 * nquad2; ++i)
446 {
447 Vmath::Vmul(nquad0, &gfac0[0], 1, &tmp5[0] + i * nquad0, 1,
448 &tmp5[0] + i * nquad0, 1);
449 }
450
451 Vmath::Vadd(nqtot, &tmp2[0], 1, &tmp5[0], 1, &tmp2[0], 1);
452}
453
454//---------------------------------------
455// Evaluation functions
456//---------------------------------------
457
459{
461 m_base[0]->GetBasisKey(), m_base[1]->GetBasisKey(),
462 m_base[2]->GetBasisKey());
463}
464
466{
468 m_base[0]->GetPointsKey());
470 m_base[1]->GetPointsKey());
472 m_base[2]->GetPointsKey());
473
475 bkey0, bkey1, bkey2);
476}
477
478/**
479 * @brief Get the coordinates #coords at the local coordinates
480 * #Lcoords.
481 */
484{
485 int i;
486
487 ASSERTL1(Lcoords[0] <= -1.0 && Lcoords[0] >= 1.0 && Lcoords[1] <= -1.0 &&
488 Lcoords[1] >= 1.0 && Lcoords[2] <= -1.0 && Lcoords[2] >= 1.0,
489 "Local coordinates are not in region [-1,1]");
490
491 m_geom->FillGeom();
492
493 for (i = 0; i < m_geom->GetCoordim(); ++i)
494 {
495 coords[i] = m_geom->GetCoord(i, Lcoords);
496 }
497}
498
500 Array<OneD, NekDouble> &coords_1,
501 Array<OneD, NekDouble> &coords_2)
502{
503 Expansion::v_GetCoords(coords_0, coords_1, coords_2);
504}
505
506/**
507 * Given the local cartesian coordinate \a Lcoord evaluate the
508 * value of physvals at this point by calling through to the
509 * StdExpansion method
510 */
512 const Array<OneD, const NekDouble> &Lcoord,
513 const Array<OneD, const NekDouble> &physvals)
514{
515 // Evaluate point in local (eta) coordinates.
516 return StdExpansion3D::v_PhysEvaluate(Lcoord, physvals);
517}
518
520 const Array<OneD, const NekDouble> &physvals)
521{
522 Array<OneD, NekDouble> Lcoord(3);
523
524 ASSERTL0(m_geom, "m_geom not defined");
525
526 m_geom->GetLocCoords(coord, Lcoord);
527
528 return StdExpansion3D::v_PhysEvaluate(Lcoord, physvals);
529}
530
532 const Array<OneD, const NekDouble> &inarray,
533 std::array<NekDouble, 3> &firstOrderDerivs)
534{
535 Array<OneD, NekDouble> Lcoord(3);
536 ASSERTL0(m_geom, "m_geom not defined");
537 m_geom->GetLocCoords(coord, Lcoord);
538 return StdPrismExp::v_PhysEvaluate(Lcoord, inarray, firstOrderDerivs);
539}
540
541//---------------------------------------
542// Helper functions
543//---------------------------------------
544
546 const NekDouble *data, const std::vector<unsigned int> &nummodes,
547 const int mode_offset, NekDouble *coeffs,
548 [[maybe_unused]] std::vector<LibUtilities::BasisType> &fromType)
549{
550 int data_order0 = nummodes[mode_offset];
551 int fillorder0 = min(m_base[0]->GetNumModes(), data_order0);
552 int data_order1 = nummodes[mode_offset + 1];
553 int order1 = m_base[1]->GetNumModes();
554 int fillorder1 = min(order1, data_order1);
555 int data_order2 = nummodes[mode_offset + 2];
556 int order2 = m_base[2]->GetNumModes();
557 int fillorder2 = min(order2, data_order2);
558
559 switch (m_base[0]->GetBasisType())
560 {
562 {
563 int i, j;
564 int cnt = 0;
565 int cnt1 = 0;
566
568 "Extraction routine not set up for this basis");
570 "Extraction routine not set up for this basis");
571
572 Vmath::Zero(m_ncoeffs, coeffs, 1);
573 for (j = 0; j < fillorder0; ++j)
574 {
575 for (i = 0; i < fillorder1; ++i)
576 {
577 Vmath::Vcopy(fillorder2 - j, &data[cnt], 1, &coeffs[cnt1],
578 1);
579 cnt += data_order2 - j;
580 cnt1 += order2 - j;
581 }
582
583 // count out data for j iteration
584 for (i = fillorder1; i < data_order1; ++i)
585 {
586 cnt += data_order2 - j;
587 }
588
589 for (i = fillorder1; i < order1; ++i)
590 {
591 cnt1 += order2 - j;
592 }
593 }
594 }
595 break;
596 default:
597 ASSERTL0(false, "basis is either not set up or not "
598 "hierarchicial");
599 }
600}
601
602void PrismExp::v_GetTracePhysMap(const int face, Array<OneD, int> &outarray)
603{
604 int nquad0 = m_base[0]->GetNumPoints();
605 int nquad1 = m_base[1]->GetNumPoints();
606 int nquad2 = m_base[2]->GetNumPoints();
607 int nq0 = 0;
608 int nq1 = 0;
609
610 switch (face)
611 {
612 case 0:
613 nq0 = nquad0;
614 nq1 = nquad1;
615 if (outarray.size() != nq0 * nq1)
616 {
617 outarray = Array<OneD, int>(nq0 * nq1);
618 }
619
620 // Directions A and B positive
621 for (int i = 0; i < nquad0 * nquad1; ++i)
622 {
623 outarray[i] = i;
624 }
625 break;
626 case 1:
627
628 nq0 = nquad0;
629 nq1 = nquad2;
630 if (outarray.size() != nq0 * nq1)
631 {
632 outarray = Array<OneD, int>(nq0 * nq1);
633 }
634
635 // Direction A and B positive
636 for (int k = 0; k < nquad2; k++)
637 {
638 for (int i = 0; i < nquad0; ++i)
639 {
640 outarray[k * nquad0 + i] = (nquad0 * nquad1 * k) + i;
641 }
642 }
643
644 break;
645 case 2:
646
647 nq0 = nquad1;
648 nq1 = nquad2;
649 if (outarray.size() != nq0 * nq1)
650 {
651 outarray = Array<OneD, int>(nq0 * nq1);
652 }
653
654 // Directions A and B positive
655 for (int j = 0; j < nquad1 * nquad2; ++j)
656 {
657 outarray[j] = nquad0 - 1 + j * nquad0;
658 }
659 break;
660 case 3:
661 nq0 = nquad0;
662 nq1 = nquad2;
663 if (outarray.size() != nq0 * nq1)
664 {
665 outarray = Array<OneD, int>(nq0 * nq1);
666 }
667
668 // Direction A and B positive
669 for (int k = 0; k < nquad2; k++)
670 {
671 for (int i = 0; i < nquad0; ++i)
672 {
673 outarray[k * nquad0 + i] =
674 nquad0 * (nquad1 - 1) + (nquad0 * nquad1 * k) + i;
675 }
676 }
677 break;
678 case 4:
679
680 nq0 = nquad1;
681 nq1 = nquad2;
682 if (outarray.size() != nq0 * nq1)
683 {
684 outarray = Array<OneD, int>(nq0 * nq1);
685 }
686
687 // Directions A and B positive
688 for (int j = 0; j < nquad1 * nquad2; ++j)
689 {
690 outarray[j] = j * nquad0;
691 }
692 break;
693 default:
694 ASSERTL0(false, "face value (> 4) is out of range");
695 break;
696 }
697}
698
699/** \brief Get the normals along specficied face
700 * Get the face normals interplated to a points0 x points 0
701 * type distribution
702 **/
704{
705 const SpatialDomains::GeomFactorsSharedPtr &geomFactors =
706 GetGeom()->GetMetricInfo();
707
709 for (int i = 0; i < ptsKeys.size(); ++i)
710 {
711 // Need at least 2 points for computing normals
712 if (ptsKeys[i].GetNumPoints() == 1)
713 {
714 LibUtilities::PointsKey pKey(2, ptsKeys[i].GetPointsType());
715 ptsKeys[i] = pKey;
716 }
717 }
718
719 SpatialDomains::GeomType type = geomFactors->GetGtype();
721 geomFactors->GetDerivFactors(ptsKeys);
722 const Array<OneD, const NekDouble> &jac = geomFactors->GetJac(ptsKeys);
723
724 int nq0 = ptsKeys[0].GetNumPoints();
725 int nq1 = ptsKeys[1].GetNumPoints();
726 int nq2 = ptsKeys[2].GetNumPoints();
727 int nq01 = nq0 * nq1;
728 int nqtot;
729
730 LibUtilities::BasisKey tobasis0 = GetTraceBasisKey(face, 0);
731 LibUtilities::BasisKey tobasis1 = GetTraceBasisKey(face, 1);
732
733 // Number of quadrature points in face expansion.
734 int nq_face = tobasis0.GetNumPoints() * tobasis1.GetNumPoints();
735
736 int vCoordDim = GetCoordim();
737 int i;
738
741 for (i = 0; i < vCoordDim; ++i)
742 {
743 normal[i] = Array<OneD, NekDouble>(nq_face);
744 }
745
746 size_t nqb = nq_face;
747 size_t nbnd = face;
750
751 // Regular geometry case
752 if (type == SpatialDomains::eRegular ||
754 {
755 NekDouble fac;
756 // Set up normals
757 switch (face)
758 {
759 case 0:
760 {
761 for (i = 0; i < vCoordDim; ++i)
762 {
763 normal[i][0] = -df[3 * i + 2][0];
764 ;
765 }
766 break;
767 }
768 case 1:
769 {
770 for (i = 0; i < vCoordDim; ++i)
771 {
772 normal[i][0] = -df[3 * i + 1][0];
773 }
774 break;
775 }
776 case 2:
777 {
778 for (i = 0; i < vCoordDim; ++i)
779 {
780 normal[i][0] = df[3 * i][0] + df[3 * i + 2][0];
781 }
782 break;
783 }
784 case 3:
785 {
786 for (i = 0; i < vCoordDim; ++i)
787 {
788 normal[i][0] = df[3 * i + 1][0];
789 }
790 break;
791 }
792 case 4:
793 {
794 for (i = 0; i < vCoordDim; ++i)
795 {
796 normal[i][0] = -df[3 * i][0];
797 }
798 break;
799 }
800 default:
801 ASSERTL0(false, "face is out of range (face < 4)");
802 }
803
804 // Normalise resulting vector.
805 fac = 0.0;
806 for (i = 0; i < vCoordDim; ++i)
807 {
808 fac += normal[i][0] * normal[i][0];
809 }
810 fac = 1.0 / sqrt(fac);
811
812 Vmath::Fill(nqb, fac, length, 1);
813
814 for (i = 0; i < vCoordDim; ++i)
815 {
816 Vmath::Fill(nq_face, fac * normal[i][0], normal[i], 1);
817 }
818 }
819 else
820 {
821 // Set up deformed normals.
822 int j, k;
823
824 // Determine number of quadrature points on the face of 3D elmt
825 if (face == 0)
826 {
827 nqtot = nq0 * nq1;
828 }
829 else if (face == 1 || face == 3)
830 {
831 nqtot = nq0 * nq2;
832 }
833 else
834 {
835 nqtot = nq1 * nq2;
836 }
837
840
841 Array<OneD, NekDouble> faceJac(nqtot);
842 Array<OneD, NekDouble> normals(vCoordDim * nqtot, 0.0);
843
844 // Extract Jacobian along face and recover local derivatives
845 // (dx/dr) for polynomial interpolation by multiplying m_gmat by
846 // jacobian
847 switch (face)
848 {
849 case 0:
850 {
851 for (j = 0; j < nq01; ++j)
852 {
853 normals[j] = -df[2][j] * jac[j];
854 normals[nqtot + j] = -df[5][j] * jac[j];
855 normals[2 * nqtot + j] = -df[8][j] * jac[j];
856 faceJac[j] = jac[j];
857 }
858
859 points0 = ptsKeys[0];
860 points1 = ptsKeys[1];
861 break;
862 }
863
864 case 1:
865 {
866 for (j = 0; j < nq0; ++j)
867 {
868 for (k = 0; k < nq2; ++k)
869 {
870 int tmp = j + nq01 * k;
871 normals[j + k * nq0] = -df[1][tmp] * jac[tmp];
872 normals[nqtot + j + k * nq0] = -df[4][tmp] * jac[tmp];
873 normals[2 * nqtot + j + k * nq0] =
874 -df[7][tmp] * jac[tmp];
875 faceJac[j + k * nq0] = jac[tmp];
876 }
877 }
878
879 points0 = ptsKeys[0];
880 points1 = ptsKeys[2];
881 break;
882 }
883
884 case 2:
885 {
886 for (j = 0; j < nq1; ++j)
887 {
888 for (k = 0; k < nq2; ++k)
889 {
890 int tmp = nq0 - 1 + nq0 * j + nq01 * k;
891 normals[j + k * nq1] =
892 (df[0][tmp] + df[2][tmp]) * jac[tmp];
893 normals[nqtot + j + k * nq1] =
894 (df[3][tmp] + df[5][tmp]) * jac[tmp];
895 normals[2 * nqtot + j + k * nq1] =
896 (df[6][tmp] + df[8][tmp]) * jac[tmp];
897 faceJac[j + k * nq1] = jac[tmp];
898 }
899 }
900
901 points0 = ptsKeys[1];
902 points1 = ptsKeys[2];
903 break;
904 }
905
906 case 3:
907 {
908 for (j = 0; j < nq0; ++j)
909 {
910 for (k = 0; k < nq2; ++k)
911 {
912 int tmp = nq0 * (nq1 - 1) + j + nq01 * k;
913 normals[j + k * nq0] = df[1][tmp] * jac[tmp];
914 normals[nqtot + j + k * nq0] = df[4][tmp] * jac[tmp];
915 normals[2 * nqtot + j + k * nq0] =
916 df[7][tmp] * jac[tmp];
917 faceJac[j + k * nq0] = jac[tmp];
918 }
919 }
920
921 points0 = ptsKeys[0];
922 points1 = ptsKeys[2];
923 break;
924 }
925
926 case 4:
927 {
928 for (j = 0; j < nq1; ++j)
929 {
930 for (k = 0; k < nq2; ++k)
931 {
932 int tmp = j * nq0 + nq01 * k;
933 normals[j + k * nq1] = -df[0][tmp] * jac[tmp];
934 normals[nqtot + j + k * nq1] = -df[3][tmp] * jac[tmp];
935 normals[2 * nqtot + j + k * nq1] =
936 -df[6][tmp] * jac[tmp];
937 faceJac[j + k * nq1] = jac[tmp];
938 }
939 }
940
941 points0 = ptsKeys[1];
942 points1 = ptsKeys[2];
943 break;
944 }
945
946 default:
947 ASSERTL0(false, "face is out of range (face < 4)");
948 }
949
950 Array<OneD, NekDouble> work(nq_face, 0.0);
951 // Interpolate Jacobian and invert
952 LibUtilities::Interp2D(points0, points1, faceJac,
953 tobasis0.GetPointsKey(), tobasis1.GetPointsKey(),
954 work);
955 Vmath::Sdiv(nq_face, 1.0, &work[0], 1, &work[0], 1);
956
957 // Interpolate normal and multiply by inverse Jacobian.
958 for (i = 0; i < vCoordDim; ++i)
959 {
960 LibUtilities::Interp2D(points0, points1, &normals[i * nqtot],
961 tobasis0.GetPointsKey(),
962 tobasis1.GetPointsKey(), &normal[i][0]);
963 Vmath::Vmul(nq_face, work, 1, normal[i], 1, normal[i], 1);
964 }
965
966 // Normalise to obtain unit normals.
967 Vmath::Zero(nq_face, work, 1);
968 for (i = 0; i < GetCoordim(); ++i)
969 {
970 Vmath::Vvtvp(nq_face, normal[i], 1, normal[i], 1, work, 1, work, 1);
971 }
972
973 Vmath::Vsqrt(nq_face, work, 1, work, 1);
974 Vmath::Sdiv(nq_face, 1.0, work, 1, work, 1);
975
976 Vmath::Vcopy(nqb, work, 1, length, 1);
977
978 for (i = 0; i < GetCoordim(); ++i)
979 {
980 Vmath::Vmul(nq_face, normal[i], 1, work, 1, normal[i], 1);
981 }
982 }
983}
984
986 Array<OneD, NekDouble> &outarray,
987 const StdRegions::StdMatrixKey &mkey)
988{
989 StdExpansion::MassMatrixOp_MatFree(inarray, outarray, mkey);
990}
991
993 Array<OneD, NekDouble> &outarray,
994 const StdRegions::StdMatrixKey &mkey)
995{
996 PrismExp::LaplacianMatrixOp_MatFree(inarray, outarray, mkey);
997}
998
999void PrismExp::v_LaplacianMatrixOp(const int k1, const int k2,
1000 const Array<OneD, const NekDouble> &inarray,
1001 Array<OneD, NekDouble> &outarray,
1002 const StdRegions::StdMatrixKey &mkey)
1003{
1004 StdExpansion::LaplacianMatrixOp_MatFree(k1, k2, inarray, outarray, mkey);
1005}
1006
1008 Array<OneD, NekDouble> &outarray,
1009 const StdRegions::StdMatrixKey &mkey)
1010{
1011 PrismExp::v_HelmholtzMatrixOp_MatFree(inarray, outarray, mkey);
1012}
1013
1015 const StdRegions::StdMatrixKey &mkey)
1016{
1017 int nq = GetTotPoints();
1018
1019 // Calculate sqrt of the Jacobian
1021 Array<OneD, NekDouble> sqrt_jac(nq);
1022 if (m_metricinfo->GetGtype() == SpatialDomains::eDeformed)
1023 {
1024 Vmath::Vsqrt(nq, jac, 1, sqrt_jac, 1);
1025 }
1026 else
1027 {
1028 Vmath::Fill(nq, sqrt(jac[0]), sqrt_jac, 1);
1029 }
1030
1031 // Multiply array by sqrt(Jac)
1032 Vmath::Vmul(nq, sqrt_jac, 1, array, 1, array, 1);
1033
1034 // Apply std region filter
1035 StdPrismExp::v_SVVLaplacianFilter(array, mkey);
1036
1037 // Divide by sqrt(Jac)
1038 Vmath::Vdiv(nq, array, 1, sqrt_jac, 1, array, 1);
1039}
1040
1041//---------------------------------------
1042// Matrix creation functions
1043//---------------------------------------
1044
1046{
1047 DNekMatSharedPtr returnval;
1048
1049 switch (mkey.GetMatrixType())
1050 {
1058 returnval = Expansion3D::v_GenMatrix(mkey);
1059 break;
1060 default:
1061 returnval = StdPrismExp::v_GenMatrix(mkey);
1062 break;
1063 }
1064
1065 return returnval;
1066}
1067
1069 const StdRegions::StdMatrixKey &mkey)
1070{
1071 LibUtilities::BasisKey bkey0 = m_base[0]->GetBasisKey();
1072 LibUtilities::BasisKey bkey1 = m_base[1]->GetBasisKey();
1073 LibUtilities::BasisKey bkey2 = m_base[2]->GetBasisKey();
1076
1077 return tmp->GetStdMatrix(mkey);
1078}
1079
1081{
1082 return m_matrixManager[mkey];
1083}
1084
1086{
1087 m_matrixManager.DeleteObject(mkey);
1088}
1089
1091 const MatrixKey &mkey)
1092{
1093 return m_staticCondMatrixManager[mkey];
1094}
1095
1097{
1098 m_staticCondMatrixManager.DeleteObject(mkey);
1099}
1100
1101/**
1102 * @brief Calculate the Laplacian multiplication in a matrix-free
1103 * manner.
1104 *
1105 * This function is the kernel of the Laplacian matrix-free operator,
1106 * and is used in #v_HelmholtzMatrixOp_MatFree to determine the effect
1107 * of the Helmholtz operator in a similar fashion.
1108 *
1109 * The majority of the calculation is precisely the same as in the
1110 * hexahedral expansion; however the collapsed co-ordinate system must
1111 * be taken into account when constructing the geometric factors. How
1112 * this is done is detailed more exactly in the tetrahedral expansion.
1113 * On entry to this function, the input #inarray must be in its
1114 * backwards-transformed state (i.e. \f$\mathbf{u} =
1115 * \mathbf{B}\hat{\mathbf{u}}\f$). The output is in coefficient space.
1116 *
1117 * @see %TetExp::v_HelmholtzMatrixOp_MatFree
1118 */
1120 const Array<OneD, const NekDouble> &inarray,
1122{
1123 int nquad0 = m_base[0]->GetNumPoints();
1124 int nquad1 = m_base[1]->GetNumPoints();
1125 int nquad2 = m_base[2]->GetNumPoints();
1126 int nqtot = nquad0 * nquad1 * nquad2;
1127 int i;
1128
1129 // Set up temporary storage.
1130 Array<OneD, NekDouble> alloc(11 * nqtot, 0.0);
1131 Array<OneD, NekDouble> wsp1(alloc); // TensorDeriv 1
1132 Array<OneD, NekDouble> wsp2(alloc + 1 * nqtot); // TensorDeriv 2
1133 Array<OneD, NekDouble> wsp3(alloc + 2 * nqtot); // TensorDeriv 3
1134 Array<OneD, NekDouble> g0(alloc + 3 * nqtot); // g0
1135 Array<OneD, NekDouble> g1(alloc + 4 * nqtot); // g1
1136 Array<OneD, NekDouble> g2(alloc + 5 * nqtot); // g2
1137 Array<OneD, NekDouble> g3(alloc + 6 * nqtot); // g3
1138 Array<OneD, NekDouble> g4(alloc + 7 * nqtot); // g4
1139 Array<OneD, NekDouble> g5(alloc + 8 * nqtot); // g5
1140 Array<OneD, NekDouble> h0(alloc + 3 * nqtot); // h0 == g0
1141 Array<OneD, NekDouble> h1(alloc + 6 * nqtot); // h1 == g3
1142 Array<OneD, NekDouble> wsp4(alloc + 4 * nqtot); // wsp4 == g1
1143 Array<OneD, NekDouble> wsp5(alloc + 5 * nqtot); // wsp5 == g2
1144 Array<OneD, NekDouble> wsp6(alloc + 8 * nqtot); // wsp6 == g5
1145 Array<OneD, NekDouble> wsp7(alloc + 3 * nqtot); // wsp7 == g0
1146 Array<OneD, NekDouble> wsp8(alloc + 9 * nqtot); // wsp8
1147 Array<OneD, NekDouble> wsp9(alloc + 10 * nqtot); // wsp9
1148
1149 const Array<OneD, const NekDouble> &base0 = m_base[0]->GetBdata();
1150 const Array<OneD, const NekDouble> &base1 = m_base[1]->GetBdata();
1151 const Array<OneD, const NekDouble> &base2 = m_base[2]->GetBdata();
1152 const Array<OneD, const NekDouble> &dbase0 = m_base[0]->GetDbdata();
1153 const Array<OneD, const NekDouble> &dbase1 = m_base[1]->GetDbdata();
1154 const Array<OneD, const NekDouble> &dbase2 = m_base[2]->GetDbdata();
1155
1156 // Step 1. LAPLACIAN MATRIX OPERATION
1157 // wsp1 = du_dxi1 = D_xi1 * wsp0 = D_xi1 * u
1158 // wsp2 = du_dxi2 = D_xi2 * wsp0 = D_xi2 * u
1159 // wsp3 = du_dxi3 = D_xi3 * wsp0 = D_xi3 * u
1160 StdExpansion3D::PhysTensorDeriv(inarray, wsp1, wsp2, wsp3);
1161
1163 m_metricinfo->GetDerivFactors(GetPointsKeys());
1164 const Array<OneD, const NekDouble> &z0 = m_base[0]->GetZ();
1165 const Array<OneD, const NekDouble> &z2 = m_base[2]->GetZ();
1166
1167 // Step 2. Calculate the metric terms of the collapsed
1168 // coordinate transformation (Spencer's book P152)
1169 for (i = 0; i < nquad2; ++i)
1170 {
1171 Vmath::Fill(nquad0 * nquad1, 2.0 / (1.0 - z2[i]),
1172 &h0[0] + i * nquad0 * nquad1, 1);
1173 Vmath::Fill(nquad0 * nquad1, 2.0 / (1.0 - z2[i]),
1174 &h1[0] + i * nquad0 * nquad1, 1);
1175 }
1176 for (i = 0; i < nquad0; i++)
1177 {
1178 Blas::Dscal(nquad1 * nquad2, 0.5 * (1 + z0[i]), &h1[0] + i, nquad0);
1179 }
1180
1181 // Step 3. Construct combined metric terms for physical space to
1182 // collapsed coordinate system. Order of construction optimised
1183 // to minimise temporary storage
1184 if (m_metricinfo->GetGtype() == SpatialDomains::eDeformed)
1185 {
1186 // wsp4 = d eta_1/d x_1
1187 Vmath::Vvtvvtp(nqtot, &df[0][0], 1, &h0[0], 1, &df[2][0], 1, &h1[0], 1,
1188 &wsp4[0], 1);
1189 // wsp5 = d eta_2/d x_1
1190 Vmath::Vvtvvtp(nqtot, &df[3][0], 1, &h0[0], 1, &df[5][0], 1, &h1[0], 1,
1191 &wsp5[0], 1);
1192 // wsp6 = d eta_3/d x_1d
1193 Vmath::Vvtvvtp(nqtot, &df[6][0], 1, &h0[0], 1, &df[8][0], 1, &h1[0], 1,
1194 &wsp6[0], 1);
1195
1196 // g0 (overwrites h0)
1197 Vmath::Vvtvvtp(nqtot, &wsp4[0], 1, &wsp4[0], 1, &wsp5[0], 1, &wsp5[0],
1198 1, &g0[0], 1);
1199 Vmath::Vvtvp(nqtot, &wsp6[0], 1, &wsp6[0], 1, &g0[0], 1, &g0[0], 1);
1200
1201 // g3 (overwrites h1)
1202 Vmath::Vvtvvtp(nqtot, &df[1][0], 1, &wsp4[0], 1, &df[4][0], 1, &wsp5[0],
1203 1, &g3[0], 1);
1204 Vmath::Vvtvp(nqtot, &df[7][0], 1, &wsp6[0], 1, &g3[0], 1, &g3[0], 1);
1205
1206 // g4
1207 Vmath::Vvtvvtp(nqtot, &df[2][0], 1, &wsp4[0], 1, &df[5][0], 1, &wsp5[0],
1208 1, &g4[0], 1);
1209 Vmath::Vvtvp(nqtot, &df[8][0], 1, &wsp6[0], 1, &g4[0], 1, &g4[0], 1);
1210
1211 // Overwrite wsp4/5/6 with g1/2/5
1212 // g1
1213 Vmath::Vvtvvtp(nqtot, &df[1][0], 1, &df[1][0], 1, &df[4][0], 1,
1214 &df[4][0], 1, &g1[0], 1);
1215 Vmath::Vvtvp(nqtot, &df[7][0], 1, &df[7][0], 1, &g1[0], 1, &g1[0], 1);
1216
1217 // g2
1218 Vmath::Vvtvvtp(nqtot, &df[2][0], 1, &df[2][0], 1, &df[5][0], 1,
1219 &df[5][0], 1, &g2[0], 1);
1220 Vmath::Vvtvp(nqtot, &df[8][0], 1, &df[8][0], 1, &g2[0], 1, &g2[0], 1);
1221
1222 // g5
1223 Vmath::Vvtvvtp(nqtot, &df[1][0], 1, &df[2][0], 1, &df[4][0], 1,
1224 &df[5][0], 1, &g5[0], 1);
1225 Vmath::Vvtvp(nqtot, &df[7][0], 1, &df[8][0], 1, &g5[0], 1, &g5[0], 1);
1226 }
1227 else
1228 {
1229 // wsp4 = d eta_1/d x_1
1230 Vmath::Svtsvtp(nqtot, df[0][0], &h0[0], 1, df[2][0], &h1[0], 1,
1231 &wsp4[0], 1);
1232 // wsp5 = d eta_2/d x_1
1233 Vmath::Svtsvtp(nqtot, df[3][0], &h0[0], 1, df[5][0], &h1[0], 1,
1234 &wsp5[0], 1);
1235 // wsp6 = d eta_3/d x_1
1236 Vmath::Svtsvtp(nqtot, df[6][0], &h0[0], 1, df[8][0], &h1[0], 1,
1237 &wsp6[0], 1);
1238
1239 // g0 (overwrites h0)
1240 Vmath::Vvtvvtp(nqtot, &wsp4[0], 1, &wsp4[0], 1, &wsp5[0], 1, &wsp5[0],
1241 1, &g0[0], 1);
1242 Vmath::Vvtvp(nqtot, &wsp6[0], 1, &wsp6[0], 1, &g0[0], 1, &g0[0], 1);
1243
1244 // g3 (overwrites h1)
1245 Vmath::Svtsvtp(nqtot, df[1][0], &wsp4[0], 1, df[4][0], &wsp5[0], 1,
1246 &g3[0], 1);
1247 Vmath::Svtvp(nqtot, df[7][0], &wsp6[0], 1, &g3[0], 1, &g3[0], 1);
1248
1249 // g4
1250 Vmath::Svtsvtp(nqtot, df[2][0], &wsp4[0], 1, df[5][0], &wsp5[0], 1,
1251 &g4[0], 1);
1252 Vmath::Svtvp(nqtot, df[8][0], &wsp6[0], 1, &g4[0], 1, &g4[0], 1);
1253
1254 // Overwrite wsp4/5/6 with g1/2/5
1255 // g1
1256 Vmath::Fill(nqtot,
1257 df[1][0] * df[1][0] + df[4][0] * df[4][0] +
1258 df[7][0] * df[7][0],
1259 &g1[0], 1);
1260
1261 // g2
1262 Vmath::Fill(nqtot,
1263 df[2][0] * df[2][0] + df[5][0] * df[5][0] +
1264 df[8][0] * df[8][0],
1265 &g2[0], 1);
1266
1267 // g5
1268 Vmath::Fill(nqtot,
1269 df[1][0] * df[2][0] + df[4][0] * df[5][0] +
1270 df[7][0] * df[8][0],
1271 &g5[0], 1);
1272 }
1273 // Compute component derivatives into wsp7, 8, 9 (wsp7 overwrites
1274 // g0).
1275 Vmath::Vvtvvtp(nqtot, &g0[0], 1, &wsp1[0], 1, &g3[0], 1, &wsp2[0], 1,
1276 &wsp7[0], 1);
1277 Vmath::Vvtvp(nqtot, &g4[0], 1, &wsp3[0], 1, &wsp7[0], 1, &wsp7[0], 1);
1278 Vmath::Vvtvvtp(nqtot, &g1[0], 1, &wsp2[0], 1, &g3[0], 1, &wsp1[0], 1,
1279 &wsp8[0], 1);
1280 Vmath::Vvtvp(nqtot, &g5[0], 1, &wsp3[0], 1, &wsp8[0], 1, &wsp8[0], 1);
1281 Vmath::Vvtvvtp(nqtot, &g2[0], 1, &wsp3[0], 1, &g4[0], 1, &wsp1[0], 1,
1282 &wsp9[0], 1);
1283 Vmath::Vvtvp(nqtot, &g5[0], 1, &wsp2[0], 1, &wsp9[0], 1, &wsp9[0], 1);
1284
1285 // Step 4.
1286 // Multiply by quadrature metric
1287 MultiplyByQuadratureMetric(wsp7, wsp7);
1288 MultiplyByQuadratureMetric(wsp8, wsp8);
1289 MultiplyByQuadratureMetric(wsp9, wsp9);
1290
1291 // Perform inner product w.r.t derivative bases.
1292 IProductWRTBase_SumFacKernel(dbase0, base1, base2, wsp7, wsp1, wsp, false,
1293 true, true);
1294 IProductWRTBase_SumFacKernel(base0, dbase1, base2, wsp8, wsp2, wsp, true,
1295 false, true);
1296 IProductWRTBase_SumFacKernel(base0, base1, dbase2, wsp9, outarray, wsp,
1297 true, true, false);
1298
1299 // Step 5.
1300 // Sum contributions from wsp1, wsp2 and outarray.
1301 Vmath::Vadd(m_ncoeffs, wsp1.get(), 1, outarray.get(), 1, outarray.get(), 1);
1302 Vmath::Vadd(m_ncoeffs, wsp2.get(), 1, outarray.get(), 1, outarray.get(), 1);
1303}
1304
1306 Array<OneD, int> &conn, [[maybe_unused]] bool oldstandard)
1307{
1308 int np0 = m_base[0]->GetNumPoints();
1309 int np1 = m_base[1]->GetNumPoints();
1310 int np2 = m_base[2]->GetNumPoints();
1311 int np = max(np0, max(np1, np2));
1312 Array<OneD, int> prismpt(6);
1313 bool standard = true;
1314
1315 int vid0 = m_geom->GetVid(0);
1316 int vid1 = m_geom->GetVid(1);
1317 int vid2 = m_geom->GetVid(4);
1318 int rotate = 0;
1319
1320 // sort out prism rotation according to
1321 if ((vid2 < vid1) && (vid2 < vid0)) // top triangle vertex is lowest id
1322 {
1323 rotate = 0;
1324 if (vid0 > vid1)
1325 {
1326 standard = false; // reverse base direction
1327 }
1328 }
1329 else if ((vid1 < vid2) && (vid1 < vid0))
1330 {
1331 rotate = 1;
1332 if (vid2 > vid0)
1333 {
1334 standard = false; // reverse base direction
1335 }
1336 }
1337 else if ((vid0 < vid2) && (vid0 < vid1))
1338 {
1339 rotate = 2;
1340 if (vid1 > vid2)
1341 {
1342 standard = false; // reverse base direction
1343 }
1344 }
1345
1346 conn = Array<OneD, int>(12 * (np - 1) * (np - 1) * (np - 1));
1347
1348 int row = 0;
1349 int rowp1 = 0;
1350 int plane = 0;
1351 int row1 = 0;
1352 int row1p1 = 0;
1353 int planep1 = 0;
1354 int cnt = 0;
1355
1356 Array<OneD, int> rot(3);
1357
1358 rot[0] = (0 + rotate) % 3;
1359 rot[1] = (1 + rotate) % 3;
1360 rot[2] = (2 + rotate) % 3;
1361
1362 // lower diagonal along 1-3 on base
1363 for (int i = 0; i < np - 1; ++i)
1364 {
1365 planep1 += (np - i) * np;
1366 row = 0; // current plane row offset
1367 rowp1 = 0; // current plane row plus one offset
1368 row1 = 0; // next plane row offset
1369 row1p1 = 0; // nex plane row plus one offset
1370 if (standard == false)
1371 {
1372 for (int j = 0; j < np - 1; ++j)
1373 {
1374 rowp1 += np - i;
1375 row1p1 += np - i - 1;
1376 for (int k = 0; k < np - i - 2; ++k)
1377 {
1378 // bottom prism block
1379 prismpt[rot[0]] = plane + row + k;
1380 prismpt[rot[1]] = plane + row + k + 1;
1381 prismpt[rot[2]] = planep1 + row1 + k;
1382
1383 prismpt[3 + rot[0]] = plane + rowp1 + k;
1384 prismpt[3 + rot[1]] = plane + rowp1 + k + 1;
1385 prismpt[3 + rot[2]] = planep1 + row1p1 + k;
1386
1387 conn[cnt++] = prismpt[0];
1388 conn[cnt++] = prismpt[1];
1389 conn[cnt++] = prismpt[3];
1390 conn[cnt++] = prismpt[2];
1391
1392 conn[cnt++] = prismpt[5];
1393 conn[cnt++] = prismpt[2];
1394 conn[cnt++] = prismpt[3];
1395 conn[cnt++] = prismpt[4];
1396
1397 conn[cnt++] = prismpt[3];
1398 conn[cnt++] = prismpt[1];
1399 conn[cnt++] = prismpt[4];
1400 conn[cnt++] = prismpt[2];
1401
1402 // upper prism block.
1403 prismpt[rot[0]] = planep1 + row1 + k + 1;
1404 prismpt[rot[1]] = planep1 + row1 + k;
1405 prismpt[rot[2]] = plane + row + k + 1;
1406
1407 prismpt[3 + rot[0]] = planep1 + row1p1 + k + 1;
1408 prismpt[3 + rot[1]] = planep1 + row1p1 + k;
1409 prismpt[3 + rot[2]] = plane + rowp1 + k + 1;
1410
1411 conn[cnt++] = prismpt[0];
1412 conn[cnt++] = prismpt[1];
1413 conn[cnt++] = prismpt[2];
1414 conn[cnt++] = prismpt[5];
1415
1416 conn[cnt++] = prismpt[5];
1417 conn[cnt++] = prismpt[0];
1418 conn[cnt++] = prismpt[4];
1419 conn[cnt++] = prismpt[1];
1420
1421 conn[cnt++] = prismpt[3];
1422 conn[cnt++] = prismpt[4];
1423 conn[cnt++] = prismpt[0];
1424 conn[cnt++] = prismpt[5];
1425 }
1426
1427 // bottom prism block
1428 prismpt[rot[0]] = plane + row + np - i - 2;
1429 prismpt[rot[1]] = plane + row + np - i - 1;
1430 prismpt[rot[2]] = planep1 + row1 + np - i - 2;
1431
1432 prismpt[3 + rot[0]] = plane + rowp1 + np - i - 2;
1433 prismpt[3 + rot[1]] = plane + rowp1 + np - i - 1;
1434 prismpt[3 + rot[2]] = planep1 + row1p1 + np - i - 2;
1435
1436 conn[cnt++] = prismpt[0];
1437 conn[cnt++] = prismpt[1];
1438 conn[cnt++] = prismpt[3];
1439 conn[cnt++] = prismpt[2];
1440
1441 conn[cnt++] = prismpt[5];
1442 conn[cnt++] = prismpt[2];
1443 conn[cnt++] = prismpt[3];
1444 conn[cnt++] = prismpt[4];
1445
1446 conn[cnt++] = prismpt[3];
1447 conn[cnt++] = prismpt[1];
1448 conn[cnt++] = prismpt[4];
1449 conn[cnt++] = prismpt[2];
1450
1451 row += np - i;
1452 row1 += np - i - 1;
1453 }
1454 }
1455 else
1456 { // lower diagonal along 0-4 on base
1457 for (int j = 0; j < np - 1; ++j)
1458 {
1459 rowp1 += np - i;
1460 row1p1 += np - i - 1;
1461 for (int k = 0; k < np - i - 2; ++k)
1462 {
1463 // bottom prism block
1464 prismpt[rot[0]] = plane + row + k;
1465 prismpt[rot[1]] = plane + row + k + 1;
1466 prismpt[rot[2]] = planep1 + row1 + k;
1467
1468 prismpt[3 + rot[0]] = plane + rowp1 + k;
1469 prismpt[3 + rot[1]] = plane + rowp1 + k + 1;
1470 prismpt[3 + rot[2]] = planep1 + row1p1 + k;
1471
1472 conn[cnt++] = prismpt[0];
1473 conn[cnt++] = prismpt[1];
1474 conn[cnt++] = prismpt[4];
1475 conn[cnt++] = prismpt[2];
1476
1477 conn[cnt++] = prismpt[4];
1478 conn[cnt++] = prismpt[3];
1479 conn[cnt++] = prismpt[0];
1480 conn[cnt++] = prismpt[2];
1481
1482 conn[cnt++] = prismpt[3];
1483 conn[cnt++] = prismpt[4];
1484 conn[cnt++] = prismpt[5];
1485 conn[cnt++] = prismpt[2];
1486
1487 // upper prism block.
1488 prismpt[rot[0]] = planep1 + row1 + k + 1;
1489 prismpt[rot[1]] = planep1 + row1 + k;
1490 prismpt[rot[2]] = plane + row + k + 1;
1491
1492 prismpt[3 + rot[0]] = planep1 + row1p1 + k + 1;
1493 prismpt[3 + rot[1]] = planep1 + row1p1 + k;
1494 prismpt[3 + rot[2]] = plane + rowp1 + k + 1;
1495
1496 conn[cnt++] = prismpt[0];
1497 conn[cnt++] = prismpt[2];
1498 conn[cnt++] = prismpt[1];
1499 conn[cnt++] = prismpt[5];
1500
1501 conn[cnt++] = prismpt[3];
1502 conn[cnt++] = prismpt[5];
1503 conn[cnt++] = prismpt[0];
1504 conn[cnt++] = prismpt[1];
1505
1506 conn[cnt++] = prismpt[5];
1507 conn[cnt++] = prismpt[3];
1508 conn[cnt++] = prismpt[4];
1509 conn[cnt++] = prismpt[1];
1510 }
1511
1512 // bottom prism block
1513 prismpt[rot[0]] = plane + row + np - i - 2;
1514 prismpt[rot[1]] = plane + row + np - i - 1;
1515 prismpt[rot[2]] = planep1 + row1 + np - i - 2;
1516
1517 prismpt[3 + rot[0]] = plane + rowp1 + np - i - 2;
1518 prismpt[3 + rot[1]] = plane + rowp1 + np - i - 1;
1519 prismpt[3 + rot[2]] = planep1 + row1p1 + np - i - 2;
1520
1521 conn[cnt++] = prismpt[0];
1522 conn[cnt++] = prismpt[1];
1523 conn[cnt++] = prismpt[4];
1524 conn[cnt++] = prismpt[2];
1525
1526 conn[cnt++] = prismpt[4];
1527 conn[cnt++] = prismpt[3];
1528 conn[cnt++] = prismpt[0];
1529 conn[cnt++] = prismpt[2];
1530
1531 conn[cnt++] = prismpt[3];
1532 conn[cnt++] = prismpt[4];
1533 conn[cnt++] = prismpt[5];
1534 conn[cnt++] = prismpt[2];
1535
1536 row += np - i;
1537 row1 += np - i - 1;
1538 }
1539 }
1540 plane += (np - i) * np;
1541 }
1542}
1543
1544/** @brief: This method gets all of the factors which are
1545 required as part of the Gradient Jump Penalty
1546 stabilisation and involves the product of the normal and
1547 geometric factors along the element trace.
1548*/
1550 Array<OneD, Array<OneD, NekDouble>> &d0factors,
1551 Array<OneD, Array<OneD, NekDouble>> &d1factors,
1552 Array<OneD, Array<OneD, NekDouble>> &d2factors)
1553{
1554 int nquad0 = GetNumPoints(0);
1555 int nquad1 = GetNumPoints(1);
1556 int nquad2 = GetNumPoints(2);
1557
1559 m_metricinfo->GetDerivFactors(GetPointsKeys());
1560
1561 if (d0factors.size() != 5)
1562 {
1563 d0factors = Array<OneD, Array<OneD, NekDouble>>(5);
1564 d1factors = Array<OneD, Array<OneD, NekDouble>>(5);
1565 d2factors = Array<OneD, Array<OneD, NekDouble>>(5);
1566 }
1567
1568 if (d0factors[0].size() != nquad0 * nquad1)
1569 {
1570 d0factors[0] = Array<OneD, NekDouble>(nquad0 * nquad1);
1571 d1factors[0] = Array<OneD, NekDouble>(nquad0 * nquad1);
1572 d2factors[0] = Array<OneD, NekDouble>(nquad0 * nquad1);
1573 }
1574
1575 if (d0factors[1].size() != nquad0 * nquad2)
1576 {
1577 d0factors[1] = Array<OneD, NekDouble>(nquad0 * nquad2);
1578 d0factors[3] = Array<OneD, NekDouble>(nquad0 * nquad2);
1579 d1factors[1] = Array<OneD, NekDouble>(nquad0 * nquad2);
1580 d1factors[3] = Array<OneD, NekDouble>(nquad0 * nquad2);
1581 d2factors[1] = Array<OneD, NekDouble>(nquad0 * nquad2);
1582 d2factors[3] = Array<OneD, NekDouble>(nquad0 * nquad2);
1583 }
1584
1585 if (d0factors[2].size() != nquad1 * nquad2)
1586 {
1587 d0factors[2] = Array<OneD, NekDouble>(nquad1 * nquad2);
1588 d0factors[4] = Array<OneD, NekDouble>(nquad1 * nquad2);
1589 d1factors[2] = Array<OneD, NekDouble>(nquad1 * nquad2);
1590 d1factors[4] = Array<OneD, NekDouble>(nquad1 * nquad2);
1591 d2factors[2] = Array<OneD, NekDouble>(nquad1 * nquad2);
1592 d2factors[4] = Array<OneD, NekDouble>(nquad1 * nquad2);
1593 }
1594
1595 // Outwards normals
1597 GetTraceNormal(0);
1599 GetTraceNormal(1);
1601 GetTraceNormal(2);
1603 GetTraceNormal(3);
1605 GetTraceNormal(4);
1606
1607 int ncoords = normal_0.size();
1608
1609 // first gather together standard cartesian inner products
1610 if (m_metricinfo->GetGtype() == SpatialDomains::eDeformed)
1611 {
1612 // face 0
1613 for (int i = 0; i < nquad0 * nquad1; ++i)
1614 {
1615 d0factors[0][i] = df[0][i] * normal_0[0][i];
1616 d1factors[0][i] = df[1][i] * normal_0[0][i];
1617 d2factors[0][i] = df[2][i] * normal_0[0][i];
1618 }
1619
1620 for (int n = 1; n < ncoords; ++n)
1621 {
1622 for (int i = 0; i < nquad0 * nquad1; ++i)
1623 {
1624 d0factors[0][i] += df[3 * n][i] * normal_0[n][i];
1625 d1factors[0][i] += df[3 * n + 1][i] * normal_0[n][i];
1626 d2factors[0][i] += df[3 * n + 2][i] * normal_0[n][i];
1627 }
1628 }
1629
1630 // faces 1 and 3
1631 for (int j = 0; j < nquad2; ++j)
1632 {
1633 for (int i = 0; i < nquad0; ++i)
1634 {
1635 d0factors[1][j * nquad0 + i] = df[0][j * nquad0 * nquad1 + i] *
1636 normal_1[0][j * nquad0 + i];
1637 d1factors[1][j * nquad0 + i] = df[1][j * nquad0 * nquad1 + i] *
1638 normal_1[0][j * nquad0 + i];
1639 d2factors[1][j * nquad0 + i] = df[2][j * nquad0 * nquad1 + i] *
1640 normal_1[0][j * nquad0 + i];
1641
1642 d0factors[3][j * nquad0 + i] =
1643 df[0][(j + 1) * nquad0 * nquad1 - nquad0 + i] *
1644 normal_3[0][j * nquad0 + i];
1645 d1factors[3][j * nquad0 + i] =
1646 df[1][(j + 1) * nquad0 * nquad1 - nquad0 + i] *
1647 normal_3[0][j * nquad0 + i];
1648 d2factors[3][j * nquad0 + i] =
1649 df[2][(j + 1) * nquad0 * nquad1 - nquad0 + i] *
1650 normal_3[0][j * nquad0 + i];
1651 }
1652 }
1653
1654 for (int n = 1; n < ncoords; ++n)
1655 {
1656 for (int j = 0; j < nquad2; ++j)
1657 {
1658 for (int i = 0; i < nquad0; ++i)
1659 {
1660 d0factors[1][j * nquad0 + i] +=
1661 df[3 * n][j * nquad0 * nquad1 + i] *
1662 normal_1[n][j * nquad0 + i];
1663 d1factors[1][j * nquad0 + i] +=
1664 df[3 * n + 1][j * nquad0 * nquad1 + i] *
1665 normal_1[n][j * nquad0 + i];
1666 d2factors[1][j * nquad0 + i] +=
1667 df[3 * n + 2][j * nquad0 * nquad1 + i] *
1668 normal_1[n][j * nquad0 + i];
1669
1670 d0factors[3][j * nquad0 + i] +=
1671 df[3 * n][(j + 1) * nquad0 * nquad1 - nquad0 + i] *
1672 normal_3[n][j * nquad0 + i];
1673 d1factors[3][j * nquad0 + i] +=
1674 df[3 * n + 1][(j + 1) * nquad0 * nquad1 - nquad0 + i] *
1675 normal_3[n][j * nquad0 + i];
1676 d2factors[3][j * nquad0 + i] +=
1677 df[3 * n + 2][(j + 1) * nquad0 * nquad1 - nquad0 + i] *
1678 normal_3[n][j * nquad0 + i];
1679 }
1680 }
1681 }
1682
1683 // faces 2 and 4
1684 for (int j = 0; j < nquad2; ++j)
1685 {
1686 for (int i = 0; i < nquad1; ++i)
1687 {
1688 d0factors[2][j * nquad1 + i] =
1689 df[0][j * nquad0 * nquad1 + (i + 1) * nquad0 - 1] *
1690 normal_2[0][j * nquad1 + i];
1691 d1factors[2][j * nquad1 + i] =
1692 df[1][j * nquad0 * nquad1 + (i + 1) * nquad0 - 1] *
1693 normal_2[0][j * nquad1 + i];
1694 d2factors[2][j * nquad1 + i] =
1695 df[2][j * nquad0 * nquad1 + (i + 1) * nquad0 - 1] *
1696 normal_2[0][j * nquad1 + i];
1697
1698 d0factors[4][j * nquad1 + i] =
1699 df[0][j * nquad0 * nquad1 + i * nquad0] *
1700 normal_4[0][j * nquad1 + i];
1701 d1factors[4][j * nquad1 + i] =
1702 df[1][j * nquad0 * nquad1 + i * nquad0] *
1703 normal_4[0][j * nquad1 + i];
1704 d2factors[4][j * nquad1 + i] =
1705 df[2][j * nquad0 * nquad1 + i * nquad0] *
1706 normal_4[0][j * nquad1 + i];
1707 }
1708 }
1709
1710 for (int n = 1; n < ncoords; ++n)
1711 {
1712 for (int j = 0; j < nquad2; ++j)
1713 {
1714 for (int i = 0; i < nquad1; ++i)
1715 {
1716 d0factors[2][j * nquad1 + i] +=
1717 df[3 * n][j * nquad0 * nquad1 + (i + 1) * nquad0 - 1] *
1718 normal_2[n][j * nquad1 + i];
1719 d1factors[2][j * nquad1 + i] +=
1720 df[3 * n + 1]
1721 [j * nquad0 * nquad1 + (i + 1) * nquad0 - 1] *
1722 normal_2[n][j * nquad1 + i];
1723 d2factors[2][j * nquad1 + i] +=
1724 df[3 * n + 2]
1725 [j * nquad0 * nquad1 + (i + 1) * nquad0 - 1] *
1726 normal_2[n][j * nquad1 + i];
1727
1728 d0factors[4][j * nquad1 + i] +=
1729 df[3 * n][j * nquad0 * nquad1 + i * nquad0] *
1730 normal_4[n][j * nquad1 + i];
1731 d1factors[4][j * nquad1 + i] +=
1732 df[3 * n + 1][j * nquad0 * nquad1 + i * nquad0] *
1733 normal_4[n][j * nquad1 + i];
1734 d2factors[4][j * nquad1 + i] +=
1735 df[3 * n + 2][j * nquad0 * nquad1 + i * nquad0] *
1736 normal_4[n][j * nquad1 + i];
1737 }
1738 }
1739 }
1740 }
1741 else
1742 {
1743 // Face 0
1744 for (int i = 0; i < nquad0 * nquad1; ++i)
1745 {
1746 d0factors[0][i] = df[0][0] * normal_0[0][i];
1747 d1factors[0][i] = df[1][0] * normal_0[0][i];
1748 d2factors[0][i] = df[2][0] * normal_0[0][i];
1749 }
1750
1751 for (int n = 1; n < ncoords; ++n)
1752 {
1753 for (int i = 0; i < nquad0 * nquad1; ++i)
1754 {
1755 d0factors[0][i] += df[3 * n][0] * normal_0[n][i];
1756 d1factors[0][i] += df[3 * n + 1][0] * normal_0[n][i];
1757 d2factors[0][i] += df[3 * n + 2][0] * normal_0[n][i];
1758 }
1759 }
1760
1761 // faces 1 and 3
1762 for (int i = 0; i < nquad0 * nquad2; ++i)
1763 {
1764 d0factors[1][i] = df[0][0] * normal_1[0][i];
1765 d0factors[3][i] = df[0][0] * normal_3[0][i];
1766
1767 d1factors[1][i] = df[1][0] * normal_1[0][i];
1768 d1factors[3][i] = df[1][0] * normal_3[0][i];
1769
1770 d2factors[1][i] = df[2][0] * normal_1[0][i];
1771 d2factors[3][i] = df[2][0] * normal_3[0][i];
1772 }
1773
1774 for (int n = 1; n < ncoords; ++n)
1775 {
1776 for (int i = 0; i < nquad0 * nquad2; ++i)
1777 {
1778 d0factors[1][i] += df[3 * n][0] * normal_1[n][i];
1779 d0factors[3][i] += df[3 * n][0] * normal_3[n][i];
1780
1781 d1factors[1][i] += df[3 * n + 1][0] * normal_1[n][i];
1782 d1factors[3][i] += df[3 * n + 1][0] * normal_3[n][i];
1783
1784 d2factors[1][i] += df[3 * n + 2][0] * normal_1[n][i];
1785 d2factors[3][i] += df[3 * n + 2][0] * normal_3[n][i];
1786 }
1787 }
1788
1789 // faces 2 and 4
1790 for (int i = 0; i < nquad1 * nquad2; ++i)
1791 {
1792 d0factors[2][i] = df[0][0] * normal_2[0][i];
1793 d0factors[4][i] = df[0][0] * normal_4[0][i];
1794
1795 d1factors[2][i] = df[1][0] * normal_2[0][i];
1796 d1factors[4][i] = df[1][0] * normal_4[0][i];
1797
1798 d2factors[2][i] = df[2][0] * normal_2[0][i];
1799 d2factors[4][i] = df[2][0] * normal_4[0][i];
1800 }
1801
1802 for (int n = 1; n < ncoords; ++n)
1803 {
1804 for (int i = 0; i < nquad1 * nquad2; ++i)
1805 {
1806 d0factors[2][i] += df[3 * n][0] * normal_2[n][i];
1807 d0factors[4][i] += df[3 * n][0] * normal_4[n][i];
1808
1809 d1factors[2][i] += df[3 * n + 1][0] * normal_2[n][i];
1810 d1factors[4][i] += df[3 * n + 1][0] * normal_4[n][i];
1811
1812 d2factors[2][i] += df[3 * n + 2][0] * normal_2[n][i];
1813 d2factors[4][i] += df[3 * n + 2][0] * normal_4[n][i];
1814 }
1815 }
1816 }
1817}
1818} // namespace Nektar::LocalRegions
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:208
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Definition: ErrorUtil.hpp:242
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:276
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:286
SpatialDomains::GeometrySharedPtr GetGeom() const
Definition: Expansion.cpp:167
SpatialDomains::GeometrySharedPtr m_geom
Definition: Expansion.h:273
void v_GetCoords(Array< OneD, NekDouble > &coords_1, Array< OneD, NekDouble > &coords_2, Array< OneD, NekDouble > &coords_3) override
Definition: Expansion.cpp:530
SpatialDomains::GeomFactorsSharedPtr m_metricinfo
Definition: Expansion.h:274
const NormalVector & GetTraceNormal(const int id)
Definition: Expansion.cpp:251
DNekMatSharedPtr v_CreateStdMatrix(const StdRegions::StdMatrixKey &mkey) override
Definition: PrismExp.cpp:1068
DNekMatSharedPtr v_GenMatrix(const StdRegions::StdMatrixKey &mkey) override
Definition: PrismExp.cpp:1045
StdRegions::StdExpansionSharedPtr v_GetStdExp(void) const override
Definition: PrismExp.cpp:458
void v_LaplacianMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition: PrismExp.cpp:992
void v_DropLocStaticCondMatrix(const MatrixKey &mkey) override
Definition: PrismExp.cpp:1096
void v_HelmholtzMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition: PrismExp.cpp:1007
void v_GetSimplexEquiSpacedConnectivity(Array< OneD, int > &conn, bool standard=true) override
Definition: PrismExp.cpp:1305
void v_IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Calculate the inner product of inarray with respect to the basis B=base0*base1*base2 and put into out...
Definition: PrismExp.cpp:261
DNekScalMatSharedPtr v_GetLocMatrix(const MatrixKey &mkey) override
Definition: PrismExp.cpp:1080
void v_IProductWRTDerivBase(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Calculates the inner product .
Definition: PrismExp.cpp:327
void v_PhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1, Array< OneD, NekDouble > &out_d2) override
Calculate the derivative of the physical points.
Definition: PrismExp.cpp:123
LibUtilities::NekManager< MatrixKey, DNekScalBlkMat, MatrixKey::opLess > m_staticCondMatrixManager
Definition: PrismExp.h:200
void v_IProductWRTBase_SumFac(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool multiplybyweights=true) override
Definition: PrismExp.cpp:267
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: PrismExp.cpp:545
void v_GetCoord(const Array< OneD, const NekDouble > &Lcoords, Array< OneD, NekDouble > &coords) override
Get the coordinates #coords at the local coordinates #Lcoords.
Definition: PrismExp.cpp:482
void v_NormalTraceDerivFactors(Array< OneD, Array< OneD, NekDouble > > &d0factors, Array< OneD, Array< OneD, NekDouble > > &d1factors, Array< OneD, Array< OneD, NekDouble > > &d2factors) override
: This method gets all of the factors which are required as part of the Gradient Jump Penalty stabili...
Definition: PrismExp.cpp:1549
void v_AlignVectorToCollapsedDir(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray) override
Definition: PrismExp.cpp:378
StdRegions::StdExpansionSharedPtr v_GetLinStdExp(void) const override
Definition: PrismExp.cpp:465
void v_ComputeTraceNormal(const int face) override
Get the normals along specficied face Get the face normals interplated to a points0 x points 0 type d...
Definition: PrismExp.cpp:703
void v_MassMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition: PrismExp.cpp:985
void v_LaplacianMatrixOp_MatFree_Kernel(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp) override
Calculate the Laplacian multiplication in a matrix-free manner.
Definition: PrismExp.cpp:1119
void v_IProductWRTDerivBase_SumFac(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition: PrismExp.cpp:334
NekDouble v_StdPhysEvaluate(const Array< OneD, const NekDouble > &Lcoord, const Array< OneD, const NekDouble > &physvals) override
Definition: PrismExp.cpp:511
void v_FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Forward transform from physical quadrature space stored in inarray and evaluate the expansion coeffic...
Definition: PrismExp.cpp:209
PrismExp(const LibUtilities::BasisKey &Ba, const LibUtilities::BasisKey &Bb, const LibUtilities::BasisKey &Bc, const SpatialDomains::PrismGeomSharedPtr &geom)
Constructor using BasisKey class for quadrature points and order definition.
Definition: PrismExp.cpp:45
void v_GetTracePhysMap(const int face, Array< OneD, int > &outarray) override
Definition: PrismExp.cpp:602
void v_DropLocMatrix(const MatrixKey &mkey) override
Definition: PrismExp.cpp:1085
NekDouble v_PhysEvaluate(const Array< OneD, const NekDouble > &coord, const Array< OneD, const NekDouble > &physvals) override
This function evaluates the expansion at a single (arbitrary) point of the domain.
Definition: PrismExp.cpp:519
void v_SVVLaplacianFilter(Array< OneD, NekDouble > &array, const StdRegions::StdMatrixKey &mkey) override
Definition: PrismExp.cpp:1014
LibUtilities::NekManager< MatrixKey, DNekScalMat, MatrixKey::opLess > m_matrixManager
Definition: PrismExp.h:198
DNekScalBlkMatSharedPtr v_GetLocStaticCondMatrix(const MatrixKey &mkey) override
Definition: PrismExp.cpp:1090
NekDouble v_Integral(const Array< OneD, const NekDouble > &inarray) override
Integrate the physical point list inarray over prismatic region and return the value.
Definition: PrismExp.cpp:96
void v_GetCoords(Array< OneD, NekDouble > &coords_1, Array< OneD, NekDouble > &coords_2, Array< OneD, NekDouble > &coords_3) override
Definition: PrismExp.cpp:499
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
void IProductWRTBase_SumFacKernel(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, Array< OneD, NekDouble > &wsp, bool doCheckCollDir0, bool doCheckCollDir1, bool doCheckCollDir2)
void v_HelmholtzMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
int GetNcoeffs(void) const
This function returns the total number of coefficients used in the expansion.
Definition: StdExpansion.h:124
int GetTotPoints() const
This function returns the total number of quadrature points used in the element.
Definition: StdExpansion.h:134
LibUtilities::BasisType GetBasisType(const int dir) const
This function returns the type of basis used in the dir direction.
Definition: StdExpansion.h:156
const LibUtilities::PointsKeyVector GetPointsKeys() const
const LibUtilities::BasisKey GetTraceBasisKey(const int i, int k=-1) const
This function returns the basis key belonging to the i-th trace.
Definition: StdExpansion.h:299
void LaplacianMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
LibUtilities::ShapeType DetShapeType() const
This function returns the shape of the expansion domain.
Definition: StdExpansion.h:367
LibUtilities::PointsType GetPointsType(const int dir) const
This function returns the type of quadrature points used in the dir direction.
Definition: StdExpansion.h:205
int GetNumPoints(const int dir) const
This function returns the number of quadrature points in the dir direction.
Definition: StdExpansion.h:218
void MultiplyByQuadratureMetric(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: StdExpansion.h:723
Array< OneD, LibUtilities::BasisSharedPtr > m_base
MatrixType GetMatrixType() const
Definition: StdMatrixKey.h:83
static void Dscal(const int &n, const double &alpha, double *x, const int &incx)
BLAS level 1: x = alpha x.
Definition: Blas.hpp:149
static void Daxpy(const int &n, const double &alpha, const double *x, const int &incx, const double *y, const int &incy)
BLAS level 1: y = alpha x plus y.
Definition: Blas.hpp:135
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:231
@ eModified_B
Principle Modified Functions .
Definition: BasisType.h:49
@ eModified_A
Principle Modified Functions .
Definition: BasisType.h:48
std::shared_ptr< GeomFactors > GeomFactorsSharedPtr
Pointer to a GeomFactors object.
Definition: GeomFactors.h:60
std::shared_ptr< PrismGeom > PrismGeomSharedPtr
Definition: PrismGeom.h:82
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< StdPrismExp > StdPrismExpSharedPtr
Definition: StdPrismExp.h:218
std::shared_ptr< StdExpansion > StdExpansionSharedPtr
std::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
std::shared_ptr< DNekScalBlkMat > DNekScalBlkMatSharedPtr
Definition: NekTypeDefs.hpp:79
std::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:75
double NekDouble
void Vsqrt(int n, const T *x, const int incx, T *y, const int incy)
sqrt y = sqrt(x)
Definition: Vmath.hpp:340
void Svtsvtp(int n, const T alpha, const T *x, int incx, const T beta, const T *y, int incy, T *z, int incz)
Svtsvtp (scalar times vector plus scalar times vector):
Definition: Vmath.hpp:473
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 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.
Definition: Vmath.hpp:396
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 > sqrt(scalarT< T > in)
Definition: scalar.hpp:294