From bcc087a36ea7d84ac61a2c756458a208f6bc3ff3 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Thu, 25 Jul 2019 20:59:06 +0200 Subject: Dampen channel inflow --- channel_2d_gl_interop.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'channel_2d_gl_interop.py') diff --git a/channel_2d_gl_interop.py b/channel_2d_gl_interop.py index 3abebd7..f8257e6 100644 --- a/channel_2d_gl_interop.py +++ b/channel_2d_gl_interop.py @@ -13,15 +13,15 @@ from OpenGL.GL import shaders screen_x = 1920 screen_y = 1200 -pixels_per_cell = 1 -updates_per_frame = 10 +pixels_per_cell = 2 +updates_per_frame = 80 inflow = 0.02 relaxation_time = 0.51 def get_obstacles(geometry): ys = numpy.linspace(geometry.size_y//50, geometry.size_y-geometry.size_y//50, num = 20) - xs = [ 100 for i, y in enumerate(ys) ] + xs = [ 50 for i, y in enumerate(ys) ] return list(zip(xs, ys)) def is_obstacle(geometry, x, y): @@ -50,7 +50,7 @@ boundary = Template(""" u_1 = 0.0; } if ( m == 3 ) { - u_0 = $inflow; + u_0 = min(time/10000.0 * $inflow, $inflow); u_1 = 0.0; } if ( m == 4 ) { @@ -130,7 +130,7 @@ fragment_shader = shaders.compileShader(""" in vec3 color; void main(){ - gl_FragColor = vec4(color.xyz, 0.0); + gl_FragColor = vec4(color.xyz, 0.0); }""", GL_FRAGMENT_SHADER) -- cgit v1.2.3