# MIF 2.1
# MIF Example File: sample.mif
# Description: Hysteresis loop using Runge-Kutta evolver
#     and time driver.

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

RandomSeed 1

Parameter cellsize 5e-9

Specify Oxs_BoxAtlas:atlas {
  xrange {0 200e-9}
  yrange {0 100e-9}
  zrange {0  20e-9}
}

Specify Oxs_RectangularMesh:mesh [subst {
  cellsize {$cellsize $cellsize $cellsize}
  atlas :atlas
}]

Specify Oxs_CubicAnisotropy {
  K1  -4.5e3
  axis1 {1 0 0}
  axis2 {0 1 0}
}

# NOTE: In the preceding Oxs_CubicAnisotropy Specify block, K1, axis1
# and axis2 are all described above via implicit Oxs_UniformScalarField
# and Oxs_UniformVectorField objects.  That block is *exactly*
# equivalent to
#
#   Specify Oxs_CubicAnisotropy {
#     K1  { Oxs_UniformScalarField {
#              value -4.5e3
#     }}
#     axis1 { Oxs_UniformVectorField {
#              vector {1 0 0}
#     }}
#     axis2 { Oxs_UniformVectorField {
#              vector {0 1 0}
#     }}
#   }
#
# Any of the other Scalar/Vector field objects may be used to initialize
# K1, axis1 and axis2 in place of the Uniform variety.
#
# IN CONTRAST, in the following Specify block, for Oxs_UniformExchange,
# A is an actual scalar, not a scalar field, so it can only be
# initialized via an actual constant.  Use the Oxs_Exchange6Ngbr or
# Oxs_ExchangePtwise classes if you need the exchange stiffness to
# spatially vary.

Specify Oxs_UniformExchange {
   A  9e-12  comment {A here is a single scalar, not a scalar field}
}

Specify Oxs_UZeeman [subst {
  multiplier [expr {0.001/$mu0}]
  Hrange {
     {   0   0   0   100   1   0   2 }
     { 100   1   0  -100   0   0   2 }
     {   0   0   0     0 100   0   4 }
     {  10  10  10    50  50  50   0 }
  }
}]

Specify Oxs_Demag {}

Specify Oxs_RungeKuttaEvolve:evolve {}

Specify Oxs_TimeDriver [subst {
 basename sample
 evolver :evolve
 stopping_dm_dt 0.1
 mesh :mesh
 Ms 490e3
 m0 { 1 0.02 0.01 }
}]

# Ms and m0 above may be initialized using any Scalar/Vector field
# objects.  See the comment following the Oxs_CubicAnisotropy Specify
# block above.
