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

#include <Diffusion3DHomogeneous1D.h>

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

Static Public Member Functions

static DiffusionSharedPtr create (std::string diffType)
 

Static Public Attributes

static std::string type []
 

Protected Member Functions

 Diffusion3DHomogeneous1D (std::string diffType)
 Diffusion3DHomogeneous1D uses the 2D WeakDG approach to compute the diffusion term looping on the planes in the z direction and adding the flux in z direction at the end. More...
 
virtual void v_InitObject (LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields)
 Initiliase Diffusion3DHomogeneous1D objects and store them before starting the time-stepping. More...
 
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, const Array< OneD, Array< OneD, NekDouble > > &pFwd=NullNekDoubleArrayofArray, const Array< OneD, Array< OneD, NekDouble > > &pBwd=NullNekDoubleArrayofArray)
 Calculate WeakDG Diffusion for the linear problems using an LDG interface flux and the the flux in the third direction. More...
 
- 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

LibUtilities::TranspositionSharedPtr m_trans
 
std::string m_diffType
 
SolverUtils::DiffusionSharedPtr m_planeDiff
 
NekDouble m_homoLen
 
int m_numPoints
 
int m_numPointsPlane
 
int m_numPlanes
 
int m_planeCounter
 
Array< OneD, unsigned int > m_planes
 
Array< OneD, unsigned int > m_planePos
 
Array< OneD, Array< OneD,
NekDouble > > 
m_homoDerivStore
 
Array< OneD, Array< OneD,
Array< OneD, NekDouble > > > 
m_homoDerivPlane
 
Array< OneD, Array< OneD,
NekDouble > > 
m_inarrayPlane
 
Array< OneD, Array< OneD,
NekDouble > > 
m_outarrayPlane
 
Array< OneD,
MultiRegions::ExpListSharedPtr
m_fieldsPlane
 
Array< OneD, Array< OneD,
NekDouble > > 
m_advVelPlane
 
- Protected Attributes inherited from Nektar::SolverUtils::Diffusion
DiffusionFluxVecCB m_fluxVector
 
DiffusionFluxVecCBNS m_fluxVectorNS
 
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, const Array< OneD, Array< OneD, NekDouble > > &pFwd=NullNekDoubleArrayofArray, const Array< OneD, Array< OneD, NekDouble > > &pBwd=NullNekDoubleArrayofArray)
 
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 SetHomoDerivs (Array< OneD, Array< OneD, NekDouble > > &deriv)
 
virtual Array< OneD, Array
< OneD, Array< OneD, NekDouble > > > & 
GetFluxTensor ()
 

Detailed Description

Definition at line 46 of file Diffusion3DHomogeneous1D.h.

Constructor & Destructor Documentation

Nektar::SolverUtils::Diffusion3DHomogeneous1D::Diffusion3DHomogeneous1D ( std::string  diffType)
protected

Diffusion3DHomogeneous1D uses the 2D WeakDG approach to compute the diffusion term looping on the planes in the z direction and adding the flux in z direction at the end.

Definition at line 78 of file Diffusion3DHomogeneous1D.cpp.

References Nektar::LibUtilities::NekFactory< tKey, tBase, >::CreateInstance(), and Nektar::SolverUtils::GetDiffusionFactory().

Referenced by create().

79  {
80  // Strip trailing string "3DHomogeneous1D" to determine 2D diffusion
81  // type, and create a diffusion object for the plane.
82  string name = diffType.substr(0, diffType.length()-15);
84  }
tBaseSharedPtr CreateInstance(tKey idKey BOOST_PP_COMMA_IF(MAX_PARAM) BOOST_PP_ENUM_BINARY_PARAMS(MAX_PARAM, tParam, x))
Create an instance of the class referred to by idKey.
Definition: NekFactory.hpp:162
DiffusionFactory & GetDiffusionFactory()
Definition: Diffusion.cpp:42

Member Function Documentation

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

Definition at line 49 of file Diffusion3DHomogeneous1D.h.

References Diffusion3DHomogeneous1D().

50  {
51  return DiffusionSharedPtr(
52  new Diffusion3DHomogeneous1D(diffType));
53  }
Diffusion3DHomogeneous1D(std::string diffType)
Diffusion3DHomogeneous1D uses the 2D WeakDG approach to compute the diffusion term looping on the pla...
boost::shared_ptr< Diffusion > DiffusionSharedPtr
A shared pointer to an EquationSystem object.
Definition: Diffusion.h:162
void Nektar::SolverUtils::Diffusion3DHomogeneous1D::v_Diffuse ( const int  nConvective,
const Array< OneD, MultiRegions::ExpListSharedPtr > &  fields,
const Array< OneD, Array< OneD, NekDouble > > &  inarray,
Array< OneD, Array< OneD, NekDouble > > &  outarray,
const Array< OneD, Array< OneD, NekDouble > > &  pFwd = NullNekDoubleArrayofArray,
const Array< OneD, Array< OneD, NekDouble > > &  pBwd = NullNekDoubleArrayofArray 
)
protectedvirtual

Calculate WeakDG Diffusion for the linear problems using an LDG interface flux and the the flux in the third direction.

Implements Nektar::SolverUtils::Diffusion.

Definition at line 170 of file Diffusion3DHomogeneous1D.cpp.

References Vmath::Smul(), Vmath::Vadd(), Vmath::Vcopy(), and Vmath::Vsub().

177  {
178 
179  Array<OneD, NekDouble> tmp(m_numPoints), tmp2;
180  Array<OneD, Array<OneD, NekDouble> > viscHComp;
181  const int nPointsTot = fields[0]->GetNpoints();
182  int i, j;
183  NekDouble beta;
184 
185 
186  if (m_fluxVectorNS)
187  {
188  viscHComp = Array<OneD, Array<OneD, NekDouble> >(nConvectiveFields);
189  for (i = 0; i < nConvectiveFields - 1; ++i)
190  {
191  fields[0]->PhysDeriv(2, inarray[i], m_homoDerivStore[i]);
192  viscHComp[i] = Array<OneD, NekDouble>(m_numPoints);
193  }
194  }
195 
196 
197  for (i = 0; i < m_numPlanes; ++i)
198  {
199  // Set up memory references for fields, inarray and outarray for
200  // this plane.
201  for (int j = 0; j < inarray.num_elements(); ++j)
202  {
203  m_inarrayPlane [j] = Array<OneD, NekDouble>(
204  m_numPointsPlane, tmp2 = inarray [j] + m_planePos[i]);
205  }
206 
207  for (int j = 0; j < nConvectiveFields; ++j)
208  {
209  m_fieldsPlane [j] = fields[j]->GetPlane(i);
210  m_outarrayPlane[j] = Array<OneD, NekDouble>(
211  m_numPointsPlane, tmp2 = outarray[j] + m_planePos[i]);
212  }
213 
214 
215  if (m_fluxVectorNS)
216  {
217  m_planeDiff->SetHomoDerivs(m_homoDerivPlane[i]);
218  }
219 
220 
221 
222  m_planeDiff->Diffuse(nConvectiveFields,
226 
227  if (m_fluxVectorNS)
228  {
229  Array<OneD, Array<OneD, Array<OneD, NekDouble> > > &viscTensor = m_planeDiff->GetFluxTensor();
230 
231  // Extract H (viscTensor[2])
232  for (int j = 0; j < nConvectiveFields - 1; ++j)
233  {
235  viscTensor[2][j+1], 1,
236  tmp2 = viscHComp[j] + m_planePos[i], 1);
237  }
238  }
239  }
240 
241 
242 
243  if (m_fluxVectorNS)
244  {
245  for (j = 0; j < nConvectiveFields - 1; ++j)
246  {
247  fields[j+1]->PhysDeriv(2, viscHComp[j], tmp);
248  Vmath::Vadd(nPointsTot, outarray[j+1], 1, tmp, 1, outarray[j+1], 1);
249  }
250  }
251  else
252  {
253  for (j = 0; j < nConvectiveFields; ++j)
254  {
255  fields[j]->HomogeneousFwdTrans(inarray[j], tmp);
256 
257  for (i = 0; i < m_numPlanes; ++i)
258  {
259  beta = 2*M_PI*m_trans->GetK(i)/m_homoLen;
260  beta *= beta;
261 
263  beta,
264  &tmp[0] + i*m_numPointsPlane, 1,
265  &tmp[0] + i*m_numPointsPlane, 1);
266  }
267 
268  fields[0]->HomogeneousBwdTrans(tmp, tmp);
269 
270  Vmath::Vsub(nPointsTot, outarray[j], 1, tmp, 1,
271  outarray[j], 1);
272  }
273  }
274  }
LibUtilities::TranspositionSharedPtr m_trans
Array< OneD, Array< OneD, NekDouble > > m_inarrayPlane
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_homoDerivPlane
Array< OneD, MultiRegions::ExpListSharedPtr > m_fieldsPlane
DiffusionFluxVecCBNS m_fluxVectorNS
Definition: Diffusion.h:130
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:213
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:343
Array< OneD, Array< OneD, NekDouble > > m_homoDerivStore
Array< OneD, Array< OneD, NekDouble > > m_outarrayPlane
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1061
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:299
void Nektar::SolverUtils::Diffusion3DHomogeneous1D::v_InitObject ( LibUtilities::SessionReaderSharedPtr  pSession,
Array< OneD, MultiRegions::ExpListSharedPtr pFields 
)
protectedvirtual

Initiliase Diffusion3DHomogeneous1D objects and store them before starting the time-stepping.

Parameters
pSessionPointer to session reader.
pFieldsPointer to fields.

Reimplemented from Nektar::SolverUtils::Diffusion.

Definition at line 93 of file Diffusion3DHomogeneous1D.cpp.

96  {
97  int nConvectiveFields = pFields.num_elements();
98 
99  Array<OneD, MultiRegions::ExpListSharedPtr> pFields_plane0(
100  nConvectiveFields);
101 
102  // Initialise the plane advection object.
103  for (int i = 0; i < nConvectiveFields; ++i)
104  {
105  pFields_plane0[i] = pFields[i]->GetPlane(0);
106  }
107  m_planeDiff->InitObject(pSession, pFields_plane0);
108 
109  m_numPoints = pFields[0]->GetTotPoints();
110  m_planes = pFields[0]->GetZIDs();
111  m_numPlanes = m_planes.num_elements();
113  m_homoLen = pFields[0]->GetHomoLen();
114  m_trans = pFields[0]->GetTransposition();
115  m_planeCounter = 0;
116  m_planeDiff->SetFluxVectorNS(m_fluxVectorNS);
117 
118  m_fieldsPlane = Array<OneD, MultiRegions::ExpListSharedPtr>
119  (nConvectiveFields);
120 
121  if (m_fluxVectorNS)
122  {
123  m_inarrayPlane = Array<OneD, Array<OneD, NekDouble> >
124  (nConvectiveFields - 1);
125  }
126  else
127  {
128  m_inarrayPlane = Array<OneD, Array<OneD, NekDouble> >
129  (nConvectiveFields);
130  }
131  m_outarrayPlane = Array<OneD, Array<OneD, NekDouble> >
132  (nConvectiveFields);
133  m_planePos = Array<OneD, unsigned int> (m_numPlanes);
134 
135  for (int i = 0; i < m_numPlanes; ++i)
136  {
137  m_planePos[i] = i * m_numPointsPlane;
138  }
139 
140  if (m_fluxVectorNS)
141  {
142  m_homoDerivStore = Array<OneD, Array<OneD, NekDouble> >(
143  nConvectiveFields);
144  m_homoDerivPlane = Array<OneD, Array<OneD, Array<OneD, NekDouble> > >(
145  m_numPlanes);
146 
147  for (int i = 0; i < nConvectiveFields; ++i)
148  {
149  m_homoDerivStore[i] = Array<OneD, NekDouble>(m_numPoints);
150  }
151 
152  for (int i = 0; i < m_numPlanes; ++i)
153  {
154  m_homoDerivPlane[i] = Array<OneD, Array<OneD, NekDouble> >(nConvectiveFields);
155 
156  for (int j = 0; j < nConvectiveFields; ++j)
157  {
158  m_homoDerivPlane[i][j] = Array<OneD, NekDouble>(
160  m_homoDerivStore[j] + m_planePos[i]);
161  }
162  }
163  }
164  }
LibUtilities::TranspositionSharedPtr m_trans
Array< OneD, Array< OneD, NekDouble > > m_inarrayPlane
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_homoDerivPlane
Array< OneD, MultiRegions::ExpListSharedPtr > m_fieldsPlane
DiffusionFluxVecCBNS m_fluxVectorNS
Definition: Diffusion.h:130
Array< OneD, Array< OneD, NekDouble > > m_homoDerivStore
Array< OneD, Array< OneD, NekDouble > > m_outarrayPlane

Member Data Documentation

Array<OneD, Array<OneD, NekDouble> > Nektar::SolverUtils::Diffusion3DHomogeneous1D::m_advVelPlane
protected

Definition at line 74 of file Diffusion3DHomogeneous1D.h.

std::string Nektar::SolverUtils::Diffusion3DHomogeneous1D::m_diffType
protected

Definition at line 60 of file Diffusion3DHomogeneous1D.h.

Array<OneD, MultiRegions::ExpListSharedPtr> Nektar::SolverUtils::Diffusion3DHomogeneous1D::m_fieldsPlane
protected

Definition at line 73 of file Diffusion3DHomogeneous1D.h.

Array<OneD, Array<OneD, Array<OneD, NekDouble> > > Nektar::SolverUtils::Diffusion3DHomogeneous1D::m_homoDerivPlane
protected

Definition at line 70 of file Diffusion3DHomogeneous1D.h.

Array<OneD, Array<OneD, NekDouble> > Nektar::SolverUtils::Diffusion3DHomogeneous1D::m_homoDerivStore
protected

Definition at line 69 of file Diffusion3DHomogeneous1D.h.

NekDouble Nektar::SolverUtils::Diffusion3DHomogeneous1D::m_homoLen
protected

Definition at line 62 of file Diffusion3DHomogeneous1D.h.

Array<OneD, Array<OneD, NekDouble> > Nektar::SolverUtils::Diffusion3DHomogeneous1D::m_inarrayPlane
protected

Definition at line 71 of file Diffusion3DHomogeneous1D.h.

int Nektar::SolverUtils::Diffusion3DHomogeneous1D::m_numPlanes
protected

Definition at line 65 of file Diffusion3DHomogeneous1D.h.

int Nektar::SolverUtils::Diffusion3DHomogeneous1D::m_numPoints
protected

Definition at line 63 of file Diffusion3DHomogeneous1D.h.

int Nektar::SolverUtils::Diffusion3DHomogeneous1D::m_numPointsPlane
protected

Definition at line 64 of file Diffusion3DHomogeneous1D.h.

Array<OneD, Array<OneD, NekDouble> > Nektar::SolverUtils::Diffusion3DHomogeneous1D::m_outarrayPlane
protected

Definition at line 72 of file Diffusion3DHomogeneous1D.h.

int Nektar::SolverUtils::Diffusion3DHomogeneous1D::m_planeCounter
protected

Definition at line 66 of file Diffusion3DHomogeneous1D.h.

SolverUtils::DiffusionSharedPtr Nektar::SolverUtils::Diffusion3DHomogeneous1D::m_planeDiff
protected

Definition at line 61 of file Diffusion3DHomogeneous1D.h.

Array<OneD, unsigned int> Nektar::SolverUtils::Diffusion3DHomogeneous1D::m_planePos
protected

Definition at line 68 of file Diffusion3DHomogeneous1D.h.

Array<OneD, unsigned int> Nektar::SolverUtils::Diffusion3DHomogeneous1D::m_planes
protected

Definition at line 67 of file Diffusion3DHomogeneous1D.h.

LibUtilities::TranspositionSharedPtr Nektar::SolverUtils::Diffusion3DHomogeneous1D::m_trans
protected

Definition at line 59 of file Diffusion3DHomogeneous1D.h.

std::string Nektar::SolverUtils::Diffusion3DHomogeneous1D::type
static