aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2020-03-25 22:05:08 +0100
committerAdrian Kummerlaender2020-03-25 22:05:08 +0100
commit2af16451f5119398c34ef9bd8626791e0498b9ab (patch)
tree097f3bef4e61748440e720e3f6f7108bc7502d08
parent3d0803e5e133a903a27ef5fb9cb102c955b34acd (diff)
downloadboltzgas-2af16451f5119398c34ef9bd8626791e0498b9ab.tar
boltzgas-2af16451f5119398c34ef9bd8626791e0498b9ab.tar.gz
boltzgas-2af16451f5119398c34ef9bd8626791e0498b9ab.tar.bz2
boltzgas-2af16451f5119398c34ef9bd8626791e0498b9ab.tar.lz
boltzgas-2af16451f5119398c34ef9bd8626791e0498b9ab.tar.xz
boltzgas-2af16451f5119398c34ef9bd8626791e0498b9ab.tar.zst
boltzgas-2af16451f5119398c34ef9bd8626791e0498b9ab.zip
Add example for random initial velocities
-rw-r--r--random_velocities.py23
-rw-r--r--zero_velocities.py (renamed from gas.py)0
2 files changed, 23 insertions, 0 deletions
diff --git a/random_velocities.py b/random_velocities.py
new file mode 100644
index 0000000..cf7a503
--- /dev/null
+++ b/random_velocities.py
@@ -0,0 +1,23 @@
+import boltzgas.visualizer
+
+from boltzgas import HardSphereSetup, HardSphereSimulation
+from boltzgas.initial_condition import grid_of_random_velocity_particles
+from boltzgas.visual import VelocityHistogram, ColoredBox, Tracer
+
+grid_width = 50
+radius = 0.002
+char_u = 1120
+
+position, velocity = grid_of_random_velocity_particles(grid_width, radius, char_u)
+
+config = HardSphereSetup(radius, char_u, position, velocity)
+gas = HardSphereSimulation(config, opengl = True)
+
+tracer = Tracer(gas, int((grid_width**2)/2+grid_width/2))
+histogram = VelocityHistogram(gas, [1.1,0], [1,1])
+
+decorations = [ ColoredBox([0,0], [1,1], (0.2,0.2,0.2)), tracer ]
+instruments = [ histogram, tracer ]
+windows = [ histogram ]
+
+boltzgas.visualizer.simulate(config, gas, instruments, decorations, windows)
diff --git a/gas.py b/zero_velocities.py
index 135796a..135796a 100644
--- a/gas.py
+++ b/zero_velocities.py