{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# FMR\n", "\n", "In this tutorial we will use the FMR standard problem as an example to show how to use the FMR functionality in `mag2exp`.\n", "\n", "For more in-depth details of running the FMR standard problem in Ubermag please see [Tutorial for Standard Problem FMR](https://ubermag.github.io/examples/notebooks/10-tutorial-standard-problem-fmr.html).\n", "\n", "## Setting up and running the micromagnetic simulation\n", "In this first cell, we set up the micromagnetic simulation as detailed in the tutorial. This involves minimising the energy then applying a slight perturbation to the direction of the applied field and letting the system relax. \n", "\n", "Note: This simulation may take a while to complete." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Running OOMMF (ExeOOMMFRunner)[2025-06-01T15:39:40]... (0.3 s)\n", "Running OOMMF (ExeOOMMFRunner)[2025-06-01T15:39:41]... (21.0 s)\n" ] } ], "source": [ "import discretisedfield as df\n", "import micromagneticmodel as mm\n", "import numpy as np\n", "import oommfc as oc\n", "\n", "lx = ly = 120e-9 # x and y dimensions of the sample(m)\n", "lz = 10e-9 # sample thickness (m)\n", "dx = dy = dz = 5e-9 # discretisation in x, y, and z directions (m)\n", "\n", "Ms = 8e5 # saturation magnetisation (A/m)\n", "A = 1.3e-11 # exchange energy constant (J/m)\n", "H = 8e4 * np.array([0.81345856316858023, 0.58162287266553481, 0.0])\n", "alpha = 0.008 # Gilbert damping\n", "gamma0 = 2.211e5\n", "\n", "# Define the system\n", "mesh = df.Mesh(p1=(0, 0, 0), p2=(lx, ly, lz), cell=(dx, dy, dz))\n", "system = mm.System(name=\"stdprobfmr\")\n", "system.energy = mm.Exchange(A=A) + mm.Demag() + mm.Zeeman(H=H)\n", "system.dynamics = mm.Precession(gamma0=gamma0) + mm.Damping(alpha=alpha)\n", "system.m = df.Field(mesh, nvdim=3, value=(0, 0, 1), norm=Ms)\n", "\n", "# Minimize the energy\n", "md = oc.MinDriver()\n", "md.drive(system)\n", "\n", "# Change external magnetic field.\n", "H = 8e4 * np.array([0.81923192051904048, 0.57346234436332832, 0.0])\n", "system.energy.zeeman.H = H\n", "\n", "# Let the system relax\n", "T = 20e-9\n", "n = 4000\n", "td = oc.TimeDriver()\n", "td.drive(system, t=T, n=n)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now that we have run the simulation we can see what modes were present when running the `TimeDriver`.\n", "\n", "## Analysing the FMR signal\n", "Firstly we will load the data using `micromagneticdata`.\n", "\n", "We can see that two drives have been run - the `MinDriver` and the `TimeDriver`." ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [ "nbval-ignore-output" ] }, "outputs": [ { "data": { "text/html": [ "
\n", " | drive_number | \n", "date | \n", "time | \n", "start_time | \n", "adapter | \n", "adapter_version | \n", "driver | \n", "end_time | \n", "elapsed_time | \n", "success | \n", "info.json | \n", "n | \n", "t | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "0 | \n", "2025-06-01 | \n", "15:39:40 | \n", "2025-06-01T15:39:40 | \n", "oommfc | \n", "0.65.0 | \n", "MinDriver | \n", "2025-06-01T15:39:41 | \n", "00:00:01 | \n", "True | \n", "available | \n", "<NA> | \n", "<NA> | \n", "
1 | \n", "1 | \n", "2025-06-01 | \n", "15:39:41 | \n", "2025-06-01T15:39:41 | \n", "oommfc | \n", "0.65.0 | \n", "TimeDriver | \n", "2025-06-01T15:40:02 | \n", "00:00:22 | \n", "True | \n", "available | \n", "4000 | \n", "0.0 | \n", "