Nektar++
Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Nektar::SolverUtils::DiffusionLDG Class Reference

#include <DiffusionLDG.h>

Inheritance diagram for Nektar::SolverUtils::DiffusionLDG:
Inheritance graph
[legend]
Collaboration diagram for Nektar::SolverUtils::DiffusionLDG:
Collaboration graph
[legend]

Static Public Member Functions

static DiffusionSharedPtr create (std::string diffType)
 

Static Public Attributes

static std::string type
 

Protected Member Functions

 DiffusionLDG ()
 
virtual void v_InitObject (LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields)
 
virtual void v_Diffuse (const int nConvective, const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
 
virtual void v_NumFluxforScalar (const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &ufield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &uflux)
 
virtual void v_WeakPenaltyforScalar (const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const int var, const Array< OneD, const NekDouble > &ufield, Array< OneD, NekDouble > &penaltyflux)
 
virtual void v_NumFluxforVector (const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &ufield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &qfield, Array< OneD, Array< OneD, NekDouble > > &qflux)
 
virtual void v_WeakPenaltyforVector (const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const int var, const int dir, const Array< OneD, const NekDouble > &qfield, Array< OneD, NekDouble > &penaltyflux, NekDouble C11)
 
- Protected Member Functions inherited from Nektar::SolverUtils::Diffusion
virtual void v_SetHomoDerivs (Array< OneD, Array< OneD, NekDouble > > &deriv)
 
virtual Array< OneD, Array< OneD, Array< OneD, NekDouble > > > & v_GetFluxTensor ()
 

Protected Attributes

std::string m_shockCaptureType
 
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
 
LibUtilities::SessionReaderSharedPtr m_session
 
- Protected Attributes inherited from Nektar::SolverUtils::Diffusion
DiffusionFluxVecCB m_fluxVector
 
DiffusionFluxVecCBNS m_fluxVectorNS
 
RiemannSolverSharedPtr m_riemann
 
DiffusionArtificialDiffusion m_ArtificialDiffusionVector
 

Additional Inherited Members

- Public Member Functions inherited from Nektar::SolverUtils::Diffusion
SOLVER_UTILS_EXPORT void InitObject (LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields)
 
SOLVER_UTILS_EXPORT void Diffuse (const int nConvectiveFields, const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
 
SOLVER_UTILS_EXPORT void FluxVec (Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &fluxvector)
 
template<typename FuncPointerT , typename ObjectPointerT >
void SetFluxVector (FuncPointerT func, ObjectPointerT obj)
 
void SetFluxVectorVec (DiffusionFluxVecCB fluxVector)
 
template<typename FuncPointerT , typename ObjectPointerT >
void SetFluxVectorNS (FuncPointerT func, ObjectPointerT obj)
 
template<typename FuncPointerT , typename ObjectPointerT >
void SetArtificialDiffusionVector (FuncPointerT func, ObjectPointerT obj)
 
void SetFluxVectorNS (DiffusionFluxVecCBNS fluxVector)
 
void SetRiemannSolver (RiemannSolverSharedPtr riemann)
 
void SetHomoDerivs (Array< OneD, Array< OneD, NekDouble > > &deriv)
 
virtual Array< OneD, Array< OneD, Array< OneD, NekDouble > > > & GetFluxTensor ()
 

Detailed Description

Definition at line 45 of file DiffusionLDG.h.

Constructor & Destructor Documentation

Nektar::SolverUtils::DiffusionLDG::DiffusionLDG ( )
protected

Definition at line 47 of file DiffusionLDG.cpp.

Referenced by create().

48  {
49  }

Member Function Documentation

static DiffusionSharedPtr Nektar::SolverUtils::DiffusionLDG::create ( std::string  diffType)
inlinestatic

Definition at line 48 of file DiffusionLDG.h.

References DiffusionLDG().

49  {
50  return DiffusionSharedPtr(new DiffusionLDG());
51  }
boost::shared_ptr< Diffusion > DiffusionSharedPtr
A shared pointer to an EquationSystem object.
Definition: Diffusion.h:164
void Nektar::SolverUtils::DiffusionLDG::v_Diffuse ( const int  nConvective,
const Array< OneD, MultiRegions::ExpListSharedPtr > &  fields,
const Array< OneD, Array< OneD, NekDouble > > &  inarray,
Array< OneD, Array< OneD, NekDouble > > &  outarray 
)
protectedvirtual

Implements Nektar::SolverUtils::Diffusion.

Definition at line 73 of file DiffusionLDG.cpp.

References Nektar::SolverUtils::Diffusion::m_ArtificialDiffusionVector, m_shockCaptureType, Vmath::Neg(), v_NumFluxforScalar(), v_NumFluxforVector(), and Vmath::Vmul().

78  {
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();
84 
85  Array<OneD, NekDouble> qcoeffs(nCoeffs);
86  Array<OneD, NekDouble> temp (nCoeffs);
87 
88  Array<OneD, Array<OneD, NekDouble> > fluxvector(nDim);
89 
93 
94  for (j = 0; j < nDim; ++j)
95  {
96  qfield[j] =
97  Array<OneD, Array<OneD, NekDouble> >(nConvectiveFields);
98  qfieldStd[j] =
99  Array<OneD, Array<OneD, NekDouble> >(nConvectiveFields);
100  flux[j] =
101  Array<OneD, Array<OneD, NekDouble> >(nConvectiveFields);
102 
103  for (i = 0; i < nConvectiveFields; ++i)
104  {
105  qfield[j][i] = Array<OneD, NekDouble>(nPts, 0.0);
106  qfieldStd[j][i] = Array<OneD, NekDouble>(nPts, 0.0);
107  flux[j][i] = Array<OneD, NekDouble>(nTracePts, 0.0);
108  }
109  }
110 
111  for (k = 0; k < nDim; ++k)
112  {
113  fluxvector[k] = Array<OneD, NekDouble>(nPts, 0.0);
114  }
115 
116  // Compute q_{\eta} and q_{\xi}
117  // Obtain numerical fluxes
118 
119  v_NumFluxforScalar(fields, inarray, flux);
120 
121  for (j = 0; j < nDim; ++j)
122  {
123  for (i = 0; i < nConvectiveFields; ++i)
124  {
125  fields[i]->IProductWRTDerivBase(j, inarray[i], qcoeffs);
126  Vmath::Neg (nCoeffs, qcoeffs, 1);
127  fields[i]->AddTraceIntegral (flux[j][i], qcoeffs);
128  fields[i]->SetPhysState (false);
129  fields[i]->MultiplyByElmtInvMass(qcoeffs, qcoeffs);
130  fields[i]->BwdTrans (qcoeffs, qfield[j][i]);
131  }
132  }
133  // Compute u from q_{\eta} and q_{\xi}
134  // Obtain numerical fluxes
135  v_NumFluxforVector(fields, inarray, qfield, flux[0]);
136 
138  {
139  Array<OneD, NekDouble> muvar(nPts, 0.0);
140  m_ArtificialDiffusionVector(inarray, muvar);
141 
142  int numConvFields = nConvectiveFields;
143 
144  if (m_shockCaptureType == "Smooth")
145  {
146  numConvFields = nConvectiveFields - 1;
147  }
148 
149  for (j = 0; j < nDim; ++j)
150  {
151  for (i = 0; i < numConvFields; ++i)
152  {
153  Vmath::Vmul(nPts,qfield[j][i],1,muvar,1,qfield[j][i],1);
154  }
155  }
156 
157  Array<OneD, NekDouble> FwdMuVar(nTracePts, 0.0);
158  Array<OneD, NekDouble> BwdMuVar(nTracePts, 0.0);
159 
160  fields[0]->GetFwdBwdTracePhys(muvar,FwdMuVar,BwdMuVar);
161 
162  int nBndRegions = fields[0]->GetBndCondExpansions().
163  num_elements();
164  int cnt = 0;
165 
166  for (i = 0; i < nBndRegions; ++i)
167  {
168  // Number of boundary expansion related to that region
169  int nBndEdges = fields[0]->
170  GetBndCondExpansions()[i]->GetExpSize();
171 
172  // Weakly impose boundary conditions by modifying flux
173  // values
174  for (e = 0; e < nBndEdges ; ++e)
175  {
176  nBndEdgePts = fields[0]->GetBndCondExpansions()[i]
177  ->GetExp(e)->GetTotPoints();
178 
179  int id2 = fields[0]->GetTrace()->GetPhys_Offset(
180  fields[0]->GetTraceMap()
181  ->GetBndCondTraceToGlobalTraceMap(cnt++));
182 
183  for (k = 0; k < nBndEdgePts; ++k)
184  {
185  BwdMuVar[id2+k] = 0.0;
186  }
187  }
188  }
189 
190  for(i = 0; i < numConvFields; ++i)
191  {
192  for(k = 0; k < nTracePts; ++k)
193  {
194  flux[0][i][k] =
195  0.5 * (FwdMuVar[k] + BwdMuVar[k]) * flux[0][i][k];
196  }
197  }
198  }
199 
201  Array<OneD, Array<OneD, NekDouble> > qdbase(nDim);
202 
203  for (i = 0; i < nConvectiveFields; ++i)
204  {
205  for (j = 0; j < nDim; ++j)
206  {
207  qdbase[j] = qfield[j][i];
208  }
209  fields[i]->IProductWRTDerivBase(qdbase,tmp);
210 
211  // Evaulate <\phi, \hat{F}\cdot n> - outarray[i]
212  Vmath::Neg (nCoeffs, tmp, 1);
213  fields[i]->AddTraceIntegral (flux[0][i], tmp);
214  fields[i]->SetPhysState (false);
215  fields[i]->MultiplyByElmtInvMass(tmp, tmp);
216  fields[i]->BwdTrans (tmp, outarray[i]);
217  }
218  }
DiffusionArtificialDiffusion m_ArtificialDiffusionVector
Definition: Diffusion.h:135
virtual void v_NumFluxforScalar(const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &ufield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &uflux)
virtual void v_NumFluxforVector(const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &ufield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &qfield, Array< OneD, Array< OneD, NekDouble > > &qflux)
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.cpp:382
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
Definition: Vmath.cpp:169
void Nektar::SolverUtils::DiffusionLDG::v_InitObject ( LibUtilities::SessionReaderSharedPtr  pSession,
Array< OneD, MultiRegions::ExpListSharedPtr pFields 
)
protectedvirtual

Reimplemented from Nektar::SolverUtils::Diffusion.

Definition at line 51 of file DiffusionLDG.cpp.

References m_session, m_shockCaptureType, and m_traceNormals.

54  {
55  m_session = pSession;
56 
57  m_session->LoadSolverInfo("ShockCaptureType",
58  m_shockCaptureType, "Off");
59 
60  // Setting up the normals
61  int i;
62  int nDim = pFields[0]->GetCoordim(0);
63  int nTracePts = pFields[0]->GetTrace()->GetTotPoints();
64 
66  for(i = 0; i < nDim; ++i)
67  {
68  m_traceNormals[i] = Array<OneD, NekDouble> (nTracePts);
69  }
70  pFields[0]->GetTrace()->GetNormals(m_traceNormals);
71  }
LibUtilities::SessionReaderSharedPtr m_session
Definition: DiffusionLDG.h:61
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Definition: DiffusionLDG.h:60
void Nektar::SolverUtils::DiffusionLDG::v_NumFluxforScalar ( const Array< OneD, MultiRegions::ExpListSharedPtr > &  fields,
const Array< OneD, Array< OneD, NekDouble > > &  ufield,
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &  uflux 
)
protectedvirtual

Definition at line 220 of file DiffusionLDG.cpp.

References m_traceNormals, Vmath::Svtvp(), v_WeakPenaltyforScalar(), and Vmath::Vmul().

Referenced by v_Diffuse().

224  {
225  int i, j;
226  int nTracePts = fields[0]->GetTrace()->GetTotPoints();
227  int nvariables = fields.num_elements();
228  int nDim = uflux.num_elements();
229 
230  Array<OneD, NekDouble > Fwd (nTracePts);
231  Array<OneD, NekDouble > Bwd (nTracePts);
232  Array<OneD, NekDouble > Vn (nTracePts, 0.0);
233  Array<OneD, NekDouble > fluxtemp(nTracePts, 0.0);
234 
235  // Get the normal velocity Vn
236  for(i = 0; i < nDim; ++i)
237  {
238  Vmath::Svtvp(nTracePts, 1.0, m_traceNormals[i], 1,
239  Vn, 1, Vn, 1);
240  }
241 
242  // Get the sign of (v \cdot n), v = an arbitrary vector
243  // Evaluate upwind flux:
244  // uflux = \hat{u} \phi \cdot u = u^{(+,-)} n
245  for (j = 0; j < nDim; ++j)
246  {
247  for (i = 0; i < nvariables ; ++i)
248  {
249  // Compute Fwd and Bwd value of ufield of i direction
250  fields[i]->GetFwdBwdTracePhys(ufield[i], Fwd, Bwd);
251 
252  // if Vn >= 0, flux = uFwd, i.e.,
253  // edge::eForward, if V*n>=0 <=> V*n_F>=0, pick uflux = uFwd
254  // edge::eBackward, if V*n>=0 <=> V*n_B<0, pick uflux = uFwd
255 
256  // else if Vn < 0, flux = uBwd, i.e.,
257  // edge::eForward, if V*n<0 <=> V*n_F<0, pick uflux = uBwd
258  // edge::eBackward, if V*n<0 <=> V*n_B>=0, pick uflux = uBwd
259 
260  fields[i]->GetTrace()->Upwind(/*m_traceNormals[j]*/Vn,
261  Fwd, Bwd, fluxtemp);
262 
263  // Imposing weak boundary condition with flux
264  // if Vn >= 0, uflux = uBwd at Neumann, i.e.,
265  // edge::eForward, if V*n>=0 <=> V*n_F>=0, pick uflux = uBwd
266  // edge::eBackward, if V*n>=0 <=> V*n_B<0, pick uflux = uBwd
267 
268  // if Vn >= 0, uflux = uFwd at Neumann, i.e.,
269  // edge::eForward, if V*n<0 <=> V*n_F<0, pick uflux = uFwd
270  // edge::eBackward, if V*n<0 <=> V*n_B>=0, pick uflux = uFwd
271 
272  if(fields[0]->GetBndCondExpansions().num_elements())
273  {
274  v_WeakPenaltyforScalar(fields, i, ufield[i], fluxtemp);
275  }
276 
277  // if Vn >= 0, flux = uFwd*(tan_{\xi}^- \cdot \vec{n}),
278  // i.e,
279  // edge::eForward, uFwd \(\tan_{\xi}^Fwd \cdot \vec{n})
280  // edge::eBackward, uFwd \(\tan_{\xi}^Bwd \cdot \vec{n})
281 
282  // else if Vn < 0, flux = uBwd*(tan_{\xi}^- \cdot \vec{n}),
283  // i.e,
284  // edge::eForward, uBwd \(\tan_{\xi}^Fwd \cdot \vec{n})
285  // edge::eBackward, uBwd \(\tan_{\xi}^Bwd \cdot \vec{n})
286 
287  Vmath::Vmul(nTracePts,
288  m_traceNormals[j], 1,
289  fluxtemp, 1,
290  uflux[j][i], 1);
291  }
292  }
293  }
void Svtvp(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
svtvp (scalar times vector plus vector): z = alpha*x + y
Definition: Vmath.cpp:471
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Definition: DiffusionLDG.h:60
virtual void v_WeakPenaltyforScalar(const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const int var, const Array< OneD, const NekDouble > &ufield, Array< OneD, NekDouble > &penaltyflux)
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
Definition: Vmath.cpp:169
void Nektar::SolverUtils::DiffusionLDG::v_NumFluxforVector ( const Array< OneD, MultiRegions::ExpListSharedPtr > &  fields,
const Array< OneD, Array< OneD, NekDouble > > &  ufield,
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &  qfield,
Array< OneD, Array< OneD, NekDouble > > &  qflux 
)
protectedvirtual

Definition at line 356 of file DiffusionLDG.cpp.

References m_traceNormals, Vmath::Smul(), Vmath::Svtvp(), v_WeakPenaltyforVector(), Vmath::Vadd(), Vmath::Vmul(), and Vmath::Vsub().

Referenced by v_Diffuse().

361  {
362  int i, j;
363  int nTracePts = fields[0]->GetTrace()->GetTotPoints();
364  int nvariables = fields.num_elements();
365  int nDim = qfield.num_elements();
366 
367  NekDouble C11 = 0.0;
368  Array<OneD, NekDouble > Fwd(nTracePts);
369  Array<OneD, NekDouble > Bwd(nTracePts);
370  Array<OneD, NekDouble > Vn (nTracePts, 0.0);
371 
372  Array<OneD, NekDouble > qFwd (nTracePts);
373  Array<OneD, NekDouble > qBwd (nTracePts);
374  Array<OneD, NekDouble > qfluxtemp(nTracePts, 0.0);
375 
376  Array<OneD, NekDouble > uterm(nTracePts);
377 
378  /*
379  // Setting up the normals
380  m_traceNormals = Array<OneD, Array<OneD, NekDouble> >(nDim);
381  for(i = 0; i < nDim; ++i)
382  {
383  m_traceNormals[i] = Array<OneD, NekDouble> (nTracePts);
384  }
385  fields[0]->GetTrace()->GetNormals(m_traceNormals);
386  */
387 
388  // Get the normal velocity Vn
389  for(i = 0; i < nDim; ++i)
390  {
391  Vmath::Svtvp(nTracePts, 1.0, m_traceNormals[i], 1,
392  Vn, 1, Vn, 1);
393  }
394 
395  // Evaulate upwind flux:
396  // qflux = \hat{q} \cdot u = q \cdot n - C_(11)*(u^+ - u^-)
397  for (i = 0; i < nvariables; ++i)
398  {
399  qflux[i] = Array<OneD, NekDouble> (nTracePts, 0.0);
400  for (j = 0; j < nDim; ++j)
401  {
402  // Compute Fwd and Bwd value of ufield of jth direction
403  fields[i]->GetFwdBwdTracePhys(qfield[j][i], qFwd, qBwd);
404 
405  // if Vn >= 0, flux = uFwd, i.e.,
406  // edge::eForward, if V*n>=0 <=> V*n_F>=0, pick
407  // qflux = qBwd = q+
408  // edge::eBackward, if V*n>=0 <=> V*n_B<0, pick
409  // qflux = qBwd = q-
410 
411  // else if Vn < 0, flux = uBwd, i.e.,
412  // edge::eForward, if V*n<0 <=> V*n_F<0, pick
413  // qflux = qFwd = q-
414  // edge::eBackward, if V*n<0 <=> V*n_B>=0, pick
415  // qflux = qFwd = q+
416 
417  fields[i]->GetTrace()->Upwind(/*m_traceNormals[j]*/Vn,
418  qBwd, qFwd,
419  qfluxtemp);
420 
421  Vmath::Vmul(nTracePts,
422  m_traceNormals[j], 1,
423  qfluxtemp, 1,
424  qfluxtemp, 1);
425 
426  // Generate Stability term = - C11 ( u- - u+ )
427  fields[i]->GetFwdBwdTracePhys(ufield[i], Fwd, Bwd);
428 
429  Vmath::Vsub(nTracePts,
430  Fwd, 1, Bwd, 1,
431  uterm, 1);
432 
433  Vmath::Smul(nTracePts,
434  -1.0 * C11, uterm, 1,
435  uterm, 1);
436 
437  // Flux = {Fwd, Bwd} * (nx, ny, nz) + uterm * (nx, ny)
438  Vmath::Vadd(nTracePts,
439  uterm, 1,
440  qfluxtemp, 1,
441  qfluxtemp, 1);
442 
443  // Imposing weak boundary condition with flux
444  if (fields[0]->GetBndCondExpansions().num_elements())
445  {
446  v_WeakPenaltyforVector(fields, i, j,
447  qfield[j][i],
448  qfluxtemp, C11);
449  }
450 
451  // q_hat \cdot n = (q_xi \cdot n_xi) or (q_eta \cdot n_eta)
452  // n_xi = n_x * tan_xi_x + n_y * tan_xi_y + n_z * tan_xi_z
453  // n_xi = n_x * tan_eta_x + n_y * tan_eta_y + n_z*tan_eta_z
454  Vmath::Vadd(nTracePts,
455  qfluxtemp, 1,
456  qflux[i], 1,
457  qflux[i], 1);
458  }
459  }
460  }
void Svtvp(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
svtvp (scalar times vector plus vector): z = alpha*x + y
Definition: Vmath.cpp:471
virtual void v_WeakPenaltyforVector(const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const int var, const int dir, const Array< OneD, const NekDouble > &qfield, Array< OneD, NekDouble > &penaltyflux, NekDouble C11)
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
Definition: Vmath.cpp:199
double NekDouble
void Vsub(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Subtract vector z = x-y.
Definition: Vmath.cpp:329
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Definition: DiffusionLDG.h:60
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
Definition: Vmath.cpp:285
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
Definition: Vmath.cpp:169
void Nektar::SolverUtils::DiffusionLDG::v_WeakPenaltyforScalar ( const Array< OneD, MultiRegions::ExpListSharedPtr > &  fields,
const int  var,
const Array< OneD, const NekDouble > &  ufield,
Array< OneD, NekDouble > &  penaltyflux 
)
protectedvirtual

Definition at line 297 of file DiffusionLDG.cpp.

References Nektar::SpatialDomains::eDirichlet, Nektar::SpatialDomains::eNeumann, and Vmath::Vcopy().

Referenced by v_NumFluxforScalar().

302  {
303  int i, e, id1, id2;
304 
305  // Number of boundary regions
306  int nBndEdgePts, nBndEdges;
307  int cnt = 0;
308  int nBndRegions = fields[var]->GetBndCondExpansions().num_elements();
309  int nTracePts = fields[0]->GetTrace()->GetTotPoints();
310  Array<OneD, NekDouble > uplus(nTracePts);
311 
312  fields[var]->ExtractTracePhys(ufield, uplus);
313  for (i = 0; i < nBndRegions; ++i)
314  {
315  // Number of boundary expansion related to that region
316  nBndEdges = fields[var]->
317  GetBndCondExpansions()[i]->GetExpSize();
318 
319  // Weakly impose boundary conditions by modifying flux values
320  for (e = 0; e < nBndEdges ; ++e)
321  {
322  nBndEdgePts = fields[var]->
323  GetBndCondExpansions()[i]->GetExp(e)->GetTotPoints();
324 
325  id1 = fields[var]->
326  GetBndCondExpansions()[i]->GetPhys_Offset(e);
327 
328  id2 = fields[0]->GetTrace()->
329  GetPhys_Offset(fields[0]->GetTraceMap()->
330  GetBndCondTraceToGlobalTraceMap(cnt++));
331 
332  // For Dirichlet boundary condition: uflux = g_D
333  if (fields[var]->GetBndConditions()[i]->
334  GetBoundaryConditionType() == SpatialDomains::eDirichlet)
335  {
336  Vmath::Vcopy(nBndEdgePts,
337  &(fields[var]->
338  GetBndCondExpansions()[i]->
339  GetPhys())[id1], 1,
340  &penaltyflux[id2], 1);
341  }
342  // For Neumann boundary condition: uflux = u+
343  else if ((fields[var]->GetBndConditions()[i])->
344  GetBoundaryConditionType() == SpatialDomains::eNeumann)
345  {
346  Vmath::Vcopy(nBndEdgePts,
347  &uplus[id2], 1,
348  &penaltyflux[id2], 1);
349  }
350  }
351  }
352  }
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1038
void Nektar::SolverUtils::DiffusionLDG::v_WeakPenaltyforVector ( const Array< OneD, MultiRegions::ExpListSharedPtr > &  fields,
const int  var,
const int  dir,
const Array< OneD, const NekDouble > &  qfield,
Array< OneD, NekDouble > &  penaltyflux,
NekDouble  C11 
)
protectedvirtual

Diffusion: Imposing weak boundary condition for q with flux uflux = g_D on Dirichlet boundary condition uflux = u_Fwd on Neumann boundary condition

Definition at line 469 of file DiffusionLDG.cpp.

References Nektar::SpatialDomains::eDirichlet, Nektar::SpatialDomains::eNeumann, m_traceNormals, and Vmath::Vmul().

Referenced by v_NumFluxforVector().

476  {
477  int i, e, id1, id2;
478  int nBndEdges, nBndEdgePts;
479  int nBndRegions = fields[var]->GetBndCondExpansions().num_elements();
480  int nTracePts = fields[0]->GetTrace()->GetTotPoints();
481 
482  Array<OneD, NekDouble > uterm(nTracePts);
483  Array<OneD, NekDouble > qtemp(nTracePts);
484  int cnt = 0;
485 
486  /*
487  // Setting up the normals
488  m_traceNormals = Array<OneD, Array<OneD, NekDouble> >(nDim);
489  for(i = 0; i < nDim; ++i)
490  {
491  m_traceNormals[i] = Array<OneD, NekDouble> (nTracePts);
492  }
493  fields[0]->GetTrace()->GetNormals(m_traceNormals);
494  */
495 
496  fields[var]->ExtractTracePhys(qfield, qtemp);
497 
498  for (i = 0; i < nBndRegions; ++i)
499  {
500  nBndEdges = fields[var]->
501  GetBndCondExpansions()[i]->GetExpSize();
502 
503  // Weakly impose boundary conditions by modifying flux values
504  for (e = 0; e < nBndEdges ; ++e)
505  {
506  nBndEdgePts = fields[var]->
507  GetBndCondExpansions()[i]->GetExp(e)->GetTotPoints();
508 
509  id1 = fields[var]->
510  GetBndCondExpansions()[i]->GetPhys_Offset(e);
511 
512  id2 = fields[0]->GetTrace()->
513  GetPhys_Offset(fields[0]->GetTraceMap()->
514  GetBndCondTraceToGlobalTraceMap(cnt++));
515 
516  // For Dirichlet boundary condition:
517  //qflux = q+ - C_11 (u+ - g_D) (nx, ny)
518  if(fields[var]->GetBndConditions()[i]->
519  GetBoundaryConditionType() == SpatialDomains::eDirichlet)
520  {
521  Vmath::Vmul(nBndEdgePts,
522  &m_traceNormals[dir][id2], 1,
523  &qtemp[id2], 1,
524  &penaltyflux[id2], 1);
525  }
526  // For Neumann boundary condition: qflux = g_N
527  else if((fields[var]->GetBndConditions()[i])->
528  GetBoundaryConditionType() == SpatialDomains::eNeumann)
529  {
530  Vmath::Vmul(nBndEdgePts,
531  &m_traceNormals[dir][id2], 1,
532  &(fields[var]->
533  GetBndCondExpansions()[i]->
534  GetPhys())[id1], 1,
535  &penaltyflux[id2], 1);
536  }
537  }
538  }
539  }
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Definition: DiffusionLDG.h:60
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
Definition: Vmath.cpp:169

Member Data Documentation

LibUtilities::SessionReaderSharedPtr Nektar::SolverUtils::DiffusionLDG::m_session
protected

Definition at line 61 of file DiffusionLDG.h.

Referenced by v_InitObject().

std::string Nektar::SolverUtils::DiffusionLDG::m_shockCaptureType
protected

Definition at line 58 of file DiffusionLDG.h.

Referenced by v_Diffuse(), and v_InitObject().

Array<OneD, Array<OneD, NekDouble> > Nektar::SolverUtils::DiffusionLDG::m_traceNormals
protected
std::string Nektar::SolverUtils::DiffusionLDG::type
static
Initial value:
RegisterCreatorFunction("LDG", DiffusionLDG::create)

Definition at line 53 of file DiffusionLDG.h.