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);
595 std::vector<unsigned int> sIDs
598 std::vector<unsigned int> yIDs;
599 std::vector<unsigned int> zIDs;
601 for(
int n = 0; n < nhom_modes_z; ++n)
603 for(
int m = 0; m < nhom_modes_y; ++m)
610 m_lines[0]->GeneralGetFieldDefinitions(returnval, 2, HomoBasis,
622 std::vector<NekDouble> HomoLen(2);
629 std::vector<unsigned int> sIDs
632 std::vector<unsigned int> yIDs;
633 std::vector<unsigned int> zIDs;
635 for(
int n = 0; n < nhom_modes_z; ++n)
637 for(
int m = 0; m < nhom_modes_y; ++m)
645 m_lines[0]->GeneralGetFieldDefinitions(fielddef, 2, HomoBasis,
657 int ncoeffs_per_line =
m_lines[0]->GetNcoeffs();
661 map<int, int> ElmtID_to_ExpID;
662 for(i = 0; i <
m_lines[0]->GetExpSize(); ++i)
664 ElmtID_to_ExpID[(*m_exp)[i]->GetGeom()->GetGlobalID()] = i;
667 for(i = 0; i < fielddef->m_elementIDs.size(); ++i)
669 int eid = ElmtID_to_ExpID[fielddef->m_elementIDs[i]];
670 int datalen = (*m_exp)[eid]->GetNcoeffs();
672 for(k = 0; k < (NumMod_y*NumMod_z); ++k)
674 fielddata.insert(fielddata.end(),&coeffs[
m_coeff_offset[eid]+k*ncoeffs_per_line],&coeffs[m_coeff_offset[eid]+k*ncoeffs_per_line]+datalen);
689 int datalen = fielddata.size()/fielddef->m_fields.size();
690 int ncoeffs_per_line =
m_lines[0]->GetNcoeffs();
695 for(i = 0; i < fielddef->m_fields.size(); ++i)
697 if(fielddef->m_fields[i] == field)
704 ASSERTL0(i!= fielddef->m_fields.size(),
"Field not found in data file");
708 map<int, int> ElmtID_to_ExpID;
709 for(i = 0; i <
m_lines[0]->GetExpSize(); ++i)
711 ElmtID_to_ExpID[(*m_exp)[i]->GetGeom()->GetGlobalID()] = i;
714 for(i = 0; i < fielddef->m_elementIDs.size(); ++i)
716 int eid = ElmtID_to_ExpID[fielddef->m_elementIDs[i]];
717 int datalen = (*m_exp)[eid]->GetNcoeffs();
719 for(k = 0; k < (NumMod_y*NumMod_z); ++k)
731 int nq = (*m_exp)[expansion]->GetTotPoints();
732 int npoints_per_line =
m_lines[0]->GetTotPoints();
735 outfile <<
" <DataArray type=\"Float32\" Name=\""
736 << var <<
"\">" << endl;
738 for (
int n = 0; n <
m_lines.num_elements(); ++n)
741 for(i = 0; i < nq; ++i)
747 outfile <<
" </DataArray>" << endl;
756 int nyzlines =
m_lines.num_elements();
757 int npoints = inarray.num_elements();
758 int n_points_line = npoints/nyzlines;
767 for(
int i=0 ; i<nyzlines ; i++ )
769 m_lines[i]->PhysDeriv( tmp1 = inarray + i*n_points_line ,tmp2 = out_d0 + i*n_points_line);
786 for(
int i = 0; i <
m_ny; i++)
790 for(
int j = 0; j <
m_nz; j++)
792 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);
800 for(
int i = 0; i <
m_nz; i++)
803 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);
821 ASSERTL0(
false,
"Semi-phyisical time-stepping not implemented yet for non-Fourier basis")
829 for(
int i = 0; i < n_points_line; i++)
831 StdQuad.PhysDeriv(tmp1 = temparray + i*nyzlines, tmp2 = temparray1 + i*nyzlines, tmp3 = temparray2 + i*nyzlines);
847 int nyzlines =
m_lines.num_elements();
848 int npoints = inarray.num_elements();
849 int n_points_line = npoints/nyzlines;
862 for(
int i=0 ; i<nyzlines ; i++)
864 m_lines[i]->PhysDeriv( tmp1 = inarray + i*n_points_line ,tmp2 = out_d + i*n_points_line);
885 for(
int i = 0; i <
m_ny; i++)
889 for(
int j = 0; j <
m_nz; j++)
891 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);
907 for(
int i = 0; i <
m_nz; i++)
910 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);
927 ASSERTL0(
false,
"Semi-phyisical time-stepping not implemented yet for non-Fourier basis")
935 for(
int i = 0; i < n_points_line; i++)
937 StdQuad.PhysDeriv(tmp1 = temparray + i*nyzlines, tmp2 = temparray1 + i*nyzlines, tmp3 = temparray2 + i*nyzlines);
993 MatFwdPAD = StdQuad.GetStdMatrix(matkey1);
994 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)
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)
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