{ "cells": [ { "cell_type": "markdown", "id": "e115187a", "metadata": {}, "source": [ "# Spatially dependent uniaxial anisotropy\n", "\n", "In this notebook we show how to set a spatially varying uniaxial anisotropy. To demonstrate we will use a nanotube (R=30 nm outer radius,r=20 nm inner radius) and set a radial uniaxial anisotropy." ] }, { "cell_type": "code", "execution_count": 1, "id": "a0ea9478", "metadata": {}, "outputs": [], "source": [ "import tetrax as tx\n", "\n", "%matplotlib notebook\n", "import matplotlib.pyplot as plt" ] }, { "cell_type": "code", "execution_count": 2, "id": "4220be52", "metadata": { "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Setting geometry and calculating discretized differential operators on mesh.\n", "Done.\n" ] } ], "source": [ "sample = tx.create_sample(name=\"Nanotube_20nm_30nm\")\n", "sample.Msat = 800e3\n", "sample.Aex = 13e-12\n", "mesh = tx.geometries.tube_cross_section(20,30,lc=3)\n", "sample.set_geom(mesh)" ] }, { "cell_type": "markdown", "id": "bd7bbdd8", "metadata": {}, "source": [ "In the following we set a radial uniaxial anisotropy using the ```tx.vectorfields.radial(sample.xyz,1)``` function:" ] }, { "cell_type": "code", "execution_count": 3, "id": "53b30d39", "metadata": { "scrolled": true }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "db9116892fda4aaf93b32000a00b9b0c", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Output()" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "sample.Ku1 = 2e4 #J/m^3\n", "sample.e_u = tx.vectorfields.radial(sample.xyz,1)\n", "sample.plot(sample.e_u)" ] }, { "cell_type": "markdown", "id": "fb1a08a1", "metadata": {}, "source": [ "![spatially dependent anisotropy](uanis_sp_dep.png)" ] }, { "cell_type": "code", "execution_count": 4, "id": "c14f7e63", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Minimizing in using 'L-BFGS-B' (tolerance 1e-09) ...\n", "Current energy length density: 6.316798137122507e-10 J/m mx = -0.01 my = -0.00 mz = 0.00\n", "Relaxation with L-BFGS-B method was not succesful.\n", "\n", "Minimizing in using SLSQP method (tolerance 1e-09) ...\n", "Current energy length density: 6.316832551337032e-10 J/m mx = -0.01 my = -0.00 mz = 0.000\n", "Success!\n", "\n" ] } ], "source": [ "sample.mag = tx.vectorfields.radial(sample.xyz,1)\n", "exp = tx.create_experimental_setup(sample)\n", "exp.relax(tol=1e-9,continue_with_least_squares=True)" ] }, { "cell_type": "code", "execution_count": 5, "id": "72b573d5", "metadata": { "scrolled": true }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "356e14f2d7034176886ebc64a5a240eb", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Output()" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "sample.show()" ] }, { "cell_type": "markdown", "id": "56a1a596", "metadata": {}, "source": [ "![Magnetic state sp_dep_anis](mag_uanis_sp_dep.png)" ] } ], "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.8.8" } }, "nbformat": 4, "nbformat_minor": 5 }