-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
39 lines (33 loc) · 1.09 KB
/
main.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
from sys import argv
from Bubble_move import *
from Rayleigh_Taylor import *
def main():
if(len(argv) == 2):
config_file = argv[1]
elif(len(argv) == 1):
config_file = "test.cfg"
else:
raise RuntimeError("Wrong number of arguments in the call")
#Build the parameters handler
param_handler = My_Parameters(config_file).get_param()
#Build the right problem
if(param_handler["Problem"] == 'Bubble'):
sim = BubbleMove(param_handler)
#Save also the communicator for future printing purporses
comm = sim.get_communicator()
elif(param_handler["Problem"] == 'RT'):
sim = RayleighTaylor(param_handler)
#Save also the communicator for future printing purporses
comm = sim.get_communicator()
else:
raise ValueError("Unknown problem type. Please check configuration file")
#Run the simulation
try:
sim.run()
except ValueError as e:
if(MPI.rank(comm) == 0):
print(e)
print("Aborting simulation...")
exit(1)
if __name__ == "__main__":
main()