-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.py
More file actions
45 lines (34 loc) · 1.53 KB
/
Copy pathmain.py
File metadata and controls
45 lines (34 loc) · 1.53 KB
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
from src import sob
import numpy as np
import pandas as pd
'''
Added the following block to identify if the current system
'''
#runnerOptions = {"open_radioss_main_path":"/home/ivanolar/Documents/OpenRadioss2/OpenRadioss_linux64/OpenRadioss/",
# "write_vtk":False,
# "np":4, # Number of processes to run the simulation
# "nt":1,
# "h_level":1,
# "gmsh_verbosity":0,
#}
runnerOptions = {"np":1, # Number of processes to run the simulation
"nt":4,
"h_level":1,
"gmsh_verbosity":0,
"write_vtk":True,
}
r'''
Once the optimization problem instance has been generate,
the model is determined (mesh and fem data loaded) only when the variable array has been input.
'''
def main():
sim_id = 241 # Attribute to define the simulation id and connected results folder name
dim = 15#vector = [np.zeros((20,)).tolist()] # Vector where the objective function is evaluated, it has as many components as the second input argument in get_problem below
problem_id = 3 # 1: star box, 2: three point bending, 3: crash tube
vector = np.random.uniform(-5,5,(dim,)).tolist() # Vector where the objective function is evaluated, it has as many components as the second input argument in get_problem below
print(f"Evaluating vector: {vector}")
f = sob.get_problem(problem_id,dim, runner_options=runnerOptions)
obj_value = f(vector,sim_id)
print(obj_value)
if __name__ == '__main__':
main()