-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend Boris to ensemble problems (#123)
* Allow ensemble prob for Boris * Add Boris to precompile workflow
- Loading branch information
1 parent
24c52a4
commit 43d9545
Showing
6 changed files
with
106 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,40 @@ | ||
# Precompiling workloads | ||
|
||
@setup_workload begin | ||
# numerical field parameters | ||
x = range(-10, 10, length=15) | ||
y = range(-10, 10, length=20) | ||
z = range(-10, 10, length=25) | ||
B = fill(0.0, 3, length(x), length(y), length(z)) # [T] | ||
E = fill(0.0, 3, length(x), length(y), length(z)) # [V/m] | ||
@compile_workload begin | ||
# numerical field parameters | ||
x = range(-10, 10, length=15) | ||
y = range(-10, 10, length=20) | ||
z = range(-10, 10, length=25) | ||
B = fill(0.0, 3, length(x), length(y), length(z)) # [T] | ||
E = fill(0.0, 3, length(x), length(y), length(z)) # [V/m] | ||
|
||
B[3,:,:,:] .= 10e-9 | ||
E[3,:,:,:] .= 5e-10 | ||
B[3,:,:,:] .= 10e-9 | ||
E[3,:,:,:] .= 5e-10 | ||
|
||
Δx = x[2] - x[1] | ||
Δy = y[2] - y[1] | ||
Δz = z[2] - z[1] | ||
Δx = x[2] - x[1] | ||
Δy = y[2] - y[1] | ||
Δz = z[2] - z[1] | ||
|
||
mesh = CartesianGrid((length(x)-1, length(y)-1, length(z)-1), | ||
(x[1], y[1], z[1]), | ||
(Δx, Δy, Δz)) | ||
mesh = CartesianGrid((length(x)-1, length(y)-1, length(z)-1), | ||
(x[1], y[1], z[1]), | ||
(Δx, Δy, Δz)) | ||
|
||
@compile_workload begin | ||
vdf = Maxwellian([0.0, 0.0, 0.0], 1.0) | ||
v = sample(vdf, 2) | ||
# numerical field | ||
param = prepare(x, y, z, E, B) | ||
param = prepare(mesh, E, B) | ||
# analytical field | ||
param = prepare(getE_dipole, getB_dipole) | ||
# Boris pusher | ||
stateinit = let x0 = [0.0, 0.0, 0.0], v0 = [0.0, 1e5, 0.0] | ||
[x0..., v0...] | ||
end | ||
tspan = (0.0, 1.0) | ||
dt = 0.5 | ||
paramBoris = BorisMethod(param) | ||
prob = TraceProblem(stateinit, tspan, dt, paramBoris) | ||
traj = trace_trajectory(prob; savestepinterval=100) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters