mirror of
https://gitlab.rlp.net/mobitar/ReCo.jl.git
synced 2024-12-21 00:51:21 +00:00
Added parent_dir
This commit is contained in:
parent
c21d94be44
commit
02a6dd9489
2 changed files with 20 additions and 5 deletions
|
@ -6,7 +6,7 @@ function run_sim(
|
|||
dir::String;
|
||||
duration::Float64,
|
||||
snapshot_at::Float64=0.1,
|
||||
n_steps_before_verlet_list_update::Int64=1000,
|
||||
n_steps_before_verlet_list_update::Int64=100,
|
||||
seed::Int64=42,
|
||||
n_bundle_snapshots::Int64=100,
|
||||
)
|
||||
|
@ -94,7 +94,7 @@ function run_sim(
|
|||
save_data = true
|
||||
|
||||
open("$runs_dir/run_vars_$next_bundle.json", "w") do f
|
||||
JSON3.pretty(f, run_vars)
|
||||
JSON3.write(f, run_vars)
|
||||
end
|
||||
else
|
||||
save_data = false
|
||||
|
|
21
src/setup.jl
21
src/setup.jl
|
@ -38,7 +38,12 @@ function generate_particles(bundle::Bundle, N::Int64)
|
|||
end
|
||||
|
||||
function init_sim(;
|
||||
N::Int64, v::Float64, δt::Float64=1e-5, packing_ratio::Float64=0.5, comment::String=""
|
||||
N::Int64,
|
||||
v::Float64,
|
||||
δt::Float64=1e-5,
|
||||
packing_ratio::Float64=0.5,
|
||||
comment::String="",
|
||||
parent_dir::String="",
|
||||
)
|
||||
@assert N > 0
|
||||
@assert v >= 0
|
||||
|
@ -83,11 +88,21 @@ function init_sim(;
|
|||
bundle = Bundle(N, 1)
|
||||
save_snapshot!(bundle, 1, 0.0, particles)
|
||||
|
||||
dir = "exports/$(now())_N=$(N)_v=$(v)_#$(rand(1000:9999))$comment"
|
||||
particles = nothing
|
||||
|
||||
dir = "exports"
|
||||
if length(parent_dir) > 0
|
||||
dir *= "/$parent_dir"
|
||||
end
|
||||
dir *= "/$(now())_N=$(N)_v=$(v)_#$(rand(1000:9999))"
|
||||
if length(comment) > 0
|
||||
dir *= "_$comment"
|
||||
end
|
||||
|
||||
mkpath(dir)
|
||||
|
||||
open("$dir/sim_consts.json", "w") do f
|
||||
JSON3.pretty(f, sim_consts)
|
||||
JSON3.write(f, sim_consts)
|
||||
end
|
||||
|
||||
save_bundle(dir, bundle, 1, 0.0)
|
||||
|
|
Loading…
Reference in a new issue