Documentation ¶
Index ¶
- Constants
- Variables
- func AddAnisotropyField(dst *data.Slice)
- func AddExchangeField(dst *data.Slice)
- func AddSTTorque(dst *data.Slice)
- func AutoSave(q Quantity, period float64)
- func AutoSnapshot(q Quantity, period float64)
- func CenterWall(magComp int)
- func Close()
- func Comp(parent Quantity, c int) *comp
- func Const(e script.Expr) bool
- func Crop(parent Quantity, x1, x2, y1, y2, z1, z2 int) *cropped
- func CropLayer(parent Quantity, layer int) *cropped
- func CropX(parent Quantity, x1, x2 int) *cropped
- func CropY(parent Quantity, y1, y2 int) *cropped
- func CropZ(parent Quantity, z1, z2 int) *cropped
- func DeclConst(name string, value float64, doc string)
- func DeclFunc(name string, f interface{}, doc string)
- func DeclLValue(name string, value LValue, doc string)
- func DeclROnly(name string, value interface{}, doc string)
- func DeclVar(name string, value interface{}, doc string)
- func DefRegion(id int, s Shape)
- func DefRegionCell(id int, x, y, z int)
- func DoOutput()
- func Download(q Quantity) *data.Slice
- func Eval(code string)
- func EvalFile(code *script.BlockStmt)
- func Expect(msg string, have, want, maxError float64)
- func ExpectV(msg string, have, want data.Vector, maxErr float64)
- func Fprintln(filename string, msg ...interface{})
- func GUIAdd(name string, value interface{})
- func GetAnisotropyEnergy() float64
- func GetBusy() bool
- func GetDemagEnergy() float64
- func GetExchangeEnergy() float64
- func GetMaxTorque() float64
- func GetShiftPos() float64
- func GetThermalEnergy() float64
- func GetTotalEnergy() float64
- func GetZeemanEnergy() float64
- func Index2Coord(ix, iy, iz int) data.Vector
- func Info(nComp int, name, unit string) info
- func InjectAndWait(task func())
- func LoadFile(fname string) *data.Slice
- func LogInput(msg ...interface{})
- func LogOutput(msg ...interface{})
- func Mesh() *data.Mesh
- func NewSlice(ncomp, Nx, Ny, Nz int) *data.Slice
- func PostStep(f func())
- func Relax()
- func RemoveLRSurfaceCharge(region int, mxLeft, mxRight float64)
- func Run(seconds float64)
- func RunInteractive()
- func RunWhile(condition func() bool)
- func SanityCheck()
- func Save(q Quantity)
- func SaveAs(q Quantity, fname string)
- func ScaleInterExchange(region1, region2 int, scale float64)
- func Serve(port string)
- func SetBusy(b bool)
- func SetCellSize(cx, cy, cz float64)
- func SetDemagField(dst *data.Slice)
- func SetEffectiveField(dst *data.Slice)
- func SetGeom(s Shape)
- func SetGridSize(Nx, Ny, Nz int)
- func SetLLTorque(dst *data.Slice)
- func SetMFM(dst *data.Slice)
- func SetMFull(dst *data.Slice)
- func SetMesh(Nx, Ny, Nz int, cellSizeX, cellSizeY, cellSizeZ float64, pbcx, pbcy, pbcz int)
- func SetOD(od string, force bool)
- func SetPBC(nx, ny, nz int)
- func SetSolver(typ int)
- func SetTorque(dst *data.Slice)
- func SetTotalEdens(dst *data.Slice)
- func Shift(dx int)
- func Snapshot(q Quantity)
- func Steps(n int)
- func TableAdd(col TableData)
- func TableAddVariable(x script.ScalarFunction, name, unit string)
- func TableAutoSave(period float64)
- func TablePrint(msg ...interface{})
- func TableSave()
- func ThermSeed(seed int)
- func Vector(x, y, z float64) data.Vector
- func Voronoi(grainsize float64, numRegions, seed int)
- type Config
- func AntiVortex(circ, pol int) Config
- func BlochSkyrmion(charge, pol int) Config
- func NeelSkyrmion(charge, pol int) Config
- func RandomMag() Config
- func RandomMagSeed(seed int) Config
- func TwoDomain(mx1, my1, mz1, mxwall, mywall, mzwall, mx2, my2, mz2 float64) Config
- func Uniform(mx, my, mz float64) Config
- func Vortex(circ, pol int) Config
- func VortexWall(mleft, mright float64, circ, pol int) Config
- type DataTable
- type Euler
- type GetScalar
- type GetVector
- type Heun
- type LValue
- type OutputFormat
- type Param
- type Quantity
- type RK23
- type RK45DP
- type Regions
- func (r *Regions) Average() float64
- func (r *Regions) GetCell(ix, iy, iz int) int
- func (r *Regions) Gpu() *cuda.Bytes
- func (r *Regions) HostArray() [][][]byte
- func (r *Regions) HostList() []byte
- func (r *Regions) LoadFile(fname string)
- func (r *Regions) Mesh() *data.Mesh
- func (i *Regions) NComp() int
- func (i *Regions) Name() string
- func (r *Regions) SetCell(ix, iy, iz int, region int)
- func (r *Regions) Slice() (*data.Slice, bool)
- func (i *Regions) Unit() string
- type ScalarParam
- func (p *ScalarParam) Average() float64
- func (p *ScalarParam) Eval() interface{}
- func (p *ScalarParam) GetRegion(region int) float64
- func (p *ScalarParam) InputType() reflect.Type
- func (p *ScalarParam) IsUniform() bool
- func (p *ScalarParam) Mesh() *data.Mesh
- func (p *ScalarParam) Name() string
- func (p *ScalarParam) Region(r int) *sOneReg
- func (p *ScalarParam) Set(v float64)
- func (p *ScalarParam) SetRegion(region int, f script.ScalarFunction)
- func (p *ScalarParam) SetValue(v interface{})
- func (p *ScalarParam) Type() reflect.Type
- func (p *ScalarParam) Unit() string
- type Shape
- func Cell(ix, iy, iz int) Shape
- func Circle(diam float64) Shape
- func Cuboid(sidex, sidey, sidez float64) Shape
- func Cylinder(diam, height float64) Shape
- func Ellipse(diamx, diamy float64) Shape
- func Ellipsoid(diamx, diamy, diamz float64) Shape
- func ImageShape(fname string) Shape
- func Layer(index int) Shape
- func Layers(a, b int) Shape
- func Rect(sidex, sidey float64) Shape
- func Square(side float64) Shape
- func Universe() Shape
- func XRange(a, b float64) Shape
- func YRange(a, b float64) Shape
- func ZRange(a, b float64) Shape
- func (a Shape) Add(b Shape) Shape
- func (a Shape) Intersect(b Shape) Shape
- func (s Shape) Inverse() Shape
- func (s Shape) Repeat(periodX, periodY, periodZ float64) Shape
- func (s Shape) RotX(θ float64) Shape
- func (s Shape) RotY(θ float64) Shape
- func (s Shape) RotZ(θ float64) Shape
- func (s Shape) Scale(sx, sy, sz float64) Shape
- func (a Shape) Sub(b Shape) Shape
- func (s Shape) Transl(dx, dy, dz float64) Shape
- func (a Shape) Xor(b Shape) Shape
- type Stepper
- type TableData
- type VectorParam
- func (p *VectorParam) Average() data.Vector
- func (p *VectorParam) Comp(c int) *comp
- func (p *VectorParam) Eval() interface{}
- func (p *VectorParam) GetRegion(region int) [3]float64
- func (p *VectorParam) InputType() reflect.Type
- func (p *VectorParam) IsUniform() bool
- func (p *VectorParam) Mesh() *data.Mesh
- func (p *VectorParam) Name() string
- func (p *VectorParam) Region(r int) *vOneReg
- func (p *VectorParam) SetRegion(region int, f script.VectorFunction)
- func (p *VectorParam) SetRegionFn(region int, f func() [3]float64)
- func (p *VectorParam) SetValue(v interface{})
- func (p *VectorParam) Type() reflect.Type
- func (p *VectorParam) Unit() string
Constants ¶
const ( TILE = 2 // tile size in grains LAMBDA = TILE * TILE // expected grains per tile )
const ( EULER = 1 HEUN = 2 BOGAKISHAMPINE = 3 DORMANDPRINCE = 5 )
Arguments for SetSolver
const ( X = 0 Y = 1 Z = 2 )
const ( SCALAR = 1 VECTOR = 3 )
const CSS = `` /* 858-byte string literal not displayed */
const NREGION = 256 // maximum number of regions, limited by size of byte.
const VERSION = "mumax3.5.2"
Variables ¶
var (
Ku1, Kc1, Kc2 ScalarParam // uniaxial and cubic anis constants
AnisU, AnisC1, AnisC2 VectorParam // unixial and cubic anis axes
B_anis vAdder // field due to uniaxial anisotropy (T)
E_anis *GetScalar // Anisotorpy energy
Edens_anis sAdder // Anisotropy energy density
)
Anisotropy variables
var ( Msat ScalarParam Bsat derivedParam M_full vSetter B_demag vSetter E_demag *GetScalar Edens_demag sAdder EnableDemag = true // enable/disable demag field DemagAccuracy = 6.0 // Demag accuracy (divide cubes in at most N^3 points) CacheDir = "" // directory for kernel cache )
Demag variables
var ( E_total = NewGetScalar("E_total", "J", "Total energy", GetTotalEnergy) Edens_total sSetter // Total energy density )
var ( Aex ScalarParam // Exchange stiffness Dex ScalarParam // interfacial DMI strength //Dx, Dy, Dz ScalarParam // bulk DMI strength B_exch vAdder // exchange field (T) output handle //dx2, dy2, dz2 dexchParam // inter-cell DMI in 1e9 * Dex / Msat E_exch *GetScalar // Exchange energy Edens_exch sAdder // Exchange energy density ExchCoupling sSetter // Average exchange coupling with neighbors. Useful to debug inter-region exchange )
var ( BubblePos = NewGetVector("ext_bubblepos", "m", "Bubble core position", bubblePos) BubbleDist = NewGetScalar("ext_bubbledist", "m", "Bubble traveled distance", bubbleDist) BubbleSpeed = NewGetScalar("ext_bubblespeed", "m/s", "Bubble velocity", bubbleSpeed) )
var ( MFM sSetter MFMLift numberParam MFMTipSize numberParam )
var ( Time float64 // time in seconds Inject = make(chan func()) // injects code in between time steps. Used by web interface. Dt_si float64 = 1e-15 // time step = dt_si (seconds) *dt_mul, which should be nice float32 MinDt, MaxDt float64 // minimum and maximum time step MaxErr float64 = 1e-5 // maximum error/step Headroom float64 = 0.8 // solver headroom, (Gustafsson, 1992, Control of Error and Convergence in ODE Solvers) NSteps, NUndone, NEvals int // number of good steps, undone steps FixDt float64 // fixed time step? )
Solver globals
var ( FilenameFormat = "%s%06d" // formatting string for auto filenames. SnapshotFormat = "jpg" // user-settable snapshot format )
var ( TotalShift float64 // accumulated window shift (X) in meter ShiftMagL, ShiftMagR data.Vector // when shifting m, put these value at the left/right edge. ShiftM, ShiftGeom, ShiftRegions bool = true, true, true // should shift act on magnetization, geometry, regions? )
var ( Temp ScalarParam E_therm *GetScalar Edens_therm sAdder B_therm thermField )
var ( Alpha ScalarParam Xi ScalarParam Pol ScalarParam Lambda ScalarParam EpsilonPrime ScalarParam FixedLayer VectorParam Torque vSetter // total torque in T LLTorque vSetter // Landau-Lifshitz torque/γ0, in T STTorque vAdder // Spin-transfer torque/γ0, in T J excitation // Polarized electrical current density MaxTorque *GetScalar GammaLL float64 = 1.7595e11 // Gyromagnetic ratio of spins, in rad/Ts Precess = true )
var ( B_ext excitation E_Zeeman *GetScalar Edens_zeeman sAdder )
var B_eff vSetter // total effective field
var CorePos = NewGetVector("ext_corepos", "m", "Vortex core position (x,y) + polarization (z)", corePos)
var (
DWPos = NewGetScalar("ext_dwpos", "m", "Position of the simulation window while following a domain wall", GetShiftPos) // TODO: make more accurate
)
var (
DWSpeed = NewGetScalar("ext_dwspeed", "m/s", "Speed of the simulation window while following a domain wall", getShiftSpeed)
)
used for speed
var DWTiltPMA = NewGetScalar("ext_dwtilt", "rad", "PMA domain wall tilt", dwTiltPMA)
PMA domain wall tilt assuming straight wall.
var M magnetization // reduced magnetization (unit length)
var OD = "./" // Output directory
var (
SaveQue chan func() // passes save requests from runDownloader to runSaver
)
var StartTime = time.Now()
var Table = *newTable("table") // output handle for tabular data (average magnetization etc.)
var (
Timeout = 3 * time.Second // exit finished simulation this long after browser was closed
)
global GUI state stores what is currently shown in the web page.
var UNAME = VERSION + " " + runtime.GOOS + "_" + runtime.GOARCH + " " + runtime.Version() + " (" + runtime.Compiler + ")"
var World = script.NewWorld()
holds the script state (variables etc)
Functions ¶
func AddExchangeField ¶
Adds the current exchange field to dst
func AutoSnapshot ¶
Register quant to be auto-saved as image, every period.
func CenterWall ¶
func CenterWall(magComp int)
This post-step function centers the simulation window on a domain wall between up-down (or down-up) domains (like in perpendicular media). E.g.:
PostStep(CenterPMAWall)
func DeclLValue ¶
Add an LValue to the script world. Assign to LValue invokes SetValue()
func DeclROnly ¶
Add a read-only variable to the script world. It can be changed, but not by the user.
func DefRegionCell ¶
func DoOutput ¶
func DoOutput()
Periodically called by run loop to save everything that's needed at this time.
func Fprintln ¶
func Fprintln(filename string, msg ...interface{})
Append msg to file. Used to write aggregated output of many simulations in one file.
func GetExchangeEnergy ¶
func GetExchangeEnergy() float64
Returns the current exchange energy in Joules.
func GetThermalEnergy ¶
func GetThermalEnergy() float64
func GetZeemanEnergy ¶
func GetZeemanEnergy() float64
func Index2Coord ¶
converts cell index to coordinate, internal coordinates
func InjectAndWait ¶
func InjectAndWait(task func())
inject code into engine and wait for it to complete.
func PostStep ¶
func PostStep(f func())
Register function f to be called after every time step. Typically used, e.g., to manipulate the magnetization.
func RemoveLRSurfaceCharge ¶
For a nanowire magnetized in-plane, with mx = mxLeft on the left end and mx = mxRight on the right end (both -1 or +1), add a B field needed to compensate for the surface charges on the left and right edges. This will mimic an infinitely long wire.
func SanityCheck ¶
func SanityCheck()
func ScaleInterExchange ¶
Scales the heisenberg exchange interaction between region1 and 2. Scale = 1 means the harmonic mean over the regions of Aex/Msat.
func SetBusy ¶
func SetBusy(b bool)
We set SetBusy(true) when the simulation is too busy too accept GUI input on Inject channel. E.g. during kernel init.
func SetCellSize ¶
func SetCellSize(cx, cy, cz float64)
func SetEffectiveField ¶
Sets dst to the current effective field (T).
func SetGridSize ¶
func SetGridSize(Nx, Ny, Nz int)
func SetMesh ¶
Set the simulation mesh to Nx x Ny x Nz cells of given size. Can be set only once at the beginning of the simulation. TODO: dedup arguments from globals
func SetOD ¶
SetOD sets the output directory where auto-saved files will be stored. The -o flag can also be used for this purpose.
func TableAddVariable ¶
func TableAddVariable(x script.ScalarFunction, name, unit string)
func TableAutoSave ¶
func TableAutoSave(period float64)
func TablePrint ¶
func TablePrint(msg ...interface{})
Types ¶
type Config ¶
Magnetic configuration returns m vector for position (x,y,z)
func AntiVortex ¶
func BlochSkyrmion ¶
func NeelSkyrmion ¶
func RandomMagSeed ¶
func TwoDomain ¶
Make a 2-domain configuration with domain wall. (mx1, my1, mz1) and (mx2, my2, mz2) are the magnetizations in the left and right domain, respectively. (mxwall, mywall, mzwall) is the magnetization in the wall. The wall is smoothed over a few cells so it will easily relax to its ground state. E.g.:
TwoDomain(1,0,0, 0,1,0, -1,0,0) // head-to-head domains with transverse (Néel) wall TwoDomain(1,0,0, 0,0,1, -1,0,0) // head-to-head domains with perpendicular (Bloch) wall TwoDomain(0,0,1, 1,0,0, 0,0,-1)// up-down domains with Bloch wall
func Uniform ¶
Returns a uniform magnetization state. E.g.:
M = Uniform(1, 0, 0)) // saturated along X
func Vortex ¶
Make a vortex magnetization with given circulation and core polarization (+1 or -1). The core is smoothed over a few exchange lengths and should easily relax to its ground state.
func VortexWall ¶
Make a vortex wall configuration.
type DataTable ¶
func (*DataTable) AddVariable ¶
func (t *DataTable) AddVariable(x script.ScalarFunction, name, unit string)
type GetScalar ¶
type GetScalar struct {
// contains filtered or unexported fields
}
func NewGetScalar ¶
INTERNAL
type GetVector ¶
type GetVector struct {
// contains filtered or unexported fields
}
func NewGetVector ¶
INTERNAL
type LValue ¶
type LValue interface { SetValue(interface{}) // assigns a new value Eval() interface{} // evaluate and return result (nil for void) Type() reflect.Type // type that can be assigned and will be returned by Eval }
LValue is settable
type OutputFormat ¶
type OutputFormat int
const ( OVF1_TEXT OutputFormat = iota + 1 OVF1_BINARY OVF2_TEXT OVF2_BINARY )
type Param ¶
type Param interface { NComp() int Name() string Unit() string IsUniform() bool // contains filtered or unexported methods }
displayable quantity in GUI Parameters section
type Quantity ¶
type Quantity interface { Slice() (q *data.Slice, recycle bool) // get quantity data (GPU or CPU), indicate need to recycle NComp() int Name() string Unit() string Mesh() *data.Mesh // contains filtered or unexported methods }
Any space-dependent quantity
type RK23 ¶
type RK23 struct {
// contains filtered or unexported fields
}
Bogacki-Shampine solver. 3rd order, 3 evaluations per step, adaptive step.
http://en.wikipedia.org/wiki/Bogacki-Shampine_method k1 = f(tn, yn) k2 = f(tn + 1/2 h, yn + 1/2 h k1) k3 = f(tn + 3/4 h, yn + 3/4 h k2) y{n+1} = yn + 2/9 h k1 + 1/3 h k2 + 4/9 h k3 // 3rd order k4 = f(tn + h, y{n+1}) z{n+1} = yn + 7/24 h k1 + 1/4 h k2 + 1/3 h k3 + 1/8 h k4 // 2nd order
type Regions ¶
type Regions struct {
// contains filtered or unexported fields
}
stores the region index for each cell
func (*Regions) LoadFile ¶
Load regions from ovf file, use first component. Regions should be between 0 and 256
type ScalarParam ¶
type ScalarParam struct {
// contains filtered or unexported fields
}
specialized param with 1 component
func (*ScalarParam) Average ¶
func (p *ScalarParam) Average() float64
func (*ScalarParam) Eval ¶
func (p *ScalarParam) Eval() interface{}
func (*ScalarParam) GetRegion ¶
func (p *ScalarParam) GetRegion(region int) float64
func (*ScalarParam) InputType ¶
func (p *ScalarParam) InputType() reflect.Type
func (*ScalarParam) Region ¶
func (p *ScalarParam) Region(r int) *sOneReg
func (*ScalarParam) Set ¶
func (p *ScalarParam) Set(v float64)
func (*ScalarParam) SetRegion ¶
func (p *ScalarParam) SetRegion(region int, f script.ScalarFunction)
func (*ScalarParam) SetValue ¶
func (p *ScalarParam) SetValue(v interface{})
func (*ScalarParam) Type ¶
func (p *ScalarParam) Type() reflect.Type
type Shape ¶
geometrical shape for setting sample geometry
func ImageShape ¶
func (Shape) Repeat ¶
Infinitely repeats the shape with given period in x, y, z. A period of 0 or infinity means no repetition.
type Stepper ¶
type Stepper interface { Step() // take time step using solver globals Free() // free resources, if any (e.g.: RK23 previous torque) }
Time stepper like Euler, Heun, RK23
type TableData ¶
type TableData interface { Name() string Unit() string NComp() int // contains filtered or unexported methods }
can be saved in table
type VectorParam ¶
type VectorParam struct {
// contains filtered or unexported fields
}
vector input parameter, settable by user
func (*VectorParam) Average ¶
func (p *VectorParam) Average() data.Vector
func (*VectorParam) Comp ¶
func (p *VectorParam) Comp(c int) *comp
func (*VectorParam) Eval ¶
func (p *VectorParam) Eval() interface{}
func (*VectorParam) GetRegion ¶
func (p *VectorParam) GetRegion(region int) [3]float64
func (*VectorParam) InputType ¶
func (p *VectorParam) InputType() reflect.Type
func (*VectorParam) Region ¶
func (p *VectorParam) Region(r int) *vOneReg
func (*VectorParam) SetRegion ¶
func (p *VectorParam) SetRegion(region int, f script.VectorFunction)
func (*VectorParam) SetRegionFn ¶
func (p *VectorParam) SetRegionFn(region int, f func() [3]float64)
func (*VectorParam) SetValue ¶
func (p *VectorParam) SetValue(v interface{})
func (*VectorParam) Type ¶
func (p *VectorParam) Type() reflect.Type
Source Files ¶
- adder.go
- anisotropy.go
- asyncio.go
- autosave.go
- average.go
- comp.go
- config.go
- crop.go
- demag.go
- derivedparam.go
- effectivefield.go
- energy.go
- engine.go
- euler.go
- exchange.go
- excitation.go
- ext_bubblepos.go
- ext_centerwall.go
- ext_corepos.go
- ext_dwtilt.go
- ext_makegrains.go
- ext_rmsurfacecharge.go
- geom.go
- getfunc.go
- gui.go
- heun.go
- html.go
- info.go
- inputparam.go
- log.go
- lutdata.go
- magnetization.go
- mesh.go
- mfm.go
- numberparam.go
- od.go
- oneregion.go
- plot.go
- quantity.go
- regions.go
- relax.go
- render.go
- rk23.go
- rk45dp.go
- run.go
- save.go
- scalarparam.go
- script.go
- setter.go
- shape.go
- shift.go
- table.go
- temperature.go
- torque.go
- util.go
- vectorparam.go
- zeeman.go