Skip to main content

No project description provided

Project description

PlanarPy

A small 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

# 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 [0, 10]x[0, 10]
mesh = Mesh(pts, cells, 6)

# define groups
left = mesh.def_group(lambda x, y: x == 0.)
right = mesh.def_group(lambda x, y: x == 10.)
left_half = mesh.def_group(lambda x, y: x <= 5.)

# p-refinement 
mesh.adapt_p(left_half, 10)

# domain setup
dom = Dom(mesh)

# define Dirichlet boundary
dom.set_boundary(left, right)
# 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: [0.], left)
dom.embed_bcond(lambda x, y: [x.sin()], right)
# set force in the domain
dom.set_force(lambda x, y: [x.sin()])

# solve
dom.solve()

Plotting

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

sys = dom.plot_sys()
disp = dom.plot_disp()

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.

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

planarpy-0.0.1-cp310-cp310-win_amd64.whl (544.9 kB view details)

Uploaded CPython 3.10Windows x86-64

File details

Details for the file planarpy-0.0.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: planarpy-0.0.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 544.9 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using 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.1

File hashes

Hashes for planarpy-0.0.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 fb36679a701cd11fa17494c5a8cd3f1222308a43490d4a0202b04102666e35ef
MD5 ebc0490f9469c274a8a1f508a1f9db94
BLAKE2b-256 e9419d7d7910368abd663c27bd9d4d213f250d26ab5f056e5308bc8a90aeeabc

See more details on using hashes here.

Supported by

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