20 int main(
int argc,
char *argv[])
26 fprintf(stderr,
"Usage: ./CalcVorticity file.xml file.fld\n");
31 = LibUtilities::SessionReader::CreateInstance(argc, argv);
36 string meshfile(argv[argc-2]);
42 string fieldfile(argv[argc-1]);
43 vector<LibUtilities::FieldDefinitionsSharedPtr> fielddef;
44 vector<vector<NekDouble> > fielddata;
47 bool dealiasing =
false;
52 int expdim = graphShPt->GetMeshDimension();
53 int nfields = fielddef[0]->m_fields.size();
57 if(fielddef[0]->m_numHomogeneousDir == 2)
68 if(fielddef[0]->m_numHomogeneousDir == 1)
90 ASSERTL0(fielddef[0]->m_numHomogeneousDir <= 2,
"Quasi-3D approach is only set up for 1 or 2 homogeneous directions");
92 if(fielddef[0]->m_numHomogeneousDir == 1)
100 vSession->LoadParameter(
"HomModesZ",nplanes,fielddef[0]->m_numModes[1]);
105 NekDouble ly = fielddef[0]->m_homogeneousLengths[0];
110 for(i = 1; i < nfields + vorticitydim; ++i)
115 else if(fielddef[0]->m_numHomogeneousDir == 2)
125 vSession->LoadParameter(
"HomModesY",nylines,fielddef[0]->m_numModes[1]);
126 vSession->LoadParameter(
"HomModesZ",nzlines,fielddef[0]->m_numModes[2]);
135 NekDouble ly = fielddef[0]->m_homogeneousLengths[0];
136 NekDouble lz = fielddef[0]->m_homogeneousLengths[1];
141 for(i = 1; i < nfields + vorticitydim; ++i)
152 for(i = 1; i < nfields + vorticitydim; ++i)
162 ASSERTL0(fielddef[0]->m_numHomogeneousDir <= 1,
"NumHomogeneousDir is only set up for 1");
164 if(fielddef[0]->m_numHomogeneousDir == 1)
172 vSession->LoadParameter(
"HomModesZ",nplanes,fielddef[0]->m_numModes[2]);
178 NekDouble lz = fielddef[0]->m_homogeneousLengths[0];
183 for(i = 1; i < nfields + vorticitydim; ++i)
195 for(i = 1; i < nfields + vorticitydim; ++i)
210 for(i = 1; i < nfields + vorticitydim; ++i)
218 ASSERTL0(
false,
"Expansion dimension not recognised");
224 for(j = 0; j < nfields; ++j)
226 for(
unsigned int i = 0; i < fielddata.size(); ++i)
228 Exp[j]->ExtractDataToCoeffs(fielddef [i],
230 fielddef [i]->m_fields[j],
231 Exp[j]->UpdateCoeffs());
233 Exp[j]->BwdTrans(Exp[j]->GetCoeffs(),Exp[j]->UpdatePhys());
237 int nq = Exp[0]->GetNpoints();
253 if(fielddef[0]->m_numHomogeneousDir == 1)
255 ASSERTL0(
false,
"Not implemented yet");
257 else if(fielddef[0]->m_numHomogeneousDir == 2)
270 Exp[4]->FwdTrans(Qx,Exp[4]->UpdateCoeffs());
271 Exp[5]->FwdTrans(Qy,Exp[5]->UpdateCoeffs());
272 Exp[6]->FwdTrans(Qz,Exp[6]->UpdateCoeffs());
276 ASSERTL0(
false,
"Not implemented yet");
282 if(fielddef[0]->m_numHomogeneousDir == 1)
295 Exp[4]->FwdTrans(Qx,Exp[4]->UpdateCoeffs());
296 Exp[5]->FwdTrans(Qy,Exp[5]->UpdateCoeffs());
297 Exp[6]->FwdTrans(Qz,Exp[6]->UpdateCoeffs());
306 Exp[3]->FwdTrans(Qz,Exp[3]->UpdateCoeffs());
323 Exp[4]->FwdTrans(Qx,Exp[4]->UpdateCoeffs());
324 Exp[5]->FwdTrans(Qy,Exp[5]->UpdateCoeffs());
325 Exp[6]->FwdTrans(Qz,Exp[6]->UpdateCoeffs());
330 ASSERTL0(
false,
"Expansion dimension not recognised");
337 string fldfilename(argv[2]);
338 string out = fldfilename.substr(0, fldfilename.find_last_of(
"."));
339 string endfile(
"_with_vorticity.fld");
341 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
342 = Exp[0]->GetFieldDefinitions();
343 std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
345 for(j = 0; j < nfields + vorticitydim; ++j)
347 for(i = 0; i < FieldDef.size(); ++i)
353 FieldDef[i]->m_fields.push_back(
"Qx");
357 FieldDef[i]->m_fields.push_back(
"Qy");
361 FieldDef[i]->m_fields.push_back(
"Qz");
366 FieldDef[i]->m_fields.push_back(fielddef[i]->m_fields[j]);
368 Exp[j]->AppendFieldData(FieldDef[i], FieldData[i]);
#define ASSERTL0(condition, msg)
int main(int argc, char *argv[])
void Import(const std::string &infilename, std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata, FieldMetaDataMap &fieldinfomap, const Array< OneD, int > &ElementIDs)
This function allows for data to be imported from an FLD file when a session and/or communicator is n...
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
boost::shared_ptr< ExpList3DHomogeneous2D > ExpList3DHomogeneous2DSharedPtr
Shared pointer to an ExpList3DHomogeneous2D object.
1D Evenly-spaced points using Lagrange polynomial
boost::shared_ptr< ExpList1D > ExpList1DSharedPtr
Shared pointer to an ExpList1D object.
Defines a specification for a set of points.
boost::shared_ptr< ExpList2D > ExpList2DSharedPtr
Shared pointer to an ExpList2D object.
void Write(const std::string &outFile, std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata, const FieldMetaDataMap &fieldinfomap, const bool backup)
This function allows for data to be written to an FLD file when a session and/or communicator is not ...
boost::shared_ptr< ExpList2DHomogeneous1D > ExpList2DHomogeneous1DSharedPtr
Shared pointer to an ExpList2DHomogeneous1D object.
void Vsub(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Subtract vector z = x-y.
boost::shared_ptr< ExpList3D > ExpList3DSharedPtr
Shared pointer to an ExpList3D object.
MultiRegions::Direction const DirCartesianMap[]
boost::shared_ptr< ExpList3DHomogeneous1D > ExpList3DHomogeneous1DSharedPtr
Shared pointer to an ExpList3DHomogeneous1D object.
boost::shared_ptr< MeshGraph > MeshGraphSharedPtr
Describes the specification for a Basis.