-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_for_thesis_with_example_structures.py
57 lines (48 loc) · 2.01 KB
/
run_for_thesis_with_example_structures.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
import time
import femem_package.femem as femem
import example_structures
NUM_ATTEMPTS = 1
METHODS = ['BFGS', 'SLSQP', 'CG', 'Powell', 'TNC']
STRUCTURE_LIST = {
'example1a': example_structures.example1a,
'example1b': example_structures.example1b,
'example2a': example_structures.example2a,
'example2b': example_structures.example2b,
'example3a': example_structures.example3a,
'example3b': example_structures.example3b,
'example5a': example_structures.example5a,
'example6a': example_structures.example6a,
'example7a': example_structures.example7a,
}
def run_one(structure, attempt, name, method):
options = femem.Options()
options.optimization.method = method
options.draw.save_path = 'exports/draw/'
options.csv.save_path = 'exports/csv/'
options.general.name = name
options.general.attempt = attempt
options.draw.draw_first_case = True
options.draw.draw_last_case = False
options.draw.draw_animation = True
options.draw.draw_ghost_case = True
options.draw.x_label_name = 'X Ekseni (m)'
options.draw.y_label_name = 'Y Ekseni (m)'
options.draw.z_label_name = 'Z Ekseni (m)'
if name in ['example6a', 'example7a']:
options.draw.x_label_name = 'X Ekseni (mm)'
options.draw.y_label_name = 'Y Ekseni (mm)'
options.draw.z_label_name = 'Z Ekseni (mm)'
femem.FEMEM(structure).run_all()
def run():
toc = time.time()
for name, structure in STRUCTURE_LIST.items():
for attempt in range(1, NUM_ATTEMPTS+1):
for method in METHODS:
print(f'------------------ Started {name} with {method} - {attempt}/{NUM_ATTEMPTS} ------------------')
run_one(structure, attempt, name, method)
print(f'----------------- Finished {name} with {method} - {attempt}/{NUM_ATTEMPTS} ------------------')
print()
tic = time.time()
print(f"------------------ Finished all runs in {(tic - toc):.4f} seconds ------------------")
if __name__ == '__main__':
run()