vinamax2

package module
v0.0.0-...-1989004 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 28, 2015 License: GPL-3.0 Imports: 13 Imported by: 0

README

vinamax2

Documentation

Overview

Contains function to control the output of the program

Index

Constants

View Source
const (
	X = 0
	Y = 1
	Z = 2
)

Variables

View Source
var (
	Root      Cell        // roots the entire FMM tree
	Level     [][]*Cell   // for each level of the FMM tree: all cells on that level. Root = level 0
	Particles []*Particle // all particles, to be manipulated via Root.AddParticle

	FMMOrder  = 0
	Proximity = 1.1
)

FMM globals

View Source
var (
	//These variables can be set in the input files
	B_ext       func(t float64) (float64, float64, float64)                  // External applied field in T
	B_ext_space func(t, x, y, z float64) (float64, float64, float64)         // External applied field in T
	Dt          float64                                              = -1    // Timestep in s
	Mindt       float64                                              = 1e-20 //smallest allowed timestep
	Maxdt       float64                                              = 1     //largest allowed timestep
	T           float64                                                      // Time in s
	Alpha       float64                                              = -1    // Gilbert damping constant

	Temp           float64 = -1 // Temperature in K
	Ku1            float64 = 0  // Uniaxial anisotropy constant in J/m**3
	Kc1            float64 = 0  // Cubic anisotropy constant in J/m**3
	Errortolerance float64 = 1e-8
	Thresholdbeta  float64 = 0.3 // The threshold value for the FMM

	//universe       node           // The entire universe of the simulation
	FMM   bool = false // Calculate demag with FMM method
	Demag bool = true  // Calculate demag

	Adaptivestep bool = false

	Jumpnoise bool = false
	Brown     bool = false
)
View Source
var NEvals int

Functions

func AddParticle

func AddParticle(p *Particle)

Add a particle to the global FMM tree and Particles list

func Anisotropy_axis

func Anisotropy_axis(x, y, z float64)

Gives all particles the same specified uniaxialanisotropy-axis

func Anisotropy_random

func Anisotropy_random()

Gives all particles a random anisotropy-axis

func AtExit

func AtExit(cleanup func())

Add a function to be executed at program exit.

func C1anisotropy_axis

func C1anisotropy_axis(x, y, z float64)

Gives all particles the same specified cubic1anisotropy-axis

func C2anisotropy_axis

func C2anisotropy_axis(x, y, z float64)

Gives all particles the same specified cubic2anisotropy-axis, must be orthogonal to c1

func CalcDemag

func CalcDemag()

Calculates the magnetostatic field of all Particles.

func CalcDemagBrute

func CalcDemagBrute()

func CalcDemagParallel

func CalcDemagParallel()

EXPERIMENTAL

func CalculateCenterOfMags

func CalculateCenterOfMags()

func Cleanup

func Cleanup()

Runs all functions stacked by AtExit().

func DemagError

func DemagError() float64

RMS difference between CalcDemag and brute-force method

func Demagevery

func Demagevery(t float64)

demag every interval

func DiffBxdx

func DiffBxdx(m, R Vector) float64

func DiffBxdy

func DiffBxdy(m, R Vector) float64

func DiffBxdz

func DiffBxdz(m, R Vector) float64

func DiffBydx

func DiffBydx(m, R Vector) float64

func DiffBydy

func DiffBydy(m, R Vector) float64

func DiffBydz

func DiffBydz(m, R Vector) float64

func DiffBzdx

func DiffBzdx(m, R Vector) float64

func DiffBzdy

func DiffBzdy(m, R Vector) float64

func DiffBzdz

func DiffBzdz(m, R Vector) float64

func Fatal

func Fatal(msg ...interface{})

func FatalErr

func FatalErr(err interface{})

If err != nil, trigger log.Fatal(msg, err)

func InitCPUProfile

func InitCPUProfile()

start CPU profiling, safe to cpu.pprof

func InitFMM

func InitFMM(worldSize Vector, nLevels int)

Initializes the global FMM variables Root, Level with an FMM octree, nLevels deep (8^(nLevels-1)) base cells.

func InitFMM2

func InitFMM2()

func InitMemProfile

func InitMemProfile()

start memory profiling

func IsFar

func IsFar(a, b *Cell) bool

Are the cells considered far separated?

func Log

func Log(msg ...interface{})

func LogErr

func LogErr(err error, msg ...interface{})

Logs the error of non-nil, plus message

func M_random

func M_random()

Gives all particles with random magnetisation orientation

func M_uniform

func M_uniform(x, y, z float64)

Gives all particles a specified magnetisation direction

func Msat

func Msat(x float64)

Sets the saturation magnetisation of all Particles in A/m

func NoExt

func NoExt(file string) string

Remove extension from file name.

func Output

func Output(interval float64)

Sets the interval at which Mul the output table has to be written

func PanicErr

func PanicErr(err error)

Panics if err is not nil. Signals a bug.

func Particle_radius

func Particle_radius(x float64)

Sets the radius of all entries in radii to a constant value

func PruneTree

func PruneTree()

Prunes all the empty cells from the fmm tree

func Run

func Run(time float64)

func Save

func Save(a string)

Saves different quantities. At the moment only "geometry" and "m" are possible

func Setrandomseed

func Setrandomseed(a int64)

Set the randomseed for the temperature

func Setsolver

func Setsolver(a string)

Set the solver to use, "euler" or "heun"

func Tableadd

func Tableadd(a string)

adds a quantity to the output table

func Tableadd_b_at_location

func Tableadd_b_at_location(x, y, z float64)

Adds the field at a specific location to the output table

Types

type Cell

type Cell struct {
	// contains filtered or unexported fields
}

Cell in the FMM tree

func (*Cell) Center

func (c *Cell) Center() Vector

func (*Cell) CenterOfMag

func (c *Cell) CenterOfMag() Vector

func (*Cell) Divide

func (c *Cell) Divide(nLevels int)

Create child cells to reach nLevels of levels and add to global level array. nLevels == 1 stops creating children (we always already have at least 1 level), but still adds the cell to the global level array.

func (*Cell) FindPartners

func (c *Cell) FindPartners(candidates []*Cell)

Recursively find partner cells from a list candidates. To be called on the root cell with level[0] as candidates. Partners are selected from a cell's own level, so they have the same size (otherwise it's just anarchy!) TODO: when we have unit tests, it can be optimized not to do so many allocations

func (*Cell) IsLeaf

func (c *Cell) IsLeaf() bool

Is this cell a leaf cell?

func (*Cell) Len

func (c *Cell) Len() int

returns the amount of particles lying in this cell

func (*Cell) Moment

func (c *Cell) Moment() float64

returns the moment of a cell

func (*Cell) String

func (c *Cell) String() string

type Particle

type Particle struct {
	M Vector // magnetization
	// contains filtered or unexported fields
}

func NewParticle

func NewParticle(center Vector, radius float64, M Vector, Msat float64) *Particle

func (*Particle) Bdemag

func (p *Particle) Bdemag() Vector

TODO (j): just export b field + rename

func (*Particle) BruteDemag

func (p *Particle) BruteDemag() Vector

Brute-force demag calculation for debugging.

func (*Particle) Center

func (p *Particle) Center() Vector

type Vector

type Vector [3]float64

3-component vector

func DiffDipole

func DiffDipole(i int, m, R Vector) Vector

func DipoleField

func DipoleField(m, R Vector) Vector

Field generated at position R relative to dipole m

func (Vector) Abs

func (v Vector) Abs() Vector

func (Vector) Add

func (a Vector) Add(b Vector) Vector

Returns a+b.

func (Vector) Cross

func (a Vector) Cross(b Vector) Vector

Returns the cross (vector) product a x b in a right-handed coordinate system.

func (Vector) Div

func (v Vector) Div(a float64) Vector

Returns (1/a)*v.

func (Vector) Dot

func (a Vector) Dot(b Vector) float64

Returns the dot (inner) product a.b.

func (Vector) Len

func (v Vector) Len() float64

Returns the norm of v.

func (Vector) Len2

func (v Vector) Len2() float64

Returns the norm squared

func (Vector) MAdd

func (a Vector) MAdd(s float64, b Vector) Vector

Returns a+s*b.

func (Vector) MaxNorm

func (v Vector) MaxNorm() float64

Returns the uniform norm of v (maximum of absolute values of components)

func (Vector) Mul

func (v Vector) Mul(a float64) Vector

Returns a*v.

func (Vector) Mul3

func (v Vector) Mul3(a Vector) Vector

point-wise multiplication of components

func (Vector) Sub

func (a Vector) Sub(b Vector) Vector

Returns a-b.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL