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 | Private Member Functions | List of all members
Nektar::SolverUtils::Advection3DHomogeneous1D Class Reference

#include <Advection3DHomogeneous1D.h>

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

Static Public Member Functions

static AdvectionSharedPtr create (std::string advType)
 

Static Public Attributes

static std::string type []
 

Protected Member Functions

 Advection3DHomogeneous1D (std::string advType)
 AdvectionFR uses the Flux Reconstruction (FR) approach to compute the advection term. The implementation is only for segments, quadrilaterals and hexahedra at the moment. More...
 
virtual void v_InitObject (LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields)
 Initiliase Advection3DHomogeneous1D objects and store them before starting the time-stepping. More...
 
virtual void v_Advect (const int nConvField, const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &advVel, const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble &time, const Array< OneD, Array< OneD, NekDouble > > &pFwd=NullNekDoubleArrayofArray, const Array< OneD, Array< OneD, NekDouble > > &pBwd=NullNekDoubleArrayofArray)
 Compute the advection operator for a given input inarray and put the result in outarray. More...
 
- Protected Member Functions inherited from Nektar::SolverUtils::Advection
virtual SOLVER_UTILS_EXPORT void v_SetBaseFlow (const Array< OneD, Array< OneD, NekDouble > > &inarray, const Array< OneD, MultiRegions::ExpListSharedPtr > &fields)
 Overrides the base flow used during linearised advection. More...
 

Protected Attributes

std::string m_advType
 
SolverUtils::AdvectionSharedPtr m_planeAdv
 
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,
Array< OneD, NekDouble > > > 
m_fluxVecStore
 
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
 
Array< OneD, Array< OneD,
Array< OneD, Array< OneD,
NekDouble > > > > 
m_fluxVecPlane
 
- Protected Attributes inherited from Nektar::SolverUtils::Advection
AdvectionFluxVecCB m_fluxVector
 Callback function to the flux vector (set when advection is in conservative form). More...
 
RiemannSolverSharedPtr m_riemann
 Riemann solver for DG-type schemes. More...
 
int m_spaceDim
 Storage for space dimension. Used for homogeneous extension. More...
 

Private Member Functions

void ModifiedFluxVector (const Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &flux)
 

Additional Inherited Members

- Public Member Functions inherited from Nektar::SolverUtils::Advection
SOLVER_UTILS_EXPORT void InitObject (LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields)
 Interface function to initialise the advection object. More...
 
SOLVER_UTILS_EXPORT void Advect (const int nConvectiveFields, const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &advVel, const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble &time, const Array< OneD, Array< OneD, NekDouble > > &pFwd=NullNekDoubleArrayofArray, const Array< OneD, Array< OneD, NekDouble > > &pBwd=NullNekDoubleArrayofArray)
 Interface function to advect the vector field. More...
 
template<typename FuncPointerT , typename ObjectPointerT >
void SetFluxVector (FuncPointerT func, ObjectPointerT obj)
 Set the flux vector callback function. More...
 
void SetRiemannSolver (RiemannSolverSharedPtr riemann)
 Set a Riemann solver object for this advection object. More...
 
void SetFluxVector (AdvectionFluxVecCB fluxVector)
 Set the flux vector callback function. More...
 
void SetBaseFlow (const Array< OneD, Array< OneD, NekDouble > > &inarray, const Array< OneD, MultiRegions::ExpListSharedPtr > &fields)
 Set the base flow used for linearised advection objects. More...
 

Detailed Description

Definition at line 48 of file Advection3DHomogeneous1D.h.

Constructor & Destructor Documentation

Nektar::SolverUtils::Advection3DHomogeneous1D::Advection3DHomogeneous1D ( std::string  advType)
protected

AdvectionFR uses the Flux Reconstruction (FR) approach to compute the advection term. The implementation is only for segments, quadrilaterals and hexahedra at the moment.

Todo:
Extension to triangles, tetrahedra and other shapes. (Long term objective)

Definition at line 72 of file Advection3DHomogeneous1D.cpp.

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

Referenced by create().

73  : m_advType(advType)
74  {
75  // Strip trailing string "3DHomogeneous1D" to determine 2D advection
76  // type, and create an advection object for the plane.
77  string advName = advType.substr(0, advType.length()-15);
78  m_planeAdv = GetAdvectionFactory().CreateInstance(advName, advName);
79  }
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
AdvectionFactory & GetAdvectionFactory()
Gets the factory for initialising advection objects.
Definition: Advection.cpp:46

Member Function Documentation

static AdvectionSharedPtr Nektar::SolverUtils::Advection3DHomogeneous1D::create ( std::string  advType)
inlinestatic

Definition at line 51 of file Advection3DHomogeneous1D.h.

References Advection3DHomogeneous1D().

52  {
53  return AdvectionSharedPtr(
54  new Advection3DHomogeneous1D(advType));
55  }
boost::shared_ptr< Advection > AdvectionSharedPtr
A shared pointer to an Advection object.
Definition: Advection.h:165
Advection3DHomogeneous1D(std::string advType)
AdvectionFR uses the Flux Reconstruction (FR) approach to compute the advection term. The implementation is only for segments, quadrilaterals and hexahedra at the moment.
void Nektar::SolverUtils::Advection3DHomogeneous1D::ModifiedFluxVector ( const Array< OneD, Array< OneD, NekDouble > > &  physfield,
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &  flux 
)
private

Definition at line 247 of file Advection3DHomogeneous1D.cpp.

References m_fluxVecPlane, m_numPlanes, and m_planeCounter.

Referenced by v_InitObject().

250  {
251  // Return section of flux vector for this plane.
252  outarray = m_fluxVecPlane[m_planeCounter];
253 
254  // Increment the plane counter.
256  }
Array< OneD, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > > m_fluxVecPlane
void Nektar::SolverUtils::Advection3DHomogeneous1D::v_Advect ( const int  nConvectiveFields,
const Array< OneD, MultiRegions::ExpListSharedPtr > &  fields,
const Array< OneD, Array< OneD, NekDouble > > &  advVel,
const Array< OneD, Array< OneD, NekDouble > > &  inarray,
Array< OneD, Array< OneD, NekDouble > > &  outarray,
const NekDouble time,
const Array< OneD, Array< OneD, NekDouble > > &  pFwd = NullNekDoubleArrayofArray,
const Array< OneD, Array< OneD, NekDouble > > &  pBwd = NullNekDoubleArrayofArray 
)
protectedvirtual

Compute the advection operator for a given input inarray and put the result in outarray.

Parameters
nConvectiveFieldsNumber of fields to advect.
fieldsPointer to fields.
advVelAdvection velocities.
inarrayInput which will be advected.
outarrayComputed advection.

Implements Nektar::SolverUtils::Advection.

Definition at line 191 of file Advection3DHomogeneous1D.cpp.

References m_advVelPlane, m_fieldsPlane, m_fluxVecStore, Nektar::SolverUtils::Advection::m_fluxVector, m_inarrayPlane, m_numPlanes, m_numPoints, m_numPointsPlane, m_outarrayPlane, m_planeAdv, m_planePos, and Vmath::Vadd().

200  {
201  Array<OneD, NekDouble> tmp(m_numPoints), tmp2;
202  int nVel = advVel.num_elements();
203 
204  // Call solver's flux vector function to compute the flux vector on
205  // the entire domain.
206  m_fluxVector(inarray, m_fluxVecStore);
207 
208  // Loop over each plane.
209  for (int i = 0; i < m_numPlanes; ++i)
210  {
211  // Set up memory references for fields, inarray and outarray for
212  // this plane.
213  for (int j = 0; j < nConvectiveFields; ++j)
214  {
215  m_fieldsPlane [j] = fields[j]->GetPlane(i);
216  m_inarrayPlane [j] = Array<OneD, NekDouble>(
217  m_numPointsPlane, tmp2 = inarray [j] + m_planePos[i]);
218  m_outarrayPlane[j] = Array<OneD, NekDouble>(
219  m_numPointsPlane, tmp2 = outarray[j] + m_planePos[i]);
220  }
221 
222  for (int j = 0; j < nVel; ++j)
223  {
224  if (advVel[j].num_elements() != 0)
225  {
226  m_advVelPlane[j] = Array<OneD, NekDouble>(
227  m_numPointsPlane, tmp2 = advVel[j] + m_planePos[i]);
228  }
229  }
230 
231  // Compute advection term for this plane.
232  m_planeAdv->Advect(nConvectiveFields, m_fieldsPlane,
234  m_outarrayPlane, time);
235  }
236 
237  // Calculate Fourier derivative and add to final result.
238  for (int i = 0; i < nConvectiveFields; ++i)
239  {
240  fields[0]->PhysDeriv(2, m_fluxVecStore[i][2], tmp);
241 
242  Vmath::Vadd(m_numPoints, outarray[i], 1, tmp, 1,
243  outarray[i], 1);
244  }
245  }
Array< OneD, Array< OneD, NekDouble > > m_advVelPlane
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_fluxVecStore
Array< OneD, Array< OneD, NekDouble > > m_outarrayPlane
Array< OneD, Array< OneD, NekDouble > > m_inarrayPlane
AdvectionFluxVecCB m_fluxVector
Callback function to the flux vector (set when advection is in conservative form).
Definition: Advection.h:136
Array< OneD, MultiRegions::ExpListSharedPtr > m_fieldsPlane
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::Advection3DHomogeneous1D::v_InitObject ( LibUtilities::SessionReaderSharedPtr  pSession,
Array< OneD, MultiRegions::ExpListSharedPtr pFields 
)
protectedvirtual

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

Parameters
pSessionPointer to session reader.
pFieldsPointer to fields.

Reimplemented from Nektar::SolverUtils::Advection.

Definition at line 88 of file Advection3DHomogeneous1D.cpp.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::SolverUtils::HomoRSScalar::Exec(), Nektar::SolverUtils::HomoRSVector::Exec(), Nektar::iterator, m_advVelPlane, m_fieldsPlane, m_fluxVecPlane, m_fluxVecStore, m_inarrayPlane, m_numPlanes, m_numPoints, m_numPointsPlane, m_outarrayPlane, m_planeAdv, m_planeCounter, m_planePos, m_planes, Nektar::SolverUtils::Advection::m_riemann, and ModifiedFluxVector().

91  {
92  int nConvectiveFields = pFields.num_elements();
93 
94  Array<OneD, MultiRegions::ExpListSharedPtr> pFields_plane0(
95  nConvectiveFields);
96 
97  // Initialise the plane advection object.
98  for (int i = 0; i < nConvectiveFields; ++i)
99  {
100  pFields_plane0[i] = pFields[i]->GetPlane(0);
101  }
102  m_planeAdv->InitObject(pSession, pFields_plane0);
103 
104  m_numPoints = pFields[0]->GetTotPoints();
105  m_planes = pFields[0]->GetZIDs();
106  m_numPlanes = m_planes.num_elements();
108 
109  // Set Riemann solver and flux vector callback for this plane.
110  m_planeAdv->SetRiemannSolver(m_riemann);
111  m_planeAdv->SetFluxVector (
113  m_planeCounter = 0;
114 
115  // Override Riemann solver scalar and vector callbacks.
118  map<string, RSScalarFuncType> scalars = m_riemann->GetScalars();
119  map<string, RSVecFuncType> vectors = m_riemann->GetVectors();
120 
121  for (it1 = scalars.begin(); it1 != scalars.end(); ++it1)
122  {
123  boost::shared_ptr<HomoRSScalar> tmp = MemoryManager<HomoRSScalar>
124  ::AllocateSharedPtr(it1->second, m_numPlanes);
125  m_riemann->SetScalar(it1->first, &HomoRSScalar::Exec, tmp);
126  }
127 
128  for (it2 = vectors.begin(); it2 != vectors.end(); ++it2)
129  {
130  boost::shared_ptr<HomoRSVector> tmp = MemoryManager<HomoRSVector>
131  ::AllocateSharedPtr(it2->second, m_numPlanes, it2->first);
132  m_riemann->SetVector(it2->first, &HomoRSVector::Exec, tmp);
133  }
134 
135  m_fluxVecStore = Array<OneD, Array<OneD, Array<OneD, NekDouble> > >(
136  nConvectiveFields);
137 
138  // Set up storage for flux vector.
139  for (int i = 0; i < nConvectiveFields; ++i)
140  {
141  m_fluxVecStore[i] = Array<OneD, Array<OneD, NekDouble> >(3);
142  for (int j = 0; j < 3; ++j)
143  {
144  m_fluxVecStore[i][j] = Array<OneD, NekDouble>(m_numPoints);
145  }
146  }
147 
148  m_fluxVecPlane = Array<OneD, Array<OneD,
149  Array<OneD, Array<OneD, NekDouble> > > >(m_numPlanes);
150  m_fieldsPlane = Array<OneD, MultiRegions::ExpListSharedPtr>
151  (nConvectiveFields);
152  m_inarrayPlane = Array<OneD, Array<OneD, NekDouble> >
153  (nConvectiveFields);
154  m_outarrayPlane = Array<OneD, Array<OneD, NekDouble> >
155  (nConvectiveFields);
156  m_planePos = Array<OneD, unsigned int> (m_numPlanes);
157  m_advVelPlane = Array<OneD, Array<OneD, NekDouble> > (3);
158 
159  // Set up memory reference which links fluxVecPlane to fluxVecStore.
160  for (int i = 0; i < m_numPlanes; ++i)
161  {
162  m_planePos[i] = i * m_numPointsPlane;
163  m_fluxVecPlane[i] =
164  Array<OneD, Array<OneD, Array<OneD, NekDouble> > >(
165  nConvectiveFields);
166 
167  for (int j = 0; j < nConvectiveFields; ++j)
168  {
169  m_fluxVecPlane[i][j] =
170  Array<OneD, Array<OneD, NekDouble> >(3);
171  for (int k = 0; k < 3; ++k)
172  {
173  m_fluxVecPlane[i][j][k] = Array<OneD, NekDouble>(
175  m_fluxVecStore[j][k] + m_planePos[i]);
176  }
177  }
178  }
179  }
Array< OneD, Array< OneD, NekDouble > > m_advVelPlane
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_fluxVecStore
const Array< OneD, const NekDouble > & Exec()
Array< OneD, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > > m_fluxVecPlane
RiemannSolverSharedPtr m_riemann
Riemann solver for DG-type schemes.
Definition: Advection.h:138
void ModifiedFluxVector(const Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &flux)
const Array< OneD, const Array< OneD, NekDouble > > & Exec()
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
Array< OneD, Array< OneD, NekDouble > > m_outarrayPlane
Array< OneD, Array< OneD, NekDouble > > m_inarrayPlane
Array< OneD, MultiRegions::ExpListSharedPtr > m_fieldsPlane

Member Data Documentation

std::string Nektar::SolverUtils::Advection3DHomogeneous1D::m_advType
protected

Definition at line 61 of file Advection3DHomogeneous1D.h.

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

Definition at line 73 of file Advection3DHomogeneous1D.h.

Referenced by v_Advect(), and v_InitObject().

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

Definition at line 72 of file Advection3DHomogeneous1D.h.

Referenced by v_Advect(), and v_InitObject().

Array<OneD, Array<OneD, Array<OneD, Array<OneD, NekDouble> > > > Nektar::SolverUtils::Advection3DHomogeneous1D::m_fluxVecPlane
protected

Definition at line 75 of file Advection3DHomogeneous1D.h.

Referenced by ModifiedFluxVector(), and v_InitObject().

Array<OneD, Array<OneD, Array<OneD, NekDouble> > > Nektar::SolverUtils::Advection3DHomogeneous1D::m_fluxVecStore
protected

Definition at line 69 of file Advection3DHomogeneous1D.h.

Referenced by v_Advect(), and v_InitObject().

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

Definition at line 70 of file Advection3DHomogeneous1D.h.

Referenced by v_Advect(), and v_InitObject().

int Nektar::SolverUtils::Advection3DHomogeneous1D::m_numPlanes
protected

Definition at line 65 of file Advection3DHomogeneous1D.h.

Referenced by ModifiedFluxVector(), v_Advect(), and v_InitObject().

int Nektar::SolverUtils::Advection3DHomogeneous1D::m_numPoints
protected

Definition at line 63 of file Advection3DHomogeneous1D.h.

Referenced by v_Advect(), and v_InitObject().

int Nektar::SolverUtils::Advection3DHomogeneous1D::m_numPointsPlane
protected

Definition at line 64 of file Advection3DHomogeneous1D.h.

Referenced by v_Advect(), and v_InitObject().

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

Definition at line 71 of file Advection3DHomogeneous1D.h.

Referenced by v_Advect(), and v_InitObject().

SolverUtils::AdvectionSharedPtr Nektar::SolverUtils::Advection3DHomogeneous1D::m_planeAdv
protected

Definition at line 62 of file Advection3DHomogeneous1D.h.

Referenced by Advection3DHomogeneous1D(), v_Advect(), and v_InitObject().

int Nektar::SolverUtils::Advection3DHomogeneous1D::m_planeCounter
protected

Definition at line 66 of file Advection3DHomogeneous1D.h.

Referenced by ModifiedFluxVector(), and v_InitObject().

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

Definition at line 68 of file Advection3DHomogeneous1D.h.

Referenced by v_Advect(), and v_InitObject().

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

Definition at line 67 of file Advection3DHomogeneous1D.h.

Referenced by v_InitObject().

std::string Nektar::SolverUtils::Advection3DHomogeneous1D::type
static