GithubHelp home page GithubHelp logo

asclepiusinformatica / amfe Goto Github PK

View Code? Open in Web Editor NEW

This project forked from appliedmechanics/amfe

0.0 0.0 0.0 20.8 MB

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

License: Other

Python 93.05% Fortran 3.99% Tcl 0.44% GLSL 2.53%

amfe's Introduction

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

(c) 2020 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 Master: coverage report

Pipeline Status: pipeline status

Wheel built for latest release (stable): AMfe_linux_x86_64.whl

Latest developer version (beta): AMfe_linux_x86_64.whl

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

Development Version

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.

The following packages should be installed for a development version via conda install command:

  • Python version 3.7 or higher
  • numpy, scipy, pandas, h5py, matplotlib, vtk==8.1.2, pytables, mkl
  • 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, coverage
  • 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.7).

For getting the package type

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

in your console. Git will clone the repository into the current folder. For installing the package in development mode run

cd AMfe
conda create --name <environment-name-of-choice> python=3.7
conda activate <environment-name-of-choice> 
python conda_setup.py
python setup.py develop [no_fortran]

in the main folder. The conda_setup.py file installs the dependencies via conda. It is recommended to install the dependencies with conda because setup.py can only install them via pip which can lead to an unclean conda environment.

The python setup.py develop command builds the fortran routines and installs 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_develop.py develop no_fortran

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

Production version

If you do not develop AMfe you can install AMfe with conda dependencies via

cd AMfe
conda create --name <environment-name-of-choice> python=3.7
conda activate <environment-name-of-choice> 
python conda_setup.py
python setup.py install [no_fortran]

If you like to use pip for your installation the easiest installation is to download the latest wheel file AMfe_linux_x86_64.whl and run

pip install AMfe_linux_x86_64.whl

Documentation

The documentation of the latest master version can be found at https://am.pages.gitlab.lrz.de/AMfe/

The documentation can also be built from source by going into the folder docs/ and running

make html

The documentation will be built in the folder docs/ available as html in _build. If the command above does not work, try to run 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++.

amfe's People

Contributors

agent18 avatar amandinedesj avatar aseibold avatar c-meyer avatar christopherlerch avatar johannesmaierhofer avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.