block_tets

This example works for: Abaqus.

To run this example, download the Blender file block_tets.blend and copy the code in the script editor in Blender.

../_images/block_tets_blender.png
from compas_fea.cad import blender
from compas_fea.structure import ElasticIsotropic
from compas_fea.structure import ElementProperties as Properties
from compas_fea.structure import GeneralStep
from compas_fea.structure import PinnedDisplacement
from compas_fea.structure import PointLoad
from compas_fea.structure import SolidSection
from compas_fea.structure import Structure

from compas_blender.utilities import get_object_by_name


# Author(s): Andrew Liew (github.com/andrewliew)


# Structure

mdl = Structure(name='block_tets', path='C:/Temp/')

# Tetrahedrons

blender.add_tets_from_mesh(mdl, name='elset_tets', mesh=get_object_by_name('mesh'))

# Sets

blender.add_nsets_from_layers(mdl, layers=['nset_base', 'nset_top'])

# Materials

mdl.add(ElasticIsotropic(name='mat_elastic', E=10*10**9, v=0.3, p=1))

# Sections

mdl.add(SolidSection(name='sec_solid'))

# Properties

mdl.add(Properties(name='ep_tets', material='mat_elastic', section='sec_solid', elset='elset_tets'))

# Displacementss

mdl.add(PinnedDisplacement(name='disp_pinned', nodes='nset_base'))

# Loads

mdl.add(PointLoad(name='load_top', nodes='nset_top', y=100, z=100))

# Steps

mdl.add([
    GeneralStep(name='step_bc', displacements=['disp_pinned']),
    GeneralStep(name='step_load', loads=['load_top']),
])
mdl.steps_order = ['step_bc', 'step_load']

# Summary

mdl.summary()

# Run

mdl.analyse_and_extract(software='abaqus', fields=['u'])

# blender.plot_data(mdl, step='step_load', field='um')
# blender.plot_voxels(mdl, step='step_load', field='um', vdx=0.05)

mdl.save_to_obj()