40 #include <boost/math/special_functions/gamma.hpp>
85 Array<OneD, MultiRegions::ExpListSharedPtr> pFields)
94 m_session->LoadParameter (
"thermalConductivity",
103 int nConvectiveFields = pFields.num_elements();
104 int nScalars = nConvectiveFields - 1;
105 int nDim = pFields[0]->GetCoordim(0);
106 int nSolutionPts = pFields[0]->GetTotPoints();
107 int nTracePts = pFields[0]->GetTrace()->GetTotPoints();
110 if (pSession->DefinesSolverInfo(
"HOMOGENEOUS"))
121 m_traceVel[i] = Array<OneD, NekDouble> (nTracePts, 0.0);
124 m_IF1 = Array<OneD, Array<OneD, Array<OneD, NekDouble> > > (
126 m_DU1 = Array<OneD, Array<OneD, Array<OneD, NekDouble> > > (
128 m_DFC1 = Array<OneD, Array<OneD, Array<OneD, NekDouble> > > (
130 m_tmp1 = Array<OneD, Array<OneD, Array<OneD, NekDouble> > > (
132 m_tmp2 = Array<OneD, Array<OneD, Array<OneD, NekDouble> > > (
134 m_BD1 = Array<OneD, Array<OneD, Array<OneD, NekDouble> > > (
138 m_DFC2 = Array<OneD, Array<OneD, Array<OneD, NekDouble> > > (
140 m_DD1 = Array<OneD, Array<OneD, Array<OneD, NekDouble> > > (
142 m_viscFlux = Array<OneD, Array<OneD, NekDouble> > (
144 m_divFD = Array<OneD, Array<OneD, NekDouble> > (nConvectiveFields);
145 m_divFC = Array<OneD, Array<OneD, NekDouble> > (nConvectiveFields);
147 m_D1 = Array<OneD, Array<OneD, Array<OneD, NekDouble> > >
149 m_viscTensor = Array<OneD, Array<OneD, Array<OneD, NekDouble> > >
151 for (i = 0; i < nScalars; ++i)
154 m_DU1[i] = Array<OneD, Array<OneD, NekDouble> >(nDim);
155 m_DFC1[i] = Array<OneD, Array<OneD, NekDouble> >(nDim);
156 m_tmp1[i] = Array<OneD, Array<OneD, NekDouble> >(nDim);
157 m_tmp2[i] = Array<OneD, Array<OneD, NekDouble> >(nDim);
158 m_BD1[i] = Array<OneD, Array<OneD, NekDouble> >(nDim);
160 for (j = 0; j < nDim; ++j)
162 m_IF1[i][j] = Array<OneD, NekDouble>(nTracePts, 0.0);
163 m_DU1[i][j] = Array<OneD, NekDouble>(nSolutionPts, 0.0);
164 m_DFC1[i][j] = Array<OneD, NekDouble>(nSolutionPts, 0.0);
165 m_tmp1[i][j] = Array<OneD, NekDouble>(nSolutionPts, 0.0);
166 m_tmp2[i][j] = Array<OneD, NekDouble>(nSolutionPts, 0.0);
167 m_BD1[i][j] = Array<OneD, NekDouble>(nSolutionPts, 0.0);
171 for (i = 0; i < nConvectiveFields; ++i)
173 m_DFC2[i] = Array<OneD, Array<OneD, NekDouble> >(nDim);
174 m_DD1[i] = Array<OneD, Array<OneD, NekDouble> >(nDim);
175 m_viscFlux[i] = Array<OneD, NekDouble>(nTracePts, 0.0);
176 m_divFD[i] = Array<OneD, NekDouble>(nSolutionPts, 0.0);
177 m_divFC[i] = Array<OneD, NekDouble>(nSolutionPts, 0.0);
179 for (j = 0; j < nDim; ++j)
181 m_DFC2[i][j] = Array<OneD, NekDouble>(nSolutionPts, 0.0);
182 m_DD1[i][j] = Array<OneD, NekDouble>(nSolutionPts, 0.0);
188 m_D1[i] = Array<OneD, Array<OneD, NekDouble> >(nScalars);
190 for (j = 0; j < nScalars; ++j)
192 m_D1[i][j] = Array<OneD, NekDouble>(nSolutionPts, 0.0);
198 m_viscTensor[i] = Array<OneD, Array<OneD, NekDouble> >(nScalars+1);
200 for (j = 0; j < nScalars+1; ++j)
202 m_viscTensor[i][j] = Array<OneD, NekDouble>(nSolutionPts, 0.0);
225 Array<OneD, MultiRegions::ExpListSharedPtr> pFields)
230 int nLocalSolutionPts;
231 int nElements = pFields[0]->GetExpSize();
232 int nDimensions = pFields[0]->GetCoordim(0);
233 int nSolutionPts = pFields[0]->GetTotPoints();
234 int nTracePts = pFields[0]->GetTrace()->GetTotPoints();
236 m_traceNormals = Array<OneD, Array<OneD, NekDouble> >(nDimensions);
237 for (i = 0; i < nDimensions; ++i)
243 Array<TwoD, const NekDouble> gmat;
244 Array<OneD, const NekDouble> jac;
246 m_jac = Array<OneD, NekDouble>(nSolutionPts);
248 Array<OneD, NekDouble> auxArray1;
249 Array<OneD, LibUtilities::BasisSharedPtr> base;
256 for (n = 0; n < nElements; ++n)
258 ptsKeys = pFields[0]->GetExp(n)->GetPointsKeys();
259 nLocalSolutionPts = pFields[0]->GetExp(n)->GetTotPoints();
260 phys_offset = pFields[0]->GetPhys_Offset(n);
261 jac = pFields[0]->GetExp(n)
264 for (i = 0; i < nLocalSolutionPts; ++i)
266 m_jac[i+phys_offset] = jac[0];
273 m_gmat = Array<OneD, Array<OneD, NekDouble> >(4);
274 m_gmat[0] = Array<OneD, NekDouble>(nSolutionPts);
275 m_gmat[1] = Array<OneD, NekDouble>(nSolutionPts);
276 m_gmat[2] = Array<OneD, NekDouble>(nSolutionPts);
277 m_gmat[3] = Array<OneD, NekDouble>(nSolutionPts);
279 m_Q2D_e0 = Array<OneD, Array<OneD, NekDouble> >(nElements);
280 m_Q2D_e1 = Array<OneD, Array<OneD, NekDouble> >(nElements);
281 m_Q2D_e2 = Array<OneD, Array<OneD, NekDouble> >(nElements);
282 m_Q2D_e3 = Array<OneD, Array<OneD, NekDouble> >(nElements);
284 for (n = 0; n < nElements; ++n)
286 base = pFields[0]->GetExp(n)->GetBase();
287 nquad0 = base[0]->GetNumPoints();
288 nquad1 = base[1]->GetNumPoints();
290 m_Q2D_e0[n] = Array<OneD, NekDouble>(nquad0);
291 m_Q2D_e1[n] = Array<OneD, NekDouble>(nquad1);
292 m_Q2D_e2[n] = Array<OneD, NekDouble>(nquad0);
293 m_Q2D_e3[n] = Array<OneD, NekDouble>(nquad1);
296 pFields[0]->GetExp(n)->GetEdgeQFactors(
297 0, auxArray1 = m_Q2D_e0[n]);
298 pFields[0]->GetExp(n)->GetEdgeQFactors(
299 1, auxArray1 = m_Q2D_e1[n]);
300 pFields[0]->GetExp(n)->GetEdgeQFactors(
301 2, auxArray1 = m_Q2D_e2[n]);
302 pFields[0]->GetExp(n)->GetEdgeQFactors(
303 3, auxArray1 = m_Q2D_e3[n]);
305 ptsKeys = pFields[0]->GetExp(n)->GetPointsKeys();
306 nLocalSolutionPts = pFields[0]->GetExp(n)->GetTotPoints();
307 phys_offset = pFields[0]->GetPhys_Offset(n);
309 jac = pFields[0]->GetExp(n)
312 gmat = pFields[0]->GetExp(n)
316 if (pFields[0]->GetExp(n)
317 ->as<LocalRegions::Expansion2D>()->GetGeom2D()
318 ->GetMetricInfo()->GetGtype()
321 for (i = 0; i < nLocalSolutionPts; ++i)
323 m_jac[i+phys_offset] = jac[i];
324 m_gmat[0][i+phys_offset] = gmat[0][i];
325 m_gmat[1][i+phys_offset] = gmat[1][i];
326 m_gmat[2][i+phys_offset] = gmat[2][i];
327 m_gmat[3][i+phys_offset] = gmat[3][i];
332 for (i = 0; i < nLocalSolutionPts; ++i)
334 m_jac[i+phys_offset] = jac[0];
335 m_gmat[0][i+phys_offset] = gmat[0][0];
336 m_gmat[1][i+phys_offset] = gmat[1][0];
337 m_gmat[2][i+phys_offset] = gmat[2][0];
338 m_gmat[3][i+phys_offset] = gmat[3][0];
346 ASSERTL0(
false,
"3DFR Metric terms not implemented yet");
351 ASSERTL0(
false,
"Expansion dimension not recognised");
375 Array<OneD, MultiRegions::ExpListSharedPtr> pFields)
381 int nquad0, nquad1, nquad2;
382 int nmodes0, nmodes1, nmodes2;
383 Array<OneD, LibUtilities::BasisSharedPtr> base;
385 int nElements = pFields[0]->GetExpSize();
386 int nDim = pFields[0]->GetCoordim(0);
392 m_dGL_xi1 = Array<OneD, Array<OneD, NekDouble> >(nElements);
393 m_dGR_xi1 = Array<OneD, Array<OneD, NekDouble> >(nElements);
395 for (n = 0; n < nElements; ++n)
397 base = pFields[0]->GetExp(n)->GetBase();
398 nquad0 = base[0]->GetNumPoints();
399 nmodes0 = base[0]->GetNumModes();
400 Array<OneD, const NekDouble> z0;
401 Array<OneD, const NekDouble> w0;
403 base[0]->GetZW(z0, w0);
405 m_dGL_xi1[n] = Array<OneD, NekDouble>(nquad0);
406 m_dGR_xi1[n] = Array<OneD, NekDouble>(nquad0);
410 Array<OneD,NekDouble> dLp0 (nquad0, 0.0);
411 Array<OneD,NekDouble> dLpp0 (nquad0, 0.0);
412 Array<OneD,NekDouble> dLpm0 (nquad0, 0.0);
415 int p0 = nmodes0 - 1;
421 NekDouble ap0 = boost::math::tgamma(2 * p0 + 1)
423 * boost::math::tgamma(p0 + 1)
424 * boost::math::tgamma(p0 + 1));
433 c0 = 2.0 * p0 / ((2.0 * p0 + 1.0) * (p0 + 1.0)
434 * (ap0 * boost::math::tgamma(p0 + 1))
435 * (ap0 * boost::math::tgamma(p0 + 1)));
439 c0 = 2.0 * (p0 + 1.0) / ((2.0 * p0 + 1.0) * p0
440 * (ap0 * boost::math::tgamma(p0 + 1))
441 * (ap0 * boost::math::tgamma(p0 + 1)));
445 c0 = -2.0 / ((2.0 * p0 + 1.0)
446 * (ap0 * boost::math::tgamma(p0 + 1))
447 * (ap0 * boost::math::tgamma(p0 + 1)));
451 c0 = 10000000000000000.0;
454 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0)
455 * (ap0 * boost::math::tgamma(p0 + 1))
456 * (ap0 * boost::math::tgamma(p0 + 1));
458 NekDouble overeta0 = 1.0 / (1.0 + etap0);
469 for(i = 0; i < nquad0; ++i)
475 m_dGL_xi1[n][i] = 0.5 * sign0 * m_dGL_xi1[n][i];
479 for(i = 0; i < nquad0; ++i)
481 m_dGR_xi1[n][i] = etap0 * dLpm0[i];
482 m_dGR_xi1[n][i] += dLpp0[i];
483 m_dGR_xi1[n][i] *= overeta0;
484 m_dGR_xi1[n][i] += dLp0[i];
485 m_dGR_xi1[n][i] = 0.5 * m_dGR_xi1[n][i];
497 m_dGL_xi1 = Array<OneD, Array<OneD, NekDouble> >(nElements);
498 m_dGR_xi1 = Array<OneD, Array<OneD, NekDouble> >(nElements);
499 m_dGL_xi2 = Array<OneD, Array<OneD, NekDouble> >(nElements);
500 m_dGR_xi2 = Array<OneD, Array<OneD, NekDouble> >(nElements);
502 for (n = 0; n < nElements; ++n)
504 base = pFields[0]->GetExp(n)->GetBase();
505 nquad0 = base[0]->GetNumPoints();
506 nquad1 = base[1]->GetNumPoints();
507 nmodes0 = base[0]->GetNumModes();
508 nmodes1 = base[1]->GetNumModes();
510 Array<OneD, const NekDouble> z0;
511 Array<OneD, const NekDouble> w0;
512 Array<OneD, const NekDouble> z1;
513 Array<OneD, const NekDouble> w1;
515 base[0]->GetZW(z0, w0);
516 base[1]->GetZW(z1, w1);
518 m_dGL_xi1[n] = Array<OneD, NekDouble>(nquad0);
519 m_dGR_xi1[n] = Array<OneD, NekDouble>(nquad0);
520 m_dGL_xi2[n] = Array<OneD, NekDouble>(nquad1);
521 m_dGR_xi2[n] = Array<OneD, NekDouble>(nquad1);
525 Array<OneD,NekDouble> dLp0 (nquad0, 0.0);
526 Array<OneD,NekDouble> dLpp0 (nquad0, 0.0);
527 Array<OneD,NekDouble> dLpm0 (nquad0, 0.0);
528 Array<OneD,NekDouble> dLp1 (nquad1, 0.0);
529 Array<OneD,NekDouble> dLpp1 (nquad1, 0.0);
530 Array<OneD,NekDouble> dLpm1 (nquad1, 0.0);
533 int p0 = nmodes0 - 1;
534 int p1 = nmodes1 - 1;
541 NekDouble ap0 = boost::math::tgamma(2 * p0 + 1)
543 * boost::math::tgamma(p0 + 1)
544 * boost::math::tgamma(p0 + 1));
546 NekDouble ap1 = boost::math::tgamma(2 * p1 + 1)
548 * boost::math::tgamma(p1 + 1)
549 * boost::math::tgamma(p1 + 1));
559 c0 = 2.0 * p0 / ((2.0 * p0 + 1.0) * (p0 + 1.0)
560 * (ap0 * boost::math::tgamma(p0 + 1))
561 * (ap0 * boost::math::tgamma(p0 + 1)));
563 c1 = 2.0 * p1 / ((2.0 * p1 + 1.0) * (p1 + 1.0)
564 * (ap1 * boost::math::tgamma(p1 + 1))
565 * (ap1 * boost::math::tgamma(p1 + 1)));
569 c0 = 2.0 * (p0 + 1.0) / ((2.0 * p0 + 1.0) * p0
570 * (ap0 * boost::math::tgamma(p0 + 1))
571 * (ap0 * boost::math::tgamma(p0 + 1)));
573 c1 = 2.0 * (p1 + 1.0) / ((2.0 * p1 + 1.0) * p1
574 * (ap1 * boost::math::tgamma(p1 + 1))
575 * (ap1 * boost::math::tgamma(p1 + 1)));
579 c0 = -2.0 / ((2.0 * p0 + 1.0)
580 * (ap0 * boost::math::tgamma(p0 + 1))
581 * (ap0 * boost::math::tgamma(p0 + 1)));
583 c1 = -2.0 / ((2.0 * p1 + 1.0)
584 * (ap1 * boost::math::tgamma(p1 + 1))
585 * (ap1 * boost::math::tgamma(p1 + 1)));
589 c0 = 10000000000000000.0;
590 c1 = 10000000000000000.0;
593 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0)
594 * (ap0 * boost::math::tgamma(p0 + 1))
595 * (ap0 * boost::math::tgamma(p0 + 1));
597 NekDouble etap1 = 0.5 * c1 * (2.0 * p1 + 1.0)
598 * (ap1 * boost::math::tgamma(p1 + 1))
599 * (ap1 * boost::math::tgamma(p1 + 1));
601 NekDouble overeta0 = 1.0 / (1.0 + etap0);
602 NekDouble overeta1 = 1.0 / (1.0 + etap1);
617 for(i = 0; i < nquad0; ++i)
623 m_dGL_xi1[n][i] = 0.5 * sign0 * m_dGL_xi1[n][i];
627 for(i = 0; i < nquad1; ++i)
629 m_dGL_xi2[n][i] = etap1 * dLpm1[i];
630 m_dGL_xi2[n][i] += dLpp1[i];
631 m_dGL_xi2[n][i] *= overeta1;
632 m_dGL_xi2[n][i] = dLp1[i] - m_dGL_xi2[n][i];
633 m_dGL_xi2[n][i] = 0.5 * sign1 * m_dGL_xi2[n][i];
637 for(i = 0; i < nquad0; ++i)
639 m_dGR_xi1[n][i] = etap0 * dLpm0[i];
640 m_dGR_xi1[n][i] += dLpp0[i];
641 m_dGR_xi1[n][i] *= overeta0;
642 m_dGR_xi1[n][i] += dLp0[i];
643 m_dGR_xi1[n][i] = 0.5 * m_dGR_xi1[n][i];
647 for(i = 0; i < nquad1; ++i)
649 m_dGR_xi2[n][i] = etap1 * dLpm1[i];
650 m_dGR_xi2[n][i] += dLpp1[i];
651 m_dGR_xi2[n][i] *= overeta1;
652 m_dGR_xi2[n][i] += dLp1[i];
653 m_dGR_xi2[n][i] = 0.5 * m_dGR_xi2[n][i];
660 m_dGL_xi1 = Array<OneD, Array<OneD, NekDouble> >(nElements);
661 m_dGR_xi1 = Array<OneD, Array<OneD, NekDouble> >(nElements);
662 m_dGL_xi2 = Array<OneD, Array<OneD, NekDouble> >(nElements);
663 m_dGR_xi2 = Array<OneD, Array<OneD, NekDouble> >(nElements);
664 m_dGL_xi3 = Array<OneD, Array<OneD, NekDouble> >(nElements);
665 m_dGR_xi3 = Array<OneD, Array<OneD, NekDouble> >(nElements);
667 for (n = 0; n < nElements; ++n)
669 base = pFields[0]->GetExp(n)->GetBase();
670 nquad0 = base[0]->GetNumPoints();
671 nquad1 = base[1]->GetNumPoints();
672 nquad2 = base[2]->GetNumPoints();
673 nmodes0 = base[0]->GetNumModes();
674 nmodes1 = base[1]->GetNumModes();
675 nmodes2 = base[2]->GetNumModes();
677 Array<OneD, const NekDouble> z0;
678 Array<OneD, const NekDouble> w0;
679 Array<OneD, const NekDouble> z1;
680 Array<OneD, const NekDouble> w1;
681 Array<OneD, const NekDouble> z2;
682 Array<OneD, const NekDouble> w2;
684 base[0]->GetZW(z0, w0);
685 base[1]->GetZW(z1, w1);
686 base[1]->GetZW(z2, w2);
688 m_dGL_xi1[n] = Array<OneD, NekDouble>(nquad0);
689 m_dGR_xi1[n] = Array<OneD, NekDouble>(nquad0);
690 m_dGL_xi2[n] = Array<OneD, NekDouble>(nquad1);
691 m_dGR_xi2[n] = Array<OneD, NekDouble>(nquad1);
692 m_dGL_xi3[n] = Array<OneD, NekDouble>(nquad2);
693 m_dGR_xi3[n] = Array<OneD, NekDouble>(nquad2);
697 Array<OneD,NekDouble> dLp0 (nquad0, 0.0);
698 Array<OneD,NekDouble> dLpp0 (nquad0, 0.0);
699 Array<OneD,NekDouble> dLpm0 (nquad0, 0.0);
700 Array<OneD,NekDouble> dLp1 (nquad1, 0.0);
701 Array<OneD,NekDouble> dLpp1 (nquad1, 0.0);
702 Array<OneD,NekDouble> dLpm1 (nquad1, 0.0);
703 Array<OneD,NekDouble> dLp2 (nquad2, 0.0);
704 Array<OneD,NekDouble> dLpp2 (nquad2, 0.0);
705 Array<OneD,NekDouble> dLpm2 (nquad2, 0.0);
708 int p0 = nmodes0 - 1;
709 int p1 = nmodes1 - 1;
710 int p2 = nmodes2 - 1;
718 NekDouble ap0 = boost::math::tgamma(2 * p0 + 1)
720 * boost::math::tgamma(p0 + 1)
721 * boost::math::tgamma(p0 + 1));
724 NekDouble ap1 = boost::math::tgamma(2 * p1 + 1)
726 * boost::math::tgamma(p1 + 1)
727 * boost::math::tgamma(p1 + 1));
730 NekDouble ap2 = boost::math::tgamma(2 * p2 + 1)
732 * boost::math::tgamma(p2 + 1)
733 * boost::math::tgamma(p2 + 1));
744 c0 = 2.0 * p0 / ((2.0 * p0 + 1.0) * (p0 + 1.0)
745 * (ap0 * boost::math::tgamma(p0 + 1))
746 * (ap0 * boost::math::tgamma(p0 + 1)));
748 c1 = 2.0 * p1 / ((2.0 * p1 + 1.0) * (p1 + 1.0)
749 * (ap1 * boost::math::tgamma(p1 + 1))
750 * (ap1 * boost::math::tgamma(p1 + 1)));
752 c2 = 2.0 * p2 / ((2.0 * p2 + 1.0) * (p2 + 1.0)
753 * (ap2 * boost::math::tgamma(p2 + 1))
754 * (ap2 * boost::math::tgamma(p2 + 1)));
758 c0 = 2.0 * (p0 + 1.0) / ((2.0 * p0 + 1.0) * p0
759 * (ap0 * boost::math::tgamma(p0 + 1))
760 * (ap0 * boost::math::tgamma(p0 + 1)));
762 c1 = 2.0 * (p1 + 1.0) / ((2.0 * p1 + 1.0) * p1
763 * (ap1 * boost::math::tgamma(p1 + 1))
764 * (ap1 * boost::math::tgamma(p1 + 1)));
766 c2 = 2.0 * (p2 + 1.0) / ((2.0 * p2 + 1.0) * p2
767 * (ap2 * boost::math::tgamma(p2 + 1))
768 * (ap2 * boost::math::tgamma(p2 + 1)));
772 c0 = -2.0 / ((2.0 * p0 + 1.0)
773 * (ap0 * boost::math::tgamma(p0 + 1))
774 * (ap0 * boost::math::tgamma(p0 + 1)));
776 c1 = -2.0 / ((2.0 * p1 + 1.0)
777 * (ap1 * boost::math::tgamma(p1 + 1))
778 * (ap1 * boost::math::tgamma(p1 + 1)));
780 c2 = -2.0 / ((2.0 * p2 + 1.0)
781 * (ap2 * boost::math::tgamma(p2 + 1))
782 * (ap2 * boost::math::tgamma(p2 + 1)));
786 c0 = 10000000000000000.0;
787 c1 = 10000000000000000.0;
788 c2 = 10000000000000000.0;
791 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0)
792 * (ap0 * boost::math::tgamma(p0 + 1))
793 * (ap0 * boost::math::tgamma(p0 + 1));
795 NekDouble etap1 = 0.5 * c1 * (2.0 * p1 + 1.0)
796 * (ap1 * boost::math::tgamma(p1 + 1))
797 * (ap1 * boost::math::tgamma(p1 + 1));
799 NekDouble etap2 = 0.5 * c2 * (2.0 * p2 + 1.0)
800 * (ap2 * boost::math::tgamma(p2 + 1))
801 * (ap2 * boost::math::tgamma(p2 + 1));
803 NekDouble overeta0 = 1.0 / (1.0 + etap0);
804 NekDouble overeta1 = 1.0 / (1.0 + etap1);
805 NekDouble overeta2 = 1.0 / (1.0 + etap2);
824 for(i = 0; i < nquad0; ++i)
830 m_dGL_xi1[n][i] = 0.5 * sign0 * m_dGL_xi1[n][i];
834 for(i = 0; i < nquad1; ++i)
836 m_dGL_xi2[n][i] = etap1 * dLpm1[i];
837 m_dGL_xi2[n][i] += dLpp1[i];
838 m_dGL_xi2[n][i] *= overeta1;
839 m_dGL_xi2[n][i] = dLp1[i] - m_dGL_xi2[n][i];
840 m_dGL_xi2[n][i] = 0.5 * sign1 * m_dGL_xi2[n][i];
844 for(i = 0; i < nquad2; ++i)
846 m_dGL_xi3[n][i] = etap2 * dLpm2[i];
847 m_dGL_xi3[n][i] += dLpp2[i];
848 m_dGL_xi3[n][i] *= overeta2;
849 m_dGL_xi3[n][i] = dLp2[i] - m_dGL_xi3[n][i];
850 m_dGL_xi3[n][i] = 0.5 * sign2 * m_dGL_xi3[n][i];
854 for(i = 0; i < nquad0; ++i)
856 m_dGR_xi1[n][i] = etap0 * dLpm0[i];
857 m_dGR_xi1[n][i] += dLpp0[i];
858 m_dGR_xi1[n][i] *= overeta0;
859 m_dGR_xi1[n][i] += dLp0[i];
860 m_dGR_xi1[n][i] = 0.5 * m_dGR_xi1[n][i];
864 for(i = 0; i < nquad1; ++i)
866 m_dGR_xi2[n][i] = etap1 * dLpm1[i];
867 m_dGR_xi2[n][i] += dLpp1[i];
868 m_dGR_xi2[n][i] *= overeta1;
869 m_dGR_xi2[n][i] += dLp1[i];
870 m_dGR_xi2[n][i] = 0.5 * m_dGR_xi2[n][i];
874 for(i = 0; i < nquad2; ++i)
876 m_dGR_xi3[n][i] = etap2 * dLpm2[i];
877 m_dGR_xi3[n][i] += dLpp2[i];
878 m_dGR_xi3[n][i] *= overeta2;
879 m_dGR_xi3[n][i] += dLp2[i];
880 m_dGR_xi3[n][i] = 0.5 * m_dGR_xi3[n][i];
887 ASSERTL0(
false,
"Expansion dimension not recognised");
902 const int nConvectiveFields,
903 const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
904 const Array<
OneD, Array<OneD, NekDouble> > &inarray,
905 Array<
OneD, Array<OneD, NekDouble> > &outarray)
910 Array<TwoD, const NekDouble> gmat;
911 Array<OneD, const NekDouble> jac;
912 Array<OneD, NekDouble> auxArray1, auxArray2;
914 Array<OneD, LibUtilities::BasisSharedPtr> Basis;
915 Basis = fields[0]->GetExp(0)->GetBase();
917 int nElements = fields[0]->GetExpSize();
918 int nDim = fields[0]->GetCoordim(0);
919 int nScalars = inarray.num_elements();
920 int nSolutionPts = fields[0]->GetTotPoints();
921 int nCoeffs = fields[0]->GetNcoeffs();
923 Array<OneD, Array<OneD, NekDouble> > outarrayCoeff(nConvectiveFields);
924 for (i = 0; i < nConvectiveFields; ++i)
926 outarrayCoeff[i] = Array<OneD, NekDouble>(nCoeffs);
937 for (i = 0; i < nScalars; ++i)
941 for (n = 0; n < nElements; n++)
943 phys_offset = fields[0]->GetPhys_Offset(n);
945 fields[i]->GetExp(n)->PhysDeriv(0,
946 auxArray1 = inarray[i] + phys_offset,
947 auxArray2 =
m_DU1[i][0] + phys_offset);
977 for (i = 0; i < nConvectiveFields; ++i)
981 for (n = 0; n < nElements; n++)
983 phys_offset = fields[0]->GetPhys_Offset(n);
985 fields[i]->GetExp(n)->PhysDeriv(0,
987 auxArray2 =
m_DD1[i][0] + phys_offset);
1004 &
m_DD1[i][0][0], 1, &outarray[i][0], 1);
1007 if(!(Basis[0]->Collocation()))
1009 fields[i]->FwdTrans(outarray[i], outarrayCoeff[i]);
1010 fields[i]->BwdTrans(outarrayCoeff[i], outarray[i]);
1018 for(i = 0; i < nScalars; ++i)
1020 for (j = 0; j < nDim; ++j)
1023 Array<OneD, NekDouble> u1_hat(nSolutionPts, 0.0);
1024 Array<OneD, NekDouble> u2_hat(nSolutionPts, 0.0);
1029 &
m_gmat[0][0], 1, &u1_hat[0], 1);
1032 &
m_jac[0], 1, &u1_hat[0], 1);
1035 &
m_gmat[1][0], 1, &u2_hat[0], 1);
1038 &
m_jac[0], 1, &u2_hat[0], 1);
1043 &
m_gmat[2][0], 1, &u1_hat[0], 1);
1046 &
m_jac[0], 1, &u1_hat[0], 1);
1049 &
m_gmat[3][0], 1, &u2_hat[0], 1);
1052 &
m_jac[0], 1, &u2_hat[0], 1);
1055 for (n = 0; n < nElements; n++)
1057 phys_offset = fields[0]->GetPhys_Offset(n);
1059 fields[i]->GetExp(n)->StdPhysDeriv(0,
1060 auxArray1 = u1_hat + phys_offset,
1061 auxArray2 =
m_tmp1[i][j] + phys_offset);
1063 fields[i]->GetExp(n)->StdPhysDeriv(1,
1064 auxArray1 = u2_hat + phys_offset,
1065 auxArray2 =
m_tmp2[i][j] + phys_offset);
1070 &
m_DU1[i][j][0], 1);
1079 inarray[i],
m_IF1[i][j],
1085 for (j = 0; j < nSolutionPts; ++j)
1108 for (j = 0; j < nSolutionPts; j++)
1117 m_gmat[0][j] * m_BD1[i][1][j] -
1118 m_gmat[1][j] * m_BD1[i][0][j];
1122 for (j = 0; j < nDim; ++j)
1133 for (i = 0; i < nScalars; ++i)
1150 for (i = 0; i < nConvectiveFields; ++i)
1153 Array<OneD, NekDouble> f_hat(nSolutionPts, 0.0);
1154 Array<OneD, NekDouble> g_hat(nSolutionPts, 0.0);
1156 for (j = 0; j < nSolutionPts; j++)
1165 for (n = 0; n < nElements; n++)
1167 phys_offset = fields[0]->GetPhys_Offset(n);
1169 fields[0]->GetExp(n)->StdPhysDeriv(0,
1170 auxArray1 = f_hat + phys_offset,
1171 auxArray2 =
m_DD1[i][0] + phys_offset);
1173 fields[0]->GetExp(n)->StdPhysDeriv(1,
1174 auxArray1 = g_hat + phys_offset,
1175 auxArray2 =
m_DD1[i][1] + phys_offset);
1183 if (Basis[0]->GetPointsType() ==
1185 Basis[1]->GetPointsType() ==
1203 &
m_divFC[i][0], 1, &outarray[i][0], 1);
1208 &
m_jac[0], 1, &outarray[i][0], 1);
1211 if(!(Basis[0]->Collocation()))
1213 fields[i]->FwdTrans(outarray[i], outarrayCoeff[i]);
1214 fields[i]->BwdTrans(outarrayCoeff[i], outarray[i]);
1222 ASSERTL0(
false,
"3D FRDG case not implemented yet");
1234 const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
1235 const Array<
OneD, Array<OneD, NekDouble> > &inarray,
1236 Array<
OneD, Array<
OneD, Array<OneD, NekDouble> > >
1240 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1241 int nScalars = inarray.num_elements();
1242 int nDim = fields[0]->GetCoordim(0);
1244 Array<OneD, NekDouble > Vn (nTracePts, 0.0);
1245 Array<OneD, NekDouble > fluxtemp(nTracePts, 0.0);
1248 for (i = 0; i < nDim; ++i)
1250 fields[0]->ExtractTracePhys(inarray[i],
m_traceVel[i]);
1256 Array<OneD, Array<OneD, NekDouble> > Fwd (nScalars);
1257 Array<OneD, Array<OneD, NekDouble> > Bwd (nScalars);
1258 Array<OneD, Array<OneD, NekDouble> > numflux(nScalars);
1260 for (i = 0; i < nScalars; ++i)
1262 Fwd[i] = Array<OneD, NekDouble>(nTracePts);
1263 Bwd[i] = Array<OneD, NekDouble>(nTracePts);
1264 numflux[i] = Array<OneD, NekDouble>(nTracePts);
1265 fields[i]->GetFwdBwdTracePhys(inarray[i], Fwd[i], Bwd[i]);
1266 fields[0]->GetTrace()->Upwind(Vn, Fwd[i], Bwd[i], numflux[i]);
1270 if (fields[0]->GetBndCondExpansions().num_elements())
1276 for (j = 0; j < nDim; ++j)
1278 for (i = 0; i < nScalars; ++i)
1281 numericalFluxO1[i][j], 1);
1291 const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
1292 const Array<
OneD, Array<OneD, NekDouble> > &inarray,
1293 Array<
OneD, Array<OneD, NekDouble> > &penaltyfluxO1)
1299 int nBndEdgePts, nBndEdges, nBndRegions;
1301 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1302 int nScalars = inarray.num_elements();
1304 Array<OneD, NekDouble> tmp1(nTracePts, 0.0);
1305 Array<OneD, NekDouble> tmp2(nTracePts, 0.0);
1306 Array<OneD, NekDouble> Tw(nTracePts,
m_Twall);
1308 Array< OneD, Array<OneD, NekDouble > > scalarVariables(nScalars);
1309 Array< OneD, Array<OneD, NekDouble > > uplus(nScalars);
1312 for (i = 0; i < nScalars; ++i)
1314 scalarVariables[i] = Array<OneD, NekDouble>(nTracePts, 0.0);
1316 uplus[i] = Array<OneD, NekDouble>(nTracePts, 0.0);
1317 fields[i]->ExtractTracePhys(inarray[i], uplus[i]);
1321 for (i = 0; i < nScalars-1; ++i)
1326 nBndRegions = fields[i+1]->
1327 GetBndCondExpansions().num_elements();
1328 for (j = 0; j < nBndRegions; ++j)
1330 nBndEdges = fields[i+1]->
1331 GetBndCondExpansions()[j]->GetExpSize();
1332 for (e = 0; e < nBndEdges; ++e)
1334 nBndEdgePts = fields[i+1]->
1335 GetBndCondExpansions()[j]->GetExp(e)->GetTotPoints();
1338 GetBndCondExpansions()[j]->GetPhys_Offset(e);
1340 id2 = fields[0]->GetTrace()->
1341 GetPhys_Offset(fields[0]->GetTraceMap()->
1342 GetBndCondTraceToGlobalTraceMap(cnt++));
1345 if (fields[i]->GetBndConditions()[j]->
1350 &scalarVariables[i][id2], 1);
1354 else if (fields[i]->GetBndConditions()[j]->
1355 GetBoundaryConditionType() ==
1360 GetBndCondExpansions()[j]->
1361 UpdatePhys())[id1], 1,
1363 GetBndCondExpansions()[j]->
1364 UpdatePhys())[id1], 1,
1365 &scalarVariables[i][id2], 1);
1369 if (fields[i]->GetBndConditions()[j]->
1370 GetBoundaryConditionType() ==
1374 &scalarVariables[i][id2], 1,
1375 &penaltyfluxO1[i][id2], 1);
1379 else if ((fields[i]->GetBndConditions()[j])->
1380 GetBoundaryConditionType() ==
1385 &penaltyfluxO1[i][id2], 1);
1390 &scalarVariables[i][id2], 1,
1391 &scalarVariables[i][id2], 1,
1408 nBndRegions = fields[nScalars]->
1409 GetBndCondExpansions().num_elements();
1410 for (j = 0; j < nBndRegions; ++j)
1412 nBndEdges = fields[nScalars]->
1413 GetBndCondExpansions()[j]->GetExpSize();
1414 for (e = 0; e < nBndEdges; ++e)
1416 nBndEdgePts = fields[nScalars]->
1417 GetBndCondExpansions()[j]->GetExp(e)->GetTotPoints();
1419 id1 = fields[nScalars]->
1420 GetBndCondExpansions()[j]->GetPhys_Offset(e);
1422 id2 = fields[0]->GetTrace()->
1423 GetPhys_Offset(fields[0]->GetTraceMap()->
1424 GetBndCondTraceToGlobalTraceMap(cnt++));
1427 if (fields[i]->GetBndConditions()[j]->
1433 &scalarVariables[nScalars-1][id2], 1);
1437 else if (fields[i]->GetBndConditions()[j]->
1438 GetBoundaryConditionType() ==
1443 &(fields[nScalars]->
1444 GetBndCondExpansions()[j]->
1447 GetBndCondExpansions()[j]->
1449 &scalarVariables[nScalars-1][id2], 1);
1453 &scalarVariables[nScalars-1][id2], 1,
1455 &scalarVariables[nScalars-1][id2], 1);
1459 &scalarVariables[nScalars-1][id2], 1,
1460 &scalarVariables[nScalars-1][id2], 1);
1464 if (fields[nScalars]->GetBndConditions()[j]->
1465 GetBoundaryConditionType() ==
1469 &scalarVariables[nScalars-1][id2], 1,
1470 &penaltyfluxO1[nScalars-1][id2], 1);
1474 else if ((fields[nScalars]->GetBndConditions()[j])->
1475 GetBoundaryConditionType() ==
1479 &uplus[nScalars-1][id2], 1,
1480 &penaltyfluxO1[nScalars-1][id2], 1);
1491 const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
1492 const Array<
OneD, Array<OneD, NekDouble> > &ufield,
1493 Array<
OneD, Array<
OneD, Array<OneD, NekDouble> > > &qfield,
1494 Array<
OneD, Array<OneD, NekDouble> > &qflux)
1497 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1498 int nVariables = fields.num_elements();
1499 int nDim = fields[0]->GetCoordim(0);
1501 Array<OneD, NekDouble > Fwd(nTracePts);
1502 Array<OneD, NekDouble > Bwd(nTracePts);
1503 Array<OneD, NekDouble > Vn (nTracePts, 0.0);
1505 Array<OneD, NekDouble > qFwd (nTracePts);
1506 Array<OneD, NekDouble > qBwd (nTracePts);
1507 Array<OneD, NekDouble > qfluxtemp(nTracePts, 0.0);
1510 for (i = 0; i < nDim; ++i)
1512 fields[0]->ExtractTracePhys(ufield[i],
m_traceVel[i]);
1520 for (i = 1; i < nVariables; ++i)
1522 qflux[i] = Array<OneD, NekDouble> (nTracePts, 0.0);
1523 for (j = 0; j < nDim; ++j)
1526 fields[i]->GetFwdBwdTracePhys(qfield[j][i], qFwd, qBwd);
1529 fields[i]->GetTrace()->Upwind(Vn, qBwd, qFwd, qfluxtemp);
1536 if (fields[0]->GetBndCondExpansions().num_elements())
1554 const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
1557 const Array<OneD, const NekDouble> &qfield,
1558 Array<OneD, NekDouble> &penaltyflux)
1561 int nBndEdges, nBndEdgePts;
1565 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1566 int nBndRegions = fields[var]->GetBndCondExpansions().num_elements();
1568 Array<OneD, NekDouble > uterm(nTracePts);
1569 Array<OneD, NekDouble > qtemp(nTracePts);
1572 fields[var]->ExtractTracePhys(qfield, qtemp);
1575 for (i = 0; i < nBndRegions; ++i)
1578 nBndEdges = fields[var]->
1579 GetBndCondExpansions()[i]->GetExpSize();
1582 for (e = 0; e < nBndEdges; ++e)
1584 nBndEdgePts = fields[var]->
1585 GetBndCondExpansions()[i]->GetExp(e)->GetTotPoints();
1587 id2 = fields[0]->GetTrace()->
1588 GetPhys_Offset(fields[0]->GetTraceMap()->
1589 GetBndCondTraceToGlobalTraceMap(cnt++));
1594 if (fields[var]->GetBndConditions()[i]->
1598 &qtemp[id2], 1, &penaltyflux[id2], 1);
1602 else if ((fields[var]->GetBndConditions()[i])->
1606 "Neumann bcs not implemented for LFRNS");
1632 const int nConvectiveFields,
1633 const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
1634 const Array<OneD, const NekDouble> &flux,
1635 const Array<OneD, const NekDouble> &iFlux,
1636 Array<OneD, NekDouble> &derCFlux)
1639 int nLocalSolutionPts, phys_offset;
1641 Array<OneD, NekDouble> auxArray1, auxArray2;
1642 Array<TwoD, const NekDouble> gmat;
1643 Array<OneD, const NekDouble> jac;
1647 Basis = fields[0]->GetExp(0)->GetBasis(0);
1649 int nElements = fields[0]->GetExpSize();
1650 int nPts = fields[0]->GetTotPoints();
1653 Array<OneD, NekDouble> DCL(nPts/nElements, 0.0);
1654 Array<OneD, NekDouble> DCR(nPts/nElements, 0.0);
1657 Array<OneD, NekDouble> JumpL(nElements);
1658 Array<OneD, NekDouble> JumpR(nElements);
1660 for (n = 0; n < nElements; ++n)
1662 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1663 phys_offset = fields[0]->GetPhys_Offset(n);
1665 Array<OneD, NekDouble> tmparrayX1(nLocalSolutionPts, 0.0);
1668 &flux[phys_offset], 1,
1671 fields[0]->GetExp(n)->GetVertexPhysVals(0, tmparrayX1,
1673 JumpL[n] = iFlux[n] - tmpFluxVertex;
1675 fields[0]->GetExp(n)->GetVertexPhysVals(1, tmparrayX1,
1677 JumpR[n] = iFlux[n+1] - tmpFluxVertex;
1680 for (n = 0; n < nElements; ++n)
1682 ptsKeys = fields[0]->GetExp(n)->GetPointsKeys();
1683 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1684 phys_offset = fields[0]->GetPhys_Offset(n);
1685 jac = fields[0]->GetExp(n)
1689 JumpL[n] = JumpL[n] * jac[0];
1690 JumpR[n] = JumpR[n] * jac[0];
1701 Vmath::Vadd(nLocalSolutionPts, &DCL[0], 1, &DCR[0], 1,
1702 &derCFlux[phys_offset], 1);
1722 const int nConvectiveFields,
1723 const int direction,
1724 const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
1725 const Array<OneD, const NekDouble> &flux,
1726 const Array<OneD, NekDouble> &iFlux,
1727 Array<OneD, NekDouble> &derCFlux)
1729 int n, e, i, j, cnt;
1731 Array<OneD, const NekDouble> jac;
1733 int nElements = fields[0]->GetExpSize();
1734 int trace_offset, phys_offset;
1735 int nLocalSolutionPts;
1740 Array<OneD, NekDouble> auxArray1, auxArray2;
1741 Array<OneD, LibUtilities::BasisSharedPtr> base;
1742 Array<OneD, Array<OneD, LocalRegions::ExpansionSharedPtr> >
1743 &elmtToTrace = fields[0]->GetTraceMap()->GetElmtToTrace();
1746 for (n = 0; n < nElements; ++n)
1749 phys_offset = fields[0]->GetPhys_Offset(n);
1750 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1751 ptsKeys = fields[0]->GetExp(n)->GetPointsKeys();
1756 base = fields[0]->GetExp(n)->GetBase();
1757 nquad0 = base[0]->GetNumPoints();
1758 nquad1 = base[1]->GetNumPoints();
1760 Array<OneD, NekDouble> divCFluxE0(nLocalSolutionPts, 0.0);
1761 Array<OneD, NekDouble> divCFluxE1(nLocalSolutionPts, 0.0);
1762 Array<OneD, NekDouble> divCFluxE2(nLocalSolutionPts, 0.0);
1763 Array<OneD, NekDouble> divCFluxE3(nLocalSolutionPts, 0.0);
1766 for (e = 0; e < fields[0]->GetExp(n)->GetNedges(); ++e)
1769 nEdgePts = fields[0]->GetExp(n)->GetEdgeNumPoints(e);
1772 Array<OneD, NekDouble> tmparray(nEdgePts, 0.0);
1775 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
1776 elmtToTrace[n][e]->GetElmtId());
1785 fields[0]->GetExp(n)->GetEdgePhysVals(
1786 e, elmtToTrace[n][e],
1788 auxArray1 = tmparray);
1797 Array<OneD, NekDouble> fluxJumps(nEdgePts, 0.0);
1799 &tmparray[0], 1, &fluxJumps[0], 1);
1803 if (fields[0]->GetExp(n)->GetEorient(e) ==
1812 if (fields[0]->GetExp(n)->as<LocalRegions::Expansion2D>()
1813 ->GetGeom2D()->GetMetricInfo()->GetGtype()
1817 Array<OneD, NekDouble> jacEdge(nEdgePts, 0.0);
1818 fields[0]->GetExp(n)->GetEdgePhysVals(
1819 e, elmtToTrace[n][e],
1820 jac, auxArray1 = jacEdge);
1824 if (fields[0]->GetExp(n)->GetEorient(e) ==
1833 for (j = 0; j < nEdgePts; j++)
1835 fluxJumps[j] = fluxJumps[j] * jacEdge[j];
1853 for (i = 0; i < nquad0; ++i)
1858 for (j = 0; j < nquad1; ++j)
1861 divCFluxE0[cnt] = fluxJumps[i] *
m_dGL_xi2[n][j];
1866 for (i = 0; i < nquad1; ++i)
1871 for (j = 0; j < nquad0; ++j)
1873 cnt = (nquad0)*i + j;
1874 divCFluxE1[cnt] = fluxJumps[i] *
m_dGR_xi1[n][j];
1879 for (i = 0; i < nquad0; ++i)
1884 for (j = 0; j < nquad1; ++j)
1886 cnt = (nquad0 - 1) + j*nquad0 - i;
1887 divCFluxE2[cnt] = fluxJumps[i] *
m_dGR_xi2[n][j];
1892 for (i = 0; i < nquad1; ++i)
1896 for (j = 0; j < nquad0; ++j)
1898 cnt = (nquad0*nquad1 - nquad0) + j - i*nquad0;
1899 divCFluxE3[cnt] = fluxJumps[i] *
m_dGL_xi1[n][j];
1905 ASSERTL0(
false,
"edge value (< 3) is out of range");
1919 &divCFluxE3[0], 1, &derCFlux[phys_offset], 1);
1921 else if (direction == 1)
1924 &divCFluxE2[0], 1, &derCFlux[phys_offset], 1);
1943 const int nConvectiveFields,
1944 const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
1945 const Array<OneD, const NekDouble> &fluxX1,
1946 const Array<OneD, const NekDouble> &fluxX2,
1947 const Array<OneD, const NekDouble> &numericalFlux,
1948 Array<OneD, NekDouble> &divCFlux)
1950 int n, e, i, j, cnt;
1952 int nElements = fields[0]->GetExpSize();
1953 int nLocalSolutionPts;
1960 Array<OneD, NekDouble> auxArray1, auxArray2;
1961 Array<OneD, LibUtilities::BasisSharedPtr> base;
1963 Array<OneD, Array<OneD, LocalRegions::ExpansionSharedPtr> >
1964 &elmtToTrace = fields[0]->GetTraceMap()->GetElmtToTrace();
1967 for(n = 0; n < nElements; ++n)
1970 phys_offset = fields[0]->GetPhys_Offset(n);
1971 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1973 base = fields[0]->GetExp(n)->GetBase();
1974 nquad0 = base[0]->GetNumPoints();
1975 nquad1 = base[1]->GetNumPoints();
1977 Array<OneD, NekDouble> divCFluxE0(nLocalSolutionPts, 0.0);
1978 Array<OneD, NekDouble> divCFluxE1(nLocalSolutionPts, 0.0);
1979 Array<OneD, NekDouble> divCFluxE2(nLocalSolutionPts, 0.0);
1980 Array<OneD, NekDouble> divCFluxE3(nLocalSolutionPts, 0.0);
1983 for(e = 0; e < fields[0]->GetExp(n)->GetNedges(); ++e)
1986 nEdgePts = fields[0]->GetExp(n)->GetEdgeNumPoints(e);
1988 Array<OneD, NekDouble> tmparrayX1(nEdgePts, 0.0);
1989 Array<OneD, NekDouble> tmparrayX2(nEdgePts, 0.0);
1990 Array<OneD, NekDouble> fluxN (nEdgePts, 0.0);
1991 Array<OneD, NekDouble> fluxT (nEdgePts, 0.0);
1992 Array<OneD, NekDouble> fluxJumps(nEdgePts, 0.0);
1995 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
1996 elmtToTrace[n][e]->GetElmtId());
1999 const Array<OneD, const Array<OneD, NekDouble> > &normals =
2000 fields[0]->GetExp(n)->GetEdgeNormal(e);
2004 fields[0]->GetExp(n)->GetEdgePhysVals(
2005 e, elmtToTrace[n][e],
2006 fluxX1 + phys_offset,
2007 auxArray1 = tmparrayX1);
2011 fields[0]->GetExp(n)->GetEdgePhysVals(
2012 e, elmtToTrace[n][e],
2013 fluxX2 + phys_offset,
2014 auxArray1 = tmparrayX2);
2017 for (i = 0; i < nEdgePts; ++i)
2026 &numericalFlux[trace_offset], 1,
2027 &fluxN[0], 1, &fluxJumps[0], 1);
2030 if (fields[0]->GetExp(n)->GetEorient(e) ==
2034 auxArray1 = fluxJumps, 1,
2035 auxArray2 = fluxJumps, 1);
2038 NekDouble fac = fields[0]->GetExp(n)->EdgeNormalNegated(e) ?
2041 for (i = 0; i < nEdgePts; ++i)
2046 fluxJumps[i] = -fluxJumps[i];
2054 for (i = 0; i < nquad0; ++i)
2057 fluxJumps[i] = -(
m_Q2D_e0[n][i]) * fluxJumps[i];
2059 for (j = 0; j < nquad1; ++j)
2062 divCFluxE0[cnt] = fluxJumps[i] *
m_dGL_xi2[n][j];
2067 for (i = 0; i < nquad1; ++i)
2070 fluxJumps[i] = (
m_Q2D_e1[n][i]) * fluxJumps[i];
2072 for (j = 0; j < nquad0; ++j)
2074 cnt = (nquad0)*i + j;
2075 divCFluxE1[cnt] = fluxJumps[i] *
m_dGR_xi1[n][j];
2080 for (i = 0; i < nquad0; ++i)
2083 fluxJumps[i] = (
m_Q2D_e2[n][i]) * fluxJumps[i];
2085 for (j = 0; j < nquad1; ++j)
2087 cnt = (nquad0 - 1) + j*nquad0 - i;
2088 divCFluxE2[cnt] = fluxJumps[i] *
m_dGR_xi2[n][j];
2093 for (i = 0; i < nquad1; ++i)
2096 fluxJumps[i] = -(
m_Q2D_e3[n][i]) * fluxJumps[i];
2097 for (j = 0; j < nquad0; ++j)
2099 cnt = (nquad0*nquad1 - nquad0) + j - i*nquad0;
2100 divCFluxE3[cnt] = fluxJumps[i] *
m_dGL_xi1[n][j];
2107 ASSERTL0(
false,
"edge value (< 3) is out of range");
2114 &divCFluxE1[0], 1, &divCFlux[phys_offset], 1);
2116 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
2117 &divCFluxE2[0], 1, &divCFlux[phys_offset], 1);
2119 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
2120 &divCFluxE3[0], 1, &divCFlux[phys_offset], 1);
2139 const int nConvectiveFields,
2140 const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
2141 const Array<OneD, const NekDouble> &fluxX1,
2142 const Array<OneD, const NekDouble> &fluxX2,
2143 const Array<OneD, const NekDouble> &numericalFlux,
2144 Array<OneD, NekDouble> &divCFlux)
2146 int n, e, i, j, cnt;
2148 int nElements = fields[0]->GetExpSize();
2149 int nLocalSolutionPts;
2156 Array<OneD, NekDouble> auxArray1, auxArray2;
2157 Array<OneD, LibUtilities::BasisSharedPtr> base;
2159 Array<OneD, Array<OneD, LocalRegions::ExpansionSharedPtr> >
2160 &elmtToTrace = fields[0]->GetTraceMap()->GetElmtToTrace();
2163 for(n = 0; n < nElements; ++n)
2166 phys_offset = fields[0]->GetPhys_Offset(n);
2167 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
2169 base = fields[0]->GetExp(n)->GetBase();
2170 nquad0 = base[0]->GetNumPoints();
2171 nquad1 = base[1]->GetNumPoints();
2173 Array<OneD, NekDouble> divCFluxE0(nLocalSolutionPts, 0.0);
2174 Array<OneD, NekDouble> divCFluxE1(nLocalSolutionPts, 0.0);
2175 Array<OneD, NekDouble> divCFluxE2(nLocalSolutionPts, 0.0);
2176 Array<OneD, NekDouble> divCFluxE3(nLocalSolutionPts, 0.0);
2179 for(e = 0; e < fields[0]->GetExp(n)->GetNedges(); ++e)
2182 nEdgePts = fields[0]->GetExp(n)->GetEdgeNumPoints(e);
2184 Array<OneD, NekDouble> fluxN (nEdgePts, 0.0);
2185 Array<OneD, NekDouble> fluxT (nEdgePts, 0.0);
2186 Array<OneD, NekDouble> fluxN_R (nEdgePts, 0.0);
2187 Array<OneD, NekDouble> fluxN_D (nEdgePts, 0.0);
2188 Array<OneD, NekDouble> fluxJumps (nEdgePts, 0.0);
2191 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
2192 elmtToTrace[n][e]->GetElmtId());
2195 const Array<OneD, const Array<OneD, NekDouble> > &normals =
2196 fields[0]->GetExp(n)->GetEdgeNormal(e);
2205 fields[0]->GetExp(n)->GetEdgePhysVals(
2206 e, elmtToTrace[n][e],
2207 fluxX2 + phys_offset,
2208 auxArray1 = fluxN_D);
2214 &numericalFlux[trace_offset], 1,
2218 if (fields[0]->GetExp(n)->GetEorient(e) ==
2222 auxArray1 = fluxN, 1,
2223 auxArray2 = fluxN, 1);
2226 auxArray1 = fluxN_D, 1,
2227 auxArray2 = fluxN_D, 1);
2231 for (i = 0; i < nquad0; ++i)
2234 fluxN_R[i] = (
m_Q2D_e0[n][i]) * fluxN[i];
2237 for (i = 0; i < nEdgePts; ++i)
2244 fluxN_R[i] = -fluxN_R[i];
2252 &fluxN_D[0], 1, &fluxJumps[0], 1);
2256 for (i = 0; i < nquad0; ++i)
2258 for (j = 0; j < nquad1; ++j)
2270 fields[0]->GetExp(n)->GetEdgePhysVals(
2271 e, elmtToTrace[n][e],
2272 fluxX1 + phys_offset,
2273 auxArray1 = fluxN_D);
2277 &numericalFlux[trace_offset], 1,
2281 if (fields[0]->GetExp(n)->GetEorient(e) ==
2285 auxArray1 = fluxN, 1,
2286 auxArray2 = fluxN, 1);
2289 auxArray1 = fluxN_D, 1,
2290 auxArray2 = fluxN_D, 1);
2294 for (i = 0; i < nquad1; ++i)
2297 fluxN_R[i] = (
m_Q2D_e1[n][i]) * fluxN[i];
2300 for (i = 0; i < nEdgePts; ++i)
2307 fluxN_R[i] = -fluxN_R[i];
2315 &fluxN_D[0], 1, &fluxJumps[0], 1);
2319 for (i = 0; i < nquad1; ++i)
2321 for (j = 0; j < nquad0; ++j)
2323 cnt = (nquad0)*i + j;
2335 fields[0]->GetExp(n)->GetEdgePhysVals(
2336 e, elmtToTrace[n][e],
2337 fluxX2 + phys_offset,
2338 auxArray1 = fluxN_D);
2342 &numericalFlux[trace_offset], 1,
2346 if (fields[0]->GetExp(n)->GetEorient(e) ==
2350 auxArray1 = fluxN, 1,
2351 auxArray2 = fluxN, 1);
2354 auxArray1 = fluxN_D, 1,
2355 auxArray2 = fluxN_D, 1);
2359 for (i = 0; i < nquad0; ++i)
2362 fluxN_R[i] = (
m_Q2D_e2[n][i]) * fluxN[i];
2365 for (i = 0; i < nEdgePts; ++i)
2372 fluxN_R[i] = -fluxN_R[i];
2381 &fluxN_D[0], 1, &fluxJumps[0], 1);
2385 for (i = 0; i < nquad0; ++i)
2387 for (j = 0; j < nquad1; ++j)
2389 cnt = (nquad0 - 1) + j*nquad0 - i;
2400 fields[0]->GetExp(n)->GetEdgePhysVals(
2401 e, elmtToTrace[n][e],
2402 fluxX1 + phys_offset,
2403 auxArray1 = fluxN_D);
2408 &numericalFlux[trace_offset], 1,
2412 if (fields[0]->GetExp(n)->GetEorient(e) ==
2416 auxArray1 = fluxN, 1,
2417 auxArray2 = fluxN, 1);
2420 auxArray1 = fluxN_D, 1,
2421 auxArray2 = fluxN_D, 1);
2425 for (i = 0; i < nquad1; ++i)
2428 fluxN_R[i] = (
m_Q2D_e3[n][i]) * fluxN[i];
2431 for (i = 0; i < nEdgePts; ++i)
2438 fluxN_R[i] = -fluxN_R[i];
2447 &fluxN_D[0], 1, &fluxJumps[0], 1);
2451 for (i = 0; i < nquad1; ++i)
2453 for (j = 0; j < nquad0; ++j)
2455 cnt = (nquad0*nquad1 - nquad0) + j
2463 ASSERTL0(
false,
"edge value (< 3) is out of range");
2471 &divCFluxE1[0], 1, &divCFlux[phys_offset], 1);
2473 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
2474 &divCFluxE2[0], 1, &divCFlux[phys_offset], 1);
2476 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
2477 &divCFluxE3[0], 1, &divCFlux[phys_offset], 1);