# Decomposition of component
tree_builder = TreeBuilder()
tree_builder.add([0], [my_composite])
leaf_id = tree_builder.leaf_paths.max_leaf_id
tree_builder.separate_partitioned_component_by_leafid(leaf_id)
structural_composite = tree_builder.root_composite.components[0]
structural_composite.update_component_connections()
"""
Then we define the external force of 1.5 kN and apply the Neumann boundary condition.
"""

F = constant_force(1.5E3)

# Neumann conditions, with the force direction [0, -1, 0] for the [x direction, y direction, z direction]
my_neumann = FixedDirectionNeumann(np.array([0, -1, 0]), time_func=F)
structural_composite.assign_neumann('Neumann0', my_neumann, ['neumann'],
                                    '_groups')

# Dirichlet conditions
dirichlet = structural_composite.components[
    1]._constraints.create_dirichlet_constraint()
for dof in glo_dofs_x.reshape(-1):
    structural_composite.assign_constraint('Dirichlet0', dirichlet,
                                           np.array([dof], dtype=int), [])
for dof in glo_dofs_y.reshape(-1):
    structural_composite.assign_constraint('Dirichlet1', dirichlet,
                                           np.array([dof], dtype=int), [])
for dof in glo_dofs_z.reshape(-1):
    structural_composite.assign_constraint('Dirichlet2', dirichlet,
                                           np.array([dof], dtype=int), [])
示例#2
0
#   Force:  g mm s-2 = µN
#   Stiffness: g s-2 mm-1 = Pa
#   velocity: mm/s
#   acceleration: mm/s^2
#   density: g/mm3

E_alu = 70e6
nu_alu = 0.34
rho_alu = 2.7e-3

logging.basicConfig(level=logging.DEBUG)


input_file = amfe_dir('meshes/amfe_json/simple_beam/simple_beam.json')
my_mesh = GidJsonMeshReader(input_file, AmfeMeshConverter()).parse()

my_material = KirchhoffMaterial(E_alu, nu_alu, rho_alu, thickness=10)

my_component = StructuralComponent(my_mesh)

my_component.assign_material(my_material, 'Quad8', 'S', 'shape')

my_neumann = FixedDirectionNeumann(np.array([0, 1]), time_func = lambda t: 2)
my_component.assign_neumann('Neumann0', my_neumann, ['right_boundary'], '_groups')

my_constraint = my_component.constraints.create_dirichlet_constraint()
fixed_nodeids = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], dtype=int)
my_component.assign_constraint('Dirichlet0', my_constraint, fixed_nodeids, '_nodeids', 'elim')


print('END')