1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| counter = 1 while counter < 1000: err = 0 forcx, forcy, psi = force(nx, ny, cx, cy, rho, rho_boundary, rho_liq, rho_gas, w, G, obstk) print('碰撞%s' % counter) f = collision(nx, ny, u, v, cx, cy, omega, f, rho, w, forcx, forcy) print('迁移%s' % counter) f, f_old = stream(f) f, fill = boundary(nx, ny, f, f_old, obstk, opp, obst) print('宏观量计算%s' % counter) rho, u, v, pressure = ruv(u, v, f, psi, rho, obst) print('速度修正%s' % counter) uf, vf = uvf(u, v, forcx, forcy, rho) print('***********') rho_tot = 0 for i in range(nx): for j in range(ny): if rho[i, j] != '': rho_tot = rho_tot + rho[i, j] print(rho_tot) plt.imshow(rho, cmap=cm.bwr) plt.savefig(r"./计算结果/" + str(counter) + ".png") plt.clf() counter = counter + 1
|