44 namespace MultiRegions
63 const bool dealiasing):
69 m_dealiasing(dealiasing)
72 "Homogeneous Basis in y direction is a null basis");
74 "Homogeneous Basis in z direction is a null basis");
97 ASSERTL0(
m_comm->GetColumnComm()->GetSize() == 1,
"Remove dealiasing if you want to run in parallel");
108 m_useFFT(In.m_useFFT),
111 m_transposition(In.m_transposition),
114 m_homogeneousBasis_y(In.m_homogeneousBasis_y),
115 m_homogeneousBasis_z(In.m_homogeneousBasis_z),
116 m_lhom_y(In.m_lhom_y),
117 m_lhom_z(In.m_lhom_z),
118 m_homogeneous2DBlockMat(In.m_homogeneous2DBlockMat),
121 m_dealiasing(In.m_dealiasing),
122 m_padsize_y(In.m_padsize_y),
123 m_padsize_z(In.m_padsize_z),
124 MatFwdPAD(In.MatFwdPAD),
125 MatBwdPAD(In.MatBwdPAD)
162 int npoints = outarray.num_elements();
163 int nlines =
m_lines.num_elements();
164 int nslabs = npoints/nlines;
205 for(
int j = 0 ; j< nslabs ; j++)
209 for(
int i = 0 ; i<
m_nz ; i++)
212 Vmath::Vcopy(m_ny,&(ShufV2[i*m_ny + j*nlines]),1,&(PadV2_slab_coeff[i*2*m_ny]),1);
216 PadOUT_V1 = (*MatBwdPAD)*PadIN_V1;
217 PadOUT_V2 = (*MatBwdPAD)*PadIN_V2;
225 PadOUT_Re = (*MatFwdPAD)*PadIN_Re;
229 for (
int i = 0; i <
m_nz; i++)
250 int cnt = 0, cnt1 = 0;
252 int nlines =
m_lines.num_elements();
254 for(
int n = 0; n < nlines; ++n)
256 m_lines[n]->FwdTrans(inarray+cnt, tmparray = outarray + cnt1,
258 cnt +=
m_lines[n]->GetTotPoints();
259 cnt1 +=
m_lines[n]->GetNcoeffs();
269 int cnt = 0, cnt1 = 0;
271 int nlines =
m_lines.num_elements();
273 for(
int n = 0; n < nlines; ++n)
275 m_lines[n]->FwdTrans_IterPerExp(inarray+cnt, tmparray = outarray + cnt1);
277 cnt +=
m_lines[n]->GetTotPoints();
278 cnt1 +=
m_lines[n]->GetNcoeffs();
288 int cnt = 0, cnt1 = 0;
290 int nlines =
m_lines.num_elements();
292 for(
int n = 0; n < nlines; ++n)
294 m_lines[n]->BwdTrans(inarray+cnt, tmparray = outarray + cnt1,
296 cnt +=
m_lines[n]->GetNcoeffs();
297 cnt1 +=
m_lines[n]->GetTotPoints();
307 int cnt = 0, cnt1 = 0;
309 int nlines =
m_lines.num_elements();
311 for(
int n = 0; n < nlines; ++n)
313 m_lines[n]->BwdTrans_IterPerExp(inarray+cnt, tmparray = outarray + cnt1);
315 cnt +=
m_lines[n]->GetNcoeffs();
316 cnt1 +=
m_lines[n]->GetTotPoints();
327 int cnt = 0, cnt1 = 0;
329 int nlines =
m_lines.num_elements();
331 for(
int n = 0; n < nlines; ++n)
333 m_lines[n]->IProductWRTBase(inarray+cnt, tmparray = outarray + cnt1,coeffstate);
335 cnt +=
m_lines[n]->GetNcoeffs();
336 cnt1 +=
m_lines[n]->GetTotPoints();
342 int cnt = 0, cnt1 = 0;
344 int nlines =
m_lines.num_elements();
346 for(
int n = 0; n < nlines; ++n)
348 m_lines[n]->IProductWRTBase_IterPerExp(inarray+cnt, tmparray = outarray + cnt1);
350 cnt +=
m_lines[n]->GetNcoeffs();
351 cnt1 +=
m_lines[n]->GetTotPoints();
365 int n =
m_lines.num_elements();
366 int s = inarray.num_elements();
376 for(
int i=0;i<(p*
m_nz);i++)
384 for(
int i=0;i<(p*
m_nz);i++)
394 for(
int i=0;i<(p*
m_ny);i++)
402 for(
int i=0;i<(p*
m_ny);i++)
446 int nrowsY = blkmatY->GetRows();
447 int ncolsY = blkmatY->GetColumns();
452 int nrowsZ = blkmatZ->GetRows();
453 int ncolsZ = blkmatZ->GetColumns();
466 outY = (*blkmatY)*inY;
470 outZ = (*blkmatZ)*inZ;
489 return matrixIter->second;
526 n_exp =
m_lines[0]->GetNcoeffs();
530 n_exp =
m_lines[0]->GetTotPoints();
557 StdSeg.DetShapeType(),
560 loc_mat = StdSeg.GetStdMatrix(matkey);
565 StdSeg.DetShapeType(),
568 loc_mat = StdSeg.GetStdMatrix(matkey);
572 for(i = 0; i < (n_exp*NumPencils); ++i)
574 BlkMatrix->SetBlock(i,i,loc_mat);
582 std::vector<LibUtilities::FieldDefinitionsSharedPtr> returnval;
588 std::vector<NekDouble> HomoLen(2);
592 m_lines[0]->GeneralGetFieldDefinitions(returnval, 2, 1, HomoBasis, HomoLen);
602 std::vector<NekDouble> HomoLen(2);
607 m_lines[0]->GeneralGetFieldDefinitions(fielddef, 2, 1, HomoBasis, HomoLen);
617 int ncoeffs_per_line =
m_lines[0]->GetNcoeffs();
621 map<int, int> ElmtID_to_ExpID;
622 for(i = 0; i <
m_lines[0]->GetExpSize(); ++i)
624 ElmtID_to_ExpID[(*m_exp)[i]->GetGeom()->GetGlobalID()] = i;
627 for(i = 0; i < fielddef->m_elementIDs.size(); ++i)
629 int eid = ElmtID_to_ExpID[fielddef->m_elementIDs[i]];
630 int datalen = (*m_exp)[eid]->GetNcoeffs();
632 for(k = 0; k < (NumMod_y*NumMod_z); ++k)
634 fielddata.insert(fielddata.end(),&coeffs[
m_coeff_offset[eid]+k*ncoeffs_per_line],&coeffs[m_coeff_offset[eid]+k*ncoeffs_per_line]+datalen);
649 int datalen = fielddata.size()/fielddef->m_fields.size();
650 int ncoeffs_per_line =
m_lines[0]->GetNcoeffs();
655 for(i = 0; i < fielddef->m_fields.size(); ++i)
657 if(fielddef->m_fields[i] == field)
664 ASSERTL0(i!= fielddef->m_fields.size(),
"Field not found in data file");
668 map<int, int> ElmtID_to_ExpID;
669 for(i = 0; i <
m_lines[0]->GetExpSize(); ++i)
671 ElmtID_to_ExpID[(*m_exp)[i]->GetGeom()->GetGlobalID()] = i;
674 for(i = 0; i < fielddef->m_elementIDs.size(); ++i)
676 int eid = ElmtID_to_ExpID[fielddef->m_elementIDs[i]];
677 int datalen = (*m_exp)[eid]->GetNcoeffs();
679 for(k = 0; k < (NumMod_y*NumMod_z); ++k)
693 int nyzlines =
m_lines.num_elements();
694 int npoints = inarray.num_elements();
695 int n_points_line = npoints/nyzlines;
704 for(
int i=0 ; i<nyzlines ; i++ )
706 m_lines[i]->PhysDeriv( tmp1 = inarray + i*n_points_line ,tmp2 = out_d0 + i*n_points_line);
723 for(
int i = 0; i <
m_ny; i++)
727 for(
int j = 0; j <
m_nz; j++)
729 Vmath::Smul(n_points_line,beta,tmp1 = temparray + n_points_line*(i+j*m_ny),1, tmp2 = temparray1 + n_points_line*((i-
int(sign))+j*m_ny),1);
737 for(
int i = 0; i <
m_nz; i++)
740 Vmath::Smul(m_ny*n_points_line,beta,tmp1 = temparray + i*m_ny*n_points_line,1,tmp2 = temparray2 + (i-
int(sign))*m_ny*n_points_line,1);
758 ASSERTL0(
false,
"Semi-phyisical time-stepping not implemented yet for non-Fourier basis")
766 for(
int i = 0; i < n_points_line; i++)
768 StdQuad.PhysDeriv(tmp1 = temparray + i*nyzlines, tmp2 = temparray1 + i*nyzlines, tmp3 = temparray2 + i*nyzlines);
784 int nyzlines =
m_lines.num_elements();
785 int npoints = inarray.num_elements();
786 int n_points_line = npoints/nyzlines;
799 for(
int i=0 ; i<nyzlines ; i++)
801 m_lines[i]->PhysDeriv( tmp1 = inarray + i*n_points_line ,tmp2 = out_d + i*n_points_line);
822 for(
int i = 0; i <
m_ny; i++)
826 for(
int j = 0; j <
m_nz; j++)
828 Vmath::Smul(n_points_line,beta,tmp1 = temparray + n_points_line*(i+j*m_ny),1, tmp2 = temparray1 + n_points_line*((i-
int(sign))+j*m_ny),1);
844 for(
int i = 0; i <
m_nz; i++)
847 Vmath::Smul(
m_ny*n_points_line,beta,tmp1 = temparray + i*
m_ny*n_points_line,1,tmp2 = temparray2 + (i-
int(sign))*
m_ny*n_points_line,1);
864 ASSERTL0(
false,
"Semi-phyisical time-stepping not implemented yet for non-Fourier basis")
872 for(
int i = 0; i < n_points_line; i++)
874 StdQuad.PhysDeriv(tmp1 = temparray + i*nyzlines, tmp2 = temparray1 + i*nyzlines, tmp3 = temparray2 + i*nyzlines);
930 MatFwdPAD = StdQuad.GetStdMatrix(matkey1);
931 MatBwdPAD = StdQuad.GetStdMatrix(matkey2);
Abstraction of a two-dimensional multi-elemental expansion which is merely a collection of local expa...
#define ASSERTL0(condition, msg)
LibUtilities::TranspositionSharedPtr m_transposition
void HomogeneousFwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)
LibUtilities::CommSharedPtr m_Ycomm
Homo2DBlockMatrixMapShPtr m_homogeneous2DBlockMat
LibUtilities::CommSharedPtr m_Zcomm
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.
DNekBlkMatSharedPtr GenHomogeneous2DBlockMatrix(Homogeneous2DMatType mattype, CoeffState coeffstate=eLocal) const
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
#define sign(a, b)
return the sign(b)*a
virtual std::vector< LibUtilities::FieldDefinitionsSharedPtr > v_GetFieldDefinitions(void)
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
void SetPaddingBase(void)
LibUtilities::BasisSharedPtr m_paddingBasis_z
Base expansion in z direction.
boost::shared_ptr< FieldDefinitions > FieldDefinitionsSharedPtr
static BasisSharedPtr NullBasisSharedPtr
ExpListHomogeneous2D()
Default constructor.
LibUtilities::NektarFFTSharedPtr m_FFT_z
NekDouble m_lhom_z
Width of homogeneous direction z.
virtual void v_DealiasedProd(const Array< OneD, NekDouble > &inarray1, const Array< OneD, NekDouble > &inarray2, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal)
Array< OneD, NekDouble > m_coeffs
Concatenation of all local expansion coefficients.
void PhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1, Array< OneD, NekDouble > &out_d2)
boost::shared_ptr< DNekMat > DNekMatSharedPtr
NektarFFTFactory & GetNektarFFTFactory()
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
virtual void v_BwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate)
Array< OneD, NekDouble > m_tmpOUT
Array< OneD, ExpListSharedPtr > m_lines
Vector of ExpList, will be filled with ExpList1D.
BasisManagerT & BasisManager(void)
virtual void v_IProductWRTBase_IterPerExp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Class representing a segment element in reference space.
Array< OneD, int > m_coeff_offset
Offset of elemental data into the array m_coeffs.
Base class for all multi-elemental spectral/hp expansions.
1D Evenly-spaced points using Fourier Fit
LibUtilities::BasisSharedPtr m_homogeneousBasis_z
Base expansion in z direction.
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
virtual void v_HomogeneousFwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)
NekDouble m_lhom_y
Width of homogeneous direction y.
virtual ~ExpListHomogeneous2D()
Destructor.
Defines a specification for a set of points.
virtual void v_IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate)
virtual void v_PhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1, Array< OneD, NekDouble > &out_d2)
int m_ny
Number of modes = number of poitns in y direction.
LibUtilities::BasisSharedPtr m_homogeneousBasis_y
Definition of the total number of degrees of freedom and quadrature points. Sets up the storage for m...
void Homogeneous2DTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool IsForwards, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)
int m_nz
Number of modes = number of poitns in z direction.
LibUtilities::BasisSharedPtr m_paddingBasis_y
Base expansion in y direction.
boost::shared_ptr< DNekBlkMat > DNekBlkMatSharedPtr
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
virtual void v_BwdTrans_IterPerExp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
LibUtilities::CommSharedPtr m_comm
Communicator.
map< Homogeneous2DMatType, DNekBlkMatSharedPtr > Homo2DBlockMatrixMap
A map between homo matrix keys and their associated block matrices.
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed t...
DNekMatSharedPtr MatBwdPAD
static const BasisKey NullBasisKey(eNoBasisType, 0, NullPointsKey)
Defines a null basis with no type or points.
LibUtilities::NektarFFTSharedPtr m_FFT_y
virtual void v_FwdTrans_IterPerExp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Array< OneD, NekDouble > m_tmpIN
virtual void v_ExtractDataToCoeffs(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector< NekDouble > &fielddata, std::string &field, Array< OneD, NekDouble > &coeffs)
Extract data from raw field data into expansion list.
boost::shared_ptr< Basis > BasisSharedPtr
bool m_useFFT
FFT variables.
DNekMatSharedPtr MatFwdPAD
virtual void v_HomogeneousBwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Describes the specification for a Basis.
virtual void v_FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate)
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.
virtual void v_AppendFieldData(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector< NekDouble > &fielddata)
void HomogeneousBwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)
DNekBlkMatSharedPtr GetHomogeneous2DBlockMatrix(Homogeneous2DMatType mattype, CoeffState coeffstate=eLocal) const