Esempio n. 1
0
 def test_generalized_alpha_nonlinear_dynamics_solver(self):
     self.system.apply_neumann_boundaries(key=3,
                                          val=2.5e8,
                                          direct=(0, -1),
                                          time_func=lambda t: 1)
     self.solver = amfe.GeneralizedAlphaNonlinearDynamicsSolver(
         mechanical_system=self.system, **self.options)
     self.solver.solve()
     x = np.array([
         self.system.T_output[:],
         [displacement[2] for displacement in self.system.u_output]
     ])
     y = np.array([
         self.system.T_output[:],
         [displacement[3] for displacement in self.system.u_output]
     ])
     fnx = amfe.amfe_dir(
         'tests/kratos/Kratos_beam10x1Quad8_nonlinear_dynamics_x_wbzalpha_rhoinf095_dt1e-6.grf'
     )
     fny = amfe.amfe_dir(
         'tests/kratos/Kratos_beam10x1Quad8_nonlinear_dynamics_y_wbzalpha_rhoinf095_dt1e-6.grf'
     )
     reference_x = read_grf(fnx)
     reference_y = read_grf(fny)
     assert_allclose(x[1, 1:],
                     reference_x[1, 499::500],
                     rtol=1e-12,
                     atol=0.06)
     assert_allclose(y[1, 1:],
                     reference_y[1, 499::500],
                     rtol=1e-12,
                     atol=0.06)
Esempio n. 2
0
    solver.solve()
    q_static = system.constrain_vec(system.u_output[-1][:])
    system.clear_timesteps()
    if not statics:  # dynamics
        system.apply_neumann_boundaries(key=3, val=-2.5e8, direct=(0, -1), time_func=lambda t: t)  # delete static NBCs
        system.apply_neumann_boundaries(key=3, val=2.5e8, direct=(0, -1), time_func=lambda t: 1)  # reset dynamic NBCs
    #  > convert system to state-space form
    state_space_system = amfe.mechanical_system.convert_mechanical_system_to_state_space(
        system, regular_matrix=system.K(q_static), overwrite=False)


# solve system
if not statics:
    if not linear:  # non-linear dynamics
        if scheme is 'GeneralizedAlpha':
            solver = amfe.GeneralizedAlphaNonlinearDynamicsSolver(mechanical_system=system, **options)
        elif scheme is 'WBZAlpha':
            solver = amfe.GeneralizedAlphaNonlinearDynamicsSolver(mechanical_system=system, **options)
            solver.set_wbz_alpha_parameters(rho_inf=rho_inf)
        elif scheme is 'HHTAlpha':
            solver = amfe.GeneralizedAlphaNonlinearDynamicsSolver(mechanical_system=system, **options)
            solver.set_hht_alpha_parameters(rho_inf=rho_inf)
        elif scheme is 'NewmarkBeta':
            solver = amfe.GeneralizedAlphaNonlinearDynamicsSolver(mechanical_system=system, **options)
            solver.set_newmark_beta_parameters(beta=0.25*(1 + alpha)**2, gamma=0.5 + alpha)
        elif scheme is 'JWHAlpha':
            solver = amfe.JWHAlphaNonlinearDynamicsSolver(mechanical_system=system, **options)
        elif scheme is 'JWHAlphaStateSpace':
            system = state_space_system
            solver = amfe.JWHAlphaNonlinearDynamicsSolverStateSpace(mechanical_system=system, **options)
        else:
Esempio n. 3
0
#
# Distributed under BSD-3-Clause License. See LICENSE-File for more information
#
"""
Rubber boot example
"""

import amfe

input_file = amfe.amfe_dir('meshes/gmsh/rubber_boot.msh')
output_file = amfe.amfe_dir('results/rubber_boot/boot')

# PE-LD; better material would be Mooney-Rivlin
my_material = amfe.KirchhoffMaterial(E=200E6, nu=0.3, rho=1E3)

my_system = amfe.MechanicalSystem(stress_recovery=False)
my_system.load_mesh_from_gmsh(input_file, 977, my_material, scale_factor=1E-3)
my_system.apply_dirichlet_boundaries(978, 'xyz')
my_system.apply_neumann_boundaries(979, 1E7, (0, 1, 0), lambda t: 1)

#%%

solver = amfe.GeneralizedAlphaNonlinearDynamicsSolver(my_system)
solver.solve()
my_system.export_paraview(output_file + '_full_ti')

#amfe.vibration_modes(my_system, save=True)

#my_system.export_paraview(output_file + '_modes')

#%%
Esempio n. 4
0

###############################################################################
## time integration
###############################################################################

ndof = my_system.dirichlet_class.no_of_constrained_dofs
q0 = np.zeros(ndof)
dq0 = np.zeros(ndof)
initial_conditions = {'q0': q0, 'dq0': dq0}

dt = 5e-4
t_end = 2

#%%
solver = amfe.GeneralizedAlphaNonlinearDynamicsSolver(my_system,dt=dt, t_end=t_end, initial_conditions=initial_conditions)
solver.solve()
my_system.export_paraview(paraview_output_file + '_full_model')

my_system.clear_timesteps()
solver = amfe.GeneralizedAlphaLinearDynamicsSolver(my_system, dt=dt, t_end=t_end, initial_conditions=initial_conditions)
solver.solve()
my_system.export_paraview(paraview_output_file + '_linear_model')

my_system.clear_timesteps()
omega, V = amfe.vibration_modes(my_system, 7, save=True)
my_system.export_paraview(paraview_output_file + '_modes')

Theta, Theta_tilde = amfe.shifted_modal_derivatives(V, my_system.K, my_system.M(), omega)
my_system.clear_timesteps()
V_temp = amfe.augment_with_derivatives(None, Theta, deflate=False)
Esempio n. 5
0

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
                                                         },
                                                         t_end=T,
                                                         dt=dt,
                                                         track_iterations=True)
dynsolver.solve()
my_system.export_paraview(output_file + '_3')