-
Notifications
You must be signed in to change notification settings - Fork 2
/
var.go
130 lines (122 loc) · 5.05 KB
/
var.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
package vinamax2
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
gammaoveralpha float64 //g/1+alfa^2
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
demagtime float64
//universe node // The entire universe of the simulation
FMM bool = false // Calculate demag with FMM method
Demag bool = true // Calculate demag
demagevery bool = false // Calculate demag only after certain interval
Adaptivestep bool = false
solver string = "dopri" // The solver used
outputinterval float64
maxtauwitht float64 = 0. //maximum torque during the simulations with temperature
order int = 5 //the order of the solver
constradius float64
logradius_m float64
logradius_s float64
msatcalled bool = false
radiuscalled bool = false
constradiuscalled bool = false
logradiuscalled bool = false
uaniscalled bool = false
c1called bool = false
c2called bool = false
worldcalled bool = false
magnetisationcalled bool = false
treecalled bool = false
outputcalled bool = false
randomseedcalled bool = false
tableaddcalled bool = false
Jumpnoise bool = false
Brown bool = false
)
//initialised B_ext functions
func init() {
B_ext = func(t float64) (float64, float64, float64) { return 0, 0, 0 } // External applied field in T
B_ext_space = func(t, x, y, z float64) (float64, float64, float64) { return 0, 0, 0 } // External applied field in T
}
//demag every interval
func Demagevery(t float64) {
demagevery = true
demagtime = t
}
//test the inputvalues for unnatural things
func testinput() {
if Demag == true && demagevery == true {
Fatal("You cannot call both Demagevery and Demag, pick one")
}
if Dt < 0 {
Fatal("Dt cannot be smaller than 0, did you forget to initialise?")
}
if Alpha < 0 {
Fatal("Alpha cannot be smaller than 0, did you forget to initialise?")
}
if Temp < 0 {
Fatal("Temp cannot be smaller than 0, did you forget to initialise?")
}
}
//checks the inputfiles for functions that should have been called but weren't
func syntaxrun() {
Log("TODO: call syntaxrun()!")
// if msatcalled == false {
// log.Fatal("You have to specify msat")
// }
// if radiuscalled == false {
// log.Fatal("You have to specify the size of the particles")
// }
// if uaniscalled == false && Ku1 != 0 {
// log.Fatal("You have to specify the uniaxial anisotropy-axis")
// }
// if (c1called == false || c2called == false) && Kc1 != 0 {
// log.Fatal("You have to specify the cubic anisotropy-axes")
// }
// if worldcalled == false {
// log.Fatal("You have define a \"World\"")
// }
// if magnetisationcalled == false {
// log.Fatal("You have specify the initial magnetisation")
// }
// if treecalled == false && FMM == true {
// log.Fatal("You have to run Maketree() as last command in front of Run() when using the FMM method")
// }
// if Temp != 0 && randomseedcalled == false {
// log.Fatal("You have to run Setrandomseed() when using nonzero temperatures")
// }
// if tableaddcalled == true && outputcalled == false {
// log.Fatal("You have to run Output(interval) when calling tableadd")
// }
// if Brown == true && Adaptivestep == true {
// log.Fatal("Brown Temperature can only be used with fixed timestep")
// }
// //if Jumpnoise == true {
// // resetswitchtimes(universe.lijst)
// //}
// if Temp != 0 && Brown == false && Jumpnoise == false {
// log.Fatal("You have to specify which temperature you want to use: \"Jumpnoise\" or \"Brown\"")
// }
// //if Brown {
// // calculatetempnumbers(universe.lijst)
// //}
}
//Sets the radius of all entries in radii to a constant value
func Particle_radius(x float64) {
radiuscalled = true
constradiuscalled = true
if x < 0 {
Fatal("particles can't have a negative radius")
}
constradius = x
}