Running multiple simulations from one input script

This can be done in several ways. See the documentation for individual commands for more details on how these examples work.

If “multiple simulations” means continue a previous simulation for more timesteps, then you simply use the simulate command multiple times. For example, this script

read file restart/restart.init
materials {m1}
material_properties m1 density 1000 youngsModulus 5e6 poissonsRatio 0.3 coefficientRestitution 0.5
particle_contact_model normal hertz
simulation_timestep 5e-5
simulate time_steps 10000
simulate time_steps 10000
simulate time_steps 10000
simulate time_steps 10000
simulate time_steps 10000

would run 5 successive simulations of the same system for a total of 50,000 timesteps.

If you wish to run totally different simulations, one after the other, the clear command can be used in between them to re-initialize Aspherix®. For example, this script

read file restart/restart.init
materials {m1}
material_properties m1 density 1000 youngsModulus 5e6 poissonsRatio 0.3 coefficientRestitution 0.5
particle_contact_model normal hertz
simulation_timestep 5e-5
simulate time_steps 10000
clear
read file restart/restart.init_ms
materials {m1}
material_properties m1 density 1000 youngsModulus 5e6 poissonsRatio 0.3 coefficientRestitution 0.5
particle_contact_model normal hertz
simulation_timestep 5e-5
simulate time_steps 10000

would run 2 independent simulations, one after the other.

For large numbers of independent simulations, you can use variables and the next and jump commands to loop over the same input script multiple times with different settings. For example, this script

variable d index run1 run2 run3 run4 run5 run6 run7 run8
shell mkdir $d
shell cd $d
read file ../restart/restart.init
materials {m1}
material_properties m1 density 1000 youngsModulus 5e6 poissonsRatio 0.3 coefficientRestitution 0.5
particle_contact_model normal hertz
simulation_timestep 5e-5
output_settings
simulate time_steps 10000
shell cd ..
clear
next d
jump SELF

would run 8 simulations in different directories, using a restart.init file from a restart folder. The same concept could be used to run the same system at 4 different particle diameters, using a temperature variable and storing the output in different log and dump files, for example

variable a loop 4
variable t index 0.008 0.009 0.01 0.011
read file restart/restart.init
materials {m1}
material_properties m1 density 1000 youngsModulus 5e6 poissonsRatio 0.3 coefficientRestitution 0.5
particle_contact_model normal hertz
set group all diameter ${t}
simulation_timestep 5e-5
output_settings file post_$a/output*.vtm
simulate time_steps 10000
clear
next t
next a
jump SELF

All of the above examples work whether you are running on 1 or multiple processors, but assumed you are running Aspherix® on a single partition of processors. Aspherix® can be run on multiple partitions via the -partition command-line option.

In the last 2 examples, if Aspherix® were run on 3 partitions, the same scripts could be used if the “index” and “loop” variables were replaced with universe-style variables, as described in the variable command. Also, the “next t” and “next a” commands would need to be replaced with a single “next a t” command. With these modifications, the 8 simulations of each script would run on the 3 partitions one after the other until all were finished. Initially, 3 simulations would be started simultaneously, one on each partition. When one finished, that partition would then start the 4th simulation, and so forth, until all 8 were completed.