mammos_mumag.simulation#
Simulation class.
Classes
|
Simulation class. |
- class mammos_mumag.simulation.Simulation(material_domain_list=None, mesh_filepath=None, materials_filepath=None, parameters_filepath=None, materials=None, parameters=None)[source]#
Simulation class.
- Parameters:
material_domain_list (list[MaterialDomain] | None) – TODO
mesh_filepath (Path | None) – TODO
paretials_filepath – TODO
parameters_filepath (Path | None) – TODO
materials (Materials | None) – class managing materials.
parameters (Parameters | None) – class managing parameters.
materials_filepath (Path | None)
- check_attribute(*args)[source]#
Check existence of attributes.
- Parameters:
*args – Attribtes to check.
- Raises:
AttributeError – Attribute has not been defined yet.
- Return type:
None
- material_domain_list: list[MaterialDomain] | None = None#
- parameters: Parameters | None = None#
- run_exani(outdir='exani', name='out')[source]#
Run “exani” script.
Test the computation of the exchange and anisotropy energy density. This gives the exchange energy density of a vortex in the \(xy\)-plane and the anistropy energy density in the uniformly magnetized state. Here we have placed the anistropy direction paralle to to the \(z\)-axis. The anisotropy energy density is calculated as \(-K (\mathbf{m} \cdot \mathbf{k})^2\) where \(\mathbf{m}\) is the unit vector of magnetization and \(\mathbf{k}\) is the anisotropy direction. \(K\) is the magnetocrystalline anisotropy constant.
This scripts creates the following files in outdir:
<name>.fly: mesh file.
<name>.krn: materials file.
<name>_uniform.csv: table containing information about the exchange anisotropy energy evaluated with different methods on a uniformly magnetized cube.
<name>_vortex.csv: table containing information about the exchange anisotropy energy evaluated with different methods on a vortex.
- run_external(outdir='external', name='out')[source]#
Run “external” script.
Compute the Zeemann energy by finite elements and analytically.
This scripts creates the following files in outdir:
<name>.fly: mesh file.
<name>.krn: materials file.
<name>.p2: simulation parameters file.
<name>.csv: table containing information about the Zeeman energy evaluated with different methods.
- run_hmag(outdir='hmag', name='out')[source]#
Run “hmag” script.
This script evaluates the magnetostatic energy density and the field of a uniformly magnetized geometry. Creates the vtk file for visualisation of the magnetic scalar potential and the magnetic field. With linear basis function for the magnetic scalar potential \(u\), the magnetostatic field \(h = -\nabla u\) is defined at the finite elements. By smoothing the field can be transfered to the nodes of the finite element mesh.
This scripts creates the following files in outdir:
<name>.fly: mesh file.
<name>.krn: materials file.
<name>.csv: table containing information about the magnetostatic energy density evaluated with different methods. Three energy values are compared:
\[E_{\mathsf{field}} := - \frac{1}{2} \int_\Omega \frac{\mathbf{h} \cdot J_s \mathbf{m}}{V} \ \mathrm{d}x\]where \(\Omega\) is the domain, \(\mathbf{h}\) is the demagnetization field, \(J_s\) is the spontaneous polarisation, \(\mathbf{m}\) is the magnetization field, and \(V\) is the volume of the domain.
\[E_{\mathsf{gradient}} := \frac{1}{2} \sum_i \mathbf{m}_i \cdot \mathbf{g}_i\]where \(\mathbf{m}_i\) and \(\mathbf{g}_i\) are the unit vector of the magnetization and the gradient of the energy normalized by the volume of the energy with respect to \(\mathbf{m}_i\) at the nodes of the finite element mesh.
\[E_{\mathsf{analytic}} := J_s^2 / (6 \mu_0)\]
- run_loop(outdir='loop', name='out')[source]#
Run “loop” script.
Compute demagnetization curves.
This scripts creates the following files in outdir:
<name>.fly: mesh file.
<name>.krn: materials file.
<name>.p2: simulation parameters file.
<name>_{i}.vtu: saved vtk files. TODO
<name>_stats.txt: memory usage information.
<name>.dat: table data regarding the demagnetization curve. The columns of the file are:
the number of the vtk file that corresponds to the field and magnetic polarisation values in the line.
value of \(\mu_0 H_{\mathsf{ext}}\) in Tesla, where \(\mu_0\) is the permability of vacuum and \(H_{\mathsf{ext}}\) is the external value of the external field.
the componenent of magnetic polarisation (in Tesla) parallel to the direction of the external field.
the energy density (\(\mathrm{J}/\mathrm{m}^3\)) of the current state.
- run_magnetization(outdir='magnetization', name='out')[source]#
Run “magnetization” script.
Creates the vtk file for the visualisation of the material properties.
- run_mapping(outdir='magnetization', name='out')[source]#
Run “mapping” script.
Test the energy calculations with matrices. The module mapping.py contains the tools for mapping from the finite element bilinear forms to sparse matrices. We use sparse matrix methods from
jax
.
- run_materials(outdir='materials', name='out')[source]#
Run “materials” script.
This script generates a vtu file that shows the material.