Exemplo n.º 1
0
my_system = amfe.MechanicalSystem()
my_material = amfe.KirchhoffMaterial(E=210E9,
                                     nu=0.3,
                                     rho=1E4,
                                     plane_stress=True)

my_system.load_mesh_from_gmsh(input_file, 1, my_material)
my_system.mesh_class.load_group_to_mesh(2, my_material)
my_system.assembly_class.preallocate_csr()

my_system.tie_mesh(5,
                   6,
                   tying_type='slide',
                   verbose=True,
                   conform_slave_mesh=True,
                   fix_mesh_dist=1E-1)

my_system.apply_dirichlet_boundaries(3, 'xyz')
my_system.apply_neumann_boundaries(4, 1E10, (1, 1, 1), lambda t: t)

#%%
solver = amfe.LinearStaticsSolver(my_system)
solver.solve()

my_system.export_paraview(output_file + '_full_linear')

#%% Modal analysis
amfe.vibration_modes(my_system, save=True)
my_system.export_paraview(output_file + '_modes')
material = amfe.KirchhoffMaterial(E=2.1e11,
                                  nu=0.3,
                                  rho=7.867e3,
                                  plane_stress=False)
system = amfe.MechanicalSystem()
system.load_mesh_from_gmsh(input_file, 1, material)
system.apply_dirichlet_boundaries(5, 'xy')
ndof = system.dirichlet_class.no_of_constrained_dofs
system.apply_neumann_boundaries(key=3,
                                val=2.5e8,
                                direct=(0, -1),
                                time_func=lambda t: 1.)
system.apply_rayleigh_damping(1e0, 1e-6)

# vibration modes
amfe.vibration_modes(mechanical_system=system, n=20, save=True)
system.export_paraview(output_file + '_vibration_modes')
system.clear_timesteps()

# define simulation parameters
options = {
    't0': 0.,
    't_end': 10.,
    'dt': 1.e-4,
    'output_frequency': 1,
    'rho_inf': .95,
    'initial_conditions': {
        'q0': np.zeros(ndof),
        'dq0': np.zeros(ndof)
    },
    'relative_tolerance': 1.e-6,
Exemplo n.º 3
0
#g = [(0, -9.81, 0) for i in range(no_of_nodes)]
g = [(0, -9.81, 0) for i in range(no_of_nodes)]
g = np.array(g).flatten()
f_gravity = M_unconstr @ g


def f_ext_unconstr(u=None, t=None):
    #    if t > 0.5:
    #        return f_gravity*0
    #    else:
    return f_gravity * np.sin(t * 2 * np.pi * 4.2)


my_system._f_ext_unconstr = f_ext_unconstr

om, V = amfe.vibration_modes(my_system, 40)

print('The vibration modes eigenfrequencies (1/s) are:\n', om / (2 * np.pi))

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

# time integration
dt = 1E-2
T = np.arange(0, 4, dt)
ndof = my_system.dirichlet_class.no_of_constrained_dofs
q0 = dq0 = np.zeros(ndof)
solver = amfe.NonlinearDynamicsSolver(my_system,
                                      initial_conditions={
                                          'q0': q0,
                                          'dq0': dq0
Exemplo n.º 4
0
#my_system.apply_neumann_boundaries(32, 1E8, np.array([0,0,1]),
#                                   time_func=lambda t: t)
# pulling the system
my_system.apply_neumann_boundaries(32, -1E10, 'normal', time_func=lambda t: t)

# Test the paraview basic output
# my_system.export_paraview(paraview_output_file)

#%%
nlsolver = amfe.NonlinearStaticsSolver(my_system, number_of_load_steps=20)
nlsolver.solve()

my_system.export_paraview(paraview_output_file)

#%%
omega, V = amfe.vibration_modes(my_system, save=True)
my_system.export_paraview(paraview_output_file)

#%%
Theta = amfe.static_correction_theta(V, my_system.K)
my_system.clear_timesteps()

no_of_modes = V.shape[1]
for i in range(no_of_modes):
    for j in range(i + 1):
        my_system.write_timestep(u=Theta[:, i, j], t=i * 100 + j)

my_system.export_paraview(paraview_output_file + 'mds')
#%%
my_system.K_and_f()
Exemplo n.º 5
0
                                     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')


def harmonic_excitation(t):
    return np.sin(2.4 * 2 * np.pi * t) + np.sin(3.0 * 2 * np.pi * t)


my_system.apply_neumann_boundaries(85, 1E5, (1, 1, 0), harmonic_excitation)

#%%
omega, V = amfe.vibration_modes(my_system)
#%%

dt = 0.001
T = 10
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,
#                                track_niter=True)
dynsolver = amfe.GeneralizedAlphaNonlinearDynamicsSolver(my_system,
                                                         initial_conditions={
                                                             'q0': q0,
                                                             'dq0': dq0
                                                         },