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 76 of file Diffusion3DHomogeneous1D.cpp.

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

Referenced by create().

77  {
78  // Strip trailing string "3DHomogeneous1D" to determine 2D diffusion
79  // type, and create a diffusion object for the plane.
80  string name = diffType.substr(0, diffType.length()-15);
82  }
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 187 of file Diffusion3DHomogeneous1D.cpp.

References m_fieldsPlane, Nektar::SolverUtils::Diffusion::m_fluxVectorNS, m_homoDerivPlane, m_homoDerivStore, m_homoLen, m_inarrayPlane, m_numPlanes, m_numPoints, m_numPointsPlane, m_outarrayPlane, m_planeDiff, m_planePos, m_trans, Vmath::Smul(), Vmath::Vadd(), Vmath::Vcopy(), and Vmath::Vsub().

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

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::SolverUtils::HomoRSScalar::Exec(), Nektar::iterator, m_fieldsPlane, Nektar::SolverUtils::Diffusion::m_fluxVectorNS, m_homoDerivPlane, m_homoDerivStore, m_homoLen, m_inarrayPlane, m_numPlanes, m_numPoints, m_numPointsPlane, m_outarrayPlane, m_planeCounter, m_planeDiff, m_planePos, m_planes, Nektar::SolverUtils::Diffusion::m_riemann, and m_trans.

94  {
95  int nConvectiveFields = pFields.num_elements();
96 
98  nConvectiveFields);
99 
100  // Initialise the plane advection object.
101  for (int i = 0; i < nConvectiveFields; ++i)
102  {
103  pFields_plane0[i] = pFields[i]->GetPlane(0);
104  }
105  m_planeDiff->InitObject(pSession, pFields_plane0);
106 
107  m_numPoints = pFields[0]->GetTotPoints();
108  m_planes = pFields[0]->GetZIDs();
109  m_numPlanes = m_planes.num_elements();
111  m_homoLen = pFields[0]->GetHomoLen();
112  m_trans = pFields[0]->GetTransposition();
113  m_planeCounter = 0;
114  m_planeDiff->SetFluxVectorNS(m_fluxVectorNS);
115 
116  if (m_riemann)
117  {
118  // Set Riemann solver and flux vector callback for this plane.
119  m_planeDiff->SetRiemannSolver(m_riemann);
120 
121  // Override Riemann solver scalar and vector callbacks.
123  map<string, RSScalarFuncType> scalars = m_riemann->GetScalars();
124 
125  for (it1 = scalars.begin(); it1 != scalars.end(); ++it1)
126  {
127  boost::shared_ptr<HomoRSScalar> tmp =
129  ::AllocateSharedPtr(it1->second, m_numPlanes);
130  m_riemann->SetScalar(it1->first, &HomoRSScalar::Exec, tmp);
131  }
132  }
133 
135  (nConvectiveFields);
136 
137 
138  if (m_fluxVectorNS)
139  {
141  (nConvectiveFields - 1);
142  }
143  else
144  {
146  (nConvectiveFields);
147  }
149  (nConvectiveFields);
151 
152  for (int i = 0; i < m_numPlanes; ++i)
153  {
154  m_planePos[i] = i * m_numPointsPlane;
155  }
156 
157  if (m_fluxVectorNS)
158  {
160  nConvectiveFields);
162  m_numPlanes);
163 
164  for (int i = 0; i < nConvectiveFields; ++i)
165  {
167  }
168 
169  for (int i = 0; i < m_numPlanes; ++i)
170  {
171  m_homoDerivPlane[i] = Array<OneD, Array<OneD, NekDouble> >(nConvectiveFields);
172 
173  for (int j = 0; j < nConvectiveFields; ++j)
174  {
175  m_homoDerivPlane[i][j] = Array<OneD, NekDouble>(
177  m_homoDerivStore[j] + m_planePos[i]);
178  }
179  }
180  }
181  }
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.

Referenced by v_Diffuse(), and v_InitObject().

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

Definition at line 70 of file Diffusion3DHomogeneous1D.h.

Referenced by v_Diffuse(), and v_InitObject().

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

Definition at line 69 of file Diffusion3DHomogeneous1D.h.

Referenced by v_Diffuse(), and v_InitObject().

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

Definition at line 62 of file Diffusion3DHomogeneous1D.h.

Referenced by v_Diffuse(), and v_InitObject().

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

Definition at line 71 of file Diffusion3DHomogeneous1D.h.

Referenced by v_Diffuse(), and v_InitObject().

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

Definition at line 65 of file Diffusion3DHomogeneous1D.h.

Referenced by v_Diffuse(), and v_InitObject().

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

Definition at line 63 of file Diffusion3DHomogeneous1D.h.

Referenced by v_Diffuse(), and v_InitObject().

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

Definition at line 64 of file Diffusion3DHomogeneous1D.h.

Referenced by v_Diffuse(), and v_InitObject().

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

Definition at line 72 of file Diffusion3DHomogeneous1D.h.

Referenced by v_Diffuse(), and v_InitObject().

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

Definition at line 66 of file Diffusion3DHomogeneous1D.h.

Referenced by v_InitObject().

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

Definition at line 61 of file Diffusion3DHomogeneous1D.h.

Referenced by Diffusion3DHomogeneous1D(), v_Diffuse(), and v_InitObject().

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

Definition at line 68 of file Diffusion3DHomogeneous1D.h.

Referenced by v_Diffuse(), and v_InitObject().

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

Definition at line 67 of file Diffusion3DHomogeneous1D.h.

Referenced by v_InitObject().

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

Definition at line 59 of file Diffusion3DHomogeneous1D.h.

Referenced by v_Diffuse(), and v_InitObject().

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