Skip to content

XingWJin/FEM_PYTHON

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

152 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SolidsPy: 2D-Finite Element Analysis with Python

Wrench under bending.

This repo contains a simple finite element analysis code for 2D elasticity problems. The code uses as input data simple-to-create text files containing nodal, element, material and load data.

The repo contains 3 main folders:

  1. solidspy/ stores the package routines:

    • solids_GUI.py: run the program;
    • preprocesor.py model input subroutines);
    • assemutil.py (assembly subroutines);
    • femutil.py (general finite element method subroutines);
    • uelutil.py (local matrix subroutines for different elements; and
    • postprocesor.py (results handling subroutines)
  2. meshes/ contains input files and meshes in .msh format corresponding to different examples.

  3. docs/ contains the documentation files.

  4. examples/ contains some examples of the use of the package.

  5. tests/ contains unit testing.

Authors

Installation

The code is written in Python and it depends on numpy, scipy and sympy.

To run the examples with GUI input you will need to install easygui. And, you will need meshio to automatically read Gmsh mesh files. These two can be installed with

pip install easygui
pip install meshio

To install SolidsPy use

pip install solidspy

Run a simple model

After installation, you can run an analysis in 3 easy steps (see template):

  • Create the mesh using Gmsh.
  • Generate the model files (eles.txt, nodes.txt, mater.txt and loads.txt) using a python script with the aid of meshio.
  • Run it in Python
import matplotlib.pyplot as plt  # load matplotlib
from solidspy import solids_GUI  # import our package
solids_GUI()  # run the Finite Element Analysis
plt.show()    # plot contours

License

This project is licensed under the MIT license. The documents are licensed under Creative Commons Attribution License.

Since this project is used to teach Finite Element Methods and Computational Mechanics, we have included some examples and documents and code snippets developed by students. Their license is specified in each particular directory.

About

2D-Finite Element Analysis with Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 93.9%
  • GLSL 6.1%