-
Notifications
You must be signed in to change notification settings - Fork 0
/
PolyakovChainModels.jl
356 lines (229 loc) · 12.1 KB
/
PolyakovChainModels.jl
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
using GaugeSQM
using Plots
using Statistics
#prob = GaugeSQM.PolyakovChainProblem(SU2,1e-3,1.,0.5*(1. + 5*sqrt(3)*im),5;NTr=10)
prob = GaugeSQM.PolyakovChainProblem(SU3,1e-3,1.,2.,30;NTr=10,κ=0.1,μ=1.)
noRegs = Regulators(NoGaugeCooling(), NoDynamicStabilization())
regs_GC = Regulators(GaugeCooling(1.0,1), NoDynamicStabilization())
regs_GCAD = Regulators(GaugeCoolingAdaptive(1.0,0.8,10), NoDynamicStabilization())
#regs_I = Regulators(GaugeCooling(0.03,5), NoDynamicStabilization())
#regs_I_Ad = Regulators(GaugeCoolingAdaptive(1.0,0.8,1), NoDynamicStabilization())
DSRegs = Regulators(GaugeCoolingAdaptive(1.0,0.8,1), DynamicStabilization(1.0))
saveat = 0.01
@time sol_E = solve(prob,gEM(),noRegs)
@time sol_E_DS = solve(prob,gEM(),DSRegs,adaptive=true,saveat=saveat)
@time sol_E_GC = solve(prob,gEM(),regs_GC; adaptive=true, saveat=saveat)
@time sol_E_GCAD = solve(prob,gEM(),regs_GCAD; adaptive=false, saveat=saveat)
@time sol_I = solve(prob,gθEM(1.0),noRegs)
@time sol_I_DS = solve(prob,gθEM(1.0),DSRegs,adaptive=true,saveat=saveat)
@time sol_I_GC = solve(prob,gθEM(1.0),regs_GC; adaptive=true,saveat=saveat)
@time sol_I_GCAD = solve(prob,gθEM(1.0),regs_GCAD; adaptive=false, saveat=saveat)
dts = Float64[]
### Why adaptive stepsize is worse for implicit scheme?
cb = function (integrator)
append!(dts,integrator.dt)
end
dts_I = dts
dts_E = dts
begin
fig = plot(yaxis=:log,ylim=[7e-5,1e-3])
plot!(fig,dts_E)
plot!(fig,dts_I)
end
termTime = 1
sol_E = reshape(sol_E[:,floor(Int64,1/saveat)*termTime:end],:)
sol_E_DS = reshape(sol_E_DS[:,floor(Int64,1/saveat)*termTime:end],:)
sol_E_GC = reshape(sol_E_GC[:,floor(Int64,1/saveat)*termTime:end],:)#[1:10:end]
sol_E_GCAD = reshape(sol_E_GCAD[:,floor(Int64,1/saveat)*termTime:end],:)#[1:10:end]
sol_E = sol_E[abs.(real(sol_E)) .< 1e6]
sol_E = sol_E[abs.(imag(sol_E)) .< 1e6]
sol_E_GC = sol_E_GC[abs.(real(sol_E_GC)) .< 1e10]
sol_E_GC = sol_E_GC[abs.(imag(sol_E_GC)) .< 1e10]
sol_E_GCAD = sol_E_GCAD[abs.(real(sol_E_GCAD)) .< 1e6]
sol_E_GCAD = sol_E_GCAD[abs.(imag(sol_E_GCAD)) .< 1e6]
sol_I = reshape(sol_I[:,floor(Int64,1/saveat)*termTime:end],:)
sol_I_DS = reshape(sol_I_DS[:,floor(Int64,1/saveat)*termTime:end],:)
sol_I_GC = reshape(sol_I_GC[:,floor(Int64,1/saveat)*termTime:end],:)
sol_I_GCAD = reshape(sol_I_GCAD[:,floor(Int64,1/saveat)*termTime:end],:)
begin
ylim = [-10,10]
plot(real(sol_I_GC_AD),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(real(sol_I_GC_AD)),ylim=[1e-3,10],yaxis=:log,label="Implicit Re GC_AD")
plot!(real(sol_E_GCAD),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(real(sol_E_GCAD)),ylim=[1e-3,10],yaxis=:log,label="Explicit Re GC_AD")
plot!(real(sol_I_GC),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(real(sol_I_GC)),ylim=[1e-3,10],yaxis=:log,label="Implicit Re GC")
plot!(real(sol_E_GC),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(real(sol_E_GC)),ylim=[1e-3,10],yaxis=:log,label="Explicit Re GC")
#plot!(real(sol_I),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(real(sol_I)),ylim=[1e-3,10],yaxis=:log,label="Implicit Re")
#plot!(real(sol_E),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(real(sol_E)),ylim=[1e-3,10],yaxis=:log,label="Explicit Re")
plot!(imag(sol_I_GC_AD),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(imag(sol_I_GC_AD)),ylim=[1e-3,10],yaxis=:log,label="Implicit Im GC_AD")
plot!(imag(sol_E_GCAD),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(imag(sol_E_GCAD)),ylim=[1e-3,10],yaxis=:log,label="Explicit Im GC_AD")
plot!(imag(sol_I_GC),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(imag(sol_I_GC)),ylim=[1e-3,10],yaxis=:log,label="Implicit Im GC")
plot!(imag(sol_E_GC),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(imag(sol_E_GC)),ylim=[1e-3,10],yaxis=:log,label="Explicit Im GC")
#plot!(imag(sol_E),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(imag(sol_E)),ylim=[1e-3,10],yaxis=:log,label="Explicit Im")
#plot!(imag(sol_I),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(imag(sol_I)),ylim=[1e-3,10],yaxis=:log,label="Implicit Im")
end
begin
ylim = [-15,15]
plot(real(sol_I_GC_AD),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(real(sol_I_GC_AD)),ylim=[1e-3,10],yaxis=:log,label="Implicit Re GC_AD")
plot!(imag(sol_I_GC_AD),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(imag(sol_I_GC_AD)),ylim=[1e-3,10],yaxis=:log,label="Implicit Im GC_AD")
end
begin
ylim = [-5,5]
plot(real(sol_I_GC),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(real(sol_I_GC_AD)),ylim=[1e-3,10],yaxis=:log,label="Implicit Re GC_AD")
plot!(imag(sol_I_GC),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(imag(sol_I_GC_AD)),ylim=[1e-3,10],yaxis=:log,label="Implicit Im GC_AD")
end
begin
ylim = [-5,5]
plot(real(sol_E_GCAD),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(real(sol_E_GCAD)),ylim=[1e-3,10],yaxis=:log,label="Explicit Re GC_AD")
plot!(imag(sol_E_GCAD),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(imag(sol_E_GCAD)),ylim=[1e-3,10],yaxis=:log,label="Explicit Im GC_AD")
end
begin
ylim = [-5,5]
plot(real(sol_I),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(real(sol_I)),ylim=[1e-3,10],yaxis=:log,label="Implicit Re")
plot!(imag(sol_I),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(imag(sol_I)),ylim=[1e-3,10],yaxis=:log,label="Implicit Im")
#plot!(real(sol_E),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(real(sol_E)),ylim=[1e-3,10],yaxis=:log,label="Explicit Re")
#plot!(imag(sol_E),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(imag(sol_E)),ylim=[1e-3,10],yaxis=:log,label="Explicit Im")
end
begin
ylim = [-50,50]
plot(real(sol_I_GC),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(real(sol_I_GC)),ylim=[1e-3,10],yaxis=:log,label="Implicit Re GC")
plot!(imag(sol_I_GC),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(imag(sol_I_GC)),ylim=[1e-3,10],yaxis=:log,label="Implicit Im GC")
plot!(real(sol_E_GC),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(real(sol_E_GC)),ylim=[1e-3,10],yaxis=:log,label="Explicit Re GC")
plot!(imag(sol_E_GC),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(imag(sol_E_GC)),ylim=[1e-3,10],yaxis=:log,label="Explicit Im GC")
end
begin
ylim = [-20,20]
plot(real(sol_I_DS),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(real(sol_I_DS)),ylim=[1e-3,10],yaxis=:log,label="Implicit Re DS")
plot!(imag(sol_I_DS),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(imag(sol_I_DS)),ylim=[1e-3,10],yaxis=:log,label="Implicit Im DS")
plot!(real(sol_E_DS),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(real(sol_E_DS)),ylim=[1e-3,10],yaxis=:log,label="Explicit Re DS")
plot!(imag(sol_E_DS),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(imag(sol_E_DS)),ylim=[1e-3,10],yaxis=:log,label="Explicit Im DS")
end
begin
ylim = [-5,5]
plot(real(sol_E_DS),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(real(sol_E_DS)),ylim=[1e-3,10],yaxis=:log,label="Explicit Re DS")
plot!(imag(sol_E_DS),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(imag(sol_E_DS)),ylim=[1e-3,10],yaxis=:log,label="Explicit Im DS")
plot!(real(sol_E_GC),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(real(sol_E_GC)),ylim=[1e-3,10],yaxis=:log,label="Explicit Re GC")
plot!(imag(sol_E_GC),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(imag(sol_E_GC)),ylim=[1e-3,10],yaxis=:log,label="Explicit Im GC")
plot!(real(sol_E_GCAD),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(real(sol_E_GCAD)),ylim=[1e-3,10],yaxis=:log,label="Explicit Re GCAD")
plot!(imag(sol_E_GCAD),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(imag(sol_E_GCAD)),ylim=[1e-3,10],yaxis=:log,label="Explicit Im GCAD")
plot!(real(sol_I_DS),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(real(sol_I_DS)),ylim=[1e-3,10],yaxis=:log,label="Implicit Re DS")
plot!(imag(sol_I_DS),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(imag(sol_I_DS)),ylim=[1e-3,10],yaxis=:log,label="Implicit Im DS")
plot!(real(sol_I_GC),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(real(sol_I_GC)),ylim=[1e-3,10],yaxis=:log,label="Implicit Re GC")
plot!(imag(sol_I_GC),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(imag(sol_I_GC)),ylim=[1e-3,10],yaxis=:log,label="Implicit Im GC")
plot!(real(sol_I_GCAD),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(real(sol_I_GCAD)),ylim=[1e-3,10],yaxis=:log,label="Implicit Re GC")
plot!(imag(sol_I_GCAD),xlim=ylim,seriestype=:stephist, norm=true,bins=GaugeSQM.get_nr_bins(imag(sol_I_GCAD)),ylim=[1e-3,10],yaxis=:log,label="Implicit Im GC")
end
mean(mean(sol_E_GC,dims=2))
mean(sol_I_GC_AD)
sol
begin
fig = plot(ylim=[-10,10])
plot!(fig,real(sol_E_GCAD[1300:2000]), label="Re Explicit")
plot!(fig,real(sol_I_GC_AD[1300:2000]), label="Re Implicit")
end
begin
fig = plot(ylim=[-100,100])
plot!(fig,imag(sol_E_GCAD), label="Im Explicit")
plot!(fig,imag(sol_I_GC_AD), label="Im Implicit")
end
sol_E
sol_E = [s for s in sol_E if !isnan(s)]
using Measurements
begin
exact = 2.09
N16PC_E = Measurement{Float64}[]
N16PC_I = Measurement{Float64}[]
prob = GaugeSQM.PolyakovChainProblem(SU3,1e-4,30.,2.,10;NTr=20,κ=0.1,μ=1.)
αs = collect(0.03:0.2:1.53)
for α in αs
println("Starting on ", α)
regs = Regulators(GaugeCooling(α,5), NoDynamicStabilization())
saveat = 0.005
termTime = 1
@time sol_E_GC = solve(prob,gEM(),regs; adaptive=true, saveat=saveat)
M_E_GC = mean(sol_E_GC[:,floor(Int64,1/prob.dt)*termTime:end],dims=2)
append!(N16PC_E,real(mean(M_E_GC)) ± real(std(M_E_GC))/sqrt(length(M_E_GC)))
#append!(N16PC_E,real(mean(sol_E_GC)) ± real(std(sol_E_GC))/sqrt(length(sol_E_GC)))
@time sol_I_GC = solve(prob,gθEM(1.0),regs; adaptive=true, saveat=saveat)
M_I_GC = mean(sol_I_GC[:,floor(Int64,1/prob.dt)*termTime:end],dims=2)
append!(N16PC_I,real(mean(M_I_GC)) ± real(std(M_I_GC))/sqrt(length(M_I_GC)))
#append!(N16PC_I,real(mean(sol_I_GC)) ± real(std(sol_I_GC))/sqrt(length(sol_I_GC)))
end
end
begin
fig = plot()
hline!(fig,[exact])
scatter!(fig,N16PC_E)
scatter!(fig,N16PC_I)
end
A = LieAlgebraFields(ComplexF64,2,10)
sum(norm,A)
for i in A
@show i
end
GaugeSQM.clear!(A)
Aview = view(A.a,:,1)
A[1:2,1] = [2.,1.]
A
randn(size(A.a))
GaugeSQM.mul!(B,2.,A)
A*B
GaugeSQM.gauss_distribution_lie!(A)
A
B.a .= convert(typeof(A.a),randn(size(A.a)))
B
B = similar(A)
g = zeros(SUMatrix{2},10)
[SUMatrix{2}(0,0,0,0) for i in 1:10]
SU2Matrix(0.,0.,0.,0. + im) *
SU2Matrix(0.,0.,0.,0. + im)
copy(GF.g)
GF1 = GaugeFields(2,10)
GF2 = GaugeSQM.IdentityGauges(2,1)
GF3 = GaugeSQM.RandomGauges(2,10)
for i in 1:1000000
GaugeCoolingUpdate!(GF3,A,similar(A),similar(GF3),similar(GF3),similar(GF3))
end
GF3
sum(tr,GF3)
using LinearAlgebra
mul!(GF1,GF2,GF3)
GF1
GF3
GaugeSQM.trT(GF)
(1/2)*GaugeSQM.tr(GF2[1])
GaugeSQM.substitute!(GF1,GF2)
GF1
GF2[1] = SUMatrix{2}(2000,0,0,0)
GF2
M = GF[1]
G = M
AF[1]
GF[1]
AF[1] = SUMatrix{2}(2,1,1,1)
GF
copy(GF)
GaugeSQM.Gauge2Lie!(A,GF)
A
GF[1][1,1] = 1
GF[5] = SUMatrix{GF.NC}(1. + im,2.,3.,4.)
GF = GaugeSQM.IdentityGauges(2,10)
GF = GaugeSQM.RandomGauges(2,10)
eltype(GF.g)(1,2,3,4)
GF
GaugeSQM.clear!(GF)
f(G::GaugeFields{S,T}) where {S <: SU2, T} = T
f(GF)
@. GF.g = GaugeSQM.identity(GF.g[1])
typeof(zero(eltype(GF.g)))
typeof(identity(GF.g[1]))
typeof(GF.g)
eltype(GF.g)
typeof(identity(GF.g[1]))
GF
V = [SUMatrix{GF.NC}(1. + im,2.,3.,4.) for i in 1:3]
eltype(V)
SUMatrix{2}(1. + im,2.,3.,4.)
zeros(SUMatrix{2},10)
[SUMatrix{2}(zeros(2^2)) for i in 1:10]
SUMatrix2{2}(0,0,0,0)
const T{N,L} = GaugeSQM.SMatrix{N,N,Complex{Real},L}
T{2,4}(1.,1.,1.,1.)