/*
	Micromagnetic standard problem 4 (a),
	using a custom-defined zeeman field.
*/

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

	Msat  = 800e3
	Aex   = 13e-12
	alpha = 0.02
	m  = uniform(1, .1, 0)

	minimize()
	save(m)
	TOL := 1e-4
	expectv("m", m.average(), vector(0.9669684171676636,  0.1252732127904892, 0), TOL)

	tableautosave(10e-12)
	autosave(m, 100e-12)
	autosnapshot(m, 50e-12)

	myField := div( constvector(-24.6, 4.3, 0), Const(1e3) )
	AddFieldTerm(myField)

	run(1e-9)
	expectv("m", m.average(), vector(-0.9846124053001404, 0.12604089081287384, 0.04327124357223511), TOL)
