27 fprintf(stderr,
"Usage: ./CalcDivergence file.xml file.fld\n");
32 = LibUtilities::SessionReader::CreateInstance(argc, argv);
37 string meshfile(argv[argc-2]);
43 string fieldfile(argv[argc-1]);
44 vector<LibUtilities::FieldDefinitionsSharedPtr> fielddef;
45 vector<vector<NekDouble> > fielddata;
48 bool dealiasing =
false;
53 int expdim = graphShPt->GetMeshDimension();
54 int nfields = fielddef[0]->m_fields.size();
62 ASSERTL0(fielddef[0]->m_numHomogeneousDir <= 2,
"Quasi-3D approach is only set up for 1 or 2 homogeneous directions");
64 if(fielddef[0]->m_numHomogeneousDir == 1)
72 vSession->LoadParameter(
"HomModesZ",nplanes,fielddef[0]->m_numModes[1]);
77 NekDouble ly = fielddef[0]->m_homogeneousLengths[0];
82 for(i = 1; i < nfields + 1; ++i)
87 else if(fielddef[0]->m_numHomogeneousDir == 2)
97 vSession->LoadParameter(
"HomModesY",nylines,fielddef[0]->m_numModes[1]);
98 vSession->LoadParameter(
"HomModesZ",nzlines,fielddef[0]->m_numModes[2]);
107 NekDouble ly = fielddef[0]->m_homogeneousLengths[0];
108 NekDouble lz = fielddef[0]->m_homogeneousLengths[1];
113 for(i = 1; i < nfields + 1; ++i)
124 for(i = 1; i < nfields + 1; ++i)
134 ASSERTL0(fielddef[0]->m_numHomogeneousDir <= 1,
"NumHomogeneousDir is only set up for 1");
136 if(fielddef[0]->m_numHomogeneousDir == 1)
144 vSession->LoadParameter(
"HomModesZ",nplanes,fielddef[0]->m_numModes[2]);
150 NekDouble lz = fielddef[0]->m_homogeneousLengths[0];
155 for(i = 1; i < nfields + 1; ++i)
167 for(i = 1; i < nfields + 1; ++i)
182 for(i = 1; i < nfields + 1; ++i)
190 ASSERTL0(
false,
"Expansion dimension not recognised");
196 for(j = 0; j < nfields; ++j)
198 for(
unsigned int i = 0; i < fielddata.size(); ++i)
200 Exp[j]->ExtractDataToCoeffs(fielddef [i],
202 fielddef [i]->m_fields[j],
203 Exp[j]->UpdateCoeffs());
205 Exp[j]->BwdTrans(Exp[j]->GetCoeffs(),Exp[j]->UpdatePhys());
209 int nq = Exp[0]->GetNpoints();
219 if(fielddef[0]->m_numHomogeneousDir == 1)
221 ASSERTL0(
false,
"Not implemented yet");
223 else if(fielddef[0]->m_numHomogeneousDir == 2)
225 ASSERTL0(
false,
"Not implemented yet");
229 ASSERTL0(
false,
"Not implemented yet");
235 if(fielddef[0]->m_numHomogeneousDir == 1)
237 ASSERTL0(
false,
"Not implemented yet");
246 Exp[3]->FwdTrans(Div,Exp[3]->UpdateCoeffs());
252 ASSERTL0(
false,
"Not implemented yet");
257 ASSERTL0(
false,
"Expansion dimension not recognised");
264 string fldfilename(argv[2]);
265 string out = fldfilename.substr(0, fldfilename.find_last_of(
"."));
266 string endfile(
"_with_divergence.fld");
268 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
269 = Exp[0]->GetFieldDefinitions();
270 std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
272 for(j = 0; j < nfields + 1; ++j)
274 for(i = 0; i < FieldDef.size(); ++i)
278 FieldDef[i]->m_fields.push_back(
"Div");
282 FieldDef[i]->m_fields.push_back(fielddef[i]->m_fields[j]);
284 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.