Skip to content

Instantly share code, notes, and snippets.

@deparkes
Created April 22, 2017 09:32
Show Gist options
  • Save deparkes/5b95f547241349617ae71fab6f961e82 to your computer and use it in GitHub Desktop.
Save deparkes/5b95f547241349617ae71fab6f961e82 to your computer and use it in GitHub Desktop.
Example of defining a field with polar coordinates in OOMMF mif file
# MIF 2.1
# MIF Example File: ellipsoid.mif
# Description: Hysteresis loop of an ellipsoidal particle.
# This example uses an Oxs_EllipsoidAtlas to define the
# ellipsoid volume. This example is exactly equivalent
# to ellipsoid-atlasproc.mif and ellipsoid-fieldproc.mif.
set pi [expr {4*atan(1.0)}]
set mu0 [expr {4*$pi*1e-7}]
set theta 270
set magnitude 500
Specify Oxs_EllipsoidAtlas:atlas {
xrange {0 320e-9}
yrange {0 160e-9}
zrange {0 80e-9}
name ellipsoid
}
Specify Oxs_RectangularMesh:mesh {
cellsize {5e-9 5e-9 5e-9}
atlas :atlas
}
# Exchange
Specify Oxs_UniformExchange {
A 1.3e-11
}
# Demag
Specify Oxs_Demag {}
# Applied field
#Specify Oxs_UZeeman [subst {
# multiplier [expr {0.001/$mu0}]
# Hrange {
# { 0 0 0 200 20 20 10 }
# { 200 20 20 -200 -20 -20 20 }
# { -200 -20 -20 200 20 20 20 }
# }
#}]
Specify Oxs_ScriptUZeeman [ subst {
multiplier [expr {0.001/$mu0}]
script Radial
}]
Specify Oxs_CGEvolve:evolve {}
Specify Oxs_MinDriver {
basename ellipsoid
evolver :evolve
stopping_mxHxm 0.1
mesh :mesh
Ms { Oxs_AtlasScalarField {
atlas :atlas
default_value 0.0
values {
ellipsoid 8e5
}
}}
m0 { Oxs_ScriptVectorField {
atlas :atlas
script Vortex
norm 1
}}
}
proc Vortex { x y z } {
set yrad [expr {$y-0.5}]
set zrad [expr {$z-0.5}]
set normsq [expr {$yrad*$yrad+$zrad*$zrad}]
if {$normsq <= 0.0125} {return "1 0 0"}
return [list 0 $zrad [expr {-1*$yrad}]]
}
proc Radial { x y z } {
variable theta
variable magnitude
set PI [expr {4 * atan(1.)}]
set Hx [expr $magnitude * cos(($PI/180.)*$theta)]
set Hy [expr $magnitude * sin(($PI/180.)*$theta)]
set Hz 0
return [list $Hx $Hy $Hz 0 0 0 ]
}
# Create destinations
Destination my_graph mmGraph
Destination my_archive mmArchive
Destination my_display mmDisp
# Specify what should be saved
Schedule DataTable my_graph Step 1
Schedule DataTable my_archive Step 1
Schedule Oxs_MinDriver::Magnetization my_display Stage 1
Schedule Oxs_MinDriver::Magnetization my_display Step 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment