Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import numpy as np
- import readdy
- system = readdy.ReactionDiffusionSystem(box_size=[10., 10., 10.])
- system.add_species("A", 1.0)
- sim = system.simulation("SingleCPU")
- sim.output_file = "out.h5"
- if os.path.exists("checkpoints/"):
- # load checkpoint
- sim.load_particles_from_latest_checkpoint("checkpoints/")
- else:
- # new positions
- init_pos = np.random.uniform(size=(100, 3)) * 10. - 5.
- sim.add_particles("A", init_pos)
- # this also creates the directory, if it does not exist
- sim.make_checkpoints(100, output_directory="checkpoints/", max_n_saves=5)
- if os.path.exists(sim.output_file):
- os.remove(sim.output_file)
- sim.run(1000, 0.1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement