# Data set on "Accuracy of the analytical demagnetization tensor for various geometries"

This data set is for the article "Accuracy of the analytical demagnetization tensor for various geometries", with the followng bibliography information: Bjørk, R., & d’Aquino, M. (2023). Accuracy of the analytical demagnetization tensor for various geometries. Journal of Magnetism and Magnetic Materials, 171245, DOI: https://doi.org/10.1016/j.jmmm.2023.171245

This data set is published as Bjørk, Rasmus (2023), Data set on "Accuracy of the analytical demagnetization tensor for various geometries". Technical University of Denmark. Dataset. https://doi.org/10.11583/DTU.22293088 This dataset is distributed under a CC BY 4.0 license.

This data set contains the necessaary Matlab files for generating the data files for the magnetic field for the different tile geometries as well as for the dipole field, the Matlab plotting scripts as well as the actual data files.

The data is generated using the Matlab script file "Calculate_demagnetization_fields_all.m". In this script the geometry for which to calculate the field can be set with the variables introduced in the beginning of the script. The path to the MagTense simulation framework must also be specified, as must the path to a python installation containing Magpylib.

The following Matlab auxillary script files, which assist in the field calculation are also present in this data set: Center_of_mass.m,

fcn_RotationFromTwoVectors.m and tetrahedron_circumsphere.m . These files are only called from Calculate_demagnetization_fields_all.m .

The following Matlab plotting script files are also present: Plot_aspect_ratio_at_r_1000.m, Plot_cyl_tile_and_precision.m and Plot_different_tile_sizes.m . These plot all the files in the article based on the data files. Some of the plot script contains variable that can be used to change which plot is produced.

This data set also contains the actual data files generated using the Calculate_demagnetization_fields_all.m script. They are named using the following logical order:

"MagTense_" + type of tile + type of data file.

There are four types of tiles:

"cyl" which contains the magnetic field from the cylindrical slice tile as computed using MagTense

"cyl_python" which contains the magnetic field from the cylindrical slice tile as computed using Magpylib. Note that the file still has the prefix MagTense even though the data is computed using Magpylib

"prism" which contains the magnetic field from the prism tile as computed using MagTense

"tetra" which contains the magnetic field from the tetrahedron tile as computed using MagTense

There are three types of data files:

"diff_sizes" contains the magnetic field as function of distance for two differently sized tiles of the specified type

"diff_sizes_Hnorm" contains the magnetic field as function of the norm of the magnetic field for two differently sized tiles of the specified type

"size_r_1000" contains the magnetic field at a distance of 1000 tile radii for tiles with different aspect ratios

The data within these matlab files are structured as follows:

diff_field_all : Cell array for different tile sizes. Each cell is the relative error as function of distance

diff_field_s_all : Cell array for different tile sizes. Each cell is the relative error in single precision as function of distance

dipole_all : Cell array for different tile sizes. Each cell is the dipole magnetic field as function of distance

H_all : Cell array for different tile sizes. Each cell is the tile magnetic field as function of distance

i_size_arr : A counting array determining the size of a specific tile

j_size_arr : A counting array determining the size of a specific tile

max_arr_all : Contains the maximum relative error for each distance value. Not visualized

r_s_all : For the data files "diff_sizes" and "size_r_1000" this contains the distance to the tile. For the data files "diff_sizes_Hnorm" this contains the magnetic field norm normalized by the magnetization norm

stat_arr_all : Cell array for different tile sizes. Each cell is the median relative error as function of distance

tiles : Contains information of the tiles used in the calculations