45 namespace MultiRegions
62 m_dealiasing(dealiasing)
69 m_comm->GetColumnComm()->GetColumnComm() :
96 ASSERTL0(
false,
"Dealiasing available just in combination "
108 m_transposition(In.m_transposition),
109 m_useFFT(In.m_useFFT),
112 m_tmpOUT(In.m_tmpOUT),
113 m_homogeneousBasis(In.m_homogeneousBasis),
115 m_homogeneous1DBlockMat(In.m_homogeneous1DBlockMat),
116 m_dealiasing(In.m_dealiasing),
117 m_padsize(In.m_padsize)
161 int num_dofs = inarray1.num_elements();
172 int num_points_per_plane = num_dofs/
m_planes.num_elements();
174 if(!
m_session->DefinesSolverInfo(
"HomoStrip"))
176 num_proc =
m_comm->GetColumnComm()->GetSize();
182 int num_dfts_per_proc = num_points_per_plane / num_proc
183 + (num_points_per_plane % num_proc > 0);
201 for(
int i = 0 ; i < num_dfts_per_proc ; i++)
205 Vmath::Vcopy(N, &(ShufV1[i*N]), 1, &(ShufV1_PAD_coef[0]), 1);
206 Vmath::Vcopy(N, &(ShufV2[i*N]), 1, &(ShufV2_PAD_coef[0]), 1);
209 m_FFT_deal->FFTBwdTrans(ShufV1_PAD_coef, ShufV1_PAD_phys);
210 m_FFT_deal->FFTBwdTrans(ShufV2_PAD_coef, ShufV2_PAD_phys);
216 ShufV1V2_PAD_phys, 1);
220 m_FFT_deal->FFTFwdTrans(ShufV1V2_PAD_phys, ShufV1V2_PAD_coef);
225 &(ShufV1V2[i*N]), 1);
240 int cnt = 0, cnt1 = 0;
243 for(
int n = 0; n <
m_planes.num_elements(); ++n)
245 m_planes[n]->FwdTrans(inarray+cnt, tmparray = outarray + cnt1,
262 int cnt = 0, cnt1 = 0;
266 for(
int n = 0; n <
m_planes.num_elements(); ++n)
268 m_planes[n]->FwdTrans_IterPerExp(inarray+cnt, tmparray = outarray + cnt1);
283 int cnt = 0, cnt1 = 0;
286 for(
int n = 0; n <
m_planes.num_elements(); ++n)
288 m_planes[n]->BwdTrans(inarray+cnt, tmparray = outarray + cnt1,
291 cnt1 +=
m_planes[n]->GetTotPoints();
304 int cnt = 0, cnt1 = 0;
307 for(
int n = 0; n <
m_planes.num_elements(); ++n)
309 m_planes[n]->BwdTrans_IterPerExp(inarray+cnt, tmparray = outarray + cnt1);
312 cnt1 +=
m_planes[n]->GetTotPoints();
325 int cnt = 0, cnt1 = 0;
328 for(
int n = 0; n <
m_planes.num_elements(); ++n)
330 m_planes[n]->IProductWRTBase(inarray+cnt, tmparray = outarray + cnt1,coeffstate);
342 int cnt = 0, cnt1 = 0;
345 for(
int n = 0; n <
m_planes.num_elements(); ++n)
347 m_planes[n]->IProductWRTBase_IterPerExp(inarray+cnt, tmparray = outarray + cnt1);
367 num_dofs = inarray.num_elements();
371 num_dofs = outarray.num_elements();
376 int num_points_per_plane = num_dofs/
m_planes.num_elements();
377 int num_dfts_per_proc;
378 if(!
m_session->DefinesSolverInfo(
"HomoStrip"))
380 int nP =
m_comm->GetColumnComm()->GetSize();
381 num_dfts_per_proc = num_points_per_plane / nP
382 + (num_points_per_plane % nP > 0);
387 num_dfts_per_proc = num_points_per_plane / nP
388 + (num_points_per_plane % nP > 0);
406 for(
int i = 0 ; i < num_dfts_per_proc ; i++)
413 for(
int i = 0 ; i < num_dfts_per_proc ; i++)
426 fft_out,1,outarray,1);
456 int nrows = blkmat->GetRows();
457 int ncols = blkmat->GetColumns();
501 return matrixIter->second;
511 int num_trans_per_proc = 0;
520 n_exp =
m_planes[0]->GetTotPoints();
523 num_trans_per_proc = n_exp/
m_comm->GetColumnComm()->GetSize() + (n_exp%
m_comm->GetColumnComm()->GetSize() > 0);
551 StdPoint.DetShapeType(),
554 loc_mat = StdPoint.GetStdMatrix(matkey);
559 StdPoint.DetShapeType(),
562 loc_mat = StdPoint.GetStdMatrix(matkey);
573 StdSeg.DetShapeType(),
576 loc_mat = StdSeg.GetStdMatrix(matkey);
581 StdSeg.DetShapeType(),
584 loc_mat = StdSeg.GetStdMatrix(matkey);
590 for(
int i = 0; i < num_trans_per_proc; ++i)
592 BlkMatrix->SetBlock(i,i,loc_mat);
600 std::vector<LibUtilities::FieldDefinitionsSharedPtr> returnval;
605 std::vector<NekDouble> HomoLen;
606 HomoLen.push_back(
m_lhom);
608 std::vector<unsigned int> PlanesIDs;
610 for(
int i = 0; i <
m_planes.num_elements(); i++)
616 m_session->LoadParameter(
"Strip_Z",NumHomoStrip,1);
618 m_planes[0]->GeneralGetFieldDefinitions(returnval, 1, NumHomoStrip, HomoBasis, HomoLen, PlanesIDs);
628 std::vector<NekDouble> HomoLen;
629 HomoLen.push_back(
m_lhom);
631 std::vector<unsigned int> PlanesIDs;
633 for(
int i = 0; i <
m_planes.num_elements(); i++)
639 m_session->LoadParameter(
"Strip_Z",NumHomoStrip,1);
642 m_planes[0]->GeneralGetFieldDefinitions(fielddef, 1, NumHomoStrip, HomoBasis,HomoLen,PlanesIDs);
655 int ncoeffs_per_plane =
m_planes[0]->GetNcoeffs();
659 map<int, int> ElmtID_to_ExpID;
660 for(i = 0; i <
m_planes[0]->GetExpSize(); ++i)
662 ElmtID_to_ExpID[(*m_exp)[i]->GetGeom()->GetGlobalID()] = i;
665 for(i = 0; i < fielddef->m_elementIDs.size(); ++i)
667 int eid = ElmtID_to_ExpID[fielddef->m_elementIDs[i]];
668 int datalen = (*m_exp)[eid]->GetNcoeffs();
670 for(n = 0; n <
m_planes.num_elements(); ++n)
672 fielddata.insert(fielddata.end(),&coeffs[
m_coeff_offset[eid]+n*ncoeffs_per_plane],&coeffs[m_coeff_offset[eid]+n*ncoeffs_per_plane]+datalen);
685 std::vector<NekDouble> &fielddata,
692 int datalen = fielddata.size()/fielddef->m_fields.size();
693 std::vector<unsigned int> fieldDefHomoZids;
697 for(i = 0; i < fielddef->m_fields.size(); ++i)
699 if(fielddef->m_fields[i] == field)
706 if(i == fielddef->m_fields.size())
708 cout <<
"Field "<< field<<
"not found in data file. " << endl;
713 int modes_offset = 0;
714 int planes_offset = 0;
720 std::map<int,int> homoZids;
721 for (i = 0; i <
m_planes.num_elements(); ++i)
726 if(fielddef->m_numHomogeneousDir)
728 for(i = 0; i < fielddef->m_basis.size(); ++i)
732 nzmodes = fielddef->m_homogeneousZIDs.size();
736 ASSERTL1(i != fielddef->m_basis.size(),
"Failed to determine number of Homogeneous modes");
738 fieldDefHomoZids = fielddef->m_homogeneousZIDs;
743 fieldDefHomoZids.push_back(0);
747 map<int, int> ElmtID_to_ExpID;
748 for(i = 0; i <
m_planes[0]->GetExpSize(); ++i)
750 ElmtID_to_ExpID[(*m_exp)[i]->GetGeom()->GetGlobalID()] = i;
755 int ncoeffs_per_plane =
m_planes[0]->GetNcoeffs();
757 for(i = 0; i < fielddef->m_elementIDs.size(); ++i)
759 if(fielddef->m_uniOrder ==
true)
765 fielddef->m_numModes,
768 it = ElmtID_to_ExpID.find(fielddef->m_elementIDs[i]);
771 if(it == ElmtID_to_ExpID.end())
774 offset += datalen*nzmodes;
778 int eid = it->second;
781 for(n = 0; n < nzmodes; ++n, offset += datalen)
784 it = homoZids.find(fieldDefHomoZids[n]);
787 if (it == homoZids.end())
792 planes_offset = it->second;
793 if(datalen == (*
m_exp)[eid]->GetNcoeffs())
799 (*m_exp)[eid]->ExtractDataToCoeffs(&fielddata[offset], fielddef->m_numModes,modes_offset,&coeffs[
m_coeff_offset[eid] + planes_offset*ncoeffs_per_plane]);
802 modes_offset += (*m_exp)[0]->GetNumBases();
812 int fromNcoeffs_per_plane = fromExpList->GetPlane(0)->GetNcoeffs();
815 for(i = 0; i <
m_planes.num_elements(); ++i)
817 m_planes[i]->ExtractCoeffsToCoeffs(fromExpList->GetPlane(i),fromcoeffs_tmp = fromCoeffs + fromNcoeffs_per_plane*i, tocoeffs_tmp = toCoeffs +
m_ncoeffs*i);
825 int nq = (*m_exp)[expansion]->GetTotPoints();
826 int npoints_per_plane =
m_planes[0]->GetTotPoints();
829 outfile <<
" <DataArray type=\"Float32\" Name=\""
830 << var <<
"\">" << endl;
832 for (
int n = 0; n <
m_planes.num_elements(); ++n)
835 for(i = 0; i < nq; ++i)
841 outfile <<
" </DataArray>" << endl;
849 cnt1 =
m_planes[0]->Get1DScaledTotPoints(scale);
851 ASSERTL1(
m_planes.num_elements()*cnt1 <= outarray.num_elements(),
"size of outarray does not match internal estimage");
854 for(
int i = 0; i <
m_planes.num_elements(); i++)
857 m_planes[i]->PhysInterp1DScaled(scale,inarray+i*cnt,
858 tmparray = outarray+i*cnt1);
867 cnt =
m_planes[0]->Get1DScaledTotPoints(scale);
870 ASSERTL1(
m_planes.num_elements()*cnt <= inarray.num_elements(),
"size of outarray does not match internal estimage");
873 for(
int i = 0; i <
m_planes.num_elements(); i++)
875 m_planes[i]->PhysGalerkinProjection1DScaled(scale,inarray+i*cnt,
876 tmparray = outarray+i*cnt1);
885 int nT_pts = inarray.num_elements();
886 int nP_pts = nT_pts/
m_planes.num_elements();
894 for(
int i = 0; i <
m_planes.num_elements(); i++)
896 m_planes[i]->PhysDeriv(inarray + i*nP_pts ,tmp2 = out_d0 + i*nP_pts , tmp3 = out_d1 + i*nP_pts );
933 for(
int i = 0; i <
m_planes.num_elements(); i++)
937 Vmath::Smul(nP_pts,beta,tmp1 = temparray + i*nP_pts,1,tmp2 = outarray + (i-
int(sign))*nP_pts,1);
954 if(!
m_session->DefinesSolverInfo(
"HomoStrip"))
957 "Parallelisation in the homogeneous direction "
958 "implemented just for Fourier basis");
963 "Parallelisation in the homogeneous direction "
964 "implemented just for Fourier basis");
969 ASSERTL0(
false,
"Semi-phyisical time-stepping not "
970 "implemented yet for non-Fourier "
979 for(
int i = 0; i < nP_pts; i++)
981 StdSeg.PhysDeriv(temparray + i*
m_planes.num_elements(), tmp2 = outarray + i*
m_planes.num_elements());
996 int nT_pts = inarray.num_elements();
997 int nP_pts = nT_pts/
m_planes.num_elements();
1008 for(
int i=0; i <
m_planes.num_elements(); i++)
1010 m_planes[i]->PhysDeriv(edir, inarray + i*nP_pts ,tmp2 = out_d + i*nP_pts);
1020 temparray = inarray;
1046 for(
int i = 0; i <
m_planes.num_elements(); i++)
1050 Vmath::Smul(nP_pts,beta,tmp1 = temparray + i*nP_pts,1,tmp2 = outarray + (i-
int(sign))*nP_pts,1);
1066 if(!
m_session->DefinesSolverInfo(
"HomoStrip"))
1069 "Parallelisation in the homogeneous direction "
1070 "implemented just for Fourier basis");
1075 "Parallelisation in the homogeneous direction "
1076 "implemented just for Fourier basis");
1081 ASSERTL0(
false,
"Semi-phyisical time-stepping not implemented yet for non-Fourier basis");
1089 for(
int i = 0; i < nP_pts; i++)
1091 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.
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)
int m_ncoeffs
The total number of local degrees of freedom. m_ncoeffs .
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
map< Homogeneous1DMatType, DNekBlkMatSharedPtr > Homo1DBlockMatrixMap
A map between homo matrix keys and their associated block matrices.
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.
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