Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Nektar::SolverUtils::DiffusionLDGNS Class Reference

#include <DiffusionLDGNS.h>

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

Static Public Member Functions

static DiffusionSharedPtr create (std::string diffType)
 

Static Public Attributes

static std::string type
 

Protected Member Functions

 DiffusionLDGNS ()
 
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)
 Calculate weak DG Diffusion in the LDG form for the Navier-Stokes (NS) equations: More...
 
virtual void v_NumericalFluxO1 (const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &numericalFluxO1)
 Builds the numerical flux for the 1st order derivatives. More...
 
virtual void v_WeakPenaltyO1 (const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &penaltyfluxO1)
 Imposes appropriate bcs for the 1st order derivatives. More...
 
virtual void v_NumericalFluxO2 (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)
 Build the numerical flux for the 2nd order derivatives. More...
 
virtual void v_WeakPenaltyO2 (const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const int var, const int dir, const Array< OneD, const NekDouble > &qfield, Array< OneD, NekDouble > &penaltyflux)
 Imposes appropriate bcs for the 2nd order derivatives. More...
 
virtual void v_SetHomoDerivs (Array< OneD, Array< OneD, NekDouble > > &deriv)
 
virtual Array< OneD, Array
< OneD, Array< OneD, NekDouble > > > & 
v_GetFluxTensor ()
 

Protected Attributes

Array< OneD, Array< OneD,
NekDouble > > 
m_traceVel
 
Array< OneD, Array< OneD,
NekDouble > > 
m_traceNormals
 
LibUtilities::SessionReaderSharedPtr m_session
 
NekDouble m_gamma
 
NekDouble m_gasConstant
 
NekDouble m_Twall
 
std::string m_ViscosityType
 
NekDouble m_mu
 
NekDouble m_thermalConductivity
 
NekDouble m_rhoInf
 
NekDouble m_pInf
 
Array< OneD, Array< OneD,
Array< OneD, NekDouble > > > 
m_viscTensor
 
Array< OneD, Array< OneD,
NekDouble > > 
m_homoDerivs
 
int m_spaceDim
 
int m_diffDim
 
- 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 DiffusionLDGNS.h.

Constructor & Destructor Documentation

Nektar::SolverUtils::DiffusionLDGNS::DiffusionLDGNS ( )
protected

Definition at line 49 of file DiffusionLDGNS.cpp.

Referenced by create().

50  {
51  }

Member Function Documentation

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

Definition at line 48 of file DiffusionLDGNS.h.

References DiffusionLDGNS().

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

Calculate weak DG Diffusion in the LDG form for the Navier-Stokes (NS) equations:

$ \langle\psi, \hat{u}\cdot n\rangle - \langle\nabla\psi \cdot u\rangle \langle\phi, \hat{q}\cdot n\rangle - (\nabla \phi \cdot q) \rangle $

The equations that need a diffusion operator are those related with the velocities and with the energy.

Implements Nektar::SolverUtils::Diffusion.

Definition at line 105 of file DiffusionLDGNS.cpp.

References m_diffDim, Nektar::SolverUtils::Diffusion::m_fluxVectorNS, m_homoDerivs, m_spaceDim, m_viscTensor, Vmath::Neg(), v_NumericalFluxO1(), v_NumericalFluxO2(), and Vmath::Vadd().

110  {
111  int i, j;
112  int nDim = fields[0]->GetCoordim(0);
113  int nScalars = inarray.num_elements();
114  int nPts = fields[0]->GetTotPoints();
115  int nCoeffs = fields[0]->GetNcoeffs();
116  int nTracePts = fields[0]->GetTrace()->GetTotPoints();
117 
118  Array<OneD, NekDouble> tmp1(nCoeffs);
119  Array<OneD, Array<OneD, NekDouble> > tmp2(nConvectiveFields);
120 
122  numericalFluxO1(m_spaceDim);
124  derivativesO1(m_spaceDim);
125 
127 
128  for (j = 0; j < m_spaceDim; ++j)
129  {
130  numericalFluxO1[j] = Array<OneD, Array<OneD, NekDouble> >(
131  nScalars);
132  derivativesO1[j] = Array<OneD, Array<OneD, NekDouble> >(
133  nScalars);
134 
135  for (i = 0; i < nScalars; ++i)
136  {
137  numericalFluxO1[j][i] = Array<OneD, NekDouble>(
138  nTracePts, 0.0);
139  derivativesO1[j][i] = Array<OneD, NekDouble>(nPts, 0.0);
140  }
141  }
142 
143  // Compute the numerical fluxes for the first order derivatives
144  v_NumericalFluxO1(fields, inarray, numericalFluxO1);
145 
146  for (j = 0; j < nDim; ++j)
147  {
148  for (i = 0; i < nScalars; ++i)
149  {
150  fields[i]->IProductWRTDerivBase (j, inarray[i], tmp1);
151  Vmath::Neg (nCoeffs, tmp1, 1);
152  fields[i]->AddTraceIntegral (numericalFluxO1[j][i],
153  tmp1);
154  fields[i]->SetPhysState (false);
155  fields[i]->MultiplyByElmtInvMass(tmp1, tmp1);
156  fields[i]->BwdTrans (tmp1, derivativesO1[j][i]);
157  }
158  }
159 
160  // For 3D Homogeneous 1D only take derivatives in 3rd direction
161  if (m_diffDim == 1)
162  {
163  for (i = 0; i < nScalars; ++i)
164  {
165  derivativesO1[2][i] = m_homoDerivs[i];
166  }
167  }
168 
169  // Initialisation viscous tensor
171  (m_spaceDim);
172  Array<OneD, Array<OneD, NekDouble> > viscousFlux(nConvectiveFields);
173 
174  for (j = 0; j < m_spaceDim; ++j)
175  {
177  nScalars+1);
178  for (i = 0; i < nScalars+1; ++i)
179  {
180  m_viscTensor[j][i] = Array<OneD, NekDouble>(nPts, 0.0);
181  }
182  }
183 
184  for (i = 0; i < nConvectiveFields; ++i)
185  {
186  viscousFlux[i] = Array<OneD, NekDouble>(nTracePts, 0.0);
187  }
188 
189  m_fluxVectorNS(inarray, derivativesO1, m_viscTensor);
190 
191  // Compute u from q_{\eta} and q_{\xi}
192  // Obtain numerical fluxes
193  v_NumericalFluxO2(fields, inarray, m_viscTensor, viscousFlux);
194 
195  for (i = 0; i < nConvectiveFields; ++i)
196  {
197  tmp2[i] = Array<OneD, NekDouble>(nCoeffs, 0.0);
198 
199  for (j = 0; j < nDim; ++j)
200  {
201  fields[i]->IProductWRTDerivBase(j, m_viscTensor[j][i], tmp1);
202  Vmath::Vadd(nCoeffs, tmp1, 1, tmp2[i], 1, tmp2[i], 1);
203  }
204 
205  // Evaulate <\phi, \hat{F}\cdot n> - outarray[i]
206  Vmath::Neg (nCoeffs, tmp2[i], 1);
207  fields[i]->AddTraceIntegral (viscousFlux[i], tmp2[i]);
208  fields[i]->SetPhysState (false);
209  fields[i]->MultiplyByElmtInvMass(tmp2[i], tmp2[i]);
210  fields[i]->BwdTrans (tmp2[i], outarray[i]);
211  }
212  }
Array< OneD, Array< OneD, NekDouble > > m_homoDerivs
DiffusionFluxVecCBNS m_fluxVectorNS
Definition: Diffusion.h:133
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_viscTensor
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.cpp:382
virtual void v_NumericalFluxO2(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)
Build the numerical flux for the 2nd order derivatives.
virtual void v_NumericalFluxO1(const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &numericalFluxO1)
Builds the numerical flux for the 1st order derivatives.
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
virtual Array<OneD, Array<OneD, Array<OneD, NekDouble> > >& Nektar::SolverUtils::DiffusionLDGNS::v_GetFluxTensor ( )
inlineprotectedvirtual

Reimplemented from Nektar::SolverUtils::Diffusion.

Definition at line 117 of file DiffusionLDGNS.h.

References m_viscTensor.

118  {
119  return m_viscTensor;
120  }
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_viscTensor
void Nektar::SolverUtils::DiffusionLDGNS::v_InitObject ( LibUtilities::SessionReaderSharedPtr  pSession,
Array< OneD, MultiRegions::ExpListSharedPtr pFields 
)
protectedvirtual

Reimplemented from Nektar::SolverUtils::Diffusion.

Definition at line 53 of file DiffusionLDGNS.cpp.

References m_diffDim, m_gamma, m_gasConstant, m_mu, m_pInf, m_rhoInf, m_session, m_spaceDim, m_thermalConductivity, m_traceNormals, m_traceVel, m_Twall, and m_ViscosityType.

56  {
57  m_session = pSession;
58  m_session->LoadParameter ("Gamma", m_gamma, 1.4);
59  m_session->LoadParameter ("GasConstant", m_gasConstant, 287.058);
60  m_session->LoadParameter ("Twall", m_Twall, 300.15);
61  m_session->LoadSolverInfo("ViscosityType", m_ViscosityType,
62  "Constant");
63  m_session->LoadParameter ("mu", m_mu, 1.78e-05);
64  m_session->LoadParameter ("thermalConductivity",
65  m_thermalConductivity, 0.0257);
66  m_session->LoadParameter ("rhoInf", m_rhoInf, 1.225);
67  m_session->LoadParameter ("pInf", m_pInf, 101325);
68 
69  // Setting up the normals
70  int i;
71  int nDim = pFields[0]->GetCoordim(0);
72  int nTracePts = pFields[0]->GetTrace()->GetTotPoints();
73 
74  m_spaceDim = nDim;
75  if (pSession->DefinesSolverInfo("HOMOGENEOUS"))
76  {
77  m_spaceDim = 3;
78  }
79 
80  m_diffDim = m_spaceDim - nDim;
81 
84  for(i = 0; i < m_spaceDim; ++i)
85  {
86  m_traceVel[i] = Array<OneD, NekDouble> (nTracePts, 0.0);
87  m_traceNormals[i] = Array<OneD, NekDouble> (nTracePts);
88  }
89  pFields[0]->GetTrace()->GetNormals(m_traceNormals);
90  }
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
LibUtilities::SessionReaderSharedPtr m_session
Array< OneD, Array< OneD, NekDouble > > m_traceVel
void Nektar::SolverUtils::DiffusionLDGNS::v_NumericalFluxO1 ( const Array< OneD, MultiRegions::ExpListSharedPtr > &  fields,
const Array< OneD, Array< OneD, NekDouble > > &  inarray,
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &  numericalFluxO1 
)
protectedvirtual

Builds the numerical flux for the 1st order derivatives.

Definition at line 218 of file DiffusionLDGNS.cpp.

References m_spaceDim, m_traceNormals, Vmath::Svtvp(), v_WeakPenaltyO1(), and Vmath::Vmul().

Referenced by v_Diffuse().

223  {
224  int i, j;
225  int nTracePts = fields[0]->GetTrace()->GetTotPoints();
226  int nScalars = inarray.num_elements();
227  int nDim = fields[0]->GetCoordim(0);
228 
229  Array<OneD, NekDouble > Vn (nTracePts, 0.0);
230  Array<OneD, NekDouble > fluxtemp(nTracePts, 0.0);
231 
232  // Get the normal velocity Vn
233  for(i = 0; i < nDim; ++i)
234  {
235  Vmath::Svtvp(nTracePts, 1.0, m_traceNormals[i], 1,
236  Vn, 1, Vn, 1);
237  }
238 
239  // Store forwards/backwards space along trace space
240  Array<OneD, Array<OneD, NekDouble> > Fwd (nScalars);
241  Array<OneD, Array<OneD, NekDouble> > Bwd (nScalars);
242  Array<OneD, Array<OneD, NekDouble> > numflux(nScalars);
243 
244  for (i = 0; i < nScalars; ++i)
245  {
246  Fwd[i] = Array<OneD, NekDouble>(nTracePts);
247  Bwd[i] = Array<OneD, NekDouble>(nTracePts);
248  numflux[i] = Array<OneD, NekDouble>(nTracePts);
249  fields[i]->GetFwdBwdTracePhys(inarray[i], Fwd[i], Bwd[i]);
250  fields[0]->GetTrace()->Upwind(Vn, Fwd[i], Bwd[i], numflux[i]);
251  }
252 
253  // Modify the values in case of boundary interfaces
254  if (fields[0]->GetBndCondExpansions().num_elements())
255  {
256  v_WeakPenaltyO1(fields, inarray, numflux);
257  }
258 
259  // Splitting the numerical flux into the dimensions
260  for (j = 0; j < m_spaceDim; ++j)
261  {
262  for (i = 0; i < nScalars; ++i)
263  {
264  Vmath::Vmul(nTracePts, m_traceNormals[j], 1,
265  numflux[i], 1, numericalFluxO1[j][i], 1);
266  }
267  }
268  }
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
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_WeakPenaltyO1(const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &penaltyfluxO1)
Imposes appropriate bcs for the 1st order derivatives.
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::DiffusionLDGNS::v_NumericalFluxO2 ( 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

Build the numerical flux for the 2nd order derivatives.

Definition at line 480 of file DiffusionLDGNS.cpp.

References m_traceNormals, Vmath::Svtvp(), v_WeakPenaltyO2(), Vmath::Vadd(), and Vmath::Vmul().

Referenced by v_Diffuse().

485  {
486  int i, j;
487  int nTracePts = fields[0]->GetTrace()->GetTotPoints();
488  int nVariables = fields.num_elements();
489  int nDim = fields[0]->GetCoordim(0);
490 
491  Array<OneD, NekDouble > Fwd(nTracePts);
492  Array<OneD, NekDouble > Bwd(nTracePts);
493  Array<OneD, NekDouble > Vn (nTracePts, 0.0);
494 
495  Array<OneD, NekDouble > qFwd (nTracePts);
496  Array<OneD, NekDouble > qBwd (nTracePts);
497  Array<OneD, NekDouble > qfluxtemp(nTracePts, 0.0);
498 
499  // Get the normal velocity Vn
500  for(i = 0; i < nDim; ++i)
501  {
502  Vmath::Svtvp(nTracePts, 1.0, m_traceNormals[i], 1,
503  Vn, 1, Vn, 1);
504  }
505 
506  // Evaulate Riemann flux
507  // qflux = \hat{q} \cdot u = q \cdot n
508  // Notice: i = 1 (first row of the viscous tensor is zero)
509  for (i = 1; i < nVariables; ++i)
510  {
511  qflux[i] = Array<OneD, NekDouble> (nTracePts, 0.0);
512  for (j = 0; j < nDim; ++j)
513  {
514  // Compute qFwd and qBwd value of qfield in position 'ji'
515  fields[i]->GetFwdBwdTracePhys(qfield[j][i], qFwd, qBwd);
516 
517  // Get Riemann flux of qflux --> LDG implies upwind
518  fields[i]->GetTrace()->Upwind(Vn, qBwd, qFwd, qfluxtemp);
519 
520  // Multiply the Riemann flux by the trace normals
521  Vmath::Vmul(nTracePts, m_traceNormals[j], 1, qfluxtemp, 1,
522  qfluxtemp, 1);
523 
524  // Impose weak boundary condition with flux
525  if (fields[0]->GetBndCondExpansions().num_elements())
526  {
527  v_WeakPenaltyO2(fields, i, j, qfield[j][i], qfluxtemp);
528  }
529 
530  // Store the final flux into qflux
531  Vmath::Vadd(nTracePts, qfluxtemp, 1, qflux[i], 1,
532  qflux[i], 1);
533  }
534  }
535  }
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
virtual void v_WeakPenaltyO2(const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const int var, const int dir, const Array< OneD, const NekDouble > &qfield, Array< OneD, NekDouble > &penaltyflux)
Imposes appropriate bcs for the 2nd order derivatives.
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
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
virtual void Nektar::SolverUtils::DiffusionLDGNS::v_SetHomoDerivs ( Array< OneD, Array< OneD, NekDouble > > &  deriv)
inlineprotectedvirtual

Reimplemented from Nektar::SolverUtils::Diffusion.

Definition at line 111 of file DiffusionLDGNS.h.

113  {
114  m_homoDerivs = deriv;
115  }
Array< OneD, Array< OneD, NekDouble > > m_homoDerivs
void Nektar::SolverUtils::DiffusionLDGNS::v_WeakPenaltyO1 ( const Array< OneD, MultiRegions::ExpListSharedPtr > &  fields,
const Array< OneD, Array< OneD, NekDouble > > &  inarray,
Array< OneD, Array< OneD, NekDouble > > &  penaltyfluxO1 
)
protectedvirtual

Imposes appropriate bcs for the 1st order derivatives.

Definition at line 274 of file DiffusionLDGNS.cpp.

References Nektar::SpatialDomains::eDirichlet, Nektar::SpatialDomains::eNeumann, m_gamma, m_gasConstant, m_Twall, Vmath::Smul(), Vmath::Vadd(), Vmath::Vcopy(), Vmath::Vdiv(), Vmath::Vmul(), Vmath::Vsub(), and Vmath::Zero().

Referenced by v_NumericalFluxO1().

278  {
279  int cnt;
280  int i, j, e;
281  int id1, id2;
282 
283  int nBndEdgePts, nBndEdges, nBndRegions;
284 
285  int nTracePts = fields[0]->GetTrace()->GetTotPoints();
286  int nScalars = inarray.num_elements();
287 
288  Array<OneD, NekDouble> tmp1(nTracePts, 0.0);
289  Array<OneD, NekDouble> tmp2(nTracePts, 0.0);
290  Array<OneD, NekDouble> Tw(nTracePts, m_Twall);
291 
292  Array< OneD, Array<OneD, NekDouble > > scalarVariables(nScalars);
293  Array< OneD, Array<OneD, NekDouble > > uplus(nScalars);
294 
295  // Extract internal values of the scalar variables for Neumann bcs
296  for (i = 0; i < nScalars; ++i)
297  {
298  scalarVariables[i] = Array<OneD, NekDouble>(nTracePts, 0.0);
299 
300  uplus[i] = Array<OneD, NekDouble>(nTracePts, 0.0);
301  fields[i]->ExtractTracePhys(inarray[i], uplus[i]);
302  }
303 
304  // Compute boundary conditions for velocities
305  for (i = 0; i < nScalars-1; ++i)
306  {
307  // Note that cnt has to loop on nBndRegions and nBndEdges
308  // and has to be reset to zero per each equation
309  cnt = 0;
310  nBndRegions = fields[i+1]->
311  GetBndCondExpansions().num_elements();
312  for (j = 0; j < nBndRegions; ++j)
313  {
314  nBndEdges = fields[i+1]->
315  GetBndCondExpansions()[j]->GetExpSize();
316  for (e = 0; e < nBndEdges; ++e)
317  {
318  nBndEdgePts = fields[i+1]->
319  GetBndCondExpansions()[j]->GetExp(e)->GetTotPoints();
320 
321  id1 = fields[i+1]->
322  GetBndCondExpansions()[j]->GetPhys_Offset(e);
323 
324  id2 = fields[0]->GetTrace()->
325  GetPhys_Offset(fields[0]->GetTraceMap()->
326  GetBndCondTraceToGlobalTraceMap(cnt++));
327 
328  // Reinforcing bcs for velocity in case of Wall bcs
329  if (boost::iequals(fields[i]->GetBndConditions()[j]->
330  GetUserDefined(),"WallViscous") ||
331  boost::iequals(fields[i]->GetBndConditions()[j]->
332  GetUserDefined(),"WallAdiabatic"))
333  {
334  Vmath::Zero(nBndEdgePts,
335  &scalarVariables[i][id2], 1);
336 
337  }
338 
339  // Imposing velocity bcs if not Wall
340  else if (fields[i]->GetBndConditions()[j]->
341  GetBoundaryConditionType() ==
343  {
344  Vmath::Vdiv(nBndEdgePts,
345  &(fields[i+1]->GetBndCondExpansions()[j]->
346  UpdatePhys())[id1], 1,
347  &(fields[0]->GetBndCondExpansions()[j]->
348  UpdatePhys())[id1], 1,
349  &scalarVariables[i][id2], 1);
350  }
351 
352  // For Dirichlet boundary condition: uflux = u_bcs
353  if (fields[i]->GetBndConditions()[j]->
354  GetBoundaryConditionType() ==
356  {
357  Vmath::Vcopy(nBndEdgePts,
358  &scalarVariables[i][id2], 1,
359  &penaltyfluxO1[i][id2], 1);
360  }
361 
362  // For Neumann boundary condition: uflux = u_+
363  else if ((fields[i]->GetBndConditions()[j])->
364  GetBoundaryConditionType() ==
366  {
367  Vmath::Vcopy(nBndEdgePts,
368  &uplus[i][id2], 1,
369  &penaltyfluxO1[i][id2], 1);
370  }
371 
372  // Building kinetic energy to be used for T bcs
373  Vmath::Vmul(nBndEdgePts,
374  &scalarVariables[i][id2], 1,
375  &scalarVariables[i][id2], 1,
376  &tmp1[id2], 1);
377 
378  Vmath::Smul(nBndEdgePts, 0.5,
379  &tmp1[id2], 1,
380  &tmp1[id2], 1);
381 
382  Vmath::Vadd(nBndEdgePts,
383  &tmp2[id2], 1,
384  &tmp1[id2], 1,
385  &tmp2[id2], 1);
386  }
387  }
388  }
389 
390  // Compute boundary conditions for temperature
391  cnt = 0;
392  nBndRegions = fields[nScalars]->
393  GetBndCondExpansions().num_elements();
394  for (j = 0; j < nBndRegions; ++j)
395  {
396  nBndEdges = fields[nScalars]->
397  GetBndCondExpansions()[j]->GetExpSize();
398  for (e = 0; e < nBndEdges; ++e)
399  {
400  nBndEdgePts = fields[nScalars]->
401  GetBndCondExpansions()[j]->GetExp(e)->GetTotPoints();
402 
403  id1 = fields[nScalars]->
404  GetBndCondExpansions()[j]->GetPhys_Offset(e);
405 
406  id2 = fields[0]->GetTrace()->
407  GetPhys_Offset(fields[0]->GetTraceMap()->
408  GetBndCondTraceToGlobalTraceMap(cnt++));
409 
410  // Imposing Temperature Twall at the wall
411  if (boost::iequals(fields[i]->GetBndConditions()[j]->
412  GetUserDefined(),"WallViscous"))
413  {
414  Vmath::Vcopy(nBndEdgePts,
415  &Tw[0], 1,
416  &scalarVariables[nScalars-1][id2], 1);
417  }
418  // Imposing Temperature through condition on the Energy
419  // for no wall boundaries (e.g. farfield)
420  else if (fields[i]->GetBndConditions()[j]->
421  GetBoundaryConditionType() ==
423  {
424  // Divide E by rho
425  Vmath::Vdiv(nBndEdgePts,
426  &(fields[nScalars]->
427  GetBndCondExpansions()[j]->
428  GetPhys())[id1], 1,
429  &(fields[0]->
430  GetBndCondExpansions()[j]->
431  GetPhys())[id1], 1,
432  &scalarVariables[nScalars-1][id2], 1);
433 
434  // Subtract kinetic energy to E/rho
435  Vmath::Vsub(nBndEdgePts,
436  &scalarVariables[nScalars-1][id2], 1,
437  &tmp2[id2], 1,
438  &scalarVariables[nScalars-1][id2], 1);
439 
440  // Multiply by constant factor (gamma-1)/R
441  Vmath::Smul(nBndEdgePts, (m_gamma - 1)/m_gasConstant,
442  &scalarVariables[nScalars-1][id2], 1,
443  &scalarVariables[nScalars-1][id2], 1);
444  }
445 
446  // For Dirichlet boundary condition: uflux = u_bcs
447  if (fields[nScalars]->GetBndConditions()[j]->
448  GetBoundaryConditionType() ==
450  !boost::iequals(
451  fields[nScalars]->GetBndConditions()[j]
452  ->GetUserDefined(), "WallAdiabatic"))
453  {
454  Vmath::Vcopy(nBndEdgePts,
455  &scalarVariables[nScalars-1][id2], 1,
456  &penaltyfluxO1[nScalars-1][id2], 1);
457 
458  }
459 
460  // For Neumann boundary condition: uflux = u_+
461  else if (((fields[nScalars]->GetBndConditions()[j])->
462  GetBoundaryConditionType() ==
464  boost::iequals(fields[nScalars]->GetBndConditions()[j]->
465  GetUserDefined(), "WallAdiabatic"))
466  {
467  Vmath::Vcopy(nBndEdgePts,
468  &uplus[nScalars-1][id2], 1,
469  &penaltyfluxO1[nScalars-1][id2], 1);
470 
471  }
472  }
473  }
474  }
void Vdiv(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:227
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
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
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:359
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1047
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::DiffusionLDGNS::v_WeakPenaltyO2 ( const Array< OneD, MultiRegions::ExpListSharedPtr > &  fields,
const int  var,
const int  dir,
const Array< OneD, const NekDouble > &  qfield,
Array< OneD, NekDouble > &  penaltyflux 
)
protectedvirtual

Imposes appropriate bcs for the 2nd order derivatives.

Definition at line 542 of file DiffusionLDGNS.cpp.

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

Referenced by v_NumericalFluxO2().

548  {
549  int cnt = 0;
550  int nBndEdges, nBndEdgePts;
551  int i, e;
552  int id2;
553 
554  int nTracePts = fields[0]->GetTrace()->GetTotPoints();
555  int nBndRegions = fields[var]->GetBndCondExpansions().num_elements();
556 
557  Array<OneD, NekDouble > uterm(nTracePts);
558  Array<OneD, NekDouble > qtemp(nTracePts);
559 
560  // Extract the physical values of the solution at the boundaries
561  fields[var]->ExtractTracePhys(qfield, qtemp);
562 
563  // Loop on the boundary regions to apply appropriate bcs
564  for (i = 0; i < nBndRegions; ++i)
565  {
566  // Number of boundary regions related to region 'i'
567  nBndEdges = fields[var]->
568  GetBndCondExpansions()[i]->GetExpSize();
569 
570  // Weakly impose bcs by modifying flux values
571  for (e = 0; e < nBndEdges; ++e)
572  {
573  nBndEdgePts = fields[var]->
574  GetBndCondExpansions()[i]->GetExp(e)->GetTotPoints();
575 
576  id2 = fields[0]->GetTrace()->
577  GetPhys_Offset(fields[0]->GetTraceMap()->
578  GetBndCondTraceToGlobalTraceMap(cnt++));
579 
580  // In case of Dirichlet bcs:
581  // uflux = gD
582  if(fields[var]->GetBndConditions()[i]->
583  GetBoundaryConditionType() == SpatialDomains::eDirichlet
584  && !boost::iequals(fields[var]->GetBndConditions()[i]->
585  GetUserDefined(), "WallAdiabatic"))
586  {
587  Vmath::Vmul(nBndEdgePts,
588  &m_traceNormals[dir][id2], 1,
589  &qtemp[id2], 1,
590  &penaltyflux[id2], 1);
591  }
592  // 3.4) In case of Neumann bcs:
593  // uflux = u+
594  else if((fields[var]->GetBndConditions()[i])->
595  GetBoundaryConditionType() == SpatialDomains::eNeumann)
596  {
597  ASSERTL0(false,
598  "Neumann bcs not implemented for LDGNS");
599 
600  /*
601  Vmath::Vmul(nBndEdgePts,
602  &m_traceNormals[dir][id2], 1,
603  &(fields[var]->
604  GetBndCondExpansions()[i]->
605  UpdatePhys())[id1], 1,
606  &penaltyflux[id2], 1);
607  */
608  }
609  else if(boost::iequals(fields[var]->GetBndConditions()[i]->
610  GetUserDefined(), "WallAdiabatic"))
611  {
612  if ((var == m_spaceDim + 1))
613  {
614  Vmath::Zero(nBndEdgePts, &penaltyflux[id2], 1);
615  }
616  else
617  {
618 
619  Vmath::Vmul(nBndEdgePts,
620  &m_traceNormals[dir][id2], 1,
621  &qtemp[id2], 1,
622  &penaltyflux[id2], 1);
623 
624  }
625  }
626  }
627  }
628  }
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:359
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

int Nektar::SolverUtils::DiffusionLDGNS::m_diffDim
protected

Definition at line 75 of file DiffusionLDGNS.h.

Referenced by v_Diffuse(), and v_InitObject().

NekDouble Nektar::SolverUtils::DiffusionLDGNS::m_gamma
protected

Definition at line 61 of file DiffusionLDGNS.h.

Referenced by v_InitObject(), and v_WeakPenaltyO1().

NekDouble Nektar::SolverUtils::DiffusionLDGNS::m_gasConstant
protected

Definition at line 62 of file DiffusionLDGNS.h.

Referenced by v_InitObject(), and v_WeakPenaltyO1().

Array<OneD, Array<OneD, NekDouble> > Nektar::SolverUtils::DiffusionLDGNS::m_homoDerivs
protected

Definition at line 72 of file DiffusionLDGNS.h.

Referenced by v_Diffuse().

NekDouble Nektar::SolverUtils::DiffusionLDGNS::m_mu
protected

Definition at line 65 of file DiffusionLDGNS.h.

Referenced by v_InitObject().

NekDouble Nektar::SolverUtils::DiffusionLDGNS::m_pInf
protected

Definition at line 68 of file DiffusionLDGNS.h.

Referenced by v_InitObject().

NekDouble Nektar::SolverUtils::DiffusionLDGNS::m_rhoInf
protected

Definition at line 67 of file DiffusionLDGNS.h.

Referenced by v_InitObject().

LibUtilities::SessionReaderSharedPtr Nektar::SolverUtils::DiffusionLDGNS::m_session
protected

Definition at line 60 of file DiffusionLDGNS.h.

Referenced by v_InitObject().

int Nektar::SolverUtils::DiffusionLDGNS::m_spaceDim
protected

Definition at line 74 of file DiffusionLDGNS.h.

Referenced by v_Diffuse(), v_InitObject(), v_NumericalFluxO1(), and v_WeakPenaltyO2().

NekDouble Nektar::SolverUtils::DiffusionLDGNS::m_thermalConductivity
protected

Definition at line 66 of file DiffusionLDGNS.h.

Referenced by v_InitObject().

Array<OneD, Array<OneD, NekDouble> > Nektar::SolverUtils::DiffusionLDGNS::m_traceNormals
protected
Array<OneD, Array<OneD, NekDouble> > Nektar::SolverUtils::DiffusionLDGNS::m_traceVel
protected

Definition at line 58 of file DiffusionLDGNS.h.

Referenced by v_InitObject().

NekDouble Nektar::SolverUtils::DiffusionLDGNS::m_Twall
protected

Definition at line 63 of file DiffusionLDGNS.h.

Referenced by v_InitObject(), and v_WeakPenaltyO1().

std::string Nektar::SolverUtils::DiffusionLDGNS::m_ViscosityType
protected

Definition at line 64 of file DiffusionLDGNS.h.

Referenced by v_InitObject().

Array<OneD, Array<OneD, Array<OneD, NekDouble> > > Nektar::SolverUtils::DiffusionLDGNS::m_viscTensor
protected

Definition at line 70 of file DiffusionLDGNS.h.

Referenced by v_Diffuse(), and v_GetFluxTensor().

std::string Nektar::SolverUtils::DiffusionLDGNS::type
static
Initial value:
RegisterCreatorFunction("LDGNS", DiffusionLDGNS::create)

Definition at line 53 of file DiffusionLDGNS.h.