Lines missing in 3D algorithm of magnetostatic module

it seems that there are missing some lines at the end of the 3D algorithm of the magnetostatic module. At least a plot command should be there.
Does anybody know, what is missing?

My educated guess is that the author of the magnetostatic module used ParaView (actually for both the 2D and the 3D example).

Save in ParaView format using the iovtk-plugin (untested code off the top of my head)

load "iovtk"
int[int] ord = [1, 1, 1, 1];
savevtk("magnetostatic.vtu", Th, [Jx, Jy, Jz], [Bx, By, Bz], [Hx, Hy, Hz], [Ax, Ay, Az], dataname = "j B H A",  order = ord, bin = 1);

Thank you for the info.
Unfortunately it seems that I am not getting up to this command in the script. I guess it is a problem with the mesh. It says “Element of type 21 is not considered in Freefem++”.

Are you using the “gmsh script” from the magnetostatic module? Exactly what steps have you performed to create the mesh? Without this information I can only speculate.

Yes, I took the text for the “optional” “gmsh script for the mesh” from the magnetostatic module, copied it into a txt-file and opened this in gsmh. Then I created the mesh via “Modules”, “Mesh”, “3D” and saved the mesh via “File”, “Save Mesh”. I tried a few other options, too. But all ended up with the same message.

Of course the “Gmsh script for the 3D mesh:”.

  1. You are using MSH version 4 and this is not supported by gmshload3. Use Version 2 instead (File->Export; Save as Magnetostatic3D.msh and pick Version 2 in the next window)
  2. If it works, you will stumble over the issue that gmshload3 does not use the physical tags, but the elementary tags. I know three solutions for this. Either
    a) export as Magnetostatic3D.mesh (INRIA Medit), select physical entity as element tag and use readmesh3("Magnetostatic3D.mesh") or
    b) first export Magnetostatic3D.mesh (using physical tags), then convert to Magnetostatic3D.msh (version 2) or
    c) Use PETSc/DMPlex which support MSH version 4.

I tried 2b) and it worked.
My first 3D magnetostatic FEM simulation!
Thank you very much!

1 Like