# Lines missing in 3D algorithm of magnetostatic module

**URL:** https://community.freefem.org/t/lines-missing-in-3d-algorithm-of-magnetostatic-module/1696
**Category:** General Discussion
**Created:** [April 25, 2022, 12:05pm UTC](https://community.freefem.org/t/lines-missing-in-3d-algorithm-of-magnetostatic-module/1696 "2022-04-25T12:05:41Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![FEMfisH](https://avatars.discourse-cdn.com/v4/letter/f/57b2e6/32.png) [@FEMfisH](https://community.freefem.org/u/FEMfisH)
#### Post date: [April 25, 2022, 12:05pm UTC](https://community.freefem.org/t/lines-missing-in-3d-algorithm-of-magnetostatic-module/1696/1 "2022-04-25T12:05:41Z")

</div>

Hi,  
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?

---

<div class="post-metadata">

### Author: ![henkel](https://avatars.discourse-cdn.com/v4/letter/h/b77776/32.png) [@henkel](https://community.freefem.org/u/henkel)
#### Post date: [April 26, 2022, 2:13pm UTC](https://community.freefem.org/t/lines-missing-in-3d-algorithm-of-magnetostatic-module/1696/2 "2022-04-26T14:13:45Z")

</div>

My educated guess is that the author of the [magnetostatic module](https://modules.freefem.org/modules/magnetostatic/) used [ParaView](https://www.paraview.org/) (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)

```auto
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);

```

---

<div class="post-metadata">

### Author: ![FEMfisH](https://avatars.discourse-cdn.com/v4/letter/f/57b2e6/32.png) [@FEMfisH](https://community.freefem.org/u/FEMfisH)
#### Post date: [April 30, 2022, 3:56pm UTC](https://community.freefem.org/t/lines-missing-in-3d-algorithm-of-magnetostatic-module/1696/3 "2022-04-30T15:56:47Z")

</div>

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++”.

---

<div class="post-metadata">

### Author: ![henkel](https://avatars.discourse-cdn.com/v4/letter/h/b77776/32.png) [@henkel](https://community.freefem.org/u/henkel)
#### Post date: [May 2, 2022, 3:30pm UTC](https://community.freefem.org/t/lines-missing-in-3d-algorithm-of-magnetostatic-module/1696/4 "2022-05-02T15:30:54Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![FEMfisH](https://avatars.discourse-cdn.com/v4/letter/f/57b2e6/32.png) [@FEMfisH](https://community.freefem.org/u/FEMfisH)
#### Post date: [May 2, 2022, 5:13pm UTC](https://community.freefem.org/t/lines-missing-in-3d-algorithm-of-magnetostatic-module/1696/5 "2022-05-02T17:13:04Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![FEMfisH](https://avatars.discourse-cdn.com/v4/letter/f/57b2e6/32.png) [@FEMfisH](https://community.freefem.org/u/FEMfisH)
#### Post date: [May 2, 2022, 5:14pm UTC](https://community.freefem.org/t/lines-missing-in-3d-algorithm-of-magnetostatic-module/1696/6 "2022-05-02T17:14:48Z")

</div>

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

---

<div class="post-metadata">

### Author: ![henkel](https://avatars.discourse-cdn.com/v4/letter/h/b77776/32.png) [@henkel](https://community.freefem.org/u/henkel)
#### Post date: [May 3, 2022, 1:38pm UTC](https://community.freefem.org/t/lines-missing-in-3d-algorithm-of-magnetostatic-module/1696/7 "2022-05-03T13:38:04Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![FEMfisH](https://avatars.discourse-cdn.com/v4/letter/f/57b2e6/32.png) [@FEMfisH](https://community.freefem.org/u/FEMfisH)
#### Post date: [May 3, 2022, 5:24pm UTC](https://community.freefem.org/t/lines-missing-in-3d-algorithm-of-magnetostatic-module/1696/8 "2022-05-03T17:24:43Z")

</div>

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