Skip to main content

User-friendly Python library that simplifies finite element analysis.

Project description

EasyFEA - Easy Finite Element Analysis

Overview

EasyFEA is a user-friendly Python library that simplifies finite element analysis. It is flexible and supports different types of simulation without requiring users to handle complex PDE formulations. The library currently supports four specific simulation types:

  1. ElasticSimu (static and dynamic): Examples in /examples/Elastic, /examples/Dynamic and /examples/Contact.
  2. BeamSimu (static Euler-Bernoulli): Examples in /examples/Beam.
  3. ThermalSimu (stationary and transient): Examples in /examples/Thermal.
  4. PhaseFieldSimu: (quasi-static phase field) Examples in /examples/PhaseField.

For each simulation, users create a mesh and a model. Once the simulation has been set up, defining the boundary conditions, solving the problem and visualizing the results is straightforward.

Numerous examples of mesh creation are available in the examples/Meshes folder.

The simplest and quickest introduction is shown below and is available in examples/HelloWorld.py.

from EasyFEA import (Display, Mesher, ElemType,
                     Materials, Simulations)
from EasyFEA.Geoms import Point, Domain

# ----------------------------------------------
# Mesh
# ----------------------------------------------
L = 120 # mm
h = 13

domain = Domain(Point(), Point(L,h), h/5*2)
mesh = Mesher().Mesh_2D(domain, [], ElemType.QUAD4, isOrganised=True)

# ----------------------------------------------
# Simulation
# ----------------------------------------------
E = 210000 # MPa
v = .3
F = -800 # N

mat = Materials.Elas_Isot(2, E, v, planeStress=True, thickness=h)

simu = Simulations.ElasticSimu(mesh, mat)

nodesX0 = mesh.Nodes_Conditions(lambda x,y,z: x==0)
nodesXL = mesh.Nodes_Conditions(lambda x,y,z: x==L)

simu.add_dirichlet(nodesX0, [0]*2, ["x","y"])
simu.add_surfLoad(nodesXL, [F/h/h], ["y"])

simu.Solve()

# ----------------------------------------------
# Results
# ----------------------------------------------
Display.Plot_Mesh(mesh)
Display.Plot_BoundaryConditions(simu)
Display.Plot_Result(simu, 'uy', plotMesh=True)
Display.Plot_Result(simu, 'Svm', plotMesh=True, ncolors=11)

Display.plt.show()

All examples are available here.

Installation

EasyFEA can be easily installed from PyPI using pip, compatible with Python versions 3.9 through 3.12:

pip install EasyFEA

Dependencies

EasyFEA uses several libraries such as NumPy and Gmsh - as such, the following projects are required dependencies of EasyFEA:

  • numpy - Fundamental package for scientific computing with Python.
  • gmsh (>= 4.12) - Three-dimensional finite element mesh generator.
  • scipy - Fundamental package for scientific computing in Python.
  • matplotlib - Plotting package.
  • pyvista - Plotting package.
  • numba - Compiling Python code using LLVM.
  • pandas (3.9 <= Python <= 3.12) - Powerful data structures for data analysis.
  • imageio and imageio[ffmpeg] - Library for reading and writing a wide range of image, video, scientific, and volumetric data formats.

For detailed information on installing numba, refer to the Numba Installation Guide.

Optional Dependencies

EasyFEA includes a few optional dependencies for reducing resolution time or for performing DIC:

  • pypardiso (Python > 3.8 & Intel oneAPI) - Library for solving large systems of sparse linear equations.
  • petsc and petsc4py - Python bindings for PETSc.
  • opencv-python - Computer Vision package.

Naming conventions

EasyFEA uses Object-Oriented Programming (OOP) with the following naming conventions:

  • PascalCasing for classes
  • camelCasing for properties
  • Snake_Casing or Snake_casing for functions/methods

In this library, objects can contain both public and private properties or functions.

Private parameters or functions are designated by a double underscore, such as __privateParam. In addition, parameters or functions beginning with an underscore, such as _My_Function are accessible to advanced users, but should be used with caution.

Contributing

Contributors are welcome! To contribute please use the following commands.

git clone https://github.com/matnoel/EasyFEA.git
cd EasyFEA
python -m pip install -e .

To develop a new feature, start by creating a new branch in the project using the command git branch my_new_feature. After implementing and testing your modifications (refer to EasyFEA/tests), proceed to create a pull request to merge your changes.

EasyFEA is an emerging project with a strong commitment to growth and improvement. Your input and ideas are invaluable to me. I welcome your comments and advice with open arms, encouraging a culture of respect and kindness in our collaborative journey towards improvement.

License

EasyFEA is copyright (C) 2021-2024 M. Noel, and is distributed under the terms of the GNU General Public License, Version 3 or later, see LICENSE.txt and CREDITS.txt for more information.

Project details


Download files

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

Source Distribution

EasyFEA-1.0.1.tar.gz (243.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

EasyFEA-1.0.1-py3-none-any.whl (191.3 kB view details)

Uploaded Python 3

File details

Details for the file EasyFEA-1.0.1.tar.gz.

File metadata

  • Download URL: EasyFEA-1.0.1.tar.gz
  • Upload date:
  • Size: 243.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for EasyFEA-1.0.1.tar.gz
Algorithm Hash digest
SHA256 38188216917770cd22c3c78b928bdf24b895a1ae7d1fec41a193b1a3ba0684b0
MD5 edc74c5f91276964836862146e8b2dbc
BLAKE2b-256 50751a63c667a97518b776962b08c58fdd7f31735b705760d374c1435ef20873

See more details on using hashes here.

File details

Details for the file EasyFEA-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: EasyFEA-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 191.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for EasyFEA-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 456bde2339dfd89bb2e9657e8ad3888ab179bfbb3e428900989b5e23b12d80e8
MD5 f82608164a7ababbd8213baf129f024f
BLAKE2b-256 b263add477803fd00cd832056b5141d74c480483fbc18ef7aa51f70deb1c39aa

See more details on using hashes here.

Supported by

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