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., -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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file elasticitypy-0.0.7-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: elasticitypy-0.0.7-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 776.2 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4665bf90ea604b7dd106edff133e49284ab11a54f640581a3364782cfefc6875 |
|
MD5 | bc709412a3bb21bce4c3cd2bfff13220 |
|
BLAKE2b-256 | e5173e88a7891efe968d3865da9503de7e5c9ebcb7b43ddde8b2aaa9b3356175 |