Пример #1
0
#
# Distributed under 3-Clause BSD license. See LICENSE file for more information.
#
"""
Static Pipe example
"""

import numpy as np

from amfe.io import amfe_dir
from amfe.ui import *
from amfe.material import KirchhoffMaterial
from amfe.solver import AmfeSolution, SolverFactory
from amfe.solver.translators import create_constrained_mechanical_system_from_component

input_file = amfe_dir('meshes/gmsh/pipe.msh')
output_file = amfe_dir('results/pipe/pipe')

# PE-LD
my_material = KirchhoffMaterial(E=200E6, nu=0.3, rho=1E3, plane_stress=True)

mesh = import_mesh_from_file(input_file)

my_component = create_structural_component(mesh)

assign_material_by_group(my_component, my_material, 84)

set_dirichlet_by_group(my_component, 83, ('ux', 'uy', 'uz'))

set_neumann_by_group(my_component,
                     85,
Пример #2
0
"""
Created on Fri Dec 18 15:31:45 2015

@author: johannesr
"""

import numpy as np
from amfe.io import amfe_dir
from amfe.ui import *
from amfe.material import KirchhoffMaterial
from amfe.component import StructuralComponent
from amfe.solver import SolverFactory, AmfeSolution
from amfe.solver.translators import create_constrained_mechanical_system_from_component
from amfe.structural_dynamics import vibration_modes

meshfile = amfe_dir('meshes/gmsh/AMFE_logo.msh')
output_file = amfe_dir('results/AMFE_logo/logo_5_v2.xdmf')

material_1 = KirchhoffMaterial(E=5E6, rho=1E4)
material_2 = KirchhoffMaterial(E=5E7, rho=1E4)

mesh = import_mesh_from_file(meshfile)

my_component = StructuralComponent(mesh)
my_component.assign_material(material_1, [299, 300], 'S')
my_component.assign_material(material_2, [301, 302], 'S')

set_dirichlet_by_group(my_component, 298, ('ux', 'uy', 'uz'))

no_of_dofs = my_component.mapping.no_of_dofs
q0 = np.zeros(no_of_dofs)
Пример #3
0
# Universitaet Muenchen.
#
# Distributed under BSD-3-Clause License. See LICENSE-File for more information
#
"""
Running a 3D-tension bar
"""
#%%
import numpy as np

from amfe.ui import *
from amfe.io import amfe_dir
from amfe.material import KirchhoffMaterial
from amfe.solver import *

mesh_file = amfe_dir('meshes/test_meshes/bar_Tet4_fine.msh')
output_file = amfe_dir('results/bar_tet10/bar_tet4_pardiso')

# Building the structural component
mesh = import_mesh_from_file(mesh_file)
component = create_structural_component(mesh)
my_material = KirchhoffMaterial()
component.assign_material(my_material, [29], 'S')

# Fixations are simple to realize
set_dirichlet_by_group(component, [30], ('ux', 'uy', 'uz'))
set_dirichlet_by_group(component, [31], ('uy', 'uz'))

# Special boundary condition: let all x coordinates have equal displacement
constraint = component.constraints.create_equal_displacement_constraint()
nodeids = mesh.get_nodeids_by_groups([31])
Пример #4
0
# Copyright (c) 2017, Lehrstuhl fuer Angewandte Mechanik, Technische
# Universitaet Muenchen.
#
# Distributed under BSD-3-Clause License. See LICENSE-File for more information
#
"""
Example showing a corner with pressure following the Tutorial 1
"""

# --- Preparation ---
from amfe.io import amfe_dir
import amfe.ui

input_file = amfe_dir('meshes/gmsh/pressure_corner.msh')
output_file_deformation = amfe_dir(
    'results/pressure_corner/pressure_corner_nonlinear_deformation')
output_file_modes = amfe_dir(
    'results/pressure_corner/pressure_corner_linear_modes')

# --- Load Mesh ---
my_mesh = amfe.ui.import_mesh_from_file(input_file)

# --- Setting up new component ---
my_component = amfe.ui.create_structural_component(my_mesh)

# --- Define materials and assign it to component ---
my_material = amfe.ui.create_material('Kirchhoff',
                                      E=210E9,
                                      nu=0.3,
                                      rho=7.86E3,
                                      plane_stress=True,
Пример #5
0
#   Time:   s
#
# Derived Units:
#   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/gmsh/simple_beam_metis_10/simple_beam_metis_10.msh')
mesh_reader = GmshAsciiMeshReader(input_file)
mesh_converter = AmfeMeshConverter()
mesh_reader.parse(mesh_converter)
my_mesh = mesh_converter.return_mesh()

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

my_component = StructuralComponent(my_mesh)

material_tag = ['material']
my_component.assign_material(my_material, material_tag, 'S', '_groups')

glo_dofs_x = my_component.mapping.get_dofs_by_nodeids(
    my_component.mesh.get_nodeids_by_groups(['dirichlet']), ('ux'))
glo_dofs_y = my_component.mapping.get_dofs_by_nodeids(
from amfe.solver import *
from amfe.mor import *
from amfe.mor.hyper_red import *
from amfe.structural_dynamics import vibration_modes

studies = []
# studies.append('full_ti')
studies.append('create_basis_1')
#studies.append('red_ti')
#studies.append('ecsw')
studies.append('poly3')

Omega = 31.0

times = dict([])
input_file = amfe_dir('meshes/gmsh/bar.msh')
output_file = amfe_dir('results/beam_nonlinear_refactoring/beam_ecsw')

# Define material
material = KirchhoffMaterial(E=210E9, nu=0.3, rho=1E4, plane_stress=True)
# Load Mesh
mesh = import_mesh_from_file(input_file)
# Create Component
component = create_structural_component(mesh)
# Assign material
component.assign_material(material, [7], 'S')
# Assign Dirichlet Boundaries
set_dirichlet_by_group(component, [8], ('ux', 'uy'))
# Assign Neumann Boundaries
force = component.neumann.create_fixed_direction_neumann(
    np.array([0, -1], dtype=float), lambda t: 1E8 * np.sin(Omega * t))