{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Tutorial 08: Defining micromagnetic system\n", "\n", "> Interactive online tutorial:\n", "> [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/ubermag/micromagneticmodel/master?filepath=docs%2Fipynb%2Findex.ipynb)\n", "\n", "A micromagnetic system is the main entity of the micromagnetic model. It consists of three main components:\n", "- Hamiltonian\n", "- Dynamics equation\n", "- Magnetisation configuration\n", "\n", "In this tutorial, we will assemble a micromagnetic system, which can then be \"driven\" using different drivers." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import micromagneticmodel as mm" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Firstly, we create a Hamiltonian:" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "hamiltonian = mm.Exchange(A=1e-11) + mm.Zeeman(H=(1e6, 0, 0))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Next, we define the dynamics equation." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "dynamics = mm.Precession(gamma=mm.consts.gamma0) + mm.Damping(alpha=0.1)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Finally, magnetisation configuration must be defined as `discretisationfield.Field`." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "import discretisedfield as df\n", "\n", "p1 = (0, 0, 0)\n", "p2 = (10e-9, 10e-9, 10e-9)\n", "n = (5, 5, 5)\n", "Ms = 1e6\n", "mesh = df.Mesh(p1=p1, p2=p2, n=n)\n", "m = df.Field(mesh, dim=3, value=(0, 0, 1), norm=Ms)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Using these three parameters we can assemble the system object." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "system = mm.System(hamiltonian=hamiltonian, dynamics=dynamics, m=m, name='mysystem')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can now check some basics properties of the assembled system." ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "System(name='mysystem')" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "system" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$w=A (\\nabla \\mathbf{m})^{2}-\\mu_{0}M_\\text{s} \\mathbf{m} \\cdot \\mathbf{H}$" ], "text/plain": [ "Exchange(A=1e-11, name='exchange') + Zeeman(H=(1000000.0, 0, 0), name='zeeman')" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "system.hamiltonian" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\frac{\\partial \\mathbf{m}}{\\partial t}=-\\gamma_{0}^{*} \\mathbf{m} \\times \\mathbf{H}_\\text{eff}+\\alpha \\mathbf{m} \\times\\frac{\\partial \\mathbf{m}}{\\partial t}$" ], "text/plain": [ "Precession(gamma=221276.14872118403, name='precession') + Damping(alpha=0.1, name='damping')" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "system.dynamics" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "c97ecd38f6644bd19db56735776df466", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Output()" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# NBVAL_IGNORE_OUTPUT\n", "system.m.k3d_vectors()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Other\n", "\n", "Full description of all existing descriptors can be found in the [API Reference](https://micromagneticmodel.readthedocs.io/en/latest/?badge=latest)." ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.4" } }, "nbformat": 4, "nbformat_minor": 2 }