Examples¶
Running¶
To run a simulation like the example below, Julia must be invoked from the top
level directory of the repository (where the src
folder resides), a from
a directory that is appropriate for the include
statement to find the source
files. The simulation can then be run by passing the script to Julia:
julia examples/num_part.jl
Running on a Cluster¶
Using slurm, many identical simulations can be run at once. The following will run the adh.jl script on 10 different cores with 2048Mb allocated on each.
srun -N 10 -t 2000 –mem-per-cpu=2048 julia runs/vary_params/adh.jl
Quick Example¶
The following can be found in examples/num_parts.jl
in the source.
It creates an experiment with three trials and runs each one. It then
modifies the parameters and creates a new experiment with a different number
of particles. It repeats this three times for three different experiments each
with three identical trials.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | ## Runs a experiments for diffrent numbers of particles
# Each experiment consists of three trials
# Saves data to data/numparts/ relative to run path
include("../src/julia/BCIM.jl")
#using BCIM
# Hack to allow asynchronous experiment runs
sleep(rand()*10)
# Our physical constants
pc = BCIM.PhysicalConst( 1.0e-5, # dt
# Packing fraction
0.60,
# Eta
0.01,
# Temperature (K)
298.0,
# Boltzmann constant
1.38e-16,
# Propulsisions [ sp1, sp2 ]
[0.0,1.0e3],
# Repulsions [ sp1, sp2 ]
[1.5e4,1.5e3],
# Adhesions [ sp1, sp2, sp1-sp2 ]
[1.5e3, 0.0, 0.0 ],
# Cell division time ( 0 = no division)
[ 0.01, 0.01 ],
# Efective adhesive contact distance
0.1,
# Cell diameter
15.0e-4,
# Number of particles [ sp1, sp2 ]
[256,256])
##### 256 particles total
pc.npart = [128, 128]
# Initialize experiment with 3 trials in given directory with desired constants
exp = BCIM.Experiment("data/ex/256", 3, pc, false)
# Run the experiment
# Equilibriate for 1000 steps
# Collect every 1000 steps
# Run for 100000 steps
BCIM.run(exp, 1000:1000:100000)
##### Run again for 512 particles total
pc.npart = [256, 256]
exp = BCIM.Experiment("data/ex/512", 3, pc, false)
BCIM.run(exp, 1000:1000:100000)
##### 1024 particles total
pc.npart = [512, 512]
exp = BCIM.Experiment("data/ex/1024", 3, pc, false)
BCIM.run(exp, 1000:1000:100000)
|