scieee AI-readable full text Open interactive document viewer

GPU-Accelerated 2D FFT for Magnon Density and Phase in Mumax3 Simulations.

Khymyn, Roman

Abstract

This Python script helps to visualize profiles of the magnon density and phase. It calculates 2D FFT from the Mumax3 output (micromagnetic simulations) for the selected z-layer of the magnetic sample. The script must be run on a CUDA-compatible GPU (Nvidia). The script is aimed at relatively large samples, so it cut the sample into slabs to fit in GPU memory. Input: The script takes as input a standard Mumax3 .out folder with the .dump, .ovf or .npy files. Output: .npy files for the magnon density and phase for each FFT frequency. Dependencies: mumax3-converter, CuPy, NumPy Running the code: The script can be executed from IDE, as a callable function or from the console. Please go to Readme file for the details. The expressions for the magnon density is derived in Eq.(S19) [1]. The corresponding expression for the magnons phase is written in [2]. Please note, that the magnon density is a ``power" property, i.e. is a quadratic expression of the dynamic magnetization components. Thus, if one wants to visualize the amplitude of the precession, the square root should be applied.

Full text

GPU-Accelerated 2D FFT for Magnon Density and Phase in Mumax3 Simulations. Readme. Roman S. Khymyn1 1Department of Physics, University of Gothenburg, Gothenburg 41296, Sweden This Python script helps to visualize profiles of the magnon density and phase. It calculates 2D FFT from the Mumax3 output (micromagnetic simulations) for the selected z-layer of the magnetic sample. The script must be run on a CUDA-compatible GPU (Nvidia). The script is aimed at relatively large samples, so it cut the sample into slabs to fit in GPU memory. CPU version is not available yet. The expressions for the magnon density is derived in Eq.(S19) [1] (see also p.5 of [2] for explicit form). That is, n(ω) = |m0·[m(ω)×m∗(ω)]|/∥m0∥,(1) where m0=m(0) is a vector in the direction of the equilibrium magnetization and m(ω) is the dynamic magnetization in Fourier space. The corresponding expression for the magnons phase is written in [3]. Please note, that the magnon density is a “power” property, i.e. is a quadratic expression of the dynamic magnetization components. Thus, if one wants to visualize the amplitude of the precession, the pn(ω) should be applied. Inputs The script takes as input a standard Mumax3 .out folder with the .dump,.ovf or .npy files. Output The script creates OutputFFT+Z-index folder in the above .out folder. OutputFFT contains subfolders magdensity and phase, with the .npy files for the magnon density and phase for each FFT frequency. Note: The script does not apply any windows in the FFT and does not perform time interpolation. Thus, hypothetically, the results with the switched on FixDt should be more precise. User defined parameters •dir -positional, required. The path to the Mumax3 output .out folder. •ext -positional, required. Extension of the Mumax3 output files. Possible values: .dump,.ovf or .npy. •--ph0 -optional, default is (0.5, 0.5). Reference point of the sample for the phase calculations. Must be in (0..1) interval, i.e. scaled to the sample. The default value (0.5, 0.5) is in the center of the sample. The value (0, 0) represents the corner of the sample. Note: The script will fail to calculate the phase, if there is no magnetic material in the selected (x0,y0) point. •--layer, optional, default is 0. Index of the layer in z-direction. •--memnum, optional, default is 96. This coefficient defines how much GPU memory is needed for 1 time step per 1 cell. Please, increase it, if the script running out of GPU memory, or decrease if you have too much free memory at the end of the cycle. The script is aimed at relatively large simulations, so it divides the sample into the “slabs” to fit into GPU memory. Large value of memnum increases the number of the “slabs” that requires longer time to run. •--converter, optional. The path to the mumax3converter. The value is required, if mumax3converter is not in the PATH, or if the script cannot find it. It is used to convert .dump or .ovf files to .npy Dependencies •mumax3-converter. Convert .dump or .ovf files to .npy. It is not required if the case of .npy type of the input files. •CuPy with the corresponding CUDA Toolkit. The script was tested using CuPy version: 13.3.0, CUDA toolkit version: 12060. •numpy •argparse, glob, math, os, sys, subprocess 2 Running the code From IDE: Fill in the required parameters in user args() function at the top part of the script. Run. As a callable function: Example: 1from mumax2DFFTver001 import main as MumaxFFT 2 3MumaxFFT (’/ media / user / storage / SimulationOfOurUniverse . out ’,’dump ’, ph0 =(0 ,0) , layer =1, 4convert = ’/ home / user / mumax / mumax3 .10/ mumax3 - convert ’) From console: Example: 1$python mumax2DFFTver001 . py / media / user / storage / SimulationOfOurUniverse . out npy --ph0 0 0.5 This input produces the following output in a console: 1Input folder : media / user / storage / SimulationOfOurUniverse .out / 2Type of input files : npy 3Z - layer 0 is selected 4Sample shape : (256 , 256) 5Index x=0, y =128 is selected as 0 phase 6Current GPU device ID: 0 7FFT for the phase reference point - done! 8Free GPU memory : 15804.375 MB 9Slab size x: 256 10 Slab size y: 128 11 Number of created slabs : 2 12 [ 0 128 256] , [ 0 256] 13 Output directory ’OutputFFTLayer0 ’ created successfully. 14 Creating output files - Success ! 15 Load slab 16 Free GPU memory before FFT: 14302.375 MB 17 Free GPU memory after FFT : 14302.375 MB 18 Free GPU memory - end of slab: 7784.375 MB 19 1/2 - completed . 20 Load slab 21 Free GPU memory before FFT: 14294.375 MB 22 Free GPU memory after FFT : 14294.375 MB 23 Free GPU memory - end of slab: 7784.375 MB 24 2/2 - completed . 25 MumaxFFT successfully executed !!! [1] O. Dzyapko, I. Lisenkov, P. Nowik-Boltyk, V. E. Demidov, S. O. Demokritov, B. Koene, A. Kirilyuk, T. Rasing, V. Tiberkevich, and A. Slavin, Magnon-magnon interactions in a room-temperature magnonic bose-einstein condensate, Physical Review B 96, 064438 (2017). [2] S. Muralidhar, A. A. Awad, A. Alem´an, R. Khymyn, M. Dvornik, D. Hanstorp, and J. ˚ Akerman, Sustained coherent spin wave emission using frequency combs, Physical Review B 101, 224423 (2020). [3] S. Louis, I. Lisenkov, S. Nikitov, V. Tyberkevych, and A. Slavin, Bias-free spin-wave phase shifter for magnonic logic, AIP Advances 6(2016).