Skip to main content

No project description provided

Project description

ElasticityPy

A small python library running a rust back-end for computation of linear elastic problems in 3D. The package relies on quadratic tetrahedral finite elements.

Installation

Use the package manager pip to install elasticitypy.

pip install elasticitypy

Usage

The Mesh object requires a list of point tuples, pts = [(x0,y0,z0), (x1,y1,z1), ...] and a list tetrahedra node tuples, tets = [(0,1,2,3), (2,5,6,10), ...], to initialize.

Define groups using boolean functions. Always use all three coordinates x,y,z for all function definitions. Groups are used to define Dirichlet boundary conditions and may also be used to set volume forces on part of the domain. If no group is chosen when setting a volume force, a default group is used.

from elasticitypy import Mesh, Dom

mesh = Mesh(pts, tets)
left = mesh.def_group(lambda x, y, z: x == 0.)
right = mesh.def_group(lambda x, y, z: x == 2.)

dom = Dom(mesh)
dom.embed_bc(lambda x, y, z: [0., 0., 0.], left)
dom.embed_bc(lambda x, y, z: [0., 0., 0.], right)
dom.set_f(lambda x, y, z: [0., 0., x * x])

cmat = [[1., 0., 0., 0., 0., 0., 0., 0., 0.],
        [0., 1., 0., 0., 0., 0., 0., 0., 0.],
        [0., 0., 1., 0., 0., 0., 0., 0., 0.],
        [0., 0., 0., 1., 0., 0., 0., 0., 0.],
        [0., 0., 0., 0., 1., 0., 0., 0., 0.],
        [0., 0., 0., 0., 0., 1., 0., 0., 0.],
        [0., 0., 0., 0., 0., 0., 1., 0., 0.],
        [0., 0., 0., 0., 0., 0., 0., 1., 0.],
        [0., 0., 0., 0., 0., 0., 0., 0., 1.]]

dom.set_cmat(cmat)

dom.solve()
sol = dom.sol

Plotting

ElasticityPy offers two functions in order to extract graphical data in the form of lines

lines = dom.plot_dom()
disp = dom.plot_disp()

The functions return a dictionary of line-coordinates. The first function returns lines with two points, the second returns lines with three points (parabolas).

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

ElasticityPy is licensed under GNU LGPLv3.

This software relies on the PyO3 library under the Apache-2.0 license for ffi and on the rayon crate under the MIT and Apache-2.0 licenses for parallelism.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

elasticitypy-0.0.1-cp39-cp39-win_amd64.whl (265.7 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page