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::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)
 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
 
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 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:164
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 
)
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 189 of file Diffusion3DHomogeneous1D.cpp.

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

194  {
195 
196  Array<OneD, NekDouble> tmp(m_numPoints), tmp2;
197  Array<OneD, Array<OneD, NekDouble> > viscHComp;
198  const int nPointsTot = fields[0]->GetNpoints();
199  int i, j;
200  NekDouble beta;
201 
202 
203  if (m_fluxVectorNS)
204  {
205  viscHComp = Array<OneD, Array<OneD, NekDouble> >(nConvectiveFields);
206  for (i = 0; i < nConvectiveFields - 1; ++i)
207  {
208  fields[0]->PhysDeriv(2, inarray[i], m_homoDerivStore[i]);
209  viscHComp[i] = Array<OneD, NekDouble>(m_numPoints);
210  }
211  }
212 
213 
214  for (i = 0; i < m_numPlanes; ++i)
215  {
216  // Set up memory references for fields, inarray and outarray for
217  // this plane.
218  for (int j = 0; j < inarray.num_elements(); ++j)
219  {
220  m_inarrayPlane [j] = Array<OneD, NekDouble>(
221  m_numPointsPlane, tmp2 = inarray [j] + m_planePos[i]);
222  }
223 
224  for (int j = 0; j < nConvectiveFields; ++j)
225  {
226  m_fieldsPlane [j] = fields[j]->GetPlane(i);
227  m_outarrayPlane[j] = Array<OneD, NekDouble>(
228  m_numPointsPlane, tmp2 = outarray[j] + m_planePos[i]);
229  }
230 
231 
232  if (m_fluxVectorNS)
233  {
234  m_planeDiff->SetHomoDerivs(m_homoDerivPlane[i]);
235  }
236 
237 
238 
239  m_planeDiff->Diffuse(nConvectiveFields,
243 
244  if (m_fluxVectorNS)
245  {
246  Array<OneD, Array<OneD, Array<OneD, NekDouble> > > &viscTensor = m_planeDiff->GetFluxTensor();
247 
248  // Extract H (viscTensor[2])
249  for (int j = 0; j < nConvectiveFields - 1; ++j)
250  {
252  viscTensor[2][j+1], 1,
253  tmp2 = viscHComp[j] + m_planePos[i], 1);
254  }
255  }
256  }
257 
258 
259 
260  if (m_fluxVectorNS)
261  {
262  for (j = 0; j < nConvectiveFields - 1; ++j)
263  {
264  fields[j+1]->PhysDeriv(2, viscHComp[j], tmp);
265  Vmath::Vadd(nPointsTot, outarray[j+1], 1, tmp, 1, outarray[j+1], 1);
266  }
267  }
268  else
269  {
270  for (j = 0; j < nConvectiveFields; ++j)
271  {
272  fields[j]->HomogeneousFwdTrans(inarray[j], tmp);
273 
274  for (i = 0; i < m_numPlanes; ++i)
275  {
276  beta = 2*M_PI*m_trans->GetK(i)/m_homoLen;
277  beta *= beta;
278 
280  beta,
281  &tmp[0] + i*m_numPointsPlane, 1,
282  &tmp[0] + i*m_numPointsPlane, 1);
283  }
284 
285  fields[0]->HomogeneousBwdTrans(tmp, tmp);
286 
287  Vmath::Vsub(nPointsTot, outarray[j], 1, tmp, 1,
288  outarray[j], 1);
289  }
290  }
291  }
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:133
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_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: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 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.

References Nektar::iterator.

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  if (m_riemann)
119  {
120  // Set Riemann solver and flux vector callback for this plane.
121  m_planeDiff->SetRiemannSolver(m_riemann);
122 
123  // Override Riemann solver scalar and vector callbacks.
125  map<string, RSScalarFuncType> scalars = m_riemann->GetScalars();
126 
127  for (it1 = scalars.begin(); it1 != scalars.end(); ++it1)
128  {
129  boost::shared_ptr<HomoRSScalar> tmp =
131  ::AllocateSharedPtr(it1->second, m_numPlanes);
132  m_riemann->SetScalar(it1->first, &HomoRSScalar::Exec, tmp);
133  }
134  }
135 
136  m_fieldsPlane = Array<OneD, MultiRegions::ExpListSharedPtr>
137  (nConvectiveFields);
138 
139 
140  if (m_fluxVectorNS)
141  {
142  m_inarrayPlane = Array<OneD, Array<OneD, NekDouble> >
143  (nConvectiveFields - 1);
144  }
145  else
146  {
147  m_inarrayPlane = Array<OneD, Array<OneD, NekDouble> >
148  (nConvectiveFields);
149  }
150  m_outarrayPlane = Array<OneD, Array<OneD, NekDouble> >
151  (nConvectiveFields);
152  m_planePos = Array<OneD, unsigned int> (m_numPlanes);
153 
154  for (int i = 0; i < m_numPlanes; ++i)
155  {
156  m_planePos[i] = i * m_numPointsPlane;
157  }
158 
159  if (m_fluxVectorNS)
160  {
161  m_homoDerivStore = Array<OneD, Array<OneD, NekDouble> >(
162  nConvectiveFields);
163  m_homoDerivPlane = Array<OneD, Array<OneD, Array<OneD, NekDouble> > >(
164  m_numPlanes);
165 
166  for (int i = 0; i < nConvectiveFields; ++i)
167  {
168  m_homoDerivStore[i] = Array<OneD, NekDouble>(m_numPoints);
169  }
170 
171  for (int i = 0; i < m_numPlanes; ++i)
172  {
173  m_homoDerivPlane[i] = Array<OneD, Array<OneD, NekDouble> >(nConvectiveFields);
174 
175  for (int j = 0; j < nConvectiveFields; ++j)
176  {
177  m_homoDerivPlane[i][j] = Array<OneD, NekDouble>(
179  m_homoDerivStore[j] + m_planePos[i]);
180  }
181  }
182  }
183  }
LibUtilities::TranspositionSharedPtr m_trans
Array< OneD, Array< OneD, NekDouble > > m_inarrayPlane
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_homoDerivPlane
const Array< OneD, const NekDouble > & Exec()
Array< OneD, MultiRegions::ExpListSharedPtr > m_fieldsPlane
DiffusionFluxVecCBNS m_fluxVectorNS
Definition: Diffusion.h:133
RiemannSolverSharedPtr m_riemann
Definition: Diffusion.h:134
Array< OneD, Array< OneD, NekDouble > > m_homoDerivStore
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
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