my_material = amfe.KirchhoffMaterial(E=210E9,
                                     nu=0.3,
                                     rho=1E4,
                                     plane_stress=True)
my_system = amfe.MechanicalSystem()
my_system.load_mesh_from_gmsh(input_file, 7, my_material)
my_system.apply_dirichlet_boundaries(8, 'xy')  # fixature of the left side
my_system.apply_neumann_boundaries(key=9,
                                   val=1E8,
                                   direct=(0, -1),
                                   time_func=lambda t: t)

amfe.solve_linear_displacement(my_system)
my_system.export_paraview(output_file + '_linear')

amfe.solve_nonlinear_displacement(my_system, no_of_load_steps=50)
my_system.export_paraview(output_file + '_nonlinear')

#%% Modal analysis

#omega, V = amfe.vibration_modes(my_system, save=True)
#my_system.export_paraview(output_file + '_modes')

# Basis generation:

omega, V = amfe.reduced_basis.vibration_modes(my_system, 6)
Theta = amfe.reduced_basis.modal_derivatives(V, omega, my_system.K,
                                             my_system.M())

nskts = amfe.hyper_red.compute_nskts(my_system)
Exemplo n.º 2
0
# Steel
#my_material = amfe.KirchhoffMaterial(E=210E9, nu=0.3, rho=1E4, plane_stress=True)
# PE-LD
my_material = amfe.KirchhoffMaterial(E=200E6,
                                     nu=0.3,
                                     rho=1E3,
                                     plane_stress=True)

my_system = amfe.MechanicalSystem(stress_recovery=True)
my_system.load_mesh_from_gmsh(input_file, 84, my_material)
my_system.apply_dirichlet_boundaries(83, 'xyz')
my_system.apply_neumann_boundaries(85, 1E7, (0, 1, 0), lambda t: t)

#%%
#amfe.solve_linear_displacement(my_system)
amfe.solve_nonlinear_displacement(my_system,
                                  no_of_load_steps=100,
                                  track_niter=True)

my_system.export_paraview(output_file + '_10')

#%%
dt = 0.01
T = np.arange(0, 1, dt)
ndof = my_system.K().shape[0]
q0 = np.zeros(ndof)
dq0 = np.zeros(ndof)

amfe.integrate_nonlinear_system(my_system, q0, dq0, T, dt, alpha=0.1)
Exemplo n.º 3
0
mesh_file = amfe.amfe_dir('meshes/test_meshes/bar_Tet4_fine.msh')
output_file = amfe.amfe_dir('results/bar_tet10/bar_tet4')

# Building the mechanical system
my_material = amfe.KirchhoffMaterial()
my_system = amfe.MechanicalSystem()
my_system.load_mesh_from_gmsh(mesh_file, 29, my_material)
# Fixations are simple to realize
my_system.apply_dirichlet_boundaries(30, 'xyz')
my_system.apply_dirichlet_boundaries(31, 'yz')

# make master-slave approach to add constraint that x-dofs are all the same at right end
nodes, dofs = my_system.mesh_class.set_dirichlet_bc(31, 'x', output='external')
my_system.dirichlet_class.apply_master_slave_list([
    [dofs[0], dofs[1:], None],
])
my_system.dirichlet_class.update()

# %%

# static force in x-direction
# my_neumann_boundary_list = [[[dofs[0],], 'static', (1E10, ), None]]
my_system.apply_neumann_boundaries(31, 1E12, (1, 0, 0), lambda t: t)

# static solution
amfe.solve_nonlinear_displacement(my_system)
# amfe.solve_linear_displacement(my_system)

my_system.export_paraview(output_file)
Exemplo n.º 4
0
#%%


my_mechanical_system = amfe.MechanicalSystem()
my_material = amfe.KirchhoffMaterial()
my_mechanical_system.load_mesh_from_gmsh(gmsh_input_file, 29, my_material)

my_mechanical_system.apply_dirichlet_boundaries(31, 'xyz')

#%%
print('Choose now the area which will be pushed or pulled:')
#my_mechanical_system.apply_dirichlet_boundaries(30, 'yz')
def time_func(t):
    return t
my_mechanical_system.apply_neumann_boundaries(30, -1E11, 'normal', time_func=time_func)

# The old way
#nodes_list, dofs_list = my_mechanical_system.mesh_class.select_dirichlet_bc(30, 'x', output='external')
#NB = [dofs_list, 'static', (8E9, ), None]
#my_mechanical_system.apply_neumann_boundaries([NB, ])

K, f = my_mechanical_system.K_and_f(np.zeros(my_mechanical_system.dirichlet_class.no_of_constrained_dofs), t=1)
M = my_mechanical_system.M()

amfe.solve_nonlinear_displacement(my_mechanical_system, 10, smplfd_nwtn_itr=1,
                                  write_iter=False, rtol=1E-7)

# amfe.solve_linear_displacement(my_mechanical_system)
my_mechanical_system.export_paraview(paraview_output_file)

Exemplo n.º 5
0
input_file = amfe.amfe_dir('meshes/gmsh/pressure_corner.msh')
output_file = amfe.amfe_dir('results/pressure_corner/pressure_corner')

my_material = amfe.KirchhoffMaterial(E=210E9,
                                     nu=0.3,
                                     rho=1E4,
                                     plane_stress=True)
my_system = amfe.MechanicalSystem(stress_recovery=True)
my_system.load_mesh_from_gmsh(input_file, 11, my_material)
my_system.apply_dirichlet_boundaries(9, 'x')
my_system.apply_dirichlet_boundaries(10, 'y')
my_system.apply_neumann_boundaries(12, 1E10, 'normal', lambda t: t)

#amfe.solve_linear_displacement(my_system)
snapshots = amfe.solve_nonlinear_displacement(my_system,
                                              no_of_load_steps=50,
                                              track_niter=True)

my_system.export_paraview(output_file)

#%% POD reduction
sigma, V_pod = amfe.pod(my_system)
plt.semilogy(sigma, 'x-')
plt.grid()

#%% POD hyper reduction

n = 10
V = V_pod[:, :n]
my_hyper_system = hyper_red.reduce_mechanical_system_ecsw(my_system, V)
Exemplo n.º 6
0
    None, [amfe.node2total(i, 1) for i in bottom_line_indices], None
]
top_fixation_x = [
    amfe.node2total(top_line_indices[0], 0),
    [amfe.node2total(i, 0) for i in top_line_indices], None
]
top_fixation_y = [
    amfe.node2total(top_line_indices[0], 1),
    [amfe.node2total(i, 1) for i in top_line_indices], None
]

dirichlet_boundary_list = [
    bottom_fixation_x, bottom_fixation_y, top_fixation_x, top_fixation_y
]
my_mechanical_system.apply_dirichlet_boundaries(dirichlet_boundary_list)

# static force in y-direction
my_neumann_boundary_list = [[[
    amfe.node2total(top_line_indices[0], 1),
], 'static', (2E11, ), None]]
my_mechanical_system.apply_neumann_boundaries(my_neumann_boundary_list)

# static solution
t1 = time.time()
amfe.solve_nonlinear_displacement(my_mechanical_system, 40, smplfd_nwtn_itr=1)
t2 = time.time()
print('Time for solving the static problem:', t2 - t1)
export_path = '../results/gummi_mit_loch' + time.strftime(
    "_%Y%m%d_%H%M%S") + '/gummi_mit_loch'
my_mechanical_system.export_paraview(export_path)