46 namespace MultiRegions
49 ExpListHomogeneous2D::ExpListHomogeneous2D():
65 const bool dealiasing):
71 m_dealiasing(dealiasing)
74 "Homogeneous Basis in y direction is a null basis");
76 "Homogeneous Basis in z direction is a null basis");
99 ASSERTL0(
m_comm->GetColumnComm()->GetSize() == 1,
"Remove dealiasing if you want to run in parallel");
110 m_useFFT(In.m_useFFT),
113 m_transposition(In.m_transposition),
116 m_homogeneousBasis_y(In.m_homogeneousBasis_y),
117 m_homogeneousBasis_z(In.m_homogeneousBasis_z),
118 m_lhom_y(In.m_lhom_y),
119 m_lhom_z(In.m_lhom_z),
120 m_homogeneous2DBlockMat(In.m_homogeneous2DBlockMat),
123 m_dealiasing(In.m_dealiasing),
124 m_padsize_y(In.m_padsize_y),
125 m_padsize_z(In.m_padsize_z),
126 MatFwdPAD(In.MatFwdPAD),
127 MatBwdPAD(In.MatBwdPAD)
133 const std::vector<unsigned int> &eIDs):
135 m_useFFT(In.m_useFFT),
138 m_transposition(In.m_transposition),
141 m_homogeneousBasis_y(In.m_homogeneousBasis_y),
142 m_homogeneousBasis_z(In.m_homogeneousBasis_z),
143 m_lhom_y(In.m_lhom_y),
144 m_lhom_z(In.m_lhom_z),
148 m_dealiasing(In.m_dealiasing),
149 m_padsize_y(In.m_padsize_y),
150 m_padsize_z(In.m_padsize_z),
151 MatFwdPAD(In.MatFwdPAD),
152 MatBwdPAD(In.MatBwdPAD)
189 int npoints = outarray.num_elements();
190 int nlines =
m_lines.num_elements();
191 int nslabs = npoints/nlines;
232 for(
int j = 0 ; j< nslabs ; j++)
236 for(
int i = 0 ; i<
m_nz ; i++)
239 Vmath::Vcopy(m_ny,&(ShufV2[i*m_ny + j*nlines]),1,&(PadV2_slab_coeff[i*2*m_ny]),1);
243 PadOUT_V1 = (*MatBwdPAD)*PadIN_V1;
244 PadOUT_V2 = (*MatBwdPAD)*PadIN_V2;
252 PadOUT_Re = (*MatFwdPAD)*PadIN_Re;
256 for (
int i = 0; i <
m_nz; i++)
282 int ndim = inarray1.num_elements();
283 ASSERTL1( inarray2.num_elements() % ndim == 0,
284 "Wrong dimensions for DealiasedDotProd.");
285 int nvec = inarray2.num_elements() % ndim;
286 int npts = inarray1[0].num_elements();
289 for (
int i = 0; i < nvec; i++)
292 for (
int j = 0; j < ndim; j++)
295 Vmath::Vadd(npts, outarray[i], 1, out, 1, outarray[i], 1);
302 int cnt = 0, cnt1 = 0;
304 int nlines =
m_lines.num_elements();
306 for(
int n = 0; n < nlines; ++n)
308 m_lines[n]->FwdTrans(inarray+cnt, tmparray = outarray + cnt1,
310 cnt +=
m_lines[n]->GetTotPoints();
311 cnt1 +=
m_lines[n]->GetNcoeffs();
321 int cnt = 0, cnt1 = 0;
323 int nlines =
m_lines.num_elements();
325 for(
int n = 0; n < nlines; ++n)
327 m_lines[n]->FwdTrans_IterPerExp(inarray+cnt, tmparray = outarray + cnt1);
329 cnt +=
m_lines[n]->GetTotPoints();
330 cnt1 +=
m_lines[n]->GetNcoeffs();
340 int cnt = 0, cnt1 = 0;
342 int nlines =
m_lines.num_elements();
344 for(
int n = 0; n < nlines; ++n)
346 m_lines[n]->BwdTrans(inarray+cnt, tmparray = outarray + cnt1,
348 cnt +=
m_lines[n]->GetNcoeffs();
349 cnt1 +=
m_lines[n]->GetTotPoints();
359 int cnt = 0, cnt1 = 0;
361 int nlines =
m_lines.num_elements();
363 for(
int n = 0; n < nlines; ++n)
365 m_lines[n]->BwdTrans_IterPerExp(inarray+cnt, tmparray = outarray + cnt1);
367 cnt +=
m_lines[n]->GetNcoeffs();
368 cnt1 +=
m_lines[n]->GetTotPoints();
379 int cnt = 0, cnt1 = 0;
381 int nlines =
m_lines.num_elements();
383 for(
int n = 0; n < nlines; ++n)
385 m_lines[n]->IProductWRTBase(inarray+cnt, tmparray = outarray + cnt1,coeffstate);
387 cnt +=
m_lines[n]->GetNcoeffs();
388 cnt1 +=
m_lines[n]->GetTotPoints();
394 int cnt = 0, cnt1 = 0;
396 int nlines =
m_lines.num_elements();
398 for(
int n = 0; n < nlines; ++n)
400 m_lines[n]->IProductWRTBase_IterPerExp(inarray+cnt, tmparray = outarray + cnt1);
402 cnt +=
m_lines[n]->GetNcoeffs();
403 cnt1 +=
m_lines[n]->GetTotPoints();
417 int n =
m_lines.num_elements();
418 int s = inarray.num_elements();
428 for(
int i=0;i<(p*
m_nz);i++)
436 for(
int i=0;i<(p*
m_nz);i++)
446 for(
int i=0;i<(p*
m_ny);i++)
454 for(
int i=0;i<(p*
m_ny);i++)
498 int nrowsY = blkmatY->GetRows();
499 int ncolsY = blkmatY->GetColumns();
504 int nrowsZ = blkmatZ->GetRows();
505 int ncolsZ = blkmatZ->GetColumns();
518 outY = (*blkmatY)*inY;
522 outZ = (*blkmatZ)*inZ;
541 return matrixIter->second;
578 n_exp =
m_lines[0]->GetNcoeffs();
582 n_exp =
m_lines[0]->GetTotPoints();
609 StdSeg.DetShapeType(),
612 loc_mat = StdSeg.GetStdMatrix(matkey);
617 StdSeg.DetShapeType(),
620 loc_mat = StdSeg.GetStdMatrix(matkey);
624 for(i = 0; i < (n_exp*NumPencils); ++i)
626 BlkMatrix->SetBlock(i,i,loc_mat);
634 std::vector<LibUtilities::FieldDefinitionsSharedPtr> returnval;
640 std::vector<NekDouble> HomoLen(2);
647 std::vector<unsigned int> sIDs
650 std::vector<unsigned int> yIDs;
651 std::vector<unsigned int> zIDs;
653 for(
int n = 0; n < nhom_modes_z; ++n)
655 for(
int m = 0; m < nhom_modes_y; ++m)
662 m_lines[0]->GeneralGetFieldDefinitions(returnval, 2, HomoBasis,
674 std::vector<NekDouble> HomoLen(2);
681 std::vector<unsigned int> sIDs
684 std::vector<unsigned int> yIDs;
685 std::vector<unsigned int> zIDs;
687 for(
int n = 0; n < nhom_modes_z; ++n)
689 for(
int m = 0; m < nhom_modes_y; ++m)
697 m_lines[0]->GeneralGetFieldDefinitions(fielddef, 2, HomoBasis,
709 int ncoeffs_per_line =
m_lines[0]->GetNcoeffs();
713 map<int, int> ElmtID_to_ExpID;
714 for(i = 0; i <
m_lines[0]->GetExpSize(); ++i)
716 ElmtID_to_ExpID[(*m_exp)[i]->GetGeom()->GetGlobalID()] = i;
719 for(i = 0; i < fielddef->m_elementIDs.size(); ++i)
721 int eid = ElmtID_to_ExpID[fielddef->m_elementIDs[i]];
722 int datalen = (*m_exp)[eid]->GetNcoeffs();
724 for(k = 0; k < (NumMod_y*NumMod_z); ++k)
726 fielddata.insert(fielddata.end(),&coeffs[
m_coeff_offset[eid]+k*ncoeffs_per_line],&coeffs[m_coeff_offset[eid]+k*ncoeffs_per_line]+datalen);
741 int datalen = fielddata.size()/fielddef->m_fields.size();
742 int ncoeffs_per_line =
m_lines[0]->GetNcoeffs();
747 for(i = 0; i < fielddef->m_fields.size(); ++i)
749 if(fielddef->m_fields[i] == field)
756 ASSERTL0(i!= fielddef->m_fields.size(),
"Field not found in data file");
760 map<int, int> ElmtID_to_ExpID;
761 for(i = 0; i <
m_lines[0]->GetExpSize(); ++i)
763 ElmtID_to_ExpID[(*m_exp)[i]->GetGeom()->GetGlobalID()] = i;
766 for(i = 0; i < fielddef->m_elementIDs.size(); ++i)
768 int eid = ElmtID_to_ExpID[fielddef->m_elementIDs[i]];
769 int datalen = (*m_exp)[eid]->GetNcoeffs();
771 for(k = 0; k < (NumMod_y*NumMod_z); ++k)
783 int nq = (*m_exp)[expansion]->GetTotPoints();
784 int npoints_per_line =
m_lines[0]->GetTotPoints();
787 outfile <<
" <DataArray type=\"Float64\" Name=\""
788 << var <<
"\">" << endl;
790 for (
int n = 0; n <
m_lines.num_elements(); ++n)
793 for(i = 0; i < nq; ++i)
799 outfile <<
" </DataArray>" << endl;
808 int nyzlines =
m_lines.num_elements();
809 int npoints = inarray.num_elements();
810 int n_points_line = npoints/nyzlines;
819 for(
int i=0 ; i<nyzlines ; i++ )
821 m_lines[i]->PhysDeriv( tmp1 = inarray + i*n_points_line ,tmp2 = out_d0 + i*n_points_line);
838 for(
int i = 0; i <
m_ny; i++)
842 for(
int j = 0; j <
m_nz; j++)
844 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);
852 for(
int i = 0; i <
m_nz; i++)
855 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);
873 ASSERTL0(
false,
"Semi-phyisical time-stepping not implemented yet for non-Fourier basis")
881 for(
int i = 0; i < n_points_line; i++)
883 StdQuad.PhysDeriv(tmp1 = temparray + i*nyzlines, tmp2 = temparray1 + i*nyzlines, tmp3 = temparray2 + i*nyzlines);
899 int nyzlines =
m_lines.num_elements();
900 int npoints = inarray.num_elements();
901 int n_points_line = npoints/nyzlines;
914 for(
int i=0 ; i<nyzlines ; i++)
916 m_lines[i]->PhysDeriv( tmp1 = inarray + i*n_points_line ,tmp2 = out_d + i*n_points_line);
937 for(
int i = 0; i <
m_ny; i++)
941 for(
int j = 0; j <
m_nz; j++)
943 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);
959 for(
int i = 0; i <
m_nz; i++)
962 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);
979 ASSERTL0(
false,
"Semi-phyisical time-stepping not implemented yet for non-Fourier basis")
987 for(
int i = 0; i < n_points_line; i++)
989 StdQuad.PhysDeriv(tmp1 = temparray + i*nyzlines, tmp2 = temparray1 + i*nyzlines, tmp3 = temparray2 + i*nyzlines);
1045 MatFwdPAD = StdQuad.GetStdMatrix(matkey1);
1046 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.
Array< OneD, NekDouble > m_phys
The global expansion evaluated at the quadrature points.
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
static const NekDouble kNekZeroTol
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.
Array< OneD, int > m_phys_offset
Offset of elemental data into the array m_phys.
virtual void v_DealiasedDotProd(const Array< OneD, Array< OneD, NekDouble > > &inarray1, const Array< OneD, Array< OneD, NekDouble > > &inarray2, Array< OneD, Array< OneD, NekDouble > > &outarray, CoeffState coeffstate=eLocal)
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.
static std::vector< unsigned int > NullUnsignedIntVector
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)
std::map< Homogeneous2DMatType, DNekBlkMatSharedPtr > Homo2DBlockMatrixMap
A map between homo matrix keys and their associated block matrices.
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.
void DealiasedProd(const Array< OneD, NekDouble > &inarray1, const Array< OneD, NekDouble > &inarray2, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal)
#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)
virtual void v_WriteVtkPieceData(std::ostream &outfile, int expansion, std::string var)
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
void Zero(int n, T *x, const int incx)
Zero vector.
virtual void v_HomogeneousBwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
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 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.
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