12 using namespace Nektar;
14 int main(
int argc,
char *argv[])
20 fprintf(stderr,
"Usage: L2 nfield meshfile fld \n");
24 int nfield = boost::lexical_cast<
int>(argv[argc-3]);
32 string meshfile(argv[argc-2]);
38 string fieldfile(argv[argc-1]);
39 vector<LibUtilities::FieldDefinitionsSharedPtr> fielddef;
40 vector<vector<NekDouble> > fielddata;
43 bool dealiasing =
false;
48 int expdim = graphShPt->GetMeshDimension();
49 int nfields = fielddef[0]->m_fields.size();
50 Array<OneD, MultiRegions::ExpListSharedPtr> Exp(nfields);
52 ASSERTL0((nfield >= 0)&&(nfield < nfields),
"Value of nfield must be between zero and less than the number of fields in the file");
58 ASSERTL0(fielddef[0]->m_numHomogeneousDir <= 2,
"Quasi-3D approach is only set up for 1 or 2 homogeneous directions");
60 if(fielddef[0]->m_numHomogeneousDir == 1)
65 int nplanes = fielddef[0]->m_numModes[1];
70 NekDouble ly = fielddef[0]->m_homogeneousLengths[0];
75 for(i = 1; i < nfields; ++i)
80 else if(fielddef[0]->m_numHomogeneousDir == 2)
85 int nylines = fielddef[0]->m_numModes[1];
86 int nzlines = fielddef[0]->m_numModes[2];
95 NekDouble ly = fielddef[0]->m_homogeneousLengths[0];
96 NekDouble lz = fielddef[0]->m_homogeneousLengths[1];
101 for(i = 1; i < nfields; ++i)
112 for(i = 1; i < nfields; ++i)
122 ASSERTL0(fielddef[0]->m_numHomogeneousDir <= 1,
"NumHomogeneousDir is only set up for 1");
124 if(fielddef[0]->m_numHomogeneousDir == 1)
129 int nplanes = fielddef[0]->m_numModes[2];
135 NekDouble lz = fielddef[0]->m_homogeneousLengths[0];
140 for(i = 1; i < nfields; ++i)
153 for(i = 1; i < nfields; ++i)
168 for(i = 1; i < nfields; ++i)
176 ASSERTL0(
false,
"Expansion dimension not recognised");
183 for(j = 0; j < nfields; ++j)
185 for(
int i = 0; i < fielddata.size(); ++i)
187 Exp[j]->ExtractDataToCoeffs(fielddef [i],
189 fielddef [i]->m_fields[j],
190 Exp[j]->UpdateCoeffs());
192 Exp[j]->BwdTrans(Exp[j]->GetCoeffs(),Exp[j]->UpdatePhys());
196 cout <<
"L2 of field "<< nfield <<
" is : " << Exp[nfield]->L2(Exp[nfield]->GetPhys()) << endl;