51 Array<OneD, MultiRegions::ExpListSharedPtr> pFields,
53 const Array<OneD, int> pVel,
55 :
Extrapolate(pSession,pFields,pPressure,pVel,advObject)
83 int ntotpts =
m_fields[0]->GetTotPoints();
85 for(i = 1; i < 2*
m_fields.num_elements(); ++i)
101 int ntotpts =
m_fields[0]->GetTotPoints();
103 for(i = 1; i < 3*nvel; ++i)
111 ASSERTL0(0,
"Integration method not suitable: Options include BackwardEuler or BDFImplicitOrder1");
115 m_intSteps = IntegrationScheme->GetIntegrationSteps();
126 const Array<
OneD,
const Array<OneD, NekDouble> > &inarray,
127 Array<
OneD, Array<OneD, NekDouble> > &outarray,
131 int nVariables = inarray.num_elements();
132 int nQuadraturePts = inarray[0].num_elements();
135 int ncoeffs =
m_fields[0]->GetNcoeffs();
138 Array<OneD, Array<OneD, NekDouble> > WeakAdv(nVariables);
139 WeakAdv[0] = Array<OneD, NekDouble> (ncoeffs*nVariables);
140 for(i = 1; i < nVariables; ++i)
142 WeakAdv[i] = WeakAdv[i-1] + ncoeffs;
145 Array<OneD, Array<OneD, NekDouble> > Velfields(
m_velocity.num_elements());
146 Array<OneD, int> VelIds(
m_velocity.num_elements());
148 Velfields[0] = Array<OneD, NekDouble> (nQuadraturePts*
m_velocity.num_elements());
150 for(i = 1; i <
m_velocity.num_elements(); ++i)
152 Velfields[i] = Velfields[i-1] + nQuadraturePts;
159 for(i = 0; i < nVariables; ++i)
161 m_fields[i]->IProductWRTBase(outarray[i],WeakAdv[i]);
169 for(i = 0; i < nVariables; ++i)
175 m_fields[i]->MultiplyByElmtInvMass(WeakAdv[i], WeakAdv[i]);
178 m_fields[i]->BwdTrans(WeakAdv[i], outarray[i]);
206 const Array<
OneD,
const Array<OneD, NekDouble> > &inarray,
207 Array<
OneD, Array<OneD, NekDouble> > &outarray,
210 ASSERTL1(inarray.num_elements() == outarray.num_elements(),
"Inarray and outarray of different sizes ");
212 for(
int i = 0; i < inarray.num_elements(); ++i)
214 Vmath::Vcopy(inarray[i].num_elements(),inarray[i],1,outarray[i],1);
223 const Array<
OneD,
const Array<OneD, NekDouble> > &inarray,
227 int nConvectiveFields =
m_fields.num_elements()-1;
228 Array<OneD, Array<OneD, NekDouble> > velfields(nConvectiveFields);
230 for(
int i = 0; i < nConvectiveFields; ++i)
252 Array<OneD, NekDouble> save;
254 for(n = 0; n < nvel; ++n)
258 for(i = nblocks-1; i > 0; --i)
267 for(i = 0; i < nvel; ++i)
277 for(n = 0; n < nvel; ++n)
279 for(i = 1; i < nblocks; ++i)
302 Array<OneD, Array<OneD, NekDouble> > fields, velfields;
304 static int ncalls = 1;
307 Array<OneD, NekDouble> CFL(
m_fields[0]->GetExpSize(),
322 cout <<
"Sub-integrating using "<< nsubsteps
327 for (
int m = 0; m < nint; ++m)
330 fields = integrationSoln->UpdateSolutionVector()[m];
339 for(n = 0; n < nsubsteps; ++n)
342 n, dt, SubIntegrationSoln,
347 integrationSoln->SetSolVector(m,fields);
357 int n_element =
m_fields[0]->GetExpSize();
359 const Array<OneD, int> ExpOrder=
m_fields[0]->EvalBasisNumModesMaxPerExp();
360 Array<OneD, int> ExpOrderList (n_element, ExpOrder);
364 Array<OneD, NekDouble> tstep (n_element, 0.0);
365 Array<OneD, NekDouble> stdVelocity(n_element, 0.0);
366 Array<OneD, Array<OneD, NekDouble> > velfields(
m_velocity.num_elements());
368 for(
int i = 0; i <
m_velocity.num_elements(); ++i)
374 for(
int el = 0; el < n_element; ++el)
377 (stdVelocity[el] * cLambda *
378 (ExpOrder[el]-1) * (ExpOrder[el]-1));
391 const Array<
OneD,
const Array<OneD, NekDouble> > &velfield,
392 const Array<
OneD,
const Array<OneD, NekDouble> > &physfield,
393 Array<
OneD, Array<OneD, NekDouble> > &Outarray)
396 physfield.num_elements() == Outarray.num_elements(),
397 "Physfield and outarray are of different dimensions");
402 int nTracePts =
m_fields[0]->GetTrace()->GetNpoints();
407 Array<OneD, Array<OneD, NekDouble> > traceNormals(
m_curl_dim);
409 for(i = 0; i < nDimensions; ++i)
411 traceNormals[i] = Array<OneD, NekDouble> (nTracePts);
415 m_fields[0]->GetTrace()->GetNormals(traceNormals);
418 Array<OneD, NekDouble> Fwd(3*nTracePts);
421 Array<OneD, NekDouble> Bwd = Fwd + nTracePts;
424 Array<OneD, NekDouble> numflux = Bwd + nTracePts;
427 Array<OneD, NekDouble> Vn (nTracePts, 0.0);
430 for(i = 0; i < nDimensions; ++i)
433 Vmath::Vvtvp(nTracePts, traceNormals[i], 1, Fwd, 1, Vn, 1, Vn, 1);
436 for(i = 0; i < physfield.num_elements(); ++i)
440 m_fields[i]->GetFwdBwdTracePhys(physfield[i], Fwd, Bwd);
443 m_fields[0]->GetTrace()->Upwind(Vn, Fwd, Bwd, numflux);
446 Vmath::Vsub(nTracePts, numflux, 1, Fwd, 1, Fwd, 1);
447 Vmath::Vsub(nTracePts, numflux, 1, Bwd, 1, Bwd, 1);
454 m_fields[0]->AddFwdBwdTraceIntegral(Fwd,Bwd,Outarray[i]);
464 Array<
OneD, Array<OneD, NekDouble> > &ExtVel)
469 Array<OneD, NekDouble> l(4);
476 for(i = 0; i <= ord; ++i)
478 for(j = 0; j <= ord; ++j)
488 for(i = 0; i < nvel; ++i)
492 for(j = 1; j <= ord; ++j)
506 Array<OneD, NekDouble> &Q,
507 Array<OneD, const NekDouble> &Advection)
516 const Array<
OneD,
const Array<OneD, NekDouble> > &N,
524 "Velocity correction scheme not designed to have just one velocity component");
539 const Array<
OneD,
const Array<OneD, NekDouble> > &N,
547 Array<OneD, const SpatialDomains::BoundaryConditionShPtr > PBndConds;
548 Array<OneD, MultiRegions::ExpListSharedPtr> PBndExp,UBndExp,VBndExp;
550 PBndConds =
m_fields[pindex]->GetBndConditions();
551 PBndExp =
m_fields[pindex]->GetBndCondExpansions();
560 int cnt,elmtid,nq,offset, boundary,ncoeffs;
565 Array<OneD, NekDouble> Nu,Nv,Ptmp;
567 for(cnt = n = 0; n < PBndConds.num_elements(); ++n)
573 for(i = 0; i < PBndExp[n]->GetExpSize(); ++i,cnt++)
578 offset =
m_fields[0]->GetPhys_Offset(elmtid);
585 ncoeffs = Pbc->GetNcoeffs();
589 UBndExp[n]->GetExp(i)->BwdTrans(UBndExp[n]->GetCoeffs() + UBndExp[n]->GetCoeff_Offset(i),ubc);
590 VBndExp[n]->GetExp(i)->BwdTrans(VBndExp[n]->GetCoeffs() + VBndExp[n]->GetCoeff_Offset(i),vbc);
594 elmt->GetEdgePhysVals(boundary,Pbc,Nu,N1);
595 elmt->GetEdgePhysVals(boundary,Pbc,Nv,N2);
612 Blas::Dscal(nq,1.0/Aii_Dt,&ubc[0],1);
613 Blas::Dscal(nq,1.0/Aii_Dt,&vbc[0],1);
616 Pbc->NormVectorIProductWRTBase(ubc,vbc,Pvals);
618 Vmath::Vsub(ncoeffs,Ptmp = PBndExp[n]->UpdateCoeffs()
619 +PBndExp[n]->GetCoeff_Offset(i),1, Pvals,1,
620 Ptmp = PBndExp[n]->UpdateCoeffs()+PBndExp[n]->GetCoeff_Offset(i),1);
626 cnt += PBndExp[n]->GetExpSize();
630 ASSERTL0(
false,
"Unknown USERDEFINEDTYPE in pressure boundary condition");
639 const Array<
OneD,
const Array<OneD, NekDouble> > &N,
646 Array<OneD, const SpatialDomains::BoundaryConditionShPtr > PBndConds;
647 Array<OneD, MultiRegions::ExpListSharedPtr> PBndExp,UBndExp,VBndExp,WBndExp;
649 PBndConds =
m_fields[pindex]->GetBndConditions();
650 PBndExp =
m_fields[pindex]->GetBndCondExpansions();
659 int cnt,elmtid,nq,offset, boundary,ncoeffs;
666 Array<OneD, NekDouble> Nu,Nv,Nw,Ptmp;
668 for(cnt = n = 0; n < PBndConds.num_elements(); ++n)
674 for(i = 0; i < PBndExp[n]->GetExpSize(); ++i,cnt++)
679 offset =
m_fields[0]->GetPhys_Offset(elmtid);
687 ncoeffs = Pbc->GetNcoeffs();
691 UBndExp[n]->GetExp(i)->BwdTrans(UBndExp[n]->GetCoeffs() +
692 UBndExp[n]->GetCoeff_Offset(i),ubc);
693 VBndExp[n]->GetExp(i)->BwdTrans(VBndExp[n]->GetCoeffs() +
694 VBndExp[n]->GetCoeff_Offset(i),vbc);
695 WBndExp[n]->GetExp(i)->BwdTrans(WBndExp[n]->GetCoeffs() +
696 WBndExp[n]->GetCoeff_Offset(i),wbc);
699 elmt->GetFacePhysVals(boundary,Pbc,Nu,N1);
700 elmt->GetFacePhysVals(boundary,Pbc,Nv,N2);
701 elmt->GetFacePhysVals(boundary,Pbc,Nw,N3);
718 Blas::Dscal(nq,1.0/Aii_Dt,&ubc[0],1);
719 Blas::Dscal(nq,1.0/Aii_Dt,&vbc[0],1);
720 Blas::Dscal(nq,1.0/Aii_Dt,&wbc[0],1);
723 Pbc->NormVectorIProductWRTBase(ubc,vbc,wbc,Pvals);
727 Ptmp = PBndExp[n]->UpdateCoeffs()+PBndExp[n]->GetCoeff_Offset(i),
729 Ptmp = PBndExp[n]->UpdateCoeffs()+PBndExp[n]->GetCoeff_Offset(i),
736 cnt += PBndExp[n]->GetExpSize();
740 ASSERTL0(
false,
"Unknown USERDEFINEDTYPE in pressure boundary condition");