25 fprintf(stderr,
"Usage: ./CalcVorticity file.xml file.fld\n");
30 = LibUtilities::SessionReader::CreateInstance(argc, argv);
35 string meshfile(argv[argc-2]);
41 string fieldfile(argv[argc-1]);
42 vector<LibUtilities::FieldDefinitionsSharedPtr> fielddef;
43 vector<vector<NekDouble> > fielddata;
46 bool dealiasing =
false;
51 int expdim = graphShPt->GetMeshDimension();
52 int nfields = fielddef[0]->m_fields.size();
56 if(fielddef[0]->m_numHomogeneousDir == 2)
67 if(fielddef[0]->m_numHomogeneousDir == 1)
89 ASSERTL0(fielddef[0]->m_numHomogeneousDir <= 2,
"Quasi-3D approach is only set up for 1 or 2 homogeneous directions");
91 if(fielddef[0]->m_numHomogeneousDir == 1)
99 vSession->LoadParameter(
"HomModesZ",nplanes,fielddef[0]->m_numModes[1]);
104 NekDouble ly = fielddef[0]->m_homogeneousLengths[0];
109 for(i = 1; i < nfields + vorticitydim; ++i)
114 else if(fielddef[0]->m_numHomogeneousDir == 2)
124 vSession->LoadParameter(
"HomModesY",nylines,fielddef[0]->m_numModes[1]);
125 vSession->LoadParameter(
"HomModesZ",nzlines,fielddef[0]->m_numModes[2]);
134 NekDouble ly = fielddef[0]->m_homogeneousLengths[0];
135 NekDouble lz = fielddef[0]->m_homogeneousLengths[1];
140 for(i = 1; i < nfields + vorticitydim; ++i)
151 for(i = 1; i < nfields + vorticitydim; ++i)
161 ASSERTL0(fielddef[0]->m_numHomogeneousDir <= 1,
"NumHomogeneousDir is only set up for 1");
163 if(fielddef[0]->m_numHomogeneousDir == 1)
171 vSession->LoadParameter(
"HomModesZ",nplanes,fielddef[0]->m_numModes[2]);
177 NekDouble lz = fielddef[0]->m_homogeneousLengths[0];
182 for(i = 1; i < nfields + vorticitydim; ++i)
194 for(i = 1; i < nfields + vorticitydim; ++i)
209 for(i = 1; i < nfields + vorticitydim; ++i)
217 ASSERTL0(
false,
"Expansion dimension not recognised");
223 for(j = 0; j < nfields; ++j)
225 for(
unsigned int i = 0; i < fielddata.size(); ++i)
227 Exp[j]->ExtractDataToCoeffs(fielddef [i],
229 fielddef [i]->m_fields[j],
230 Exp[j]->UpdateCoeffs());
232 Exp[j]->BwdTrans(Exp[j]->GetCoeffs(),Exp[j]->UpdatePhys());
236 int nq = Exp[0]->GetNpoints();
252 if(fielddef[0]->m_numHomogeneousDir == 1)
254 ASSERTL0(
false,
"Not implemented yet");
256 else if(fielddef[0]->m_numHomogeneousDir == 2)
269 Exp[4]->FwdTrans(Qx,Exp[4]->UpdateCoeffs());
270 Exp[5]->FwdTrans(Qy,Exp[5]->UpdateCoeffs());
271 Exp[6]->FwdTrans(Qz,Exp[6]->UpdateCoeffs());
275 ASSERTL0(
false,
"Not implemented yet");
281 if(fielddef[0]->m_numHomogeneousDir == 1)
294 Exp[4]->FwdTrans(Qx,Exp[4]->UpdateCoeffs());
295 Exp[5]->FwdTrans(Qy,Exp[5]->UpdateCoeffs());
296 Exp[6]->FwdTrans(Qz,Exp[6]->UpdateCoeffs());
305 Exp[3]->FwdTrans(Qz,Exp[3]->UpdateCoeffs());
322 Exp[4]->FwdTrans(Qx,Exp[4]->UpdateCoeffs());
323 Exp[5]->FwdTrans(Qy,Exp[5]->UpdateCoeffs());
324 Exp[6]->FwdTrans(Qz,Exp[6]->UpdateCoeffs());
329 ASSERTL0(
false,
"Expansion dimension not recognised");
336 string fldfilename(argv[2]);
337 string out = fldfilename.substr(0, fldfilename.find_last_of(
"."));
338 string endfile(
"_with_vorticity.fld");
340 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
341 = Exp[0]->GetFieldDefinitions();
342 std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
344 for(j = 0; j < nfields + vorticitydim; ++j)
346 for(i = 0; i < FieldDef.size(); ++i)
352 FieldDef[i]->m_fields.push_back(
"Qx");
356 FieldDef[i]->m_fields.push_back(
"Qy");
360 FieldDef[i]->m_fields.push_back(
"Qz");
365 FieldDef[i]->m_fields.push_back(fielddef[i]->m_fields[j]);
367 Exp[j]->AppendFieldData(FieldDef[i], FieldData[i]);
#define ASSERTL0(condition, msg)
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.
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
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.
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.
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< MeshGraph > MeshGraphSharedPtr
Describes the specification for a Basis.