42 namespace MultiRegions
56 const bool dealiasing):
68 const bool dealiasing,
70 const std::string &var):
84 const bool dealiasing,
105 for(j = 0; j < nel; ++j)
113 for(j = 0; j < nel; ++j)
115 (*m_exp).push_back((*
m_exp)[j]);
136 if(DeclarePlanesSetCoeffPhys)
141 for(
int n = 0; n <
m_planes.num_elements(); ++n)
160 int ncoeffs_per_plane =
m_planes[0]->GetNcoeffs();
161 int npoints_per_plane =
m_planes[0]->GetTotPoints();
163 int nzplanes =
m_planes.num_elements();
172 int nel =
m_planes[0]->GetExpSize();
176 Array<OneD, NekDouble> tmparray;
178 for(cnt = n = 0; n < nzplanes; ++n)
181 m_planes[n]->SetPhysArray(tmparray =
m_phys + npoints_per_plane*n);
183 for(i = 0; i < nel; ++i)
186 m_phys_offset[cnt] =
m_planes[n]->GetPhys_Offset(i) + n*npoints_per_plane;
187 m_offset_elmt_id[cnt++] =
m_planes[n]->GetOffset_Elmt_Id(i) + n*nel;
193 Array<OneD, NekDouble> &xc0,
194 Array<OneD, NekDouble> &xc1,
195 Array<OneD, NekDouble> &xc2)
198 Array<OneD, NekDouble> tmp_xc;
199 int nzplanes =
m_planes.num_elements();
202 (*m_exp)[eid]->GetCoords(xc0,xc1);
206 Array<OneD, NekDouble> local_pts(
m_planes.num_elements());
208 for(n = 0; n <
m_planes.num_elements(); n++)
213 Array<OneD, NekDouble> z(nzplanes);
218 for(n = 0; n < nzplanes; ++n)
220 Vmath::Fill(npoints,z[n],tmp_xc = xc2 + npoints*n,1);
246 Array<OneD, NekDouble> &xc1,
247 Array<OneD, NekDouble> &xc2)
250 Array<OneD, NekDouble> tmp_xc;
251 int nzplanes =
m_planes.num_elements();
252 int npoints =
m_planes[0]->GetTotPoints();
259 Array<OneD, NekDouble> local_pts(
m_planes.num_elements());
261 for(n = 0; n <
m_planes.num_elements(); n++)
266 Array<OneD, NekDouble> z(nzplanes);
271 for(n = 0; n < nzplanes; ++n)
273 Vmath::Fill(npoints,z[n],tmp_xc = xc2 + npoints*n,1);
284 ASSERTL0(expansion == -1,
"Multi-zone output not supported for homogeneous expansions.");
286 const int nPtsPlane =
m_planes[0]->GetNpoints();
287 const int nElmt =
m_planes[0]->GetExpSize();
288 const int nPlanes =
m_planes.num_elements();
292 for (
int i = 0; i < nElmt; ++i)
294 const int np0 = (*m_exp)[i]->GetNumPoints(0);
295 const int np1 = (*m_exp)[i]->GetNumPoints(1);
297 for (
int n = 1; n < nPlanes; ++n)
299 const int o1 = (n-1) * nPtsPlane;
300 const int o2 = n * nPtsPlane;
301 for (
int j = 1; j < np1; ++j)
303 for(
int k = 1; k < np0; ++k)
305 outfile << cnt + (j-1)*np0 + (k-1) + o1 + 1 <<
" ";
306 outfile << cnt + (j-1)*np0 + (k-1) + o2 + 1 <<
" ";
307 outfile << cnt + (j-1)*np0 + k + o2 + 1 <<
" ";
308 outfile << cnt + (j-1)*np0 + k + o1 + 1 <<
" ";
309 outfile << cnt + j *np0 + (k-1) + o1 + 1 <<
" ";
310 outfile << cnt + j *np0 + (k-1) + o2 + 1 <<
" ";
311 outfile << cnt + j *np0 + k + o2 + 1 <<
" ";
312 outfile << cnt + j *np0 + k + o1 + 1 << endl;
325 int nquad0 = (*m_exp)[expansion]->GetNumPoints(0);
326 int nquad1 = (*m_exp)[expansion]->GetNumPoints(1);
327 int nquad2 =
m_planes.num_elements();
328 int ntot = nquad0*nquad1*nquad2;
329 int ntotminus = (nquad0-1)*(nquad1-1)*(nquad2-1);
331 Array<OneD,NekDouble> coords[3];
332 coords[0] = Array<OneD,NekDouble>(ntot);
333 coords[1] = Array<OneD,NekDouble>(ntot);
334 coords[2] = Array<OneD,NekDouble>(ntot);
335 GetCoords(expansion,coords[0],coords[1],coords[2]);
337 outfile <<
" <Piece NumberOfPoints=\""
338 << ntot <<
"\" NumberOfCells=\""
339 << ntotminus <<
"\">" << endl;
340 outfile <<
" <Points>" << endl;
341 outfile <<
" <DataArray type=\"Float32\" "
342 <<
"NumberOfComponents=\"3\" format=\"ascii\">" << endl;
344 for (i = 0; i < ntot; ++i)
346 for (j = 0; j < 3; ++j)
348 outfile << coords[j][i] <<
" ";
353 outfile <<
" </DataArray>" << endl;
354 outfile <<
" </Points>" << endl;
355 outfile <<
" <Cells>" << endl;
356 outfile <<
" <DataArray type=\"Int32\" "
357 <<
"Name=\"connectivity\" format=\"ascii\">" << endl;
358 for (i = 0; i < nquad0-1; ++i)
360 for (j = 0; j < nquad1-1; ++j)
362 for (k = 0; k < nquad2-1; ++k)
364 outfile << k*nquad0*nquad1 + j*nquad0 + i <<
" "
365 << k*nquad0*nquad1 + j*nquad0 + i + 1 <<
" "
366 << k*nquad0*nquad1 + (j+1)*nquad0 + i + 1 <<
" "
367 << k*nquad0*nquad1 + (j+1)*nquad0 + i <<
" "
368 << (k+1)*nquad0*nquad1 + j*nquad0 + i <<
" "
369 << (k+1)*nquad0*nquad1 + j*nquad0 + i + 1 <<
" "
370 << (k+1)*nquad0*nquad1 + (j+1)*nquad0 + i + 1 <<
" "
371 << (k+1)*nquad0*nquad1 + (j+1)*nquad0 + i <<
" " << endl;
376 outfile <<
" </DataArray>" << endl;
377 outfile <<
" <DataArray type=\"Int32\" "
378 <<
"Name=\"offsets\" format=\"ascii\">" << endl;
379 for (i = 0; i < ntotminus; ++i)
381 outfile << i*8+8 <<
" ";
384 outfile <<
" </DataArray>" << endl;
385 outfile <<
" <DataArray type=\"UInt8\" "
386 <<
"Name=\"types\" format=\"ascii\">" << endl;
387 for (i = 0; i < ntotminus; ++i)
392 outfile <<
" </DataArray>" << endl;
393 outfile <<
" </Cells>" << endl;
394 outfile <<
" <PointData>" << endl;
399 const Array<OneD, const NekDouble> &inarray,
400 const Array<OneD, const NekDouble> &soln)
405 Array<OneD, NekDouble> local_w(
m_planes.num_elements());
407 for(
int n = 0; n <
m_planes.num_elements(); n++)
414 for(
int n = 0; n <
m_planes.num_elements(); ++n)
416 errL2 =
m_planes[n]->L2(inarray + cnt);
418 err += errL2*errL2*local_w[n]*
m_lhom*0.5;
423 for(
int n = 0; n <
m_planes.num_elements(); ++n)
425 errL2 =
m_planes[n]->L2(inarray + cnt, soln + cnt);
427 err += errL2*errL2*local_w[n]*
m_lhom*0.5;
437 Array<OneD, NekDouble> energy(
m_planes.num_elements()/2);
441 for (
int n = 0; n <
m_planes[0]->GetExpSize(); ++n)
444 area +=
m_planes[0]->GetExp(n)->Integral(inarray);
450 for (
int n = 0; n <
m_planes.num_elements(); n += 2)
456 for(
int i = 0; i <
m_planes[n]->GetExpSize(); ++i)
459 Array<OneD, NekDouble> phys(exp->GetTotPoints());
463 energy[n/2] += err*err;
469 energy[n/2] += err*err;
473 energy[n/2] /= 2.0*area;