В примере с поршнем заменить одноатомные молекулы на двухатомные (с одной стороны, затем с обеих). Посмотреть, что изменится. Почему эти изменения?
import random as rnd import billiard5_2 as blrd
# ============== constants ====================
blrd.size = size = (1000, 300) # size of the field for billiard blrd.r_max = r_max = 25 # maximal radius of the balls blrd.v_max = v_max = 20. # maximal speed of the balls blrd.m_max = 15. # maxima mass of the balls
# ======== construction of configuration =====
Nx1 = 14 Nx2 = 7 Ny = 10 ball_list = [] for j in range(Ny): for i in range(Nx1): ball_list.append(blrd.ball(x=r_max * (i + 2), y=r_max * (j + 2) + 5 * (-1) ** (j + i), v_x=10 + (-5) ** i + 3 * (-1) ** j, v_y=10 * (-1) ** (i - j) + 5 * (-1) ** i, r=4, m=5., color="blue")) for i in range(Nx2): ball_list.append(blrd.ball(x=size[0] - 1.7*r_max * (i + 2) + j - 4*(-1)**(i+j)+5*(-1)**j, y=r_max * (j + 2) + 4 * (-1) ** i, v_x=-10+8*(-1) ** (i+j) + 7 * (-1) ** j * j, v_y=9 * (-1) ** j + 8 * (-1) ** (i), r=4, m=5., color="green"))
ball_list.append(blrd.ball(x=550, y=100, v_x=0.01, v_y=1, r=1, m=0.1, color="blue")) #chaotisators ball_list.append(blrd.ball(x=650, y=100, v_x=0.1, v_y=-1, r=1, m=0.05, color="green")) # end of the list of balls
#wall_list = [blrd.rect_x( x = 400, v_x = -2, r = 5, m = 800)] #525 #wall_list = [blrd.rect_x( x = 525, v_x = -2, r = 5, m = 800)] #600 wall_list = [blrd.rect_x( x = 600, v_x = -15, r = 5, m = 1000)]
#center in (400, 300)
blrd.moving(ball_list, wall_list, dt = 0.1, n = 60400, cm = [range((Nx1 + Nx2) * Ny)]) # start the moving
import random as rnd
import billiard5_2 as blrd
# ============== constants ====================
blrd.size = size = (1000, 300) # size of the field for billiard
blrd.r_max = r_max = 25 # maximal radius of the balls
blrd.v_max = v_max = 20. # maximal speed of the balls
blrd.m_max = 15. # maxima mass of the balls
# ======== construction of configuration =====
Nx1 = 14
Nx2 = 7
Ny = 10
ball_list = []
for j in range(Ny):
for i in range(Nx1):
ball_list.append(blrd.ball(x=r_max * (i + 2), y=r_max * (j + 2) + 5 * (-1) ** (j + i),
v_x=10 + (-5) ** i + 3 * (-1) ** j, v_y=10 * (-1) ** (i - j) + 5 * (-1) ** i, r=4, m=5., color="blue"))
for i in range(Nx2):
ball_list.append(blrd.ball(x=size[0] - 1.7*r_max * (i + 2) + j - 4*(-1)**(i+j)+5*(-1)**j, y=r_max * (j + 2) + 4 * (-1) ** i, v_x=-10+8*(-1) ** (i+j) + 7 * (-1) ** j * j,
v_y=9 * (-1) ** j + 8 * (-1) ** (i), r=4, m=5., color="green"))
ball_list.append(blrd.ball(x=550, y=100, v_x=0.01, v_y=1, r=1, m=0.1, color="blue")) #chaotisators
ball_list.append(blrd.ball(x=650, y=100, v_x=0.1, v_y=-1, r=1, m=0.05, color="green"))
# end of the list of balls
#wall_list = [blrd.rect_x( x = 400, v_x = -2, r = 5, m = 800)] #525
#wall_list = [blrd.rect_x( x = 525, v_x = -2, r = 5, m = 800)] #600
wall_list = [blrd.rect_x( x = 600, v_x = -15, r = 5, m = 1000)]
#center in (400, 300)
blrd.moving(ball_list, wall_list, dt = 0.1, n = 60400, cm = [range((Nx1 + Nx2) * Ny)]) # start the moving