mirror of
https://gitlab.rlp.net/mobitar/ReCo.jl.git
synced 2025-09-02 09:02:35 +00:00
Added documentation for running a simulation
This commit is contained in:
parent
341b1e8a85
commit
98b2d673f7
9 changed files with 164 additions and 87 deletions
|
@ -41,7 +41,7 @@ function msd_simulation(
|
|||
)
|
||||
Random.seed!(seed)
|
||||
|
||||
dir = ReCo.init_sim(;
|
||||
sim_dir = ReCo.init_sim(;
|
||||
n_particles=1,
|
||||
v₀=v₀,
|
||||
parent_dir=parent_dir,
|
||||
|
@ -51,14 +51,14 @@ function msd_simulation(
|
|||
)
|
||||
|
||||
ReCo.run_sim(
|
||||
dir;
|
||||
sim_dir;
|
||||
duration=T,
|
||||
seed=rand(1:typemax(Int64)),
|
||||
snapshot_at=snapshot_at,
|
||||
n_bundle_snapshots=1000,
|
||||
)
|
||||
|
||||
return dir
|
||||
return sim_dir
|
||||
end
|
||||
|
||||
function mean_squared_displacement(;
|
||||
|
@ -78,9 +78,11 @@ function mean_squared_displacement(;
|
|||
parent_dir = main_parent_dir * "/$v₀"
|
||||
|
||||
Threads.@threads for sim_ind in 1:n_simulations
|
||||
dir = msd_simulation(v₀, half_box_len, T, 0.5, parent_dir; comment="$sim_ind")
|
||||
sim_dir = msd_simulation(
|
||||
v₀, half_box_len, T, 0.5, parent_dir; comment="$sim_ind"
|
||||
)
|
||||
|
||||
sim_dirs[sim_ind, v₀_ind] = dir
|
||||
sim_dirs[sim_ind, v₀_ind] = sim_dir
|
||||
|
||||
ProgressMeter.next!(progress; showvalues=[(:v₀, v₀)])
|
||||
end
|
||||
|
@ -175,12 +177,14 @@ end
|
|||
|
||||
function plot_random_walk(; T::Float64, v₀::Float64, seed::Int64)
|
||||
half_box_len = max_possible_displacement(T, v₀)
|
||||
dir = msd_simulation(v₀, half_box_len, T, 8.0, "random_walk_$(Dates.now())"; seed=seed)
|
||||
sim_dir = msd_simulation(
|
||||
v₀, half_box_len, T, 8.0, "random_walk_$(Dates.now())"; seed=seed
|
||||
)
|
||||
|
||||
ts = Float64[]
|
||||
cs = SVector{2,Float64}[]
|
||||
ReCo.append_bundle_properties!(
|
||||
(ts, cs), (:t, :c), dir; particle_slice=1, snapshot_slice=:
|
||||
(ts, cs), (:t, :c), sim_dir; particle_slice=1, snapshot_slice=:
|
||||
)
|
||||
|
||||
init_cairomakie!()
|
||||
|
|
|
@ -12,7 +12,7 @@ using ReCo: ReCo
|
|||
includet("../../src/Visualization/common_CairoMakie.jl")
|
||||
|
||||
function radial_distribution_simulation(;
|
||||
n_particles::Int64, v₀s::NTuple{N,Float64}, T::Float64, packing_ratio::Float64
|
||||
n_particles::Int64, v₀s::NTuple{N,Float64}, T::Float64, packing_fraction::Float64
|
||||
) where {N}
|
||||
Random.seed!(42)
|
||||
|
||||
|
@ -25,17 +25,17 @@ function radial_distribution_simulation(;
|
|||
Threads.@threads for v₀_ind in 1:n_v₀s
|
||||
v₀ = v₀s[v₀_ind]
|
||||
|
||||
dir = ReCo.init_sim(;
|
||||
sim_dir = ReCo.init_sim(;
|
||||
n_particles=n_particles,
|
||||
v₀=v₀,
|
||||
packing_ratio=packing_ratio,
|
||||
packing_fraction=packing_fraction,
|
||||
parent_dir=parent_dir,
|
||||
comment="$v₀",
|
||||
)
|
||||
|
||||
ReCo.run_sim(dir; duration=T, seed=v₀_ind)
|
||||
ReCo.run_sim(sim_dir; duration=T, seed=v₀_ind)
|
||||
|
||||
sim_dirs[v₀_ind] = dir
|
||||
sim_dirs[v₀_ind] = sim_dir
|
||||
end
|
||||
|
||||
return sim_dirs
|
||||
|
@ -191,7 +191,7 @@ function plot_radial_distributions(;
|
|||
|
||||
if include_comparison
|
||||
comparison_curve = CSV.read(
|
||||
"analysis/radial_distribution_function/g_of_r_d_ratio_with_0_37_packing_ratio.csv",
|
||||
"analysis/radial_distribution_function/g_of_r_d_ratio_with_0_37_packing_fraction.csv",
|
||||
DataFrames.DataFrame;
|
||||
header=3,
|
||||
)
|
||||
|
@ -217,7 +217,7 @@ function run_radial_distribution_analysis()
|
|||
n_particles = 1000
|
||||
|
||||
sim_dirs = radial_distribution_simulation(;
|
||||
n_particles=n_particles, v₀s=v₀s, T=100.0, packing_ratio=0.37
|
||||
n_particles=n_particles, v₀s=v₀s, T=100.0, packing_fraction=0.37
|
||||
)
|
||||
|
||||
lower_radii, gs, particle_radius = radial_distribution(;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue