예제 #1
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')
예제 #2
0
dirichlet2 = my_component.constraints.create_dirichlet_constraint(lambda t: 3.0*np.sin(31.0*t),
                                                                  lambda t: 3.0*31.0*np.cos(31.0*t),
                                                                  lambda t: -3.0*31.0*31.0*np.sin(31.0*t))

nodeids = mesh.nodes_df.index.values
ydofs = my_component.mapping.get_dofs_by_nodeids(nodeids, ('uy'))
q0_raw = np.zeros(my_component.mapping.no_of_dofs)
dq0_raw = q0_raw.copy()
dq0_raw[ydofs] = 3.0*31.0

# (xy, direction)
nodeids = mesh.get_nodeids_by_groups([8])
supportdofs_x = my_component.mapping.get_dofs_by_nodeids(nodeids, ('ux'))
supportdofs_y = my_component.mapping.get_dofs_by_nodeids(nodeids, ('uy'))
for dof in supportdofs_x.reshape(-1):
    my_component.assign_constraint('Leftfixation', dirichlet, np.array([dof], dtype=int), np.array([], dtype=int))

for dof in supportdofs_y.reshape(-1):
    my_component.assign_constraint('Leftmotion', dirichlet2, np.array([dof], dtype=int), np.array([], dtype=int))
# END Variant B


# ----------------------------------------- NONLINEAR DYNAMIC ANALYSIS ------------------------------------------------

system, formulation = create_constrained_mechanical_system_from_component(my_component, constant_mass=True,
                                                                          constant_damping=True,
                                                                          constraint_formulation='lagrange',
                                                                          scaling=10.0, penalty=3.0)

solfac = SolverFactory()
solfac.set_system(system)