/*
        Test ext_interdmi

	Create square region with rescaled DMI coupling at the
	border. The average DMI coupling calculated analytically
	and numerically should be equal.
*/

Msat = 1.2
cs := 1
nx := 8

setcellsize(cs,cs,cs)
setgridsize(nx,nx,1)
setpbc(1,1,0)

l  := cs*(nx/2.+0.1)
ni := 2*nx // number of interfaces
Defregion(1,rect(l,l))

D0    := 1.0
Dind   = D0
scale := 0.645
ext_ScaleDind(0,1,scale)

avgdmi := dindCoupling.average()
wanted := 4*D0 + 2*(scale-1)*D0*ni/(nx*nx)

expect("dmicoupling",avgdmi,wanted,1e-2)
