-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Detection functions, minimum working example, some plotting functions
- Loading branch information
Showing
9 changed files
with
2,385 additions
and
155 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -4,14 +4,21 @@ authors = ["Ashton Bradley <[email protected]>"] | |
version = "0.3.6" | ||
|
||
[deps] | ||
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581" | ||
Coverage = "a2441757-f6aa-5fb2-8edb-039e3f45d037" | ||
DSP = "717857b8-e6f2-59f4-9121-6e50c889abd2" | ||
Distances = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7" | ||
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" | ||
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341" | ||
FLoops = "cc61a311-1640-44b5-9fba-1b764f453329" | ||
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" | ||
FourierGPE = "f013a474-557c-11e9-3596-438edcad9d97" | ||
GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a" | ||
GraphMakie = "1ecd5474-83a3-4783-bb4f-06765db800d2" | ||
GraphPlot = "a2cc645c-3eea-5389-862e-a155d0052231" | ||
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6" | ||
Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59" | ||
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819" | ||
LightGraphs = "093fc24a-ae57-5d10-9952-331d41423f4d" | ||
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" | ||
NearestNeighbors = "b8a86587-4115-5ab1-83bc-aa920d37bbce" | ||
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a" | ||
|
@@ -31,7 +38,6 @@ FLoops = "~0.2" | |
FileIO = "1, 1.8, 1.9" | ||
Interpolations = "~0.15" | ||
JLD2 = "~0.4" | ||
LightGraphs = "1, 1.3" | ||
NearestNeighbors = "~0.4" | ||
Parameters = "~0.12" | ||
ProgressMeter = "1, 1.5, 1.6, 1.7" | ||
|
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using FourierGPE | ||
using VortexDistributions | ||
using GraphMakie | ||
|
||
|
||
## Load sim | ||
@load "sim64.jld2" sim | ||
@load "sol64.jld2" sol | ||
|
||
## Isosurface plot of the solution | ||
|
||
t_idx = 25 | ||
|
||
psi = sol[t_idx] | ||
density = abs2.(psi) | ||
pmax = maximum(density) | ||
density = density/pmax | ||
|
||
# volume(density, algorithm = :iso) | ||
|
||
## Get params for detection | ||
X = sim.X; | ||
x = X[1]; y = X[2]; z = X[3]; | ||
x = round.(x, digits=3); y = round.(y, digits=3); z = round.(z, digits=3); | ||
dx = x[2] - x[1]; dy = y[2] - y[1]; dz = z[2] - z[1]; | ||
|
||
@time g, vort_lines, vort_loops, vort_rings, vorts_coords = full_algorithm(psi, x, y, z, n_itp = 4); | ||
graphplot(g, layout = (adj) -> vorts_coords, markersize=0.02, edge_width=1, node_size=5) | ||
|
||
## Smoothing | ||
|
||
vort_lines_coords = [reduce(vcat, transpose.(vorts_coords[v_line])) for v_line in vort_lines]; | ||
vort_loops_coords = [reduce(vcat, transpose.(vorts_coords[v_loop])) for v_loop in vort_loops]; | ||
vort_rings_coords = [reduce(vcat, transpose.(vorts_coords[v_ring])) for v_ring in vort_rings]; | ||
|
||
@time vort_lines_ccma_j, vort_loops_ccma_j, vort_rings_ccma_j = vortex_ccma_j(vort_lines_coords, vort_loops_coords, vort_rings_coords, w_ma = 6, w_cc = 3, distrib = "hanning"); | ||
|
||
graphplot(g, layout = (adj) -> vorts_coords, markersize=0.02, edge_width=0, node_size=5) | ||
plot_unconnected_vorts_mat(vort_lines_ccma_j, vort_loops_ccma_j, vort_rings_ccma_j, linewidth=5) |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using FourierGPE | ||
using VortexDistributions | ||
|
||
## Creating a 3D simulation | ||
|
||
L=(16.,16.,16.); | ||
N=(64,64,64); | ||
sim = Sim(L,N); | ||
@unpack_Sim sim; | ||
|
||
μ = 25.0; | ||
γ = 0.05; | ||
tf = 4/γ; | ||
Nt = 50; | ||
t = LinRange(0.,tf,Nt); | ||
|
||
## Run sim | ||
x,y,z = X; | ||
ψi = randn(N)+im*randn(N); | ||
ϕi = kspace(ψi,sim); | ||
|
||
@pack_Sim! sim; | ||
|
||
## Evolve in k-space | ||
# import FourierGPE | ||
@time sol = runsim(sim); # will take a few minutes to run. | ||
|
||
# Mutate the solution to xspace before saving to jld2 | ||
for i in eachindex(sol) | ||
sol[i] = xspace(sol[i], sim) | ||
end | ||
|
||
@save "sol64.jld2" sol | ||
@save "sim64.jld2" sim |
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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
function plot_unconnected_vorts_mat(vort_lines, vort_loops, vort_rings; linewidth=5) | ||
colors = distinguishable_colors(length(vort_lines) + length(vort_loops) + length(vort_rings)); | ||
|
||
all_vorts = [] | ||
all_colors = [] | ||
|
||
for i in eachindex(vort_lines) | ||
for j in 1:size(vort_lines[i])[1] | ||
v_sort = vort_lines[i][j, :] | ||
push!(all_vorts, (v_sort[1], v_sort[2], v_sort[3])) | ||
push!(all_colors, colors[i]) | ||
end | ||
push!(all_vorts, (NaN, NaN, NaN)) | ||
push!(all_colors, colors[i]) | ||
end | ||
|
||
# for i in eachindex(vort_loops) | ||
# for j in eachindex(vort_loops[i]) | ||
# v_sort = vort_loops[i][j] | ||
# push!(all_vorts, (v_sort[1], v_sort[2], v_sort[3])) | ||
# push!(all_colors, colors[i + length(vort_lines)]) | ||
# end | ||
# push!(all_vorts, (NaN, NaN, NaN)) | ||
# push!(all_colors, colors[i + length(vort_lines)]) | ||
# end | ||
|
||
for i in eachindex(vort_loops) | ||
for j in 1:size(vort_loops[i])[1] | ||
v_sort = vort_loops[i][j, :] | ||
push!(all_vorts, (v_sort[1], v_sort[2], v_sort[3])) | ||
push!(all_colors, colors[i + length(vort_lines)]) | ||
end | ||
push!(all_vorts, (NaN, NaN, NaN)) | ||
push!(all_colors, colors[i + length(vort_lines)]) | ||
end | ||
|
||
# for i in eachindex(vort_rings) | ||
# for j in eachindex(vort_rings[i]) | ||
# v_sort = vort_rings[i][j] | ||
# push!(all_vorts, (v_sort[1], v_sort[2], v_sort[3])) | ||
# push!(all_colors, colors[i + length(vort_lines) + length(vort_loops)]) | ||
# end | ||
# push!(all_vorts, (NaN, NaN, NaN)) | ||
# push!(all_colors, colors[i + length(vort_lines) + length(vort_loops)]) | ||
# end | ||
|
||
for i in eachindex(vort_rings) | ||
for j in 1:size(vort_rings[i])[1] | ||
v_sort = vort_rings[i][j, :] | ||
push!(all_vorts, (v_sort[1], v_sort[2], v_sort[3])) | ||
push!(all_colors, colors[i + length(vort_lines) + length(vort_loops)]) | ||
end | ||
push!(all_vorts, (NaN, NaN, NaN)) | ||
push!(all_colors, colors[i + length(vort_lines) + length(vort_loops)]) | ||
end | ||
|
||
lines!(all_vorts, color=all_colors, linewidth=linewidth) | ||
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