-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
75 lines (55 loc) · 1.42 KB
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
from Experiment import *
# Window
WIDTH = 500
HEIGHT = 600
scale = 50 # 1 cm = 100 px
window = Tk()
window.title("Simulador de viscosidade")
canvas = Canvas(window, width=WIDTH, height=HEIGHT)
canvas.pack()
# welcome message
print("")
print(" ########################################### ")
print("# #")
print("# BEM-VINDO AO SIMULADOR DE VISCOSIDADE! #")
print("# #")
print(" ########################################### ")
print("")
sample_counter = 1
while True:
print("----------- Ensaio", sample_counter, "-----------\n")
E = Experiment(
window,
canvas,
(WIDTH, HEIGHT),
scale,
4, # liquid width / cm
10, # liquid height / cm
(7850, 1400, 2.8) # ball density, fluid density, fluid viscosity (SI)
)
# User input (parameters)
ok = False
while not ok:
print("Raio da esfera (0.5 a 2 mm): ", end="")
radius = float(input())
ok = (radius >= 0.5 and radius <= 2)
print("Altura primeira marca (cm): ", end="")
h1 = float(input())
print("Altura segunda marca (cm): ", end="")
h2 = float(input())
E.AddMarker(h1)
E.AddMarker(h2)
E.AddBall(radius/10.)
E.Run(0.0001, 20)
# User input (continue?)
ok = False
while not ok:
ans = input("\nNovo ensaio? (Sim/Nao)\n")
ans = ans.lower()
ok = ans in ["sim", "nao"]
if ans == "nao":
print("Bye Bye!")
break
canvas.delete("all")
print("")
sample_counter += 1