# MIF 2.1

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

set basename std5b

Parameter total_current -0.006 ;# Current in amps

Parameter Ms 800e3
Parameter A  13e-12

Parameter Polarization  0.5669

Parameter Lambda 2.0

Parameter eps_prime 1.0

Parameter mp_theta 20.0 ;# Direction of mp, in degrees
set mp_theta [expr {$mp_theta*$pi/180.}]

set length 160e-9
set width   80e-9
set thick   5e-9

set Nx 64
set Ny 32
set Nz 1

set current_area [expr {$length*$width}]
set current_density [expr {$total_current/$current_area}]

set xcellsize [expr {$length/$Nx}]
set ycellsize [expr {$width/$Ny}]
set zcellsize [expr {$thick/$Nz}]

Specify Oxs_BoxAtlas:atlas [subst {
  xrange {0 $length}
  yrange {0 $width}
  zrange {0 $thick}
}]


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

# Exchange
Specify Oxs_UniformExchange [subst {
  A   $A
}]

# Demag
Specify Oxs_Demag {}

# Evolver
Specify Oxs_SpinXferEvolve:evolve [subst {
 alpha 0.01
 start_dm 0.00001
 min_timestep 1e-18
 max_timestep 1e-12
 mp {[expr {cos($mp_theta)}] [expr {sin($mp_theta)}] 0}
 J $current_density
 P $Polarization
 Lambda $Lambda
 eps_prime $eps_prime
}]


# Driver
Specify Oxs_TimeDriver [subst {
 basename [list ${basename}-eprime1]
 evolver :evolve
 stopping_time 1e-9
 stage_count 1
 mesh :mesh
 Ms $Ms
 m0 {1.0 0.1 0.0}
}]


Destination archive mmArchive
# Schedule Oxs_TimeDriver::Magnetization archive Stage 1
Schedule DataTable archive Stage 1
