PlanarPy
A fast hp-FEA program for the membrane Poisson equation
c(Δu) = -f
using variable order triangle elements (orders 1-20) with heterogeneous p-refinement.
Installation
Use the package manager pip to install PlanarPy.
pip install planarpy
Usage
The Mesh object requires a list of point tuples, pts = [(x0,y0), (x1,y1), ...], a list triangle node tuples, cells = [(0,1,2), (2,5,6), ...], and a base power, pow = 2, to initialize.
Define groups using boolean functions. Always use both coordinates x,y 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 planarpy import Mesh, Dom, sin, cos
# it is up to the user to define points and cells
# either manually or by using a foreign library.
# here the domain is assumed to be [-10, 10]x[-10, 10]
# enable the reverse Cuthill Mckee algorithm (rcm) for
# increased memory alignment
mesh = Mesh(pts, cells, 1, rcm=True)
# define groups
outer = mesh.def_group(lambda x, y: x == -10. or x == 10. or y == -10. or y == 10.)
left_half = mesh.def_group(lambda x, y: x <= 0.)
# p-refinement
mesh.adapt_p(left_half, 10)
# domain setup
dom = Dom(mesh)
# define Dirichlet boundary
dom.set_boundary(outer)
# get the amount of free and constrained degrees of freedom
pos_dofs, neg_dofs = dom.dofs()
# set material constant c
dom.set_consts(1.)
# set boundary condition, default is 0
dom.embed_bcond(lambda x, y: [sin(x) + cos(y)], outer)
# set force in the domain
dom.set_force(lambda x, y: [sin(x) + cos(y)])
# solve
dom.solve()
# measure error with an exact solution
err = dom.err(lambda x, y: [sin(x) + cos(y)])
Plotting
PlanarPy offers three functions in order to extract graphical data in the form of lines
# mesh plot
sys = dom.plot_sys()
# displacement plot with 5 segments per line
disp = dom.plot_disp()
# displacement plot with a given
# number of segments per line
smooth = dom.plot_smooth(50)
The functions return three lists, x, y, z, for line coordinates.
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
PlanarPy 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 planarpy 0.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| planarpy-0.0.8-cp310-cp310-win_amd64.whl | CPython 3.10 | CPython 3.10 | Windows x86-64 | Details for planarpy-0.0.8-cp310-cp310-win_amd64.whl |
Release files / planarpy-0.0.8-cp310-cp310-win_amd64.whl
| Download URL | planarpy-0.0.8-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 689.6 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
998f6903e298554507f3e00bc392c09148c4a8c3cfd017f863aa4c8398bf1831
|
|
BLAKE2b-256 checksum How to use checksums |
4bcb09de8c3f3669a9f6e4223a199bd80e8eb1c18ee8b62d5cb5e5f12f3e9bd8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2
|
Security for planarpy 0.0.8
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.