11 using namespace Nektar;
13 int main(
int argc,
char *argv[])
25 "Usage: ProbeFld meshfile fieldfile N x0 y0 z0 dx dy dz\n");
27 " Probes N points along the line from (x0,y0,z0) to "
28 "(x0+dx, y0+dy, z0+dz)\n");
30 "ProbeFld meshfile fieldfile points.txt\n");
32 " Probes the solution at the points in the points.txt file.\n");
34 " Points are given as space-separated x y z on each line.\n");
43 string meshfile(argv[1]);
49 string fieldfile(argv[2]);
50 vector<LibUtilities::FieldDefinitionsSharedPtr> fielddef;
51 vector<vector<NekDouble> > fielddata;
57 vector< vector<LibUtilities::PointsType> > pointstype;
58 for(i = 0; i < fielddef.size(); ++i)
60 vector<LibUtilities::PointsType> ptype;
61 for(j = 0; j < 3; ++j)
65 pointstype.push_back(ptype);
67 graphShPt->SetExpansions(fielddef,pointstype);
69 bool dealiasing =
false;
75 int expdim = graphShPt->GetMeshDimension();
76 int nfields = fielddef[0]->m_fields.size();
77 Array<OneD, MultiRegions::ExpListSharedPtr> Exp(nfields);
83 ASSERTL0(fielddef[0]->m_numHomogeneousDir <= 2,
"NumHomogeneousDir is only set up for 1 or 2");
85 if(fielddef[0]->m_numHomogeneousDir == 1)
92 vSession->LoadParameter(
"HomModesZ",nplanes,fielddef[0]->m_numModes[1]);
97 NekDouble ly = fielddef[0]->m_homogeneousLengths[0];
102 for(i = 1; i < nfields; ++i)
107 else if(fielddef[0]->m_numHomogeneousDir == 2)
117 vSession->LoadParameter(
"HomModesY",nylines,fielddef[0]->m_numModes[1]);
118 vSession->LoadParameter(
"HomModesZ",nzlines,fielddef[0]->m_numModes[2]);
127 NekDouble ly = fielddef[0]->m_homogeneousLengths[0];
128 NekDouble lz = fielddef[0]->m_homogeneousLengths[1];
133 for(i = 1; i < nfields; ++i)
144 for(i = 1; i < nfields; ++i)
154 ASSERTL0(fielddef[0]->m_numHomogeneousDir <= 1,
"NumHomogeneousDir is only set up for 1");
156 if(fielddef[0]->m_numHomogeneousDir == 1)
164 vSession->LoadParameter(
"HomModesZ",nplanes,fielddef[0]->m_numModes[2]);
170 NekDouble lz = fielddef[0]->m_homogeneousLengths[0];
175 for(i = 1; i < nfields; ++i)
187 for(i = 1; i < nfields; ++i)
202 for(i = 1; i < nfields; ++i)
211 ASSERTL0(
false,
"Expansion dimension not recognised");
218 for(j = 0; j < nfields; ++j)
220 for(
int i = 0; i < fielddata.size(); ++i)
222 Exp[j]->ExtractDataToCoeffs(fielddef [i],
224 fielddef [i]->m_fields[j],
225 Exp[j]->UpdateCoeffs());
227 Exp[j]->BwdTrans(Exp[j]->GetCoeffs(),Exp[j]->UpdatePhys());
231 Array<OneD, NekDouble> gloCoord(3,0.0);
235 ifstream pts(argv[3]);
236 while (getline(pts, line))
238 stringstream ss(line);
242 cout << gloCoord[0] <<
" " << gloCoord[1] <<
" " << gloCoord[2];
245 for (
int j = 0; j < nfields; ++j)
253 Array<OneD, NekDouble> phys(Exp[j]->GetPhys() + Exp[j]->GetPhys_Offset(ExpId));
254 cout <<
" " << Exp[j]->GetExp(ExpId)->PhysEvaluate(gloCoord, phys);
269 NekDouble dx = atof(argv[7])/(N>1 ? (N-1) : 1);
270 NekDouble dy = atof(argv[8])/(N>1 ? (N-1) : 1);
271 NekDouble dz = atof(argv[9])/(N>1 ? (N-1) : 1);
273 for (
int i = 0; i < N; ++i)
275 gloCoord[0] = x0 + i*dx;
276 gloCoord[1] = y0 + i*dy;
277 gloCoord[2] = z0 + i*dz;
278 cout << gloCoord[0] <<
" " << gloCoord[1] <<
" " << gloCoord[2];
281 for (
int j = 0; j < nfields; ++j)
289 Array<OneD, NekDouble> phys(Exp[j]->GetPhys() + Exp[j]->GetPhys_Offset(ExpId));
290 cout <<
" " << Exp[j]->GetExp(ExpId)->PhysEvaluate(gloCoord, phys);