Output of setgeom

85 views
Skip to first unread message

zishuo liu

unread,
Dec 17, 2025, 5:19:02 AM12/17/25
to mumax2

Hello everyone, 

I'm currently performing an FMR simulation on Permalloy. However, I have a question regarding the setgeom code.

When I imported the output OVF file into MumaxView, I expected the geometry to be 50×50×20. Yet, I noticed the results don't match the grid dimensions I set. Could you please explain why this is happening? I am very grateful for any help!


屏幕截图 2025-12-17 181457.png

I also attached the code below.

//////// Structure parameters //////////////////
SetGridsize(50, 50, 20)
SetCellsize(5e-9, 5e-9, 5e-9)
setPBC(1,1,0)
a := cuboid(1000e-9,1000e-9,2000e-9).transl(0, 0, 0)
setgeom(a)
saveas(geom, "logicAdd")
Msat  = 800e3
Aex   = 13e-12
alpha = 0.02              
m     = uniform(0.01*rand(), 1, 0)
RandomMagSeed(1)
//////////// Output ////////////
save(geom)
save(m)
save(regions)
autosave(m, 5e-9)

Антон Луценко

unread,
Dec 17, 2025, 6:18:06 AM12/17/25
to mumax2
Hi,
What is the file you loaded into MumaxView? Is that Regions or Geom file? MumaxView only works correctly with vector fields (with dimensions [...,3], like magnetization or magnetic field), so try loading m file instead. 
Also, your setgeom cuboid (1000 × 1000 × 2000 nm³) seems to be much larger than your simulation area (250 × 250 × 100 nm³), which just makes everything in the simulation area belong to the geom. Are you sure about these parameters? What is your desired configuration?

zishuo liu

unread,
Dec 17, 2025, 7:26:32 AM12/17/25
to mumax2
Hi, Thank you very much for your reply. I was loading the geom file. I have now realized this was incorrect.  
The region I intended to simulate is the material section (250 × 250 × 100 nm³).But I am still confused about the usage of geom. For example, can I define multiple geom sections within a single material? When applying an external magnetic field to the entire structure.Under the influence of an external magnetic field, is it only structures that have undergone geom that respond to external conditions?
I have another question regarding PBC. When setting PBC to (1,1,0), does this mean the structure is replicated once in both the x and y directions, or does it represent an infinitely large film within the xy plane? Currently, standing waves exist in my simulation, but I don't know how to eliminate them.
Looking forward to your reply.

pure-py1.txt

Антон Луценко

unread,
Dec 17, 2025, 9:43:58 AM12/17/25
to mumax2
Hi,

You can define several regions and combine them with boolean operations (like in the example you likely referenced, judging by `saveas(geom, "logicAdd")` ), and then use setGeom(yourDesiredRegion) once. The "outside" of the region will not be simulated at all: magnetization there would be set to (0,0,0) . 

When setting the PBC, a few things happen: 1. the boundary conditions are considered as periodic for exchange and like interactions; 2. the demag field would include the contributions from the given number of shifted copies, 3. padding/clipping is not performed during FFT in demag field calculation for selected axes, so the computational load becomes smaller, but the simulation area behaves as a cell in (quasi-)infinite periodic structure. So your demag kernel is not for the truly infinitely large film. Therefore, your PBC numbers should be "as big as necessary" so that the kernel is accurate enough, but "not too big" because you don't want to wait for a week to compute all these contributions. It is also recommended to cache the kernel so you don't need to recompute it every time you change a (non-mesh) parameter in the simulation. 

Standing waves would exist always if your sample has more than one cell along the relevant axis. You can try to partially suppress them by using absorbing boundaries or influence their wavelengths by changing the size of the simulation area. Alternatively, if you are only and specifically interested in FMR and, perhaps, PSSW, you can try other micromagnetic simulators that have frequency-domain eigensolver, e.g. TetraX.

zishuo liu

unread,
Dec 19, 2025, 10:03:19 AM12/19/25
to mumax2
Hi,
Thank you for your  response. Based on your explanation, I understand that setgeom is an important tool for simulating complex geometries. If I'm correct in my understanding, for the rectangular prism-type material I'm simulating, I can omit the setgeom code.

When simulating a thin-film material, which method is more appropriate: increasing the grid size or increasing the periodic boundary conditions (PBC)? At what ratio of the x and y axis dimensions to the z axis dimension can a structure be considered a thin film?With PBC set to 110 and the z-axis grid size set to 33, I altered the x and y grid sizes (testing 10, 50, 80, 128, and 256 respectively), but the experimental results showed no significant changes. This has left me somewhat perplexed, as none of these conditions qualify as thin films.

Thank you in advance for your reply!


AFM.txt

Антон Луценко

unread,
Dec 20, 2025, 10:01:21 AM12/20/25
to mumax2
Hi, 
To evaluate this, you usually compare effective physical sizes of the dimensions, i.e. you would compare cx×Nx×PBCx (rather than cx×Nx) to cz×Nz , and Y-dimension as well. While it's not 100% correct (even PBC of 1 "tries" to make the axis infinite), it gives enough insight into the behavior. To make the simulation maximally accurate for the thin film, these effective in-plane sizes needs to be "large enough" compared to the thickness. Both cell count and cell size are impactful for this. E.g. Nxeff = Nyeff = 10×110 is quite large compared to Nz=33, assuming cx=cz. 

The trade-offs are such that 1. number of cells impacts computational load and thus performance (less cells is faster), 2. effective number of cells impacts computation time for the demag kernel (though with kernel caching it is spent only once), 3. PBC impacts accuracy (higher is closer to "infinity") but naturally has diminishing returns. 
Reply all
Reply to author
Forward
0 new messages