Simulation about micromagnetism , all discretized nodes coordinates and demagnetization calculation

36 views
Skip to first unread message

zeyu li

unread,
Aug 27, 2025, 1:36:36 AMAug 27
to mumax2
hi. I want to get some data likes coordinate x y z and its related m +  H_demag in LLG process or energy minimization , but fail to output. 
I found it can output specified x y z as shown, 
variable := m.getcell(0, 0, 0)
print(variable)
//[0.7071067690849304 -0.7071067690849304 0]

How can i get all discretized nodes coordinates and its m +  H_demag in table.txt? 
e.g.
x y z phi
68.5 0.866025 1 0.380477
67.5302 0.657764 0 -0.376354
67.5302 0.657764 1 0.376354
67.7 1.04324 0.5 0.00449699

Thanks.

Josh Lauzier

unread,
Aug 27, 2025, 4:26:32 PM (14 days ago) Aug 27
to mumax2
Hi,

If you want full spatial data for your simulation, you should save an OVF file using the save() or saveas() functions. This will save a quantity (like m, or B_demag) into a file separate from the table.

By default, OVFs don't explicitly list the x/y/z coordinates, but it can be deduced by the format, it lists each cell in order. By default, OVFs are in binary, but you can convert them to text using  OutputFormat = OVF2_TEXT . You can read more about the format in previous dicussions or in the specification page, but it is pretty straightforward once you see a few examples. it's basically just an array saved to a file. So e.g. m for cell (0,0,0) will be the first value after the header.

Best,
Josh L.

zeyu li

unread,
Sep 2, 2025, 9:22:41 PM (8 days ago) Sep 2
to mum...@googlegroups.com
Thanks.  OutputFormat = OVF2_TEXT is useful. But what about x y z of irregular domains and how to use add() to define ? e.g.  A domain i.e. on top of a cuboid, there are one or more ellipsoids.   
a:= cuboid(800e-9, 600e-9, 50e-9)

b:=ellipsoid(100e-9, 60e-9, 50e-9).transl(0, 0, 100e-9)

setgeom(a.add(b))
saveas(geom, "cuboid_ellipsoid")
And it shown as follows, which  fail to define an ellipsoid on top of a cuboid.
image.png

Josh Lauzier <joshl...@gmail.com> 于2025年8月28日周四 04:26写道:
--
You received this message because you are subscribed to the Google Groups "mumax2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mumax2+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/mumax2/a4aea72f-2906-44e6-9979-a535b14a77ddn%40googlegroups.com.

Josh Lauzier

unread,
Sep 2, 2025, 10:35:03 PM (8 days ago) Sep 2
to mumax2
Hi,

I would double check your visualization. That does indeed produce an ellipse on top of a cuboid:

mumaxhelp4.jpg

SetGridsize(100, 100, 100)
SetCellsize(1e-6/100, 1e-6/100, 1e-6/100)

a:= cuboid(800e-9, 600e-9, 50e-9)
b:=ellipsoid(100e-9, 60e-9, 50e-9).transl(0, 0, 100e-9) 
defregion(1,a)
defregion(2,b)
m.setregion(1, uniform(1, 0, 0))
m.setregion(2, uniform(-1, 0, 0))
setgeom(a.add(b))
save(m)

My guess it that you're looking at it from below, which obscures the ellipse. For irregular geometries, it will still save the OVF for the whole simulation box, it will simply have (0,0,0) for cells that aren't in the geometry.

Best,
Josh L.
Reply all
Reply to author
Forward
0 new messages