1
0
Fork 0
mirror of https://gitlab.rlp.net/mobitar/ReCo.jl.git synced 2024-12-21 00:51:21 +00:00

Add custom half_box_len option

This commit is contained in:
Mo8it 2022-01-21 22:39:03 +01:00
parent 1edea1cd1d
commit 1b3bfc2fac

View file

@ -48,6 +48,7 @@ function gen_sim_consts(
δt::Float64=DEFAULT_δt,
packing_ratio::Float64=DEFAULT_PACKING_RATIO,
skin_to_interaction_r_ratio::Float64=DEFAULT_SKIN_TO_INTERACTION_R_RATIO,
half_box_len::Float64=0.0,
)
@assert n_particles > 0
@assert v₀ >= 0
@ -81,7 +82,12 @@ function gen_sim_consts(
n_particles = grid_n^2
half_box_len = sqrt(n_particles * π / packing_ratio) * σ / 4
if half_box_len == 0.0
half_box_len = sqrt(n_particles * π / packing_ratio) * σ / 4
elseif packing_ratio != DEFAULT_PACKING_RATIO
error("You can not specify half_box_len and packing_ratio at the same time!")
end
grid_box_width = 2 * half_box_len / grid_n
return (;
@ -154,6 +160,7 @@ function init_sim(;
exports_dir::String=DEFAULT_EXPORTS_DIR,
parent_dir::String=DEFAULT_PARENT_DIR,
comment::String=DEFAULT_COMMENT,
half_box_len::Float64=0.0,
)
sim_consts = gen_sim_consts(
n_particles,
@ -161,6 +168,7 @@ function init_sim(;
δt=δt,
packing_ratio=packing_ratio,
skin_to_interaction_r_ratio=skin_to_interaction_r_ratio,
half_box_len,
)
return init_sim_with_sim_consts(