47 namespace MultiRegions
50 ExpListHomogeneous1D::ExpListHomogeneous1D():
64 m_dealiasing(dealiasing)
71 m_comm->GetColumnComm()->GetColumnComm() :
98 ASSERTL0(
false,
"Dealiasing available just in combination "
110 m_transposition(In.m_transposition),
111 m_StripZcomm(In.m_StripZcomm),
112 m_useFFT(In.m_useFFT),
115 m_tmpOUT(In.m_tmpOUT),
116 m_homogeneousBasis(In.m_homogeneousBasis),
118 m_homogeneous1DBlockMat(In.m_homogeneous1DBlockMat),
119 m_dealiasing(In.m_dealiasing),
120 m_padsize(In.m_padsize)
126 const std::vector<unsigned int> &eIDs):
128 m_transposition(In.m_transposition),
129 m_useFFT(In.m_useFFT),
132 m_tmpOUT(In.m_tmpOUT),
133 m_homogeneousBasis(In.m_homogeneousBasis),
136 m_dealiasing(In.m_dealiasing),
137 m_padsize(In.m_padsize)
181 int num_dofs = inarray1.num_elements();
192 int num_points_per_plane = num_dofs/
m_planes.num_elements();
194 if(!
m_session->DefinesSolverInfo(
"HomoStrip"))
196 num_proc =
m_comm->GetColumnComm()->GetSize();
202 int num_dfts_per_proc = num_points_per_plane / num_proc
203 + (num_points_per_plane % num_proc > 0);
221 for(
int i = 0 ; i < num_dfts_per_proc ; i++)
225 Vmath::Vcopy(N, &(ShufV1[i*N]), 1, &(ShufV1_PAD_coef[0]), 1);
226 Vmath::Vcopy(N, &(ShufV2[i*N]), 1, &(ShufV2_PAD_coef[0]), 1);
229 m_FFT_deal->FFTBwdTrans(ShufV1_PAD_coef, ShufV1_PAD_phys);
230 m_FFT_deal->FFTBwdTrans(ShufV2_PAD_coef, ShufV2_PAD_phys);
236 ShufV1V2_PAD_phys, 1);
240 m_FFT_deal->FFTFwdTrans(ShufV1V2_PAD_phys, ShufV1V2_PAD_coef);
245 &(ShufV1V2[i*N]), 1);
260 int cnt = 0, cnt1 = 0;
263 for(
int n = 0; n <
m_planes.num_elements(); ++n)
265 m_planes[n]->FwdTrans(inarray+cnt, tmparray = outarray + cnt1,
282 int cnt = 0, cnt1 = 0;
286 for(
int n = 0; n <
m_planes.num_elements(); ++n)
288 m_planes[n]->FwdTrans_IterPerExp(inarray+cnt, tmparray = outarray + cnt1);
303 int cnt = 0, cnt1 = 0;
306 for(
int n = 0; n <
m_planes.num_elements(); ++n)
308 m_planes[n]->BwdTrans(inarray+cnt, tmparray = outarray + cnt1,
311 cnt1 +=
m_planes[n]->GetTotPoints();
324 int cnt = 0, cnt1 = 0;
327 for(
int n = 0; n <
m_planes.num_elements(); ++n)
329 m_planes[n]->BwdTrans_IterPerExp(inarray+cnt, tmparray = outarray + cnt1);
332 cnt1 +=
m_planes[n]->GetTotPoints();
345 int cnt = 0, cnt1 = 0;
348 for(
int n = 0; n <
m_planes.num_elements(); ++n)
350 m_planes[n]->IProductWRTBase(inarray+cnt, tmparray = outarray + cnt1,coeffstate);
362 int cnt = 0, cnt1 = 0;
365 for(
int n = 0; n <
m_planes.num_elements(); ++n)
367 m_planes[n]->IProductWRTBase_IterPerExp(inarray+cnt, tmparray = outarray + cnt1);
387 num_dofs = inarray.num_elements();
391 num_dofs = outarray.num_elements();
396 int num_points_per_plane = num_dofs/
m_planes.num_elements();
397 int num_dfts_per_proc;
398 if(!
m_session->DefinesSolverInfo(
"HomoStrip"))
400 int nP =
m_comm->GetColumnComm()->GetSize();
401 num_dfts_per_proc = num_points_per_plane / nP
402 + (num_points_per_plane % nP > 0);
407 num_dfts_per_proc = num_points_per_plane / nP
408 + (num_points_per_plane % nP > 0);
426 for(
int i = 0 ; i < num_dfts_per_proc ; i++)
433 for(
int i = 0 ; i < num_dfts_per_proc ; i++)
446 fft_out,1,outarray,1);
476 int nrows = blkmat->GetRows();
477 int ncols = blkmat->GetColumns();
521 return matrixIter->second;
531 int num_trans_per_proc = 0;
540 n_exp =
m_planes[0]->GetTotPoints();
543 num_trans_per_proc = n_exp/
m_comm->GetColumnComm()->GetSize() + (n_exp%
m_comm->GetColumnComm()->GetSize() > 0);
571 StdPoint.DetShapeType(),
574 loc_mat = StdPoint.GetStdMatrix(matkey);
579 StdPoint.DetShapeType(),
582 loc_mat = StdPoint.GetStdMatrix(matkey);
593 StdSeg.DetShapeType(),
596 loc_mat = StdSeg.GetStdMatrix(matkey);
601 StdSeg.DetShapeType(),
604 loc_mat = StdSeg.GetStdMatrix(matkey);
610 for(
int i = 0; i < num_trans_per_proc; ++i)
612 BlkMatrix->SetBlock(i,i,loc_mat);
620 std::vector<LibUtilities::FieldDefinitionsSharedPtr> returnval;
625 std::vector<NekDouble> HomoLen;
626 HomoLen.push_back(
m_lhom);
628 std::vector<unsigned int> StripsIDs;
631 m_session->MatchSolverInfo(
"HomoStrip",
"True",strips,
false);
637 std::vector<unsigned int> PlanesIDs;
647 for(
int i = 0; i <
m_planes.num_elements(); i++)
652 m_planes[0]->GeneralGetFieldDefinitions(returnval, 1, HomoBasis,
653 HomoLen, strips, StripsIDs, PlanesIDs);
662 std::vector<NekDouble> HomoLen;
663 HomoLen.push_back(
m_lhom);
665 std::vector<unsigned int> StripsIDs;
668 m_session->MatchSolverInfo(
"HomoStrip",
"True",strips,
false);
674 std::vector<unsigned int> PlanesIDs;
682 for(
int i = 0; i <
m_planes.num_elements(); i++)
688 m_planes[0]->GeneralGetFieldDefinitions(fielddef, 1, HomoBasis,
689 HomoLen, strips, StripsIDs, PlanesIDs);
702 int ncoeffs_per_plane =
m_planes[0]->GetNcoeffs();
706 map<int, int> ElmtID_to_ExpID;
707 for(i = 0; i <
m_planes[0]->GetExpSize(); ++i)
709 ElmtID_to_ExpID[(*m_exp)[i]->GetGeom()->GetGlobalID()] = i;
712 for(i = 0; i < fielddef->m_elementIDs.size(); ++i)
714 int eid = ElmtID_to_ExpID[fielddef->m_elementIDs[i]];
715 int datalen = (*m_exp)[eid]->GetNcoeffs();
717 for(n = 0; n <
m_planes.num_elements(); ++n)
719 fielddata.insert(fielddata.end(),&coeffs[
m_coeff_offset[eid]+n*ncoeffs_per_plane],&coeffs[m_coeff_offset[eid]+n*ncoeffs_per_plane]+datalen);
732 std::vector<NekDouble> &fielddata,
739 int datalen = fielddata.size()/fielddef->m_fields.size();
740 std::vector<unsigned int> fieldDefHomoZids;
744 for(i = 0; i < fielddef->m_fields.size(); ++i)
746 if(fielddef->m_fields[i] == field)
753 if(i == fielddef->m_fields.size())
755 cout <<
"Field "<< field<<
"not found in data file. " << endl;
760 int modes_offset = 0;
761 int planes_offset = 0;
766 std::map<int,int> homoZids;
767 for (i = 0; i <
m_planes.num_elements(); ++i)
772 if(fielddef->m_numHomogeneousDir)
774 nzmodes = fielddef->m_homogeneousZIDs.size();
775 fieldDefHomoZids = fielddef->m_homogeneousZIDs;
780 fieldDefHomoZids.push_back(0);
784 map<int, int> ElmtID_to_ExpID;
785 for(i = 0; i <
m_planes[0]->GetExpSize(); ++i)
787 ElmtID_to_ExpID[(*m_exp)[i]->GetGeom()->GetGlobalID()] = i;
792 int ncoeffs_per_plane =
m_planes[0]->GetNcoeffs();
794 for(i = 0; i < fielddef->m_elementIDs.size(); ++i)
796 if(fielddef->m_uniOrder ==
true)
802 fielddef->m_numModes,
805 it = ElmtID_to_ExpID.find(fielddef->m_elementIDs[i]);
808 if(it == ElmtID_to_ExpID.end())
811 offset += datalen*nzmodes;
812 modes_offset += (*m_exp)[0]->GetNumBases() +
813 fielddef->m_numHomogeneousDir;
817 int eid = it->second;
820 for(n = 0; n < nzmodes; ++n, offset += datalen)
823 it = homoZids.find(fieldDefHomoZids[n]);
826 if (it == homoZids.end())
831 planes_offset = it->second;
832 if(datalen == (*
m_exp)[eid]->GetNcoeffs())
838 (*m_exp)[eid]->ExtractDataToCoeffs(&fielddata[offset], fielddef->m_numModes,modes_offset,&coeffs[
m_coeff_offset[eid] + planes_offset*ncoeffs_per_plane]);
841 modes_offset += (*m_exp)[0]->GetNumBases() + fielddef->m_numHomogeneousDir;
851 int fromNcoeffs_per_plane = fromExpList->GetPlane(0)->GetNcoeffs();
852 int toNcoeffs_per_plane =
m_planes[0]->GetNcoeffs();
855 for(i = 0; i <
m_planes.num_elements(); ++i)
857 m_planes[i]->ExtractCoeffsToCoeffs(fromExpList->GetPlane(i),fromcoeffs_tmp = fromCoeffs + fromNcoeffs_per_plane*i, tocoeffs_tmp = toCoeffs + toNcoeffs_per_plane*i);
867 m_planes[0]->WriteVtkPieceData(outfile, expansion, var);
872 int nq = (*m_exp)[expansion]->GetTotPoints();
873 int npoints_per_plane =
m_planes[0]->GetTotPoints();
876 int outputExtraPlane = 0;
882 outputExtraPlane = 1;
893 int fromRank = (rank+1) % size;
894 int toRank = (rank == 0) ? size-1 : rank-1;
900 fromRank, extraPlane);
905 outfile <<
" <DataArray type=\"Float64\" Name=\""
906 << var <<
"\">" << endl;
908 for (
int n = 0; n <
m_planes.num_elements(); ++n)
911 for(i = 0; i < nq; ++i)
916 if (outputExtraPlane)
918 for(i = 0; i < nq; ++i)
921 0 : extraPlane[i]) <<
" ";
925 outfile <<
" </DataArray>" << endl;
933 cnt1 =
m_planes[0]->Get1DScaledTotPoints(scale);
935 ASSERTL1(
m_planes.num_elements()*cnt1 <= outarray.num_elements(),
"size of outarray does not match internal estimage");
938 for(
int i = 0; i <
m_planes.num_elements(); i++)
941 m_planes[i]->PhysInterp1DScaled(scale,inarray+i*cnt,
942 tmparray = outarray+i*cnt1);
951 cnt =
m_planes[0]->Get1DScaledTotPoints(scale);
954 ASSERTL1(
m_planes.num_elements()*cnt <= inarray.num_elements(),
"size of outarray does not match internal estimage");
957 for(
int i = 0; i <
m_planes.num_elements(); i++)
959 m_planes[i]->PhysGalerkinProjection1DScaled(scale,inarray+i*cnt,
960 tmparray = outarray+i*cnt1);
969 int nT_pts = inarray.num_elements();
970 int nP_pts = nT_pts/
m_planes.num_elements();
978 for(
int i = 0; i <
m_planes.num_elements(); i++)
980 m_planes[i]->PhysDeriv(inarray + i*nP_pts ,tmp2 = out_d0 + i*nP_pts , tmp3 = out_d1 + i*nP_pts );
1017 for(
int i = 0; i <
m_planes.num_elements(); i++)
1021 Vmath::Smul(nP_pts,beta,tmp1 = temparray + i*nP_pts,1,tmp2 = outarray + (i-
int(sign))*nP_pts,1);
1038 if(!
m_session->DefinesSolverInfo(
"HomoStrip"))
1041 "Parallelisation in the homogeneous direction "
1042 "implemented just for Fourier basis");
1047 "Parallelisation in the homogeneous direction "
1048 "implemented just for Fourier basis");
1053 ASSERTL0(
false,
"Semi-phyisical time-stepping not "
1054 "implemented yet for non-Fourier "
1063 for(
int i = 0; i < nP_pts; i++)
1065 StdSeg.PhysDeriv(temparray + i*
m_planes.num_elements(), tmp2 = outarray + i*
m_planes.num_elements());
1080 int nT_pts = inarray.num_elements();
1081 int nP_pts = nT_pts/
m_planes.num_elements();
1092 for(
int i=0; i <
m_planes.num_elements(); i++)
1094 m_planes[i]->PhysDeriv(edir, inarray + i*nP_pts ,tmp2 = out_d + i*nP_pts);
1104 temparray = inarray;
1130 for(
int i = 0; i <
m_planes.num_elements(); i++)
1134 Vmath::Smul(nP_pts,beta,tmp1 = temparray + i*nP_pts,1,tmp2 = outarray + (i-
int(sign))*nP_pts,1);
1150 if(!
m_session->DefinesSolverInfo(
"HomoStrip"))
1153 "Parallelisation in the homogeneous direction "
1154 "implemented just for Fourier basis");
1159 "Parallelisation in the homogeneous direction "
1160 "implemented just for Fourier basis");
1165 ASSERTL0(
false,
"Semi-phyisical time-stepping not implemented yet for non-Fourier basis");
1173 for(
int i = 0; i < nP_pts; i++)
1175 StdSeg.PhysDeriv(temparray + i*
m_planes.num_elements(), tmp2 = outarray + i*
m_planes.num_elements());
Abstraction of a two-dimensional multi-elemental expansion which is merely a collection of local expa...
void HomogeneousBwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)
Homo1DBlockMatrixMapShPtr m_homogeneous1DBlockMat
virtual void v_FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate)
#define ASSERTL0(condition, msg)
DNekBlkMatSharedPtr GetHomogeneous1DBlockMatrix(Homogeneous1DMatType mattype, CoeffState coeffstate=eLocal) const
virtual void v_PhysGalerkinProjection1DScaled(const NekDouble scale, const Array< OneD, NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
boost::shared_ptr< Transposition > TranspositionSharedPtr
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.
static Array< OneD, NekDouble > NullNekDouble1DArray
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
#define sign(a, b)
return the sign(b)*a
LibUtilities::TranspositionSharedPtr m_transposition
virtual void v_WriteVtkPieceData(std::ostream &outfile, int expansion, std::string var)
virtual void v_PhysInterp1DScaled(const NekDouble scale, const Array< OneD, NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
void PhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1, Array< OneD, NekDouble > &out_d2)
virtual void v_ExtractCoeffsToCoeffs(const boost::shared_ptr< ExpList > &fromExpList, const Array< OneD, const NekDouble > &fromCoeffs, Array< OneD, NekDouble > &toCoeffs)
boost::shared_ptr< FieldDefinitions > FieldDefinitionsSharedPtr
LibUtilities::NektarFFTSharedPtr m_FFT_deal
static BasisSharedPtr NullBasisSharedPtr
Array< OneD, NekDouble > m_tmpOUT
NekDouble m_lhom
Width of homogeneous direction.
Array< OneD, NekDouble > m_phys
The global expansion evaluated at the quadrature points.
virtual void v_HomogeneousFwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)
Array< OneD, NekDouble > m_coeffs
Concatenation of all local expansion coefficients.
boost::shared_ptr< DNekMat > DNekMatSharedPtr
NektarFFTFactory & GetNektarFFTFactory()
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
virtual LibUtilities::TranspositionSharedPtr v_GetTransposition(void)
int GetNumberOfCoefficients(ShapeType shape, std::vector< unsigned int > &modes, int offset)
virtual void v_AppendFieldData(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector< NekDouble > &fielddata)
BasisManagerT & BasisManager(void)
Class representing a segment element in reference space.
virtual void v_IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate)
Array< OneD, int > m_coeff_offset
Offset of elemental data into the array m_coeffs.
LibUtilities::BasisSharedPtr m_homogeneousBasis
Definition of the total number of degrees of freedom and quadrature points. Sets up the storage for m...
Base class for all multi-elemental spectral/hp expansions.
1D Evenly-spaced points using Fourier Fit
static const NekDouble kNekZeroTol
Fourier Modified expansions with just the real part of the first mode .
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
boost::shared_ptr< LocalRegions::ExpansionVector > m_exp
The list of local expansions.
Array< OneD, int > m_phys_offset
Offset of elemental data into the array m_phys.
virtual void v_BwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate)
virtual void v_BwdTrans_IterPerExp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
LibUtilities::SessionReaderSharedPtr m_session
Session.
Array< OneD, ExpListSharedPtr > m_planes
void HomogeneousFwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)
virtual void v_FwdTrans_IterPerExp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
virtual void v_HomogeneousBwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)
ExpListHomogeneous1D()
Default constructor.
Array< OneD, NekDouble > m_tmpIN
Fourier Modified expansions with just the imaginary part of the first mode .
virtual Array< OneD, const unsigned int > v_GetZIDs(void)
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< DNekBlkMat > DNekBlkMatSharedPtr
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
virtual void v_DealiasedProd(const Array< OneD, NekDouble > &inarray1, const Array< OneD, NekDouble > &inarray2, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal)
LibUtilities::CommSharedPtr m_comm
Communicator.
void Homogeneous1DTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool IsForwards, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)
virtual std::vector< LibUtilities::FieldDefinitionsSharedPtr > v_GetFieldDefinitions(void)
DNekBlkMatSharedPtr GenHomogeneous1DBlockMatrix(Homogeneous1DMatType mattype, CoeffState coeffstate=eLocal) const
virtual void v_IProductWRTBase_IterPerExp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Fourier ModifiedExpansion with just the first mode .
virtual ~ExpListHomogeneous1D()
Destructor.
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed t...
LibUtilities::CommSharedPtr m_StripZcomm
bool m_useFFT
FFT variables.
static const BasisKey NullBasisKey(eNoBasisType, 0, NullPointsKey)
Defines a null basis with no type or points.
std::map< Homogeneous1DMatType, DNekBlkMatSharedPtr > Homo1DBlockMatrixMap
A map between homo matrix keys and their associated block matrices.
virtual NekDouble v_GetHomoLen(void)
#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)
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)
Describes the specification for a Basis.
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.
LibUtilities::NektarFFTSharedPtr m_FFT