# MIF 2.1
set pi [expr {4*atan(1.0)}]
set mu0 [expr {4*$pi*1e-7}]

Specify Oxs_BoxAtlas:atlas {
  xrange {0 310e-9}
  yrange {0 310e-9}
  zrange {0 40e-9}
}

Specify Oxs_RectangularMesh:mesh {
  cellsize {10e-9 10e-9 10e-9}
  atlas :atlas
}

Specify Oxs_UniformExchange:NiFe {
  A  13e-12
}

Specify Oxs_UZeeman "
  multiplier [expr {0.001/$mu0}]
  Hrange {
      { 0  0  0   50  0  0   2 }
  }
"

Specify Oxs_Demag {}

Specify Oxs_EulerEvolve {
  alpha 0.5
  start_dm 0.01
}

Specify Oxs_TimeDriver {
 evolver Oxs_EulerEvolve
 stopping_dm_dt 0.01
 mesh :mesh
 stage_count 3
 stage_iteration_limit 250
 total_iteration_limit 0
 Ms { Oxs_UniformScalarField { 
   value 8e5
 }}
 m0 { Oxs_ScriptVectorField {
   comment {atlas :atlas}
   xrange {0 200e-9}
   yrange {0 310e-9}
   zrange {0 40e-9}
   script  UpDownSpin
   norm  1
 }}
}

proc UpDownSpin { x y z } {
    if { $x < 0.45 } {
        return "0 1 0"
    } elseif { $x > 0.55 } {
        return "0 -1 0"
    } else {
        return "0 0 1"
    }
}
