Saving Data from Electromagnetism Simulation with Nedelec Edge Elements

ubject: Saving Data from Electromagnetism Simulation with Nedelec Edge Elements

Good afternoon everyone,

I’m writing because I’m trying to save data after running an electromagnetism simulation based on Nedelec Edge elements, defined on a uniform 3D mesh.

When I save the data, I compute the electromagnetic field on a uniform grid of points inside the domain. However, I’m noticing significant interpolation errors. For example, I obtain a non-zero E_z component, even though it should be zero (since it’s a TE simulation). In some points, I see values like -40, which are clearly incorrect.

The same issue occurs with the real or imaginary parts of E_x. Here’s how I’m currently saving the data:

int Nx = 60, Ny = 60, Nz = 60;
real Ax = a, By = b, Cz = c;

ofstream fout(“solution_grid.txt”);
fout << Nx << " " << Ny << " " << Nz << " " << Ax << " " << By << " " << Cz << endl;

for (int ix = 0; ix <= Nx; ix++){
real xx = Ax * ix / Nx;
for (int iy = 0; iy <= Ny; iy++){
real yy = By * iy / Ny;
for (int iz = 0; iz <= Nz; iz++){
real zz = Cz * iz / Nz;

  complex ex = Ex(xx,yy,zz);
  complex ey = Ey(xx,yy,zz);
  complex ez = Ez(xx,yy,zz);

  fout << xx << " " << yy << " " << zz << " "
       << real(ex) << " " << imag(ex) << " "
       << real(ey) << " " << imag(ey) << " "
       << real(ez) << " " << imag(ez) << "\n";
}

}
}

Is this the correct way to evaluate a field, defined in an edge space, at specific points?

It is Ok for me, but youn can not use this to rebuild the field E=[Ex,Ey,Ez]

Hello Sir, thank you for your kind response.
What can I use for evaluating correctly the field at specific points?
Because with my solution, as I said, I’m not obtaining good results.

Thank you so much for the help.