14 int main(
int argc,
char *argv[])
26 fprintf(stderr,
"Usage: SplitFld meshfile fieldfile\n");
31 = LibUtilities::SessionReader::CreateInstance(argc, argv);
37 string meshfile(argv[argc-2]);
50 string fieldfile(argv[argc-1]);
51 vector<LibUtilities::FieldDefinitionsSharedPtr> fielddef;
52 vector<vector<NekDouble> > fielddata;
58 nfields = fielddef[0]->m_fields.size();
62 std::string solvtype = vSession->GetSolverInfo(
"SOLVERTYPE");
63 if(solvtype ==
"CoupledLinearisedNS" && vSession->DefinesSolverInfo(
"HOMOGENEOUS") )
66 SetFields(graphShPt,boundaryConditions,vSession,Exp,nfields-1);
70 int lastfield = nfields-1;
71 cout<<
"Set pressure: "<<lastfield<<endl;
72 int nplanes = fielddef[0]->m_numModes[2];
75 NekDouble lz = fielddef[0]->m_homogeneousLengths[0];
78 Exp[lastfield] = Exp3DH1;
84 SetFields(graphShPt,boundaryConditions,vSession,Exp,nfields);
90 for(
int j = 0; j < nfields; ++j)
92 for(
int i = 0; i < fielddef.size(); ++i)
94 Exp[j]->ExtractDataToCoeffs(fielddef [i],
96 fielddef [i]->m_fields[j],
97 Exp[j]->UpdateCoeffs());
99 Exp[j]->BwdTrans_IterPerExp(Exp[j]->GetCoeffs(),Exp[j]->UpdatePhys());
106 string fldfilename(argv[2]);
107 string out = fldfilename.substr(0, fldfilename.find_last_of(
"."));
108 string endfile(
"split.fld");
120 for(
int i = 0; i < Exp.num_elements(); ++i)
122 fieldcoeffs[i] = Exp[i]->UpdateCoeffs();
134 for(
int j =0; j<nfields; j++)
137 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
138 = Exp[j]->GetFieldDefinitions();
139 std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
141 for(
int i = 0; i < FieldDef.size(); ++i)
143 var = fielddef[i]->m_fields[j];
145 FieldDef[i]->m_fields.push_back(var);
146 Exp[j]->AppendFieldData(FieldDef[i], FieldData[i],fieldcoeffs[j]);
149 outfile +=
"_"+var+
"_"+endfile;
173 bool DeclareCoeffPhysArrays =
true;
188 enum HomogeneousType HomogeneousType = eNotHomogeneous;
190 if(session->DefinesSolverInfo(
"HOMOGENEOUS"))
192 std::string HomoStr = session->GetSolverInfo(
"HOMOGENEOUS");
195 if((HomoStr ==
"HOMOGENEOUS1D")||(HomoStr ==
"Homogeneous1D")||
196 (HomoStr ==
"1D")||(HomoStr ==
"Homo1D"))
198 HomogeneousType = eHomogeneous1D;
199 npointsZ = session->GetParameter(
"HomModesZ");
200 LhomZ = session->GetParameter(
"LZ");
203 if((HomoStr ==
"HOMOGENEOUS2D")||(HomoStr ==
"Homogeneous2D")||
204 (HomoStr ==
"2D")||(HomoStr ==
"Homo2D"))
206 HomogeneousType = eHomogeneous2D;
207 npointsY = session->GetParameter(
"HomModesY");
208 LhomY = session->GetParameter(
"LY");
209 npointsZ = session->GetParameter(
"HomModesZ");
210 LhomZ = session->GetParameter(
"LZ");
213 if((HomoStr ==
"HOMOGENEOUS3D")||(HomoStr ==
"Homogeneous3D")||
214 (HomoStr ==
"3D")||(HomoStr ==
"Homo3D"))
216 HomogeneousType = eHomogeneous3D;
219 npointsY = session->GetParameter(
"HomModesY");
220 LhomY = session->GetParameter(
"LY");
221 npointsZ = session->GetParameter(
"HomModesZ");
222 LhomZ = session->GetParameter(
"LZ");
225 if(session->DefinesSolverInfo(
"USEFFT"))
232 int expdim = mesh->GetMeshDimension();
241 if(HomogeneousType == eHomogeneous2D)
248 for(i = 0 ; i < nvariables; i++)
251 ::AllocateSharedPtr(session,BkeyY,BkeyZ,LhomY,LhomZ,useFFT,deal,mesh,session->GetVariable(i));
256 for(i = 0 ; i < nvariables; i++)
267 if(HomogeneousType == eHomogeneous1D)
271 for(i = 0 ; i < nvariables; i++)
285 for(i = 1 ; i < nvariables; i++)
296 if(HomogeneousType == eHomogeneous3D)
298 ASSERTL0(
false,
"3D fully periodic problems not implemented yet");
308 for(i = 1 ; i < nvariables; i++)
317 ASSERTL0(
false,
"Expansion dimension not recognised");
#define ASSERTL0(condition, msg)
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
boost::shared_ptr< ContField2D > ContField2DSharedPtr
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
void Import(const std::string &infilename, std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata, FieldMetaDataMap &fieldinfomap, const Array< OneD, int > ElementiDs)
Imports an FLD file.
1D Evenly-spaced points using Lagrange polynomial
1D Evenly-spaced points using Fourier Fit
void SetFields(SpatialDomains::MeshGraphSharedPtr &mesh, SpatialDomains::BoundaryConditionsSharedPtr &boundaryConditions, LibUtilities::SessionReaderSharedPtr &session, Array< OneD, MultiRegions::ExpListSharedPtr > &Exp, int nvariables)
Defines a specification for a set of points.
Array< OneD, int > GetReflectionIndex(MultiRegions::ExpListSharedPtr Exp, int Ireg)
boost::shared_ptr< BoundaryConditions > BoundaryConditionsSharedPtr
boost::shared_ptr< ExpList3DHomogeneous1D > ExpList3DHomogeneous1DSharedPtr
Shared pointer to an ExpList3DHomogeneous1D object.
void Write(const std::string &outFile, std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata, const FieldMetaDataMap &fieldinfomap)
Write a field file in serial only.
boost::shared_ptr< ContField3D > ContField3DSharedPtr
int main(int argc, char *argv[])
boost::shared_ptr< MeshGraph > MeshGraphSharedPtr
Describes the specification for a Basis.