<jupyter_start><jupyter_text>Sine-hysteresisHere we show how to plot magnetisation as a function of an external magnetic field when a time-varying (sine-wave) field is applied.<jupyter_code>import oommfc as mc
import discretisedfield as df
import micromagneticmodel as mm

region = df.Region(p1=(-50e-9, -50e-9, 0), p2=(50e-9, 50e-9, 10e-9))
mesh = df.Mesh(region=region, cell=(5e-9, 5e-9, 5e-9))

system = mm.System(name='sine_hysteresis')<jupyter_output><empty_output><jupyter_text>Now we can specify spatial and time varying field components. For the time-varying component, we choose a sine-wave with $5\,\text{GHz}$ frequency and no time shift.<jupyter_code>system.energy = mm.Zeeman(H=(0, 0, 1e2), func='sin', f=2e9, t0=0)
system.dynamics = mm.Precession(gamma0=mm.consts.gamma0) + mm.Damping(alpha=1e-5)

# create system with above geometry and initial magnetisation
system.m = df.Field(mesh, dim=3, value=(0, 0.1, 1), norm=1.1e6)<jupyter_output><empty_output><jupyter_text>Now, we can drive the system using `TimeDriver`.<jupyter_code>td = mc.TimeDriver()
td.drive(system, t=5e-9, n=500)<jupyter_output>Running OOMMF (ExeOOMMFRunner)[2022/02/25 18:14]... (2.1 s)<jupyter_text>We can plot the $z$-component of the field.<jupyter_code>system.table.mpl(y=['Bz_zeeman'])<jupyter_output><empty_output><jupyter_text>The $z$-component of magnetisation is:<jupyter_code>system.table.mpl(y=['mz'])<jupyter_output><empty_output><jupyter_text>However, we can plot them so that on the horizontal axis we place external field, and on the vertical axis we place magnetisation.<jupyter_code>system.table.mpl(x='Bz_zeeman', y=['mz'])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13897280966767372, 'fraction_numerical': 0.03867069486404834, 'mean_word_length': 6.811320754716981, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 24, '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': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '611880', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 663, 'n_tokens_neox': 625, 'n_words': 145, 'path': 'examples/sine-hysteresis.ipynb', 'repo_name': 'ubermag/tutorials', 'size': '1655'}