Skip to content

Nonlinear Finite Element Code for structural applications with simplicity in mind.

License

Notifications You must be signed in to change notification settings

vijaypolimeru/AMfe

 
 

Repository files navigation

AMfe - Finite Element Research Code at the Chair of Applied Mechanics

(c) 2018 Lehrstuhl für Angewandte Mechanik, Technische Universität München

This Finite Element Research code is developed, maintained and used by a part of the numerics group of AM.

Coverage Report for Refactoring 2018: coverage report

Pipeline Status: pipeline status

Important Info: The project has been moved recently. So please update your remote via:

git remote set-url origin https://gitlab.lrz.de/AM/AMfe.git

Overview:

  1. Installation
  2. Documentation
  3. Workflow
  4. Hints

Installation of AMfe

Before installing the AMfe package, check, if the latest python version and all necessary modules are installed. For managing the python packages, the Python distribution Anaconda is highly recommended. It has a very easy and effective packaging system and can thus handle all Python sources needed for this project. For installation and usage of Anaconda checkout http://docs.continuum.io/anaconda/install#anaconda-install.

  • Python version 3.6 or higher
  • numpy, scipy, pandas, h5py, matplotlib, dill
  • for fast fortran execution a running fortran compiler (e.g. gcc and gfortran)
  • for building the documentation sphinx, numpydoc, sphinx_rtd_theme
  • for testing nose
  • for checking the code readability: pylint

I recommend to create a separate environment in anaconda for your amfe installation. Then you later have the opportunity to create a new environment for other projects that can have different requirements (such as python 2.7 instead 3.6).

For getting the package type

git clone https://gitlab.lrz.de/AMCode/AMfe.git

in your console. Git will clone the repository into the current folder. For installing the package type

python setup.py develop

in the main folder. This should build the fortran routines and install the python module in-place, i.e. when you do changes to the source code they will be used the next time the module is loaded.

If you do not want to install the FORTRAN-routines, you can add the flag no_fortran to your installation command:

python setup.py develop no_fortran

If no FORTRAN-compile is found, the installation will work only with the no_fortran-flag.

There is also the option to use the domain decomposition solver library PYFETI. As this is very experimental, one can switch it off by adding the no_feti-flag:

python setup.py develop no_feti

Of course this can be combined with the no_fortran-flag:

python setup.py develop no_fortran no_feti

Documentation

Further documentation to this code is in the folder docs/. For building the documentation, go to the docs/ folder and type

make html

The documentation will be built in the folder docs/ available as html in _build. If the command above does not work, the execution of python setup.py build_sphinx in the main-folder also builds the documentation.

Workflow for Pre- and Postprocessing

Preprocessing and postprocessing is not part of the code AMfe, but the open source tools gmsh and Paraview are recommended:

  • gmsh The open-source meshing tool can create unstructured meshes for 2D and 3D geometries. The geometry can either be built inside the tool or outside in a CAD program with the .stp-file imported into gmsh. In order to define volumes for materials or points/lines/surfaces for boundaries, physical groups must be assigned in gmsh.
  • ParaView With ParaView the results can be analyzed. For showing the displacements, usually it is very handy to apply the Warp By Vector filter to see the displaced configuration.

AMfe provides a Mesh-Exporter for the Preprocessor GiD. This preprocessor can be downloaded as community edition or can be accessed at our chair. See the AM Wiki for more information how to access the professional edition at our chair.

Hints

Python and the Scientific Ecosystem

Though Python is a general purpose programming language, it provides a great ecosystem for scientific computing. As resources to learn both, Python as a language and the scientific Python ecosystem, the following resources are recommended to become familiar with them. As these topics are interesting for many people on the globe, lots of resources can be found in the internet.

Python language:
Scientific Python Stack (numpy, scipy, matplotlib):
Version Control with git:
gmsh:

IDEs:

A good IDE to start with is Spyder, which has sort of a MATLAB-Style look and feel. It is part of anaconda ans provides nice features like built-in debugging, static code analysis with pylint and a profiling tool to measure the performance of the code.

Other editors integrate very well into Python like Atom.

I personally work with PyCharm, which is an IDE for Python. However as it provides many functions one could be overwhelmed by it at first.


Hint

On Mac OS X Spyder 2 may run very slow, as there are some issues with the graphical frontent library, pyqt4. These issues are resolved on Spyder 3 by using pyqt5, which can already be installed on anaconda as beta version resolving all these issues. To install Spyder 3, use either

conda update qt pyqt
conda install -c qttesting qt pyqt
conda install -c spyder-ide spyder==3.0.0b6

or (which worked better for me)

pip install --pre -U spyder

Profiling the code

a good profiling tool is the cProfile module. It runs with

python -m cProfile -o stats.dat myscript.py

The stats.dat file can be analyzed using the snakeviz-tool which is a Python tool which is available via conda or pip and runs with a web-based interface. To start run

snakeviz stats.dat

in your console.

Theory of Finite Elements

The theory for finite elements is very well developed, though the knowledge is quite fragmented. When it comes to element technology for instance, good benchmarks and guidelines are often missed. A good guideline is the Documentation of the CalculiX-Software-Package which covers a lot about element technology, that is also used in AMfe. CalculiX is also an OpenSource Finite Element software written in FORTRAN an C++.

About

Nonlinear Finite Element Code for structural applications with simplicity in mind.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 92.3%
  • Fortran 4.4%
  • GLSL 2.8%
  • Other 0.5%