20 int main(
int argc,
char *argv[])
26 fprintf(stderr,
"Usage: ./CalcDivergence file.xml file.fld\n");
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();
61 ASSERTL0(fielddef[0]->m_numHomogeneousDir <= 2,
"Quasi-3D approach is only set up for 1 or 2 homogeneous directions");
63 if(fielddef[0]->m_numHomogeneousDir == 1)
71 vSession->LoadParameter(
"HomModesZ",nplanes,fielddef[0]->m_numModes[1]);
76 NekDouble ly = fielddef[0]->m_homogeneousLengths[0];
81 for(i = 1; i < nfields + 1; ++i)
86 else if(fielddef[0]->m_numHomogeneousDir == 2)
96 vSession->LoadParameter(
"HomModesY",nylines,fielddef[0]->m_numModes[1]);
97 vSession->LoadParameter(
"HomModesZ",nzlines,fielddef[0]->m_numModes[2]);
106 NekDouble ly = fielddef[0]->m_homogeneousLengths[0];
107 NekDouble lz = fielddef[0]->m_homogeneousLengths[1];
112 for(i = 1; i < nfields + 1; ++i)
123 for(i = 1; i < nfields + 1; ++i)
133 ASSERTL0(fielddef[0]->m_numHomogeneousDir <= 1,
"NumHomogeneousDir is only set up for 1");
135 if(fielddef[0]->m_numHomogeneousDir == 1)
143 vSession->LoadParameter(
"HomModesZ",nplanes,fielddef[0]->m_numModes[2]);
149 NekDouble lz = fielddef[0]->m_homogeneousLengths[0];
154 for(i = 1; i < nfields + 1; ++i)
166 for(i = 1; i < nfields + 1; ++i)
181 for(i = 1; i < nfields + 1; ++i)
189 ASSERTL0(
false,
"Expansion dimension not recognised");
195 for(j = 0; j < nfields; ++j)
197 for(
unsigned int i = 0; i < fielddata.size(); ++i)
199 Exp[j]->ExtractDataToCoeffs(fielddef [i],
201 fielddef [i]->m_fields[j],
202 Exp[j]->UpdateCoeffs());
204 Exp[j]->BwdTrans(Exp[j]->GetCoeffs(),Exp[j]->UpdatePhys());
208 int nq = Exp[0]->GetNpoints();
218 if(fielddef[0]->m_numHomogeneousDir == 1)
220 ASSERTL0(
false,
"Not implemented yet");
222 else if(fielddef[0]->m_numHomogeneousDir == 2)
224 ASSERTL0(
false,
"Not implemented yet");
228 ASSERTL0(
false,
"Not implemented yet");
234 if(fielddef[0]->m_numHomogeneousDir == 1)
236 ASSERTL0(
false,
"Not implemented yet");
245 Exp[3]->FwdTrans(Div,Exp[3]->UpdateCoeffs());
251 ASSERTL0(
false,
"Not implemented yet");
256 ASSERTL0(
false,
"Expansion dimension not recognised");
263 string fldfilename(argv[2]);
264 string out = fldfilename.substr(0, fldfilename.find_last_of(
"."));
265 string endfile(
"_with_divergence.fld");
267 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
268 = Exp[0]->GetFieldDefinitions();
269 std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
271 for(j = 0; j < nfields + 1; ++j)
273 for(i = 0; i < FieldDef.size(); ++i)
277 FieldDef[i]->m_fields.push_back(
"Div");
281 FieldDef[i]->m_fields.push_back(fielddef[i]->m_fields[j]);
283 Exp[j]->AppendFieldData(FieldDef[i], FieldData[i]);
#define ASSERTL0(condition, msg)
static boost::shared_ptr< MeshGraph > Read(const LibUtilities::SessionReaderSharedPtr &pSession, DomainRangeShPtr &rng=NullDomainRangeShPtr)
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
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
static SessionReaderSharedPtr CreateInstance(int argc, char *argv[])
Creates an instance of the SessionReader class.
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
int main(int argc, char *argv[])
Describes the specification for a Basis.