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)
379 int nquad0, nquad1, nquad2;
380 int nmodes0, nmodes1, nmodes2;
381 Array<OneD, LibUtilities::BasisSharedPtr> base;
383 int nElements = pFields[0]->GetExpSize();
384 int nDim = pFields[0]->GetCoordim(0);
390 m_dGL_xi1 = Array<OneD, Array<OneD, NekDouble> >(nElements);
391 m_dGR_xi1 = Array<OneD, Array<OneD, NekDouble> >(nElements);
393 for (n = 0; n < nElements; ++n)
395 base = pFields[0]->GetExp(n)->GetBase();
396 nquad0 = base[0]->GetNumPoints();
397 nmodes0 = base[0]->GetNumModes();
398 Array<OneD, const NekDouble> z0;
399 Array<OneD, const NekDouble> w0;
401 base[0]->GetZW(z0, w0);
403 m_dGL_xi1[n] = Array<OneD, NekDouble>(nquad0);
404 m_dGR_xi1[n] = Array<OneD, NekDouble>(nquad0);
408 Array<OneD,NekDouble> dLp0 (nquad0, 0.0);
409 Array<OneD,NekDouble> dLpp0 (nquad0, 0.0);
410 Array<OneD,NekDouble> dLpm0 (nquad0, 0.0);
413 int p0 = nmodes0 - 1;
419 NekDouble ap0 = boost::math::tgamma(2 * p0 + 1)
421 * boost::math::tgamma(p0 + 1)
422 * boost::math::tgamma(p0 + 1));
431 c0 = 2.0 * p0 / ((2.0 * p0 + 1.0) * (p0 + 1.0)
432 * (ap0 * boost::math::tgamma(p0 + 1))
433 * (ap0 * boost::math::tgamma(p0 + 1)));
437 c0 = 2.0 * (p0 + 1.0) / ((2.0 * p0 + 1.0) * p0
438 * (ap0 * boost::math::tgamma(p0 + 1))
439 * (ap0 * boost::math::tgamma(p0 + 1)));
443 c0 = -2.0 / ((2.0 * p0 + 1.0)
444 * (ap0 * boost::math::tgamma(p0 + 1))
445 * (ap0 * boost::math::tgamma(p0 + 1)));
449 c0 = 10000000000000000.0;
452 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0)
453 * (ap0 * boost::math::tgamma(p0 + 1))
454 * (ap0 * boost::math::tgamma(p0 + 1));
456 NekDouble overeta0 = 1.0 / (1.0 + etap0);
467 for(i = 0; i < nquad0; ++i)
473 m_dGL_xi1[n][i] = 0.5 * sign0 * m_dGL_xi1[n][i];
477 for(i = 0; i < nquad0; ++i)
479 m_dGR_xi1[n][i] = etap0 * dLpm0[i];
480 m_dGR_xi1[n][i] += dLpp0[i];
481 m_dGR_xi1[n][i] *= overeta0;
482 m_dGR_xi1[n][i] += dLp0[i];
483 m_dGR_xi1[n][i] = 0.5 * m_dGR_xi1[n][i];
495 m_dGL_xi1 = Array<OneD, Array<OneD, NekDouble> >(nElements);
496 m_dGR_xi1 = Array<OneD, Array<OneD, NekDouble> >(nElements);
497 m_dGL_xi2 = Array<OneD, Array<OneD, NekDouble> >(nElements);
498 m_dGR_xi2 = Array<OneD, Array<OneD, NekDouble> >(nElements);
500 for (n = 0; n < nElements; ++n)
502 base = pFields[0]->GetExp(n)->GetBase();
503 nquad0 = base[0]->GetNumPoints();
504 nquad1 = base[1]->GetNumPoints();
505 nmodes0 = base[0]->GetNumModes();
506 nmodes1 = base[1]->GetNumModes();
508 Array<OneD, const NekDouble> z0;
509 Array<OneD, const NekDouble> w0;
510 Array<OneD, const NekDouble> z1;
511 Array<OneD, const NekDouble> w1;
513 base[0]->GetZW(z0, w0);
514 base[1]->GetZW(z1, w1);
516 m_dGL_xi1[n] = Array<OneD, NekDouble>(nquad0);
517 m_dGR_xi1[n] = Array<OneD, NekDouble>(nquad0);
518 m_dGL_xi2[n] = Array<OneD, NekDouble>(nquad1);
519 m_dGR_xi2[n] = Array<OneD, NekDouble>(nquad1);
523 Array<OneD,NekDouble> dLp0 (nquad0, 0.0);
524 Array<OneD,NekDouble> dLpp0 (nquad0, 0.0);
525 Array<OneD,NekDouble> dLpm0 (nquad0, 0.0);
526 Array<OneD,NekDouble> dLp1 (nquad1, 0.0);
527 Array<OneD,NekDouble> dLpp1 (nquad1, 0.0);
528 Array<OneD,NekDouble> dLpm1 (nquad1, 0.0);
531 int p0 = nmodes0 - 1;
532 int p1 = nmodes1 - 1;
539 NekDouble ap0 = boost::math::tgamma(2 * p0 + 1)
541 * boost::math::tgamma(p0 + 1)
542 * boost::math::tgamma(p0 + 1));
544 NekDouble ap1 = boost::math::tgamma(2 * p1 + 1)
546 * boost::math::tgamma(p1 + 1)
547 * boost::math::tgamma(p1 + 1));
557 c0 = 2.0 * p0 / ((2.0 * p0 + 1.0) * (p0 + 1.0)
558 * (ap0 * boost::math::tgamma(p0 + 1))
559 * (ap0 * boost::math::tgamma(p0 + 1)));
561 c1 = 2.0 * p1 / ((2.0 * p1 + 1.0) * (p1 + 1.0)
562 * (ap1 * boost::math::tgamma(p1 + 1))
563 * (ap1 * boost::math::tgamma(p1 + 1)));
567 c0 = 2.0 * (p0 + 1.0) / ((2.0 * p0 + 1.0) * p0
568 * (ap0 * boost::math::tgamma(p0 + 1))
569 * (ap0 * boost::math::tgamma(p0 + 1)));
571 c1 = 2.0 * (p1 + 1.0) / ((2.0 * p1 + 1.0) * p1
572 * (ap1 * boost::math::tgamma(p1 + 1))
573 * (ap1 * boost::math::tgamma(p1 + 1)));
577 c0 = -2.0 / ((2.0 * p0 + 1.0)
578 * (ap0 * boost::math::tgamma(p0 + 1))
579 * (ap0 * boost::math::tgamma(p0 + 1)));
581 c1 = -2.0 / ((2.0 * p1 + 1.0)
582 * (ap1 * boost::math::tgamma(p1 + 1))
583 * (ap1 * boost::math::tgamma(p1 + 1)));
587 c0 = 10000000000000000.0;
588 c1 = 10000000000000000.0;
591 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0)
592 * (ap0 * boost::math::tgamma(p0 + 1))
593 * (ap0 * boost::math::tgamma(p0 + 1));
595 NekDouble etap1 = 0.5 * c1 * (2.0 * p1 + 1.0)
596 * (ap1 * boost::math::tgamma(p1 + 1))
597 * (ap1 * boost::math::tgamma(p1 + 1));
599 NekDouble overeta0 = 1.0 / (1.0 + etap0);
600 NekDouble overeta1 = 1.0 / (1.0 + etap1);
615 for(i = 0; i < nquad0; ++i)
621 m_dGL_xi1[n][i] = 0.5 * sign0 * m_dGL_xi1[n][i];
625 for(i = 0; i < nquad1; ++i)
627 m_dGL_xi2[n][i] = etap1 * dLpm1[i];
628 m_dGL_xi2[n][i] += dLpp1[i];
629 m_dGL_xi2[n][i] *= overeta1;
630 m_dGL_xi2[n][i] = dLp1[i] - m_dGL_xi2[n][i];
631 m_dGL_xi2[n][i] = 0.5 * sign1 * m_dGL_xi2[n][i];
635 for(i = 0; i < nquad0; ++i)
637 m_dGR_xi1[n][i] = etap0 * dLpm0[i];
638 m_dGR_xi1[n][i] += dLpp0[i];
639 m_dGR_xi1[n][i] *= overeta0;
640 m_dGR_xi1[n][i] += dLp0[i];
641 m_dGR_xi1[n][i] = 0.5 * m_dGR_xi1[n][i];
645 for(i = 0; i < nquad1; ++i)
647 m_dGR_xi2[n][i] = etap1 * dLpm1[i];
648 m_dGR_xi2[n][i] += dLpp1[i];
649 m_dGR_xi2[n][i] *= overeta1;
650 m_dGR_xi2[n][i] += dLp1[i];
651 m_dGR_xi2[n][i] = 0.5 * m_dGR_xi2[n][i];
658 m_dGL_xi1 = Array<OneD, Array<OneD, NekDouble> >(nElements);
659 m_dGR_xi1 = Array<OneD, Array<OneD, NekDouble> >(nElements);
660 m_dGL_xi2 = Array<OneD, Array<OneD, NekDouble> >(nElements);
661 m_dGR_xi2 = Array<OneD, Array<OneD, NekDouble> >(nElements);
662 m_dGL_xi3 = Array<OneD, Array<OneD, NekDouble> >(nElements);
663 m_dGR_xi3 = Array<OneD, Array<OneD, NekDouble> >(nElements);
665 for (n = 0; n < nElements; ++n)
667 base = pFields[0]->GetExp(n)->GetBase();
668 nquad0 = base[0]->GetNumPoints();
669 nquad1 = base[1]->GetNumPoints();
670 nquad2 = base[2]->GetNumPoints();
671 nmodes0 = base[0]->GetNumModes();
672 nmodes1 = base[1]->GetNumModes();
673 nmodes2 = base[2]->GetNumModes();
675 Array<OneD, const NekDouble> z0;
676 Array<OneD, const NekDouble> w0;
677 Array<OneD, const NekDouble> z1;
678 Array<OneD, const NekDouble> w1;
679 Array<OneD, const NekDouble> z2;
680 Array<OneD, const NekDouble> w2;
682 base[0]->GetZW(z0, w0);
683 base[1]->GetZW(z1, w1);
684 base[1]->GetZW(z2, w2);
686 m_dGL_xi1[n] = Array<OneD, NekDouble>(nquad0);
687 m_dGR_xi1[n] = Array<OneD, NekDouble>(nquad0);
688 m_dGL_xi2[n] = Array<OneD, NekDouble>(nquad1);
689 m_dGR_xi2[n] = Array<OneD, NekDouble>(nquad1);
690 m_dGL_xi3[n] = Array<OneD, NekDouble>(nquad2);
691 m_dGR_xi3[n] = Array<OneD, NekDouble>(nquad2);
695 Array<OneD,NekDouble> dLp0 (nquad0, 0.0);
696 Array<OneD,NekDouble> dLpp0 (nquad0, 0.0);
697 Array<OneD,NekDouble> dLpm0 (nquad0, 0.0);
698 Array<OneD,NekDouble> dLp1 (nquad1, 0.0);
699 Array<OneD,NekDouble> dLpp1 (nquad1, 0.0);
700 Array<OneD,NekDouble> dLpm1 (nquad1, 0.0);
701 Array<OneD,NekDouble> dLp2 (nquad2, 0.0);
702 Array<OneD,NekDouble> dLpp2 (nquad2, 0.0);
703 Array<OneD,NekDouble> dLpm2 (nquad2, 0.0);
706 int p0 = nmodes0 - 1;
707 int p1 = nmodes1 - 1;
708 int p2 = nmodes2 - 1;
716 NekDouble ap0 = boost::math::tgamma(2 * p0 + 1)
718 * boost::math::tgamma(p0 + 1)
719 * boost::math::tgamma(p0 + 1));
722 NekDouble ap1 = boost::math::tgamma(2 * p1 + 1)
724 * boost::math::tgamma(p1 + 1)
725 * boost::math::tgamma(p1 + 1));
728 NekDouble ap2 = boost::math::tgamma(2 * p2 + 1)
730 * boost::math::tgamma(p2 + 1)
731 * boost::math::tgamma(p2 + 1));
742 c0 = 2.0 * p0 / ((2.0 * p0 + 1.0) * (p0 + 1.0)
743 * (ap0 * boost::math::tgamma(p0 + 1))
744 * (ap0 * boost::math::tgamma(p0 + 1)));
746 c1 = 2.0 * p1 / ((2.0 * p1 + 1.0) * (p1 + 1.0)
747 * (ap1 * boost::math::tgamma(p1 + 1))
748 * (ap1 * boost::math::tgamma(p1 + 1)));
750 c2 = 2.0 * p2 / ((2.0 * p2 + 1.0) * (p2 + 1.0)
751 * (ap2 * boost::math::tgamma(p2 + 1))
752 * (ap2 * boost::math::tgamma(p2 + 1)));
756 c0 = 2.0 * (p0 + 1.0) / ((2.0 * p0 + 1.0) * p0
757 * (ap0 * boost::math::tgamma(p0 + 1))
758 * (ap0 * boost::math::tgamma(p0 + 1)));
760 c1 = 2.0 * (p1 + 1.0) / ((2.0 * p1 + 1.0) * p1
761 * (ap1 * boost::math::tgamma(p1 + 1))
762 * (ap1 * boost::math::tgamma(p1 + 1)));
764 c2 = 2.0 * (p2 + 1.0) / ((2.0 * p2 + 1.0) * p2
765 * (ap2 * boost::math::tgamma(p2 + 1))
766 * (ap2 * boost::math::tgamma(p2 + 1)));
770 c0 = -2.0 / ((2.0 * p0 + 1.0)
771 * (ap0 * boost::math::tgamma(p0 + 1))
772 * (ap0 * boost::math::tgamma(p0 + 1)));
774 c1 = -2.0 / ((2.0 * p1 + 1.0)
775 * (ap1 * boost::math::tgamma(p1 + 1))
776 * (ap1 * boost::math::tgamma(p1 + 1)));
778 c2 = -2.0 / ((2.0 * p2 + 1.0)
779 * (ap2 * boost::math::tgamma(p2 + 1))
780 * (ap2 * boost::math::tgamma(p2 + 1)));
784 c0 = 10000000000000000.0;
785 c1 = 10000000000000000.0;
786 c2 = 10000000000000000.0;
789 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0)
790 * (ap0 * boost::math::tgamma(p0 + 1))
791 * (ap0 * boost::math::tgamma(p0 + 1));
793 NekDouble etap1 = 0.5 * c1 * (2.0 * p1 + 1.0)
794 * (ap1 * boost::math::tgamma(p1 + 1))
795 * (ap1 * boost::math::tgamma(p1 + 1));
797 NekDouble etap2 = 0.5 * c2 * (2.0 * p2 + 1.0)
798 * (ap2 * boost::math::tgamma(p2 + 1))
799 * (ap2 * boost::math::tgamma(p2 + 1));
801 NekDouble overeta0 = 1.0 / (1.0 + etap0);
802 NekDouble overeta1 = 1.0 / (1.0 + etap1);
803 NekDouble overeta2 = 1.0 / (1.0 + etap2);
822 for(i = 0; i < nquad0; ++i)
828 m_dGL_xi1[n][i] = 0.5 * sign0 * m_dGL_xi1[n][i];
832 for(i = 0; i < nquad1; ++i)
834 m_dGL_xi2[n][i] = etap1 * dLpm1[i];
835 m_dGL_xi2[n][i] += dLpp1[i];
836 m_dGL_xi2[n][i] *= overeta1;
837 m_dGL_xi2[n][i] = dLp1[i] - m_dGL_xi2[n][i];
838 m_dGL_xi2[n][i] = 0.5 * sign1 * m_dGL_xi2[n][i];
842 for(i = 0; i < nquad2; ++i)
844 m_dGL_xi3[n][i] = etap2 * dLpm2[i];
845 m_dGL_xi3[n][i] += dLpp2[i];
846 m_dGL_xi3[n][i] *= overeta2;
847 m_dGL_xi3[n][i] = dLp2[i] - m_dGL_xi3[n][i];
848 m_dGL_xi3[n][i] = 0.5 * sign2 * m_dGL_xi3[n][i];
852 for(i = 0; i < nquad0; ++i)
854 m_dGR_xi1[n][i] = etap0 * dLpm0[i];
855 m_dGR_xi1[n][i] += dLpp0[i];
856 m_dGR_xi1[n][i] *= overeta0;
857 m_dGR_xi1[n][i] += dLp0[i];
858 m_dGR_xi1[n][i] = 0.5 * m_dGR_xi1[n][i];
862 for(i = 0; i < nquad1; ++i)
864 m_dGR_xi2[n][i] = etap1 * dLpm1[i];
865 m_dGR_xi2[n][i] += dLpp1[i];
866 m_dGR_xi2[n][i] *= overeta1;
867 m_dGR_xi2[n][i] += dLp1[i];
868 m_dGR_xi2[n][i] = 0.5 * m_dGR_xi2[n][i];
872 for(i = 0; i < nquad2; ++i)
874 m_dGR_xi3[n][i] = etap2 * dLpm2[i];
875 m_dGR_xi3[n][i] += dLpp2[i];
876 m_dGR_xi3[n][i] *= overeta2;
877 m_dGR_xi3[n][i] += dLp2[i];
878 m_dGR_xi3[n][i] = 0.5 * m_dGR_xi3[n][i];
885 ASSERTL0(
false,
"Expansion dimension not recognised");
900 const int nConvectiveFields,
901 const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
902 const Array<
OneD, Array<OneD, NekDouble> > &inarray,
903 Array<
OneD, Array<OneD, NekDouble> > &outarray)
908 Array<TwoD, const NekDouble> gmat;
909 Array<OneD, const NekDouble> jac;
910 Array<OneD, NekDouble> auxArray1, auxArray2;
912 Array<OneD, LibUtilities::BasisSharedPtr> Basis;
913 Basis = fields[0]->GetExp(0)->GetBase();
915 int nElements = fields[0]->GetExpSize();
916 int nDim = fields[0]->GetCoordim(0);
917 int nScalars = inarray.num_elements();
918 int nSolutionPts = fields[0]->GetTotPoints();
919 int nCoeffs = fields[0]->GetNcoeffs();
921 Array<OneD, Array<OneD, NekDouble> > outarrayCoeff(nConvectiveFields);
922 for (i = 0; i < nConvectiveFields; ++i)
924 outarrayCoeff[i] = Array<OneD, NekDouble>(nCoeffs);
935 for (i = 0; i < nScalars; ++i)
939 for (n = 0; n < nElements; n++)
941 phys_offset = fields[0]->GetPhys_Offset(n);
943 fields[i]->GetExp(n)->PhysDeriv(0,
944 auxArray1 = inarray[i] + phys_offset,
945 auxArray2 =
m_DU1[i][0] + phys_offset);
975 for (i = 0; i < nConvectiveFields; ++i)
979 for (n = 0; n < nElements; n++)
981 phys_offset = fields[0]->GetPhys_Offset(n);
983 fields[i]->GetExp(n)->PhysDeriv(0,
985 auxArray2 =
m_DD1[i][0] + phys_offset);
1002 &
m_DD1[i][0][0], 1, &outarray[i][0], 1);
1005 if(!(Basis[0]->Collocation()))
1007 fields[i]->FwdTrans(outarray[i], outarrayCoeff[i]);
1008 fields[i]->BwdTrans(outarrayCoeff[i], outarray[i]);
1016 for(i = 0; i < nScalars; ++i)
1018 for (j = 0; j < nDim; ++j)
1021 Array<OneD, NekDouble> u1_hat(nSolutionPts, 0.0);
1022 Array<OneD, NekDouble> u2_hat(nSolutionPts, 0.0);
1027 &
m_gmat[0][0], 1, &u1_hat[0], 1);
1030 &
m_jac[0], 1, &u1_hat[0], 1);
1033 &
m_gmat[1][0], 1, &u2_hat[0], 1);
1036 &
m_jac[0], 1, &u2_hat[0], 1);
1041 &
m_gmat[2][0], 1, &u1_hat[0], 1);
1044 &
m_jac[0], 1, &u1_hat[0], 1);
1047 &
m_gmat[3][0], 1, &u2_hat[0], 1);
1050 &
m_jac[0], 1, &u2_hat[0], 1);
1053 for (n = 0; n < nElements; n++)
1055 phys_offset = fields[0]->GetPhys_Offset(n);
1057 fields[i]->GetExp(n)->StdPhysDeriv(0,
1058 auxArray1 = u1_hat + phys_offset,
1059 auxArray2 =
m_tmp1[i][j] + phys_offset);
1061 fields[i]->GetExp(n)->StdPhysDeriv(1,
1062 auxArray1 = u2_hat + phys_offset,
1063 auxArray2 =
m_tmp2[i][j] + phys_offset);
1068 &
m_DU1[i][j][0], 1);
1077 inarray[i],
m_IF1[i][j],
1083 for (j = 0; j < nSolutionPts; ++j)
1106 for (j = 0; j < nSolutionPts; j++)
1115 m_gmat[0][j] * m_BD1[i][1][j] -
1116 m_gmat[1][j] * m_BD1[i][0][j];
1120 for (j = 0; j < nDim; ++j)
1131 for (i = 0; i < nScalars; ++i)
1148 for (i = 0; i < nConvectiveFields; ++i)
1151 Array<OneD, NekDouble> f_hat(nSolutionPts, 0.0);
1152 Array<OneD, NekDouble> g_hat(nSolutionPts, 0.0);
1154 for (j = 0; j < nSolutionPts; j++)
1163 for (n = 0; n < nElements; n++)
1165 phys_offset = fields[0]->GetPhys_Offset(n);
1167 fields[0]->GetExp(n)->StdPhysDeriv(0,
1168 auxArray1 = f_hat + phys_offset,
1169 auxArray2 =
m_DD1[i][0] + phys_offset);
1171 fields[0]->GetExp(n)->StdPhysDeriv(1,
1172 auxArray1 = g_hat + phys_offset,
1173 auxArray2 =
m_DD1[i][1] + phys_offset);
1181 if (Basis[0]->GetPointsType() ==
1183 Basis[1]->GetPointsType() ==
1201 &
m_divFC[i][0], 1, &outarray[i][0], 1);
1206 &
m_jac[0], 1, &outarray[i][0], 1);
1209 if(!(Basis[0]->Collocation()))
1211 fields[i]->FwdTrans(outarray[i], outarrayCoeff[i]);
1212 fields[i]->BwdTrans(outarrayCoeff[i], outarray[i]);
1220 ASSERTL0(
false,
"3D FRDG case not implemented yet");
1232 const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
1233 const Array<
OneD, Array<OneD, NekDouble> > &inarray,
1234 Array<
OneD, Array<
OneD, Array<OneD, NekDouble> > >
1238 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1239 int nScalars = inarray.num_elements();
1240 int nDim = fields[0]->GetCoordim(0);
1242 Array<OneD, NekDouble > Vn (nTracePts, 0.0);
1243 Array<OneD, NekDouble > fluxtemp(nTracePts, 0.0);
1246 for (i = 0; i < nDim; ++i)
1248 fields[0]->ExtractTracePhys(inarray[i],
m_traceVel[i]);
1254 Array<OneD, Array<OneD, NekDouble> > Fwd (nScalars);
1255 Array<OneD, Array<OneD, NekDouble> > Bwd (nScalars);
1256 Array<OneD, Array<OneD, NekDouble> > numflux(nScalars);
1258 for (i = 0; i < nScalars; ++i)
1260 Fwd[i] = Array<OneD, NekDouble>(nTracePts);
1261 Bwd[i] = Array<OneD, NekDouble>(nTracePts);
1262 numflux[i] = Array<OneD, NekDouble>(nTracePts);
1263 fields[i]->GetFwdBwdTracePhys(inarray[i], Fwd[i], Bwd[i]);
1264 fields[0]->GetTrace()->Upwind(Vn, Fwd[i], Bwd[i], numflux[i]);
1268 if (fields[0]->GetBndCondExpansions().num_elements())
1274 for (j = 0; j < nDim; ++j)
1276 for (i = 0; i < nScalars; ++i)
1279 numericalFluxO1[i][j], 1);
1289 const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
1290 const Array<
OneD, Array<OneD, NekDouble> > &inarray,
1291 Array<
OneD, Array<OneD, NekDouble> > &penaltyfluxO1)
1297 int nBndEdgePts, nBndEdges, nBndRegions;
1299 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1300 int nScalars = inarray.num_elements();
1302 Array<OneD, NekDouble> tmp1(nTracePts, 0.0);
1303 Array<OneD, NekDouble> tmp2(nTracePts, 0.0);
1304 Array<OneD, NekDouble> Tw(nTracePts,
m_Twall);
1306 Array< OneD, Array<OneD, NekDouble > > scalarVariables(nScalars);
1307 Array< OneD, Array<OneD, NekDouble > > uplus(nScalars);
1310 for (i = 0; i < nScalars; ++i)
1312 scalarVariables[i] = Array<OneD, NekDouble>(nTracePts, 0.0);
1314 uplus[i] = Array<OneD, NekDouble>(nTracePts, 0.0);
1315 fields[i]->ExtractTracePhys(inarray[i], uplus[i]);
1319 for (i = 0; i < nScalars-1; ++i)
1324 nBndRegions = fields[i+1]->
1325 GetBndCondExpansions().num_elements();
1326 for (j = 0; j < nBndRegions; ++j)
1328 nBndEdges = fields[i+1]->
1329 GetBndCondExpansions()[j]->GetExpSize();
1330 for (e = 0; e < nBndEdges; ++e)
1332 nBndEdgePts = fields[i+1]->
1333 GetBndCondExpansions()[j]->GetExp(e)->GetTotPoints();
1336 GetBndCondExpansions()[j]->GetPhys_Offset(e);
1338 id2 = fields[0]->GetTrace()->
1339 GetPhys_Offset(fields[0]->GetTraceMap()->
1340 GetBndCondTraceToGlobalTraceMap(cnt++));
1343 if (fields[i]->GetBndConditions()[j]->
1348 &scalarVariables[i][id2], 1);
1352 else if (fields[i]->GetBndConditions()[j]->
1353 GetBoundaryConditionType() ==
1358 GetBndCondExpansions()[j]->
1359 UpdatePhys())[id1], 1,
1361 GetBndCondExpansions()[j]->
1362 UpdatePhys())[id1], 1,
1363 &scalarVariables[i][id2], 1);
1367 if (fields[i]->GetBndConditions()[j]->
1368 GetBoundaryConditionType() ==
1372 &scalarVariables[i][id2], 1,
1373 &penaltyfluxO1[i][id2], 1);
1377 else if ((fields[i]->GetBndConditions()[j])->
1378 GetBoundaryConditionType() ==
1383 &penaltyfluxO1[i][id2], 1);
1388 &scalarVariables[i][id2], 1,
1389 &scalarVariables[i][id2], 1,
1406 nBndRegions = fields[nScalars]->
1407 GetBndCondExpansions().num_elements();
1408 for (j = 0; j < nBndRegions; ++j)
1410 nBndEdges = fields[nScalars]->
1411 GetBndCondExpansions()[j]->GetExpSize();
1412 for (e = 0; e < nBndEdges; ++e)
1414 nBndEdgePts = fields[nScalars]->
1415 GetBndCondExpansions()[j]->GetExp(e)->GetTotPoints();
1417 id1 = fields[nScalars]->
1418 GetBndCondExpansions()[j]->GetPhys_Offset(e);
1420 id2 = fields[0]->GetTrace()->
1421 GetPhys_Offset(fields[0]->GetTraceMap()->
1422 GetBndCondTraceToGlobalTraceMap(cnt++));
1425 if (fields[i]->GetBndConditions()[j]->
1431 &scalarVariables[nScalars-1][id2], 1);
1435 else if (fields[i]->GetBndConditions()[j]->
1436 GetBoundaryConditionType() ==
1441 &(fields[nScalars]->
1442 GetBndCondExpansions()[j]->
1445 GetBndCondExpansions()[j]->
1447 &scalarVariables[nScalars-1][id2], 1);
1451 &scalarVariables[nScalars-1][id2], 1,
1453 &scalarVariables[nScalars-1][id2], 1);
1457 &scalarVariables[nScalars-1][id2], 1,
1458 &scalarVariables[nScalars-1][id2], 1);
1462 if (fields[nScalars]->GetBndConditions()[j]->
1463 GetBoundaryConditionType() ==
1467 &scalarVariables[nScalars-1][id2], 1,
1468 &penaltyfluxO1[nScalars-1][id2], 1);
1472 else if ((fields[nScalars]->GetBndConditions()[j])->
1473 GetBoundaryConditionType() ==
1477 &uplus[nScalars-1][id2], 1,
1478 &penaltyfluxO1[nScalars-1][id2], 1);
1489 const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
1490 const Array<
OneD, Array<OneD, NekDouble> > &ufield,
1491 Array<
OneD, Array<
OneD, Array<OneD, NekDouble> > > &qfield,
1492 Array<
OneD, Array<OneD, NekDouble> > &qflux)
1495 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1496 int nVariables = fields.num_elements();
1497 int nDim = fields[0]->GetCoordim(0);
1499 Array<OneD, NekDouble > Fwd(nTracePts);
1500 Array<OneD, NekDouble > Bwd(nTracePts);
1501 Array<OneD, NekDouble > Vn (nTracePts, 0.0);
1503 Array<OneD, NekDouble > qFwd (nTracePts);
1504 Array<OneD, NekDouble > qBwd (nTracePts);
1505 Array<OneD, NekDouble > qfluxtemp(nTracePts, 0.0);
1508 for (i = 0; i < nDim; ++i)
1510 fields[0]->ExtractTracePhys(ufield[i],
m_traceVel[i]);
1518 for (i = 1; i < nVariables; ++i)
1520 qflux[i] = Array<OneD, NekDouble> (nTracePts, 0.0);
1521 for (j = 0; j < nDim; ++j)
1524 fields[i]->GetFwdBwdTracePhys(qfield[j][i], qFwd, qBwd);
1527 fields[i]->GetTrace()->Upwind(Vn, qBwd, qFwd, qfluxtemp);
1534 if (fields[0]->GetBndCondExpansions().num_elements())
1552 const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
1555 const Array<OneD, const NekDouble> &qfield,
1556 Array<OneD, NekDouble> &penaltyflux)
1559 int nBndEdges, nBndEdgePts;
1563 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1564 int nBndRegions = fields[var]->GetBndCondExpansions().num_elements();
1566 Array<OneD, NekDouble > uterm(nTracePts);
1567 Array<OneD, NekDouble > qtemp(nTracePts);
1570 fields[var]->ExtractTracePhys(qfield, qtemp);
1573 for (i = 0; i < nBndRegions; ++i)
1576 nBndEdges = fields[var]->
1577 GetBndCondExpansions()[i]->GetExpSize();
1580 for (e = 0; e < nBndEdges; ++e)
1582 nBndEdgePts = fields[var]->
1583 GetBndCondExpansions()[i]->GetExp(e)->GetTotPoints();
1585 id2 = fields[0]->GetTrace()->
1586 GetPhys_Offset(fields[0]->GetTraceMap()->
1587 GetBndCondTraceToGlobalTraceMap(cnt++));
1592 if (fields[var]->GetBndConditions()[i]->
1596 &qtemp[id2], 1, &penaltyflux[id2], 1);
1600 else if ((fields[var]->GetBndConditions()[i])->
1604 "Neumann bcs not implemented for LFRNS");
1630 const int nConvectiveFields,
1631 const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
1632 const Array<OneD, const NekDouble> &flux,
1633 const Array<OneD, const NekDouble> &iFlux,
1634 Array<OneD, NekDouble> &derCFlux)
1637 int nLocalSolutionPts, phys_offset;
1639 Array<OneD, NekDouble> auxArray1, auxArray2;
1640 Array<TwoD, const NekDouble> gmat;
1641 Array<OneD, const NekDouble> jac;
1645 Basis = fields[0]->GetExp(0)->GetBasis(0);
1647 int nElements = fields[0]->GetExpSize();
1648 int nPts = fields[0]->GetTotPoints();
1651 Array<OneD, NekDouble> DCL(nPts/nElements, 0.0);
1652 Array<OneD, NekDouble> DCR(nPts/nElements, 0.0);
1655 Array<OneD, NekDouble> JumpL(nElements);
1656 Array<OneD, NekDouble> JumpR(nElements);
1658 for (n = 0; n < nElements; ++n)
1660 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1661 phys_offset = fields[0]->GetPhys_Offset(n);
1663 Array<OneD, NekDouble> tmparrayX1(nLocalSolutionPts, 0.0);
1666 &flux[phys_offset], 1,
1669 fields[0]->GetExp(n)->GetVertexPhysVals(0, tmparrayX1,
1671 JumpL[n] = iFlux[n] - tmpFluxVertex;
1673 fields[0]->GetExp(n)->GetVertexPhysVals(1, tmparrayX1,
1675 JumpR[n] = iFlux[n+1] - tmpFluxVertex;
1678 for (n = 0; n < nElements; ++n)
1680 ptsKeys = fields[0]->GetExp(n)->GetPointsKeys();
1681 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1682 phys_offset = fields[0]->GetPhys_Offset(n);
1683 jac = fields[0]->GetExp(n)
1687 JumpL[n] = JumpL[n] * jac[0];
1688 JumpR[n] = JumpR[n] * jac[0];
1699 Vmath::Vadd(nLocalSolutionPts, &DCL[0], 1, &DCR[0], 1,
1700 &derCFlux[phys_offset], 1);
1720 const int nConvectiveFields,
1721 const int direction,
1722 const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
1723 const Array<OneD, const NekDouble> &flux,
1724 const Array<OneD, NekDouble> &iFlux,
1725 Array<OneD, NekDouble> &derCFlux)
1727 int n, e, i, j, cnt;
1729 Array<OneD, const NekDouble> jac;
1731 int nElements = fields[0]->GetExpSize();
1732 int trace_offset, phys_offset;
1733 int nLocalSolutionPts;
1738 Array<OneD, NekDouble> auxArray1, auxArray2;
1739 Array<OneD, LibUtilities::BasisSharedPtr> base;
1740 Array<OneD, Array<OneD, StdRegions::StdExpansionSharedPtr> >
1741 &elmtToTrace = fields[0]->GetTraceMap()->GetElmtToTrace();
1744 for (n = 0; n < nElements; ++n)
1747 phys_offset = fields[0]->GetPhys_Offset(n);
1748 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1749 ptsKeys = fields[0]->GetExp(n)->GetPointsKeys();
1754 base = fields[0]->GetExp(n)->GetBase();
1755 nquad0 = base[0]->GetNumPoints();
1756 nquad1 = base[1]->GetNumPoints();
1758 Array<OneD, NekDouble> divCFluxE0(nLocalSolutionPts, 0.0);
1759 Array<OneD, NekDouble> divCFluxE1(nLocalSolutionPts, 0.0);
1760 Array<OneD, NekDouble> divCFluxE2(nLocalSolutionPts, 0.0);
1761 Array<OneD, NekDouble> divCFluxE3(nLocalSolutionPts, 0.0);
1764 for (e = 0; e < fields[0]->GetExp(n)->GetNedges(); ++e)
1767 nEdgePts = fields[0]->GetExp(n)->GetEdgeNumPoints(e);
1770 Array<OneD, NekDouble> tmparray(nEdgePts, 0.0);
1773 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
1774 elmtToTrace[n][e]->GetElmtId());
1783 fields[0]->GetExp(n)->GetEdgePhysVals(
1784 e, elmtToTrace[n][e],
1786 auxArray1 = tmparray);
1795 Array<OneD, NekDouble> fluxJumps(nEdgePts, 0.0);
1797 &tmparray[0], 1, &fluxJumps[0], 1);
1801 if (fields[0]->GetExp(n)->GetEorient(e) ==
1810 if (fields[0]->GetExp(n)->as<LocalRegions::Expansion2D>()
1811 ->GetGeom2D()->GetMetricInfo()->GetGtype()
1815 Array<OneD, NekDouble> jacEdge(nEdgePts, 0.0);
1816 fields[0]->GetExp(n)->GetEdgePhysVals(
1817 e, elmtToTrace[n][e],
1818 jac, auxArray1 = jacEdge);
1822 if (fields[0]->GetExp(n)->GetEorient(e) ==
1831 for (j = 0; j < nEdgePts; j++)
1833 fluxJumps[j] = fluxJumps[j] * jacEdge[j];
1851 for (i = 0; i < nquad0; ++i)
1856 for (j = 0; j < nquad1; ++j)
1859 divCFluxE0[cnt] = fluxJumps[i] *
m_dGL_xi2[n][j];
1864 for (i = 0; i < nquad1; ++i)
1869 for (j = 0; j < nquad0; ++j)
1871 cnt = (nquad0)*i + j;
1872 divCFluxE1[cnt] = fluxJumps[i] *
m_dGR_xi1[n][j];
1877 for (i = 0; i < nquad0; ++i)
1882 for (j = 0; j < nquad1; ++j)
1884 cnt = (nquad0 - 1) + j*nquad0 - i;
1885 divCFluxE2[cnt] = fluxJumps[i] *
m_dGR_xi2[n][j];
1890 for (i = 0; i < nquad1; ++i)
1894 for (j = 0; j < nquad0; ++j)
1896 cnt = (nquad0*nquad1 - nquad0) + j - i*nquad0;
1897 divCFluxE3[cnt] = fluxJumps[i] *
m_dGL_xi1[n][j];
1903 ASSERTL0(
false,
"edge value (< 3) is out of range");
1917 &divCFluxE3[0], 1, &derCFlux[phys_offset], 1);
1919 else if (direction == 1)
1922 &divCFluxE2[0], 1, &derCFlux[phys_offset], 1);
1941 const int nConvectiveFields,
1942 const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
1943 const Array<OneD, const NekDouble> &fluxX1,
1944 const Array<OneD, const NekDouble> &fluxX2,
1945 const Array<OneD, const NekDouble> &numericalFlux,
1946 Array<OneD, NekDouble> &divCFlux)
1948 int n, e, i, j, cnt;
1950 int nElements = fields[0]->GetExpSize();
1951 int nLocalSolutionPts;
1958 Array<OneD, NekDouble> auxArray1, auxArray2;
1959 Array<OneD, LibUtilities::BasisSharedPtr> base;
1961 Array<OneD, Array<OneD, StdRegions::StdExpansionSharedPtr> >
1962 &elmtToTrace = fields[0]->GetTraceMap()->GetElmtToTrace();
1965 for(n = 0; n < nElements; ++n)
1968 phys_offset = fields[0]->GetPhys_Offset(n);
1969 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1971 base = fields[0]->GetExp(n)->GetBase();
1972 nquad0 = base[0]->GetNumPoints();
1973 nquad1 = base[1]->GetNumPoints();
1975 Array<OneD, NekDouble> divCFluxE0(nLocalSolutionPts, 0.0);
1976 Array<OneD, NekDouble> divCFluxE1(nLocalSolutionPts, 0.0);
1977 Array<OneD, NekDouble> divCFluxE2(nLocalSolutionPts, 0.0);
1978 Array<OneD, NekDouble> divCFluxE3(nLocalSolutionPts, 0.0);
1981 for(e = 0; e < fields[0]->GetExp(n)->GetNedges(); ++e)
1984 nEdgePts = fields[0]->GetExp(n)->GetEdgeNumPoints(e);
1986 Array<OneD, NekDouble> tmparrayX1(nEdgePts, 0.0);
1987 Array<OneD, NekDouble> tmparrayX2(nEdgePts, 0.0);
1988 Array<OneD, NekDouble> fluxN (nEdgePts, 0.0);
1989 Array<OneD, NekDouble> fluxT (nEdgePts, 0.0);
1990 Array<OneD, NekDouble> fluxJumps(nEdgePts, 0.0);
1993 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
1994 elmtToTrace[n][e]->GetElmtId());
1997 const Array<OneD, const Array<OneD, NekDouble> > &normals =
1998 fields[0]->GetExp(n)->GetEdgeNormal(e);
2002 fields[0]->GetExp(n)->GetEdgePhysVals(
2003 e, elmtToTrace[n][e],
2004 fluxX1 + phys_offset,
2005 auxArray1 = tmparrayX1);
2009 fields[0]->GetExp(n)->GetEdgePhysVals(
2010 e, elmtToTrace[n][e],
2011 fluxX2 + phys_offset,
2012 auxArray1 = tmparrayX2);
2015 for (i = 0; i < nEdgePts; ++i)
2024 &numericalFlux[trace_offset], 1,
2025 &fluxN[0], 1, &fluxJumps[0], 1);
2028 if (fields[0]->GetExp(n)->GetEorient(e) ==
2032 auxArray1 = fluxJumps, 1,
2033 auxArray2 = fluxJumps, 1);
2036 NekDouble fac = fields[0]->GetExp(n)->EdgeNormalNegated(e) ?
2039 for (i = 0; i < nEdgePts; ++i)
2044 fluxJumps[i] = -fluxJumps[i];
2052 for (i = 0; i < nquad0; ++i)
2055 fluxJumps[i] = -(
m_Q2D_e0[n][i]) * fluxJumps[i];
2057 for (j = 0; j < nquad1; ++j)
2060 divCFluxE0[cnt] = fluxJumps[i] *
m_dGL_xi2[n][j];
2065 for (i = 0; i < nquad1; ++i)
2068 fluxJumps[i] = (
m_Q2D_e1[n][i]) * fluxJumps[i];
2070 for (j = 0; j < nquad0; ++j)
2072 cnt = (nquad0)*i + j;
2073 divCFluxE1[cnt] = fluxJumps[i] *
m_dGR_xi1[n][j];
2078 for (i = 0; i < nquad0; ++i)
2081 fluxJumps[i] = (
m_Q2D_e2[n][i]) * fluxJumps[i];
2083 for (j = 0; j < nquad1; ++j)
2085 cnt = (nquad0 - 1) + j*nquad0 - i;
2086 divCFluxE2[cnt] = fluxJumps[i] *
m_dGR_xi2[n][j];
2091 for (i = 0; i < nquad1; ++i)
2094 fluxJumps[i] = -(
m_Q2D_e3[n][i]) * fluxJumps[i];
2095 for (j = 0; j < nquad0; ++j)
2097 cnt = (nquad0*nquad1 - nquad0) + j - i*nquad0;
2098 divCFluxE3[cnt] = fluxJumps[i] *
m_dGL_xi1[n][j];
2105 ASSERTL0(
false,
"edge value (< 3) is out of range");
2112 &divCFluxE1[0], 1, &divCFlux[phys_offset], 1);
2114 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
2115 &divCFluxE2[0], 1, &divCFlux[phys_offset], 1);
2117 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
2118 &divCFluxE3[0], 1, &divCFlux[phys_offset], 1);
2137 const int nConvectiveFields,
2138 const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
2139 const Array<OneD, const NekDouble> &fluxX1,
2140 const Array<OneD, const NekDouble> &fluxX2,
2141 const Array<OneD, const NekDouble> &numericalFlux,
2142 Array<OneD, NekDouble> &divCFlux)
2144 int n, e, i, j, cnt;
2146 int nElements = fields[0]->GetExpSize();
2147 int nLocalSolutionPts;
2154 Array<OneD, NekDouble> auxArray1, auxArray2;
2155 Array<OneD, LibUtilities::BasisSharedPtr> base;
2157 Array<OneD, Array<OneD, StdRegions::StdExpansionSharedPtr> >
2158 &elmtToTrace = fields[0]->GetTraceMap()->GetElmtToTrace();
2161 for(n = 0; n < nElements; ++n)
2164 phys_offset = fields[0]->GetPhys_Offset(n);
2165 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
2167 base = fields[0]->GetExp(n)->GetBase();
2168 nquad0 = base[0]->GetNumPoints();
2169 nquad1 = base[1]->GetNumPoints();
2171 Array<OneD, NekDouble> divCFluxE0(nLocalSolutionPts, 0.0);
2172 Array<OneD, NekDouble> divCFluxE1(nLocalSolutionPts, 0.0);
2173 Array<OneD, NekDouble> divCFluxE2(nLocalSolutionPts, 0.0);
2174 Array<OneD, NekDouble> divCFluxE3(nLocalSolutionPts, 0.0);
2177 for(e = 0; e < fields[0]->GetExp(n)->GetNedges(); ++e)
2180 nEdgePts = fields[0]->GetExp(n)->GetEdgeNumPoints(e);
2182 Array<OneD, NekDouble> fluxN (nEdgePts, 0.0);
2183 Array<OneD, NekDouble> fluxT (nEdgePts, 0.0);
2184 Array<OneD, NekDouble> fluxN_R (nEdgePts, 0.0);
2185 Array<OneD, NekDouble> fluxN_D (nEdgePts, 0.0);
2186 Array<OneD, NekDouble> fluxJumps (nEdgePts, 0.0);
2189 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
2190 elmtToTrace[n][e]->GetElmtId());
2193 const Array<OneD, const Array<OneD, NekDouble> > &normals =
2194 fields[0]->GetExp(n)->GetEdgeNormal(e);
2203 fields[0]->GetExp(n)->GetEdgePhysVals(
2204 e, elmtToTrace[n][e],
2205 fluxX2 + phys_offset,
2206 auxArray1 = fluxN_D);
2212 &numericalFlux[trace_offset], 1,
2216 if (fields[0]->GetExp(n)->GetEorient(e) ==
2220 auxArray1 = fluxN, 1,
2221 auxArray2 = fluxN, 1);
2224 auxArray1 = fluxN_D, 1,
2225 auxArray2 = fluxN_D, 1);
2229 for (i = 0; i < nquad0; ++i)
2232 fluxN_R[i] = (
m_Q2D_e0[n][i]) * fluxN[i];
2235 for (i = 0; i < nEdgePts; ++i)
2242 fluxN_R[i] = -fluxN_R[i];
2250 &fluxN_D[0], 1, &fluxJumps[0], 1);
2254 for (i = 0; i < nquad0; ++i)
2256 for (j = 0; j < nquad1; ++j)
2268 fields[0]->GetExp(n)->GetEdgePhysVals(
2269 e, elmtToTrace[n][e],
2270 fluxX1 + phys_offset,
2271 auxArray1 = fluxN_D);
2275 &numericalFlux[trace_offset], 1,
2279 if (fields[0]->GetExp(n)->GetEorient(e) ==
2283 auxArray1 = fluxN, 1,
2284 auxArray2 = fluxN, 1);
2287 auxArray1 = fluxN_D, 1,
2288 auxArray2 = fluxN_D, 1);
2292 for (i = 0; i < nquad1; ++i)
2295 fluxN_R[i] = (
m_Q2D_e1[n][i]) * fluxN[i];
2298 for (i = 0; i < nEdgePts; ++i)
2305 fluxN_R[i] = -fluxN_R[i];
2313 &fluxN_D[0], 1, &fluxJumps[0], 1);
2317 for (i = 0; i < nquad1; ++i)
2319 for (j = 0; j < nquad0; ++j)
2321 cnt = (nquad0)*i + j;
2333 fields[0]->GetExp(n)->GetEdgePhysVals(
2334 e, elmtToTrace[n][e],
2335 fluxX2 + phys_offset,
2336 auxArray1 = fluxN_D);
2340 &numericalFlux[trace_offset], 1,
2344 if (fields[0]->GetExp(n)->GetEorient(e) ==
2348 auxArray1 = fluxN, 1,
2349 auxArray2 = fluxN, 1);
2352 auxArray1 = fluxN_D, 1,
2353 auxArray2 = fluxN_D, 1);
2357 for (i = 0; i < nquad0; ++i)
2360 fluxN_R[i] = (
m_Q2D_e2[n][i]) * fluxN[i];
2363 for (i = 0; i < nEdgePts; ++i)
2370 fluxN_R[i] = -fluxN_R[i];
2379 &fluxN_D[0], 1, &fluxJumps[0], 1);
2383 for (i = 0; i < nquad0; ++i)
2385 for (j = 0; j < nquad1; ++j)
2387 cnt = (nquad0 - 1) + j*nquad0 - i;
2398 fields[0]->GetExp(n)->GetEdgePhysVals(
2399 e, elmtToTrace[n][e],
2400 fluxX1 + phys_offset,
2401 auxArray1 = fluxN_D);
2406 &numericalFlux[trace_offset], 1,
2410 if (fields[0]->GetExp(n)->GetEorient(e) ==
2414 auxArray1 = fluxN, 1,
2415 auxArray2 = fluxN, 1);
2418 auxArray1 = fluxN_D, 1,
2419 auxArray2 = fluxN_D, 1);
2423 for (i = 0; i < nquad1; ++i)
2426 fluxN_R[i] = (
m_Q2D_e3[n][i]) * fluxN[i];
2429 for (i = 0; i < nEdgePts; ++i)
2436 fluxN_R[i] = -fluxN_R[i];
2445 &fluxN_D[0], 1, &fluxJumps[0], 1);
2449 for (i = 0; i < nquad1; ++i)
2451 for (j = 0; j < nquad0; ++j)
2453 cnt = (nquad0*nquad1 - nquad0) + j
2461 ASSERTL0(
false,
"edge value (< 3) is out of range");
2469 &divCFluxE1[0], 1, &divCFlux[phys_offset], 1);
2471 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
2472 &divCFluxE2[0], 1, &divCFlux[phys_offset], 1);
2474 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
2475 &divCFluxE3[0], 1, &divCFlux[phys_offset], 1);