Example no design space with file:
from run_optimization import run_optimization
cpus = 4
# Optimization type --> seperated (combined is only in beta )
opti_type = "seperated"
# no design space is used until redefinition
sol_type = ["no_design_space", "static"]
files = ["no_design_space.inp", "testinp\Cylinder_Mesh.inp"]
max_iteration = 20
vol_frac = 0.3
penal = 3.0
matSets = 10
weight_factors = [3.0]
workDir = "work"
solverPath = "ccx"
run_optimization(penal, matSets, opti_type, sol_type,
weight_factors, max_iteration, vol_frac,
files, workDir, solverPath, cpus)
Example no design space with element set and several iterations:
from run_optimization import run_optimization
# Optimization type --> seperated (combined is only in beta )
cpus = 6
opti_type = "seperated"
sol_type = ["static"]
files = ["PlateWithNoDesignSpaceFine.inp"]
for vol_frac in [0.4, 0.6]:
for penal in [3.0]:
max_iteration = 100
matSets = 20
weight_factors = [1.0]
workDir = "work"
solverPath = "ccx"
no_design_set = 'SolidMaterial001Solid'
run_optimization(penal, matSets, opti_type, sol_type,
weight_factors, max_iteration, vol_frac,
files, workDir, solverPath, cpus, no_design_set)
from run_optimization import run_optimization
import json
import os
json_path = 'config.json'
if __name__ == "__main__":
# Optimization type --> seperated (combined is not implemented )
cpus = 6
opti_type = "seperated"
sol_type = ["static"]
with open(json_path, 'r') as file:
data = json.load(file)
files = [data['inp_path']]
workDir = 'work'
solverPath = "\"" + str(data['ccx_path']) + "\""
inp_path = data['inp_path']
files = [inp_path]
for vol_frac in [0.4]:
for penal in [3.0]:
max_iteration = 100
matSets = 20
weight_factors = [1.0]
no_design_set = 'SolidMaterial001Solid'
no_design_set = None
run_optimization(penal, matSets, opti_type, sol_type,
weight_factors, max_iteration, vol_frac,
files, workDir, solverPath, cpus, no_design_set)
Only supported if mayavi and trimesh is insatlled
This module creates rendered pictures of the result into the working folder.
Install mayavi package (with vtk ...)
Install trimesh package (for converting the stl file)
goto the file 'TopologyOptimizer\OptimizationController.py'
At the beginning of the file set the variable 'use_trimesh_may_avi=True'
You can specify a 'interactive_visualization_after_iteration'. After these iteration interval a scene will be poped up and rendered.
use_trimesh_may_avi = True
if use_trimesh_may_avi:
from mayavi import mlab
import trimesh
interactive_visualization_after_iteration = 10
GNU GENERAL PUBLIC LICENSE Version 2, June 1991