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)
164 int npoints = outarray.num_elements();
165 int nlines =
m_lines.num_elements();
166 int nslabs = npoints/nlines;
207 for(
int j = 0 ; j< nslabs ; j++)
211 for(
int i = 0 ; i<
m_nz ; i++)
214 Vmath::Vcopy(m_ny,&(ShufV2[i*m_ny + j*nlines]),1,&(PadV2_slab_coeff[i*2*m_ny]),1);
218 PadOUT_V1 = (*MatBwdPAD)*PadIN_V1;
219 PadOUT_V2 = (*MatBwdPAD)*PadIN_V2;
227 PadOUT_Re = (*MatFwdPAD)*PadIN_Re;
231 for (
int i = 0; i <
m_nz; i++)
252 int cnt = 0, cnt1 = 0;
254 int nlines =
m_lines.num_elements();
256 for(
int n = 0; n < nlines; ++n)
258 m_lines[n]->FwdTrans(inarray+cnt, tmparray = outarray + cnt1,
260 cnt +=
m_lines[n]->GetTotPoints();
261 cnt1 +=
m_lines[n]->GetNcoeffs();
271 int cnt = 0, cnt1 = 0;
273 int nlines =
m_lines.num_elements();
275 for(
int n = 0; n < nlines; ++n)
277 m_lines[n]->FwdTrans_IterPerExp(inarray+cnt, tmparray = outarray + cnt1);
279 cnt +=
m_lines[n]->GetTotPoints();
280 cnt1 +=
m_lines[n]->GetNcoeffs();
290 int cnt = 0, cnt1 = 0;
292 int nlines =
m_lines.num_elements();
294 for(
int n = 0; n < nlines; ++n)
296 m_lines[n]->BwdTrans(inarray+cnt, tmparray = outarray + cnt1,
298 cnt +=
m_lines[n]->GetNcoeffs();
299 cnt1 +=
m_lines[n]->GetTotPoints();
309 int cnt = 0, cnt1 = 0;
311 int nlines =
m_lines.num_elements();
313 for(
int n = 0; n < nlines; ++n)
315 m_lines[n]->BwdTrans_IterPerExp(inarray+cnt, tmparray = outarray + cnt1);
317 cnt +=
m_lines[n]->GetNcoeffs();
318 cnt1 +=
m_lines[n]->GetTotPoints();
329 int cnt = 0, cnt1 = 0;
331 int nlines =
m_lines.num_elements();
333 for(
int n = 0; n < nlines; ++n)
335 m_lines[n]->IProductWRTBase(inarray+cnt, tmparray = outarray + cnt1,coeffstate);
337 cnt +=
m_lines[n]->GetNcoeffs();
338 cnt1 +=
m_lines[n]->GetTotPoints();
344 int cnt = 0, cnt1 = 0;
346 int nlines =
m_lines.num_elements();
348 for(
int n = 0; n < nlines; ++n)
350 m_lines[n]->IProductWRTBase_IterPerExp(inarray+cnt, tmparray = outarray + cnt1);
352 cnt +=
m_lines[n]->GetNcoeffs();
353 cnt1 +=
m_lines[n]->GetTotPoints();
367 int n =
m_lines.num_elements();
368 int s = inarray.num_elements();
378 for(
int i=0;i<(p*
m_nz);i++)
386 for(
int i=0;i<(p*
m_nz);i++)
396 for(
int i=0;i<(p*
m_ny);i++)
404 for(
int i=0;i<(p*
m_ny);i++)
448 int nrowsY = blkmatY->GetRows();
449 int ncolsY = blkmatY->GetColumns();
454 int nrowsZ = blkmatZ->GetRows();
455 int ncolsZ = blkmatZ->GetColumns();
468 outY = (*blkmatY)*inY;
472 outZ = (*blkmatZ)*inZ;
491 return matrixIter->second;
528 n_exp =
m_lines[0]->GetNcoeffs();
532 n_exp =
m_lines[0]->GetTotPoints();
559 StdSeg.DetShapeType(),
562 loc_mat = StdSeg.GetStdMatrix(matkey);
567 StdSeg.DetShapeType(),
570 loc_mat = StdSeg.GetStdMatrix(matkey);
574 for(i = 0; i < (n_exp*NumPencils); ++i)
576 BlkMatrix->SetBlock(i,i,loc_mat);
584 std::vector<LibUtilities::FieldDefinitionsSharedPtr> returnval;
590 std::vector<NekDouble> HomoLen(2);
597 std::vector<unsigned int> sIDs
600 std::vector<unsigned int> yIDs;
601 std::vector<unsigned int> zIDs;
603 for(
int n = 0; n < nhom_modes_z; ++n)
605 for(
int m = 0; m < nhom_modes_y; ++m)
612 m_lines[0]->GeneralGetFieldDefinitions(returnval, 2, HomoBasis,
624 std::vector<NekDouble> HomoLen(2);
631 std::vector<unsigned int> sIDs
634 std::vector<unsigned int> yIDs;
635 std::vector<unsigned int> zIDs;
637 for(
int n = 0; n < nhom_modes_z; ++n)
639 for(
int m = 0; m < nhom_modes_y; ++m)
647 m_lines[0]->GeneralGetFieldDefinitions(fielddef, 2, HomoBasis,
659 int ncoeffs_per_line =
m_lines[0]->GetNcoeffs();
663 map<int, int> ElmtID_to_ExpID;
664 for(i = 0; i <
m_lines[0]->GetExpSize(); ++i)
666 ElmtID_to_ExpID[(*m_exp)[i]->GetGeom()->GetGlobalID()] = i;
669 for(i = 0; i < fielddef->m_elementIDs.size(); ++i)
671 int eid = ElmtID_to_ExpID[fielddef->m_elementIDs[i]];
672 int datalen = (*m_exp)[eid]->GetNcoeffs();
674 for(k = 0; k < (NumMod_y*NumMod_z); ++k)
676 fielddata.insert(fielddata.end(),&coeffs[
m_coeff_offset[eid]+k*ncoeffs_per_line],&coeffs[m_coeff_offset[eid]+k*ncoeffs_per_line]+datalen);
691 int datalen = fielddata.size()/fielddef->m_fields.size();
692 int ncoeffs_per_line =
m_lines[0]->GetNcoeffs();
697 for(i = 0; i < fielddef->m_fields.size(); ++i)
699 if(fielddef->m_fields[i] == field)
706 ASSERTL0(i!= fielddef->m_fields.size(),
"Field not found in data file");
710 map<int, int> ElmtID_to_ExpID;
711 for(i = 0; i <
m_lines[0]->GetExpSize(); ++i)
713 ElmtID_to_ExpID[(*m_exp)[i]->GetGeom()->GetGlobalID()] = i;
716 for(i = 0; i < fielddef->m_elementIDs.size(); ++i)
718 int eid = ElmtID_to_ExpID[fielddef->m_elementIDs[i]];
719 int datalen = (*m_exp)[eid]->GetNcoeffs();
721 for(k = 0; k < (NumMod_y*NumMod_z); ++k)
733 int nq = (*m_exp)[expansion]->GetTotPoints();
734 int npoints_per_line =
m_lines[0]->GetTotPoints();
737 outfile <<
" <DataArray type=\"Float32\" Name=\""
738 << var <<
"\">" << endl;
740 for (
int n = 0; n <
m_lines.num_elements(); ++n)
743 for(i = 0; i < nq; ++i)
749 outfile <<
" </DataArray>" << endl;
758 int nyzlines =
m_lines.num_elements();
759 int npoints = inarray.num_elements();
760 int n_points_line = npoints/nyzlines;
769 for(
int i=0 ; i<nyzlines ; i++ )
771 m_lines[i]->PhysDeriv( tmp1 = inarray + i*n_points_line ,tmp2 = out_d0 + i*n_points_line);
788 for(
int i = 0; i <
m_ny; i++)
792 for(
int j = 0; j <
m_nz; j++)
794 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);
802 for(
int i = 0; i <
m_nz; i++)
805 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);
823 ASSERTL0(
false,
"Semi-phyisical time-stepping not implemented yet for non-Fourier basis")
831 for(
int i = 0; i < n_points_line; i++)
833 StdQuad.PhysDeriv(tmp1 = temparray + i*nyzlines, tmp2 = temparray1 + i*nyzlines, tmp3 = temparray2 + i*nyzlines);
849 int nyzlines =
m_lines.num_elements();
850 int npoints = inarray.num_elements();
851 int n_points_line = npoints/nyzlines;
864 for(
int i=0 ; i<nyzlines ; i++)
866 m_lines[i]->PhysDeriv( tmp1 = inarray + i*n_points_line ,tmp2 = out_d + i*n_points_line);
887 for(
int i = 0; i <
m_ny; i++)
891 for(
int j = 0; j <
m_nz; j++)
893 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);
909 for(
int i = 0; i <
m_nz; i++)
912 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);
929 ASSERTL0(
false,
"Semi-phyisical time-stepping not implemented yet for non-Fourier basis")
937 for(
int i = 0; i < n_points_line; i++)
939 StdQuad.PhysDeriv(tmp1 = temparray + i*nyzlines, tmp2 = temparray1 + i*nyzlines, tmp3 = temparray2 + i*nyzlines);
995 MatFwdPAD = StdQuad.GetStdMatrix(matkey1);
996 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_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.
#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
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