-
Notifications
You must be signed in to change notification settings - Fork 46
/
beso_conf.py
116 lines (98 loc) · 10.2 KB
/
beso_conf.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# this is the configuration file with input values, which will be executed as python commands
# BASIC INPUTS:
path = "." # path to the working directory (without whitespaces) where the initial file is located
#path = "." # example - in the current working directory
#path = "~/tmp/beso/" # Linux example
#path = "D:\\tmp\\" # Windows example
path_calculix = "d:\\soft\\FreeCad\\FreeCAD_0.17.10993_x64_dev_win\\bin\\ccx" # path to the CalculiX solver
#path_calculix = "/usr/bin/ccx" # Linux example, may help shell command: which ccx
#path_calculix = "d:\\soft\FreeCad\\FreeCAD_0.17.8264_x64_dev_win\\bin\\ccx" # Windows example
file_name = "Plane_Mesh.inp" # file with prepared linear static analysis
elset_name = "all_available" # string with name of the element set in .inp file (CASE sensitive!)
# when "all_available" string is used, all available elements are used automatically for the optimization
domain_optimized[elset_name] = True # True - optimized domain, False - elements will not be removed
domain_density[elset_name] = [1e-6, 1] # equivalent density of the domain material for states of switch_elm
domain_thickness[elset_name] = [1.0, 1.0] # thickness of shell elements for states of switch_elm
domain_offset[elset_name] = 0.0 # offset of shell elements
domain_orientation[elset_name] = [] # orientations for each state referring to inp file,
# e.g. for 2 states ["or1", "or1"], for isotropic material use empty list []
domain_FI[elset_name] = [[("stress_von_Mises", 450.0e6)], # inner tuples () for separate Failure indices
[("stress_von_Mises", 450.0)]] # new inner list [] for the next state of switch_elm
# Failure Indices definition in python tuples (separate FI for each element state if there are more lists)
# Failure Index FI = element stress / allowable value
# Failure Indices are not evaluated if they are not defined here, i.e. domain_FI[elset_name] = [], and then optimization_base must not be "failure_index"
# examples:
# [("user_def", "sxx / 600.0"), ("user_def", "syy / 150.0"), ("user_def", "sxy / 50.0")] # "user_def" defines complete formula for FI
# [("stress_von_Mises", 450.0)] # for von Mises stress give only allowable stress
domain_material[elset_name] = ["*ELASTIC \n210000e-6, 0.3", # material definition after CalculiX *MATERIAL card, use \n for line break
"*ELASTIC \n210000, 0.3"] # next string for the next state of switch_elm
domain_same_state[elset_name] = False # False - element states can differ,
# "max" - domain elements have common state given by maximum sensitivity
# "average" - domain elements have common state given by average sensitivity
# copy this block for defining properties of the next domain (if elset_name is not 1)
mass_goal_ratio = 0.4 # the goal mass as a fragment of the full mass of optimized domains,
# i.e. fragment of mass evaluated from effective density and volumes of optimized elements in the highest state
continue_from = "" # if not "", optimization will load element states from the given files,
# for previously generated csv file use "file_name.csv"
# for inp or frd meshes use 0th file name e.g. "file051_res_mesh0.inp" or "file051_res_mesh0.frd"
# or use number N without apostrophes to start each element from state N (numbered from 0)
# (continuing from vtk result file is not supported)
filter_list = [["simple", "auto"]] # [[filter type, range, domains or nothing for all domains], [next filter type, range, "domain1", "domain2"], ...]
# filter types:
# "over points" - filter with step over own point mesh, works on sensitivities TODO does not work correctly, need a fix
# "over nodes" - filter with step over nodes (suffer from boundary sticking?, 2nd order elements need more memory), works on sensitivities
# "simple" - averages sensitivity number with surroundings (suffer from boundary sticking?), works on sensitivities
# morphology based filters:
# "erode sensitivity" - use minimum sensitivity number in radius range
# "dilate sensitivity" - use maximum sensitivity number in radius range
# "open sensitivity" - aims to remove elements smaller than filter radius(it is "erode" and than "dilate" filter)
# "close sensitivity" - aims to close holes smaller than filter radius (it is "dilate" and than "erode" filter)
# "open-close sensitivity" - (it is "open" and than "close" filter)
# "close-open sensitivity" - (it is "close" and than "open" filter)
# "combine sensitivity" - average of erode and dilate (i.e. simplified/dirty "open-close" or "close-open" filter)
# replace "sensitivity" by "state" to use filter on element states instead of sensitivities
# manufacturing filters:
# ["casting", tolerance, vector of casting direction, domains or nothing for all domains]
# e.g. filter_list = [["casting", 2., (0, 0, 1)], ["simple", 2.]] # where simple filter is used after casting filter, filter range is 2.
# range can be "auto" to use average element size on the domain, or user defined distance
# ADVANCED INPUTS:
optimization_base = "stiffness" # "stiffness" - maximization of stiffness (minimization of compliance)
# "failure_index" sensitivity number is given by FI/density
# "buckling" - maximization of the lowest buckling factor, more modes are taken linearly into account if factor difference is under 0.2
# "heat" - maximize heat flow through the structure
# inp file for heat and buckling analysis should contain only one heat or buckling step
cpu_cores = 0 # 0 - use all processor cores, N - will use N number of processor cores
FI_violated_tolerance = 1 # N - freeze mass if, compared to initial state, there is N more elements with FI >= 1
decay_coefficient = -0.2 # k - exponential decay coefficient to dump mass_additive_ratio and mass_removal_ratio after freezing mass
# fits to equation: exp(k * i), where i is iteration number from triggering by exceeding FI_violated_tolerance
# k = -0.2 ~ after 10 iterations slows down approximately 10 times
# k = 0 ~ no decaying
shells_as_composite = False # True - use more integration points to catch bending stresses (ccx 2.12 WILL FAIL for other than S8R and S6 shell elements)
# False - use ordinary shell section
reference_points = "integration points" # "integration points" - read int. pt values (stresses) from .dat file,
# "nodes" - optimization will read nodal values (stresses) from .inp file (model MUST NOT contain shell nor beam elements)
reference_value = "max" # "max" - maximal value on element,
# "average" - average value on element (not convenient for bended shell elements when optimization_base = "failure_index")
sensitivity_averaging = False # True - averaging sensitivity numbers with previous iteration, False - do not average
mass_addition_ratio = 0.015 # mass to be added in each iteration
mass_removal_ratio = 0.03 # mass to be removed in each iteration
ratio_type = "relative" # "relative" - ratios of actual mass, "absolute" - ratios of maximal mass
compensate_state_filter = True # True - if state filter changes iteration mass, next iteration will compensate it
# False - do nothing
steps_superposition = [] # make linear superposition of stress tensors from different steps to save time for evaluation of new load cases,
# [] - do not superpose
# example for 2 new load cases:
# [[(0.5, 1), (0.2, 2)], [(-1.5, 3)]]
# first superposition is from the first step (i.e. step 1) with stress tensor multiplied by 0.5 plus stress tensor from step 2 multiplied by 0.2,
# second superposition is only from step 3 but with stress tensor multiplied by -1.5
iterations_limit = "auto" # "auto" - automatic estimate, <integer> - the maximum allowable number of iterations
tolerance = 1e-3 # the maximum relative difference in mean stress in optimization domains between the last 5 iterations needed to finish
displacement_graph = [] # plot maximal displacement of the given node set, e.g.
# [] - do not plot it
# [["nset1", "ux"], ["nset2", "uy"]] - plot maximal x displacement of node set nset1 and maximal y displacement of node set nset2
# [["nset1", "total"]] - plot maximal total displacement of node set nset1, same as [["nset", "sqrt(ux**2 + uy**2 + uz**2)"]]
save_iteration_results = 1 # every i-th iteration save temporary results, 0 - save only final results
save_solver_files = "" # not removed outputs from the solver, e.g. "inp frd dat cvg sta" will preserve all outputs in iterations defined by save_iteration_results
save_resulting_format = "inp vtk" # "frd" or "inp" format of resulting meshes (each state separately in own mesh file)
# "vtk" output for viewing in Paraview (renumbered mesh, states, sensitivity numbers, failure indices)
# "csv" simple tabelized data - also possible to import into Paraview (element centres of gravity, states, sensitivity numbers, failure indices)