-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrun.py
40 lines (36 loc) · 1.02 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
from turbopy import Simulation
import spring
problem_config = {
"Grid": {"N": 2, "x_min": 0, "x_max": 1},
"Clock": {"start_time": 0,
"end_time": 10,
"num_steps": 100},
"PhysicsModules": {
"BlockOnSpring": {
"mass": 1,
"spring_constant": 1,
"pusher": "Leapfrog",
"x0": [0, 1, 0],
}
},
"Tools": {
"Leapfrog": {},
"ForwardEuler": {},
},
"Diagnostics": {
# default values come first
"directory": "output_leapfrog/",
"output_type": "csv",
"clock": {"filename": "time.csv"},
"BlockDiagnostic": [
{'component': 'momentum', 'filename': 'block_p.csv'},
{'component': 'position', 'filename': 'block_x.csv'}
]
}
}
sim = Simulation(problem_config)
sim.run()
problem_config["PhysicsModules"]["BlockOnSpring"]["pusher"] = "ForwardEuler"
problem_config["Diagnostics"]["directory"] = "output_euler/"
sim = Simulation(problem_config)
sim.run()