Example #1
0
old_zu = None

# The volumes of the elements in the filter mesh
filtr_volumes = None

# Create the array of properties
rho = [2600.0]  #, 1300.0, 600.0]
E = [70e9]  #, 35e9, 10e9]
nu = [0.3]  #, 0.3, 0.3]
vars_per_node = 1

# Set the values of the objective array
obj_array = [1.0e-4]

# Create the stiffness properties object
props = TMR.StiffnessProperties(rho, E, nu)

for ite in range(max_iterations):
    # Create the TACSAssembler and TMRTopoProblem instance
    nlevs = mg_levels[ite]
    assembler, problem, filtr, varmap = createTopoProblem(props,
                                                          forest,
                                                          nlevels=nlevs,
                                                          Xscale=Xscale)

    # Write out just the mesh - for visualization
    flag = TACS.ToFH5.NODES
    f5 = TACS.ToFH5(assembler, TACS.PY_SOLID, flag)
    f5.writeToFile(os.path.join(args.prefix, 'beam_mesh%d.f5' % (ite)))

    # Set the constraint type
Example #2
0
# The volumes of the elements in the filter mesh
filtr_volumes = None

# Create the array of properties
rho = [2600.0]  #, 1300.0, 600.0]
E = [70e9]  #, 35e9, 10e9]
nu = [0.3]  #, 0.3, 0.3]
vars_per_node = 1

# Set the values of the objective array
obj_array = [1.0e2]

# Create the stiffness properties object
use_project = args.use_project
props = TMR.StiffnessProperties(rho, E, nu, k0=1e-3, use_project=use_project)

for ite in range(max_iterations):
    # Create the TACSAssembler and TMRTopoProblem instance
    nlevs = mg_levels[ite]
    assembler, problem, filtr, varmap = createTopoProblem(
        props,
        forest,
        nlevels=nlevs,
        Xscale=Xscale,
        ordering=TACS.PY_MULTICOLOR_ORDER)

    # Write out just the mesh - for visualization
    flag = TACS.ToFH5.NODES
    f5 = TACS.ToFH5(assembler, TACS.PY_SOLID, flag)
    f5.writeToFile(os.path.join(args.prefix, 'beam_mesh%d.f5' % (ite)))
Example #3
0
prefix = args.prefix
optimization_options['output_file'] = os.path.join(prefix, 'output_file.dat')
optimization_options['tr_output_file'] = os.path.join(prefix, 'tr_output_file.dat')

# Set the max nmber of outer iterations
# (for continuation strategies and/or mesh refinement)
mg_levels = args.mg_levels
max_iterations = len(mg_levels)

# Set the material properties
rho = [2600.0]
E = [70e9]
nu = [0.3]

# Create the stiffness properties object
props = TMR.StiffnessProperties(rho, E, nu, k0=1e-3, eps=0.2, q=5.0)

# Set the values of the objective array
obj_array = [ 1.0e2 ]

# Set the boundary conditions for the problem
bcs = TMR.BoundaryConditions()
bcs.addBoundaryCondition('fixed', [0, 1, 2], [0.0, 0.0, 0.0])

# Create the initial forest
forest = create_forest(comm, args.init_depth, args.htarget)

# Set the original filter to NULL
orig_filter = None
xopt = None