53 Array<OneD, MultiRegions::ExpListSharedPtr> pFields)
57 m_session->LoadSolverInfo(
"ShockCaptureType",
62 int nDim = pFields[0]->GetCoordim(0);
63 int nTracePts = pFields[0]->GetTrace()->GetTotPoints();
66 for(i = 0; i < nDim; ++i)
74 const int nConvectiveFields,
75 const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
76 const Array<
OneD, Array<OneD, NekDouble> > &inarray,
77 Array<
OneD, Array<OneD, NekDouble> > &outarray)
79 int nBndEdgePts, i, j, k, e;
80 int nDim = fields[0]->GetCoordim(0);
81 int nPts = fields[0]->GetTotPoints();
82 int nCoeffs = fields[0]->GetNcoeffs();
83 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
85 Array<OneD, NekDouble> qcoeffs(nCoeffs);
86 Array<OneD, NekDouble> temp (nCoeffs);
88 Array<OneD, Array<OneD, NekDouble> > fluxvector(nDim);
90 Array<OneD, Array<OneD, NekDouble> > tmp(nConvectiveFields);
92 Array<OneD, Array<OneD, Array<OneD, NekDouble> > > flux (nDim);
93 Array<OneD, Array<OneD, Array<OneD, NekDouble> > > qfield(nDim);
94 Array<OneD, Array<OneD, Array<OneD, NekDouble> > > qfieldStd(nDim);
96 for (j = 0; j < nDim; ++j)
99 Array<OneD, Array<OneD, NekDouble> >(nConvectiveFields);
101 Array<OneD, Array<OneD, NekDouble> >(nConvectiveFields);
103 Array<OneD, Array<OneD, NekDouble> >(nConvectiveFields);
105 for (i = 0; i < nConvectiveFields; ++i)
107 qfield[j][i] = Array<OneD, NekDouble>(nPts, 0.0);
108 qfieldStd[j][i] = Array<OneD, NekDouble>(nPts, 0.0);
109 flux[j][i] = Array<OneD, NekDouble>(nTracePts, 0.0);
113 for (k = 0; k < nDim; ++k)
115 fluxvector[k] = Array<OneD, NekDouble>(nPts, 0.0);
123 for (j = 0; j < nDim; ++j)
125 for (i = 0; i < nConvectiveFields; ++i)
127 fields[i]->IProductWRTDerivBase(j, inarray[i], qcoeffs);
129 fields[i]->AddTraceIntegral (flux[j][i], qcoeffs);
130 fields[i]->SetPhysState (
false);
131 fields[i]->MultiplyByElmtInvMass(qcoeffs, qcoeffs);
132 fields[i]->BwdTrans (qcoeffs, qfield[j][i]);
141 Array<OneD, NekDouble> muvar(nPts, 0.0);
144 int numConvFields = nConvectiveFields;
148 numConvFields = nConvectiveFields - 1;
151 for (j = 0; j < nDim; ++j)
153 for (i = 0; i < numConvFields; ++i)
155 Vmath::Vmul(nPts,qfield[j][i],1,muvar,1,qfield[j][i],1);
159 Array<OneD, NekDouble> FwdMuVar(nTracePts, 0.0);
160 Array<OneD, NekDouble> BwdMuVar(nTracePts, 0.0);
162 fields[0]->GetFwdBwdTracePhys(muvar,FwdMuVar,BwdMuVar);
164 int nBndRegions = fields[0]->GetBndCondExpansions().
168 for (i = 0; i < nBndRegions; ++i)
171 int nBndEdges = fields[0]->
172 GetBndCondExpansions()[i]->GetExpSize();
176 for (e = 0; e < nBndEdges ; ++e)
178 nBndEdgePts = fields[0]->GetBndCondExpansions()[i]
179 ->GetExp(e)->GetTotPoints();
181 int id2 = fields[0]->GetTrace()->GetPhys_Offset(
182 fields[0]->GetTraceMap()
183 ->GetBndCondTraceToGlobalTraceMap(cnt++));
185 for (k = 0; k < nBndEdgePts; ++k)
187 BwdMuVar[id2+k] = 0.0;
192 for(i = 0; i < numConvFields; ++i)
194 for(k = 0; k < nTracePts; ++k)
197 0.5 * (FwdMuVar[k] + BwdMuVar[k]) * flux[0][i][k];
202 for (i = 0; i < nConvectiveFields; ++i)
204 tmp[i] = Array<OneD, NekDouble>(nCoeffs, 0.0);
206 for (j = 0; j < nDim; ++j)
209 fields[i]->IProductWRTDerivBase(j, fluxvector[j], qcoeffs);
210 Vmath::Vadd(nCoeffs, qcoeffs, 1, tmp[i], 1, tmp[i], 1);
215 fields[i]->AddTraceIntegral (flux[0][i], tmp[i]);
216 fields[i]->SetPhysState (
false);
217 fields[i]->MultiplyByElmtInvMass(tmp[i], tmp[i]);
218 fields[i]->BwdTrans (tmp[i], outarray[i]);
223 const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
224 const Array<
OneD, Array<OneD, NekDouble> > &ufield,
225 Array<
OneD, Array<
OneD, Array<OneD, NekDouble> > > &uflux)
228 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
229 int nvariables = fields.num_elements();
230 int nDim = uflux.num_elements();
232 Array<OneD, NekDouble > Fwd (nTracePts);
233 Array<OneD, NekDouble > Bwd (nTracePts);
234 Array<OneD, NekDouble > Vn (nTracePts, 0.0);
235 Array<OneD, NekDouble > fluxtemp(nTracePts, 0.0);
238 for(i = 0; i < nDim; ++i)
247 for (j = 0; j < nDim; ++j)
249 for (i = 0; i < nvariables ; ++i)
252 fields[i]->GetFwdBwdTracePhys(ufield[i], Fwd, Bwd);
262 fields[i]->GetTrace()->Upwind(Vn,
274 if(fields[0]->GetBndCondExpansions().num_elements())
300 const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
302 const Array<OneD, const NekDouble> &ufield,
303 Array<OneD, NekDouble> &penaltyflux)
308 int nBndEdgePts, nBndEdges;
310 int nBndRegions = fields[var]->GetBndCondExpansions().num_elements();
311 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
312 Array<OneD, NekDouble > uplus(nTracePts);
314 fields[var]->ExtractTracePhys(ufield, uplus);
315 for (i = 0; i < nBndRegions; ++i)
318 nBndEdges = fields[var]->
319 GetBndCondExpansions()[i]->GetExpSize();
322 for (e = 0; e < nBndEdges ; ++e)
324 nBndEdgePts = fields[var]->
325 GetBndCondExpansions()[i]->GetExp(e)->GetTotPoints();
328 GetBndCondExpansions()[i]->GetPhys_Offset(e);
330 id2 = fields[0]->GetTrace()->
331 GetPhys_Offset(fields[0]->GetTraceMap()->
332 GetBndCondTraceToGlobalTraceMap(cnt++));
335 if (fields[var]->GetBndConditions()[i]->
340 GetBndCondExpansions()[i]->
342 &penaltyflux[id2], 1);
345 else if ((fields[var]->GetBndConditions()[i])->
350 &penaltyflux[id2], 1);
359 const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
360 const Array<
OneD, Array<OneD, NekDouble> > &ufield,
361 Array<
OneD, Array<
OneD, Array<OneD, NekDouble> > > &qfield,
362 Array<
OneD, Array<OneD, NekDouble> > &qflux)
365 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
366 int nvariables = fields.num_elements();
367 int nDim = qfield.num_elements();
370 Array<OneD, NekDouble > Fwd(nTracePts);
371 Array<OneD, NekDouble > Bwd(nTracePts);
372 Array<OneD, NekDouble > Vn (nTracePts, 0.0);
374 Array<OneD, NekDouble > qFwd (nTracePts);
375 Array<OneD, NekDouble > qBwd (nTracePts);
376 Array<OneD, NekDouble > qfluxtemp(nTracePts, 0.0);
378 Array<OneD, NekDouble > uterm(nTracePts);
391 for(i = 0; i < nDim; ++i)
399 for (i = 0; i < nvariables; ++i)
401 qflux[i] = Array<OneD, NekDouble> (nTracePts, 0.0);
402 for (j = 0; j < nDim; ++j)
405 fields[i]->GetFwdBwdTracePhys(qfield[j][i], qFwd, qBwd);
419 fields[i]->GetTrace()->Upwind(Vn,
429 fields[i]->GetFwdBwdTracePhys(ufield[i], Fwd, Bwd);
436 -1.0 * C11, uterm, 1,
446 if (fields[0]->GetBndCondExpansions().num_elements())
472 const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
475 const Array<OneD, const NekDouble> &qfield,
476 Array<OneD, NekDouble> &penaltyflux,
480 int nBndEdges, nBndEdgePts;
481 int nBndRegions = fields[var]->GetBndCondExpansions().num_elements();
482 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
484 Array<OneD, NekDouble > uterm(nTracePts);
485 Array<OneD, NekDouble > qtemp(nTracePts);
498 fields[var]->ExtractTracePhys(qfield, qtemp);
500 for (i = 0; i < nBndRegions; ++i)
502 nBndEdges = fields[var]->
503 GetBndCondExpansions()[i]->GetExpSize();
506 for (e = 0; e < nBndEdges ; ++e)
508 nBndEdgePts = fields[var]->
509 GetBndCondExpansions()[i]->GetExp(e)->GetTotPoints();
512 GetBndCondExpansions()[i]->GetPhys_Offset(e);
514 id2 = fields[0]->GetTrace()->
515 GetPhys_Offset(fields[0]->GetTraceMap()->
516 GetBndCondTraceToGlobalTraceMap(cnt++));
520 if(fields[var]->GetBndConditions()[i]->
526 &penaltyflux[id2], 1);
529 else if((fields[var]->GetBndConditions()[i])->
535 GetBndCondExpansions()[i]->
537 &penaltyflux[id2], 1);