30 using namespace Nektar;
32 int main(
int argc,
char *argv[])
38 fprintf(stderr,
"Usage: ./StreamFunction2D file.xml file.fld\n");
48 string meshfile(argv[argc-2]);
54 string fieldfile(argv[argc-1]);
55 vector<LibUtilities::FieldDefinitionsSharedPtr> fielddef;
56 vector<vector<NekDouble> > fielddata;
61 int expdim = graphShPt->GetMeshDimension();
62 int nfields = fielddef[0]->m_fields.size();
69 Array<OneD, MultiRegions::ExpListSharedPtr> Exp(nfields + vorticitydim);
71 Array<OneD, MultiRegions::ExpListSharedPtr> FieldVar(1);
87 for(i = 1; i < nfields + vorticitydim; ++i)
97 ASSERTL0(
false,
"The input file must be two-dimensional");
103 for(j = 0; j < nfields; ++j)
105 for(
unsigned int i = 0; i < fielddata.size(); ++i)
107 Exp[j]->ExtractDataToCoeffs(fielddef [i],
109 fielddef [i]->m_fields[j],
110 Exp[j]->UpdateCoeffs());
112 Exp[j]->BwdTrans(Exp[j]->GetCoeffs(),Exp[j]->UpdatePhys());
116 int nq = Exp[0]->GetNpoints();
118 Array<OneD, NekDouble> Uy(nq);
119 Array<OneD, NekDouble> Vx(nq);
121 Array<OneD, NekDouble> StreamFunc(nq);
122 Array<OneD, NekDouble> Qz(nq);
137 Exp[3]->FwdTrans(Qz, Exp[3]->UpdateCoeffs());
147 FieldVar[0]->HelmSolve(Qz, Exp[4]->UpdateCoeffs(),
NullFlagList, factor);
154 ASSERTL0(
false,
"The input file must be two-dimensional");
161 string fldfilename(argv[2]);
162 string out = fldfilename.substr(0, fldfilename.find_last_of(
"."));
163 string endfile(
"_with_2DstremFunction.fld");
165 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
166 = Exp[0]->GetFieldDefinitions();
167 std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
169 for(j = 0; j < nfields + vorticitydim; ++j)
171 for(i = 0; i < FieldDef.size(); ++i)
177 FieldDef[i]->m_fields.push_back(
"StreamFunc");
181 FieldDef[i]->m_fields.push_back(
"Qz");
186 FieldDef[i]->m_fields.push_back(fielddef[i]->m_fields[j]);
188 Exp[j]->AppendFieldData(FieldDef[i], FieldData[i]);