Skip to main content

Python Laboratory for Finite Element Analysis

Project description

DOI Binder License: GPL v3 License: CC BY-NC-SA 4.0

pyLabFEA

Python Laboratory for Finite Element Analysis

Finite Element Analysis (FEA) is a numerical method for studying mechanical behavior of fluids and solids. The pyLabFEA package introduces a lightweight pure-python version of FEA for solid mechanics and elastic-plastic materials. pyLabFEA can import and analyse data sets on mechanical behavior of materials following the modular materials data schema published on GitHub and described in this article. Based on such data, machine learning (ML) yield functions can be trained and used as constitutive models in elasto-plastic FEA. Due to its simplicity, pyLabFEA is well-suited for teaching, and its flexibility in constitutive modeling of materials makes it a useful research tool for data-oriented constitutive modeling.

Features

  • pyLabFEA offers a lightweight Python Application Programming Interface (API).
  • Object oriented methods for generation of finite element models.
  • Flexible methods for material definitions, from conventional continuum elasticity and plasticity methods to training of machine learning yield functions, see this research article.
  • Import of mechanical data based on the modular material data schema, see this research article.

Installation

The preferred method to use pyLabFEA is within Anaconda or Miniconda, into which it can be easily installed from conda-forge by

$ conda install pylabfea -c conda-forge

Generally, it can be installed within any Python environment supporting the package installer for python pip from its latest PyPi image via pip

$ pip install pylabfea

Alternatively, the most recent version of the complete repository, including the source code, documentation and examples, can be cloned and installed locally. It is recommended to create a conda environment before installation. This can be done by the following the command line instructions

$ git clone https://github.com/AHartmaier/pyLabFEA.git ./pyLabFEA
$ cd pyLabFEA
$ conda env create -f environment.yml
$ conda activate pylabfea
$ (pylabfea) python -m pip install .

The correct installation with this method can be tested with

$ (pylabfea) pytest tests -v

After this, the package can be used within python, e.g. by importing the entire package with

import pylabfea as fea

Documentation

Online documentation for pyLabFEA can be found under https://ahartmaier.github.io/pyLabFEA/.

The documentation has been generated using Sphinx.

Examples

A collection of exemplary notebooks and python scripts is available on pyLabFEA'S GitHub repository with tutorials on linear and non-linear FEA, homogenization of elastic and elastic-plastic material behavior, and constitutive models based on machine learning algorithms.

Jupyter notebooks

pyLabFEA is conveniently used with Jupyter notebooks, which are contained in the subfolder 'notebooks' of this repository and can be accessed via index.ipynb. An overview on the contents of the notebooks is also available in the documentation.

The Jupyter notebooks of the pyLabFEA tutorials are directly accessible on Binder

Python scripts

Python routines contained in the subfolder 'examples' of this repository demonstrate how ML yield funcitons can be trained based on reference materials with significant plastic anisotropy, as Hill or Barlat reference materials, but also for isotropic J2 plasticity. The training data consists of different stress tensors that mark the onset of plastic yielding of the material. It is important that these stress tensors cover the onset of plastic yielding in the full 6-dimensional stress space, including normal and shear stresses.

The trained ML flow rules can be used in form of a user material (UMAT) for the commercial FEA package Abaqus (Dassault Systems), as described in the README file in the subdirectory 'src/umat'.

Contributions

Contributions to the pyLabFEA package are highly welcome, either in form of new notebooks with application examples or tutorials, or in form of new functionalities to the Python code. Furthermore, bug reports or any comments on possible improvements of the code or its documentation are greatly appreciated.

Dependencies

pyLabFEA requires the following packages as imports:

Version history

  • v1: 2D finite element solver for pricipal stresses only
  • v2: Introduction of machine learning (ML) yield functions
  • v3: Generalization of finite element solver and training of ML yield functions to full stress tensors
  • v4: Import and analysis of microstructure-sensitive data on mechanical behavior for training and testing of ML yield functions
  • v4.2: Support of strain hardening in machine learning yield functions
  • v4.3: Import of data on mechanical behavior following the modular material data schema as basis for training of machine learning yield functions
  • v4.4: Support of data with crystallographic texture information

License

The pyLabFEA package comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under the conditions of the GNU General Public License (GPLv3)

The contents of examples, notebooks and documentation are published under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License (CC BY-NC-SA 4.0 DEED)

© 2025 by Authors, ICAMS/Ruhr University Bochum, Germany

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

pylabfea-4.4.2.tar.gz (100.4 kB view details)

Uploaded Source

Built Distribution

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

pylabfea-4.4.2-py3-none-any.whl (96.1 kB view details)

Uploaded Python 3

File details

Details for the file pylabfea-4.4.2.tar.gz.

File metadata

  • Download URL: pylabfea-4.4.2.tar.gz
  • Upload date:
  • Size: 100.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for pylabfea-4.4.2.tar.gz
Algorithm Hash digest
SHA256 73a1368c1d1ccfc24eff02d16f714eda0b9f31045a7fa3aaf997ac703b5a6e70
MD5 257582c5e36c2d6a36c97247ee0d9ae9
BLAKE2b-256 495d23f63a098d27403ec5f9caee51033a4c8c5d536e81e3792650e9b3149fe3

See more details on using hashes here.

File details

Details for the file pylabfea-4.4.2-py3-none-any.whl.

File metadata

  • Download URL: pylabfea-4.4.2-py3-none-any.whl
  • Upload date:
  • Size: 96.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for pylabfea-4.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 af3d7b0f5a7fe6d973668e3a640318fc214d85488b1a8aed6c28d8967ff2752b
MD5 e819b31440ffcdc76366ef284a9a53f1
BLAKE2b-256 3ba3ca8928e408e93cf0506c651030579358420505bbb0142a3b73b48a5e4dd7

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