<jupyter_start><jupyter_text>Micromagnetic model Mesh<jupyter_code>import oommfc as oc
%matplotlib inline
L = 100e-9
d = 10e-9
mesh = oc.Mesh(p1=(0, 0, 0), p2=(L, L, L), cell=(d, d, d), name="mesh")
mesh<jupyter_output><empty_output><jupyter_text>The domain edge lengths in x, y, and z directions are:<jupyter_code>mesh.l<jupyter_output><empty_output><jupyter_text>The number of cells in all three directions:<jupyter_code>mesh.n<jupyter_output><empty_output><jupyter_text>The centre point of the mesh:<jupyter_code>mesh.centre<jupyter_output><empty_output><jupyter_text>System The basic block of our micromagnetic model is the system object. It is fully defined if:1. Hamiltonian,2. dynamics equation,3. magnetisation.are provided. The system is then "driven" in phase space using particular drivers.<jupyter_code>system = oc.System(name="system")<jupyter_output><empty_output><jupyter_text>Hamiltonian<jupyter_code>exchange = oc.Exchange(A=1e-12)
exchange
exchange.A
repr(exchange)
hamiltonian = exchange + oc.Zeeman(H=(1e6, 0, 0))

type(hamiltonian)
system.hamiltonian = hamiltonian
system.hamiltonian
system.hamiltonian.exchange.A
system.hamiltonian.zeeman.H
system.hamiltonian += oc.Demag(name="energy_term_name")
system.hamiltonian.energy_term_name<jupyter_output><empty_output><jupyter_text>Dynamics<jupyter_code>system.dynamics = oc.Precession(gamma=2.211e5) + oc.Damping(alpha=0.1)
system.dynamics<jupyter_output><empty_output><jupyter_text>Magnetisation<jupyter_code>import discretisedfield as df
Ms = 8e5
m = df.Field(mesh, value=(1, 0, 1), norm=Ms, name="m")
p = (50e-9, 50e-9, 5e-9)
m(p)  # sampling
m.f = lambda pos: (pos[0]+pos[2]+1, pos[2], 0)
system.m = m<jupyter_output><empty_output><jupyter_text>Drivers  MinDriver<jupyter_code>md = oc.MinDriver()
md.drive(system)
system.m.average
system.m.plot_plane("z")
system.hamiltonian.zeeman.H = (0, 1e7, 0)
md.drive(system)
system.m.plot_plane("z")<jupyter_output><empty_output><jupyter_text>Time driver<jupyter_code>system.hamiltonian += oc.UniaxialAnisotropy(K1=5e3, u=(0, 0, 1))
system.hamiltonian.zeeman.H = (1e6, 0, 0)
td = oc.TimeDriver()
td.drive(system, t=0.2e-9, n=50)
system.m.plot_plane("z")
system.dt
system.dt.plot("t", "E")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1440107671601615, 'fraction_numerical': 0.029609690444145357, 'mean_word_length': 7.991935483870968, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '10', 'dir': 'jupyter-structured-clean-dedup', 'id': '4810', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 938, 'n_tokens_neox': 892, 'n_words': 155, 'path': 'docs/ipynb/micromagneticmodel.ipynb', 'repo_name': 'gamdow/oommfc', 'size': '2229'}