Skip to main content

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., -2.])

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()

error = dom.error(lambda x, y, z: [0., 0., x * x - 2. * x])

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.

Metadata

Release files for elasticitypy 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for elasticitypy 0.0.7
File Interpreter ABI Platform Actions
elasticitypy-0.0.7-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details for elasticitypy-0.0.7-cp310-cp310-win_amd64.whl

Release files / elasticitypy-0.0.7-cp310-cp310-win_amd64.whl

Download URL elasticitypy-0.0.7-cp310-cp310-win_amd64.whl
Size 776.2 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
4665bf90ea604b7dd106edff133e49284ab11a54f640581a3364782cfefc6875
BLAKE2b-256 checksum
How to use checksums
e5173e88a7891efe968d3865da9503de7e5c9ebcb7b43ddde8b2aaa9b3356175
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

Security for elasticitypy 0.0.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page