/*
	Micromagnetic standard problem 4 (a) according to
	http://www.ctcms.nist.gov/~rdm/mumag.org.html
*/

// geometry
	setgridsize(128, 32, 1)
	setcellsize(500e-9/128, 125e-9/32, 3e-9)

// material
	Msat  = 1600e3
	Aex   = 13e-12
	E_total.get()  // try to trigger bad lex2

	Msat  = 800e3
	alpha = 0.02
	m  = uniform(1, .1, 0)

// relax
	relax()
	save(m)
	TOL := 1e-5
	expectv("m", m.average(), vector(0.9669684171676636,  0.1252732127904892, 0), TOL)

// reversal
	tableautosave(10e-12)
	autosave(m, 100e-12)
	autosnapshot(m, 50e-12)
	B_ext = vector(-24.6E-3, 4.3E-3, 0)
	run(1e-9)
	expectv("m", m.average(), vector(-0.9846124053001404, 0.12604089081287384, 0.04327124357223511), TOL)
