dmitryikh / nla3d

2D/3D finite element programming framework
MIT License
29 stars 11 forks source link

nla3d

Build Status Build status

Introduction

nla3d (Non-Linear Analysis 3D) - is a program to solve mechanics non-linear finite element (FE) problems. Or, better to say, it a set of procedures (framework) that make it easy to implement new FE, material model, constraint, solution scheme, post-processing and etc. It's written in C++ language massively using classes. Then many low-level details are hidden from "end-user". This program is a good opportunity for students and researchers to implement their own FE code based on nla3d framework. The nla3d code has been developing since 2011 year. First steps were made by the author as a part of a course work. The name of the program was nla, because it was capable to solve only 2D axisymmetric problems with Neo-Hookean hyperelastic material. Then the program was improved for solving 3D problems in 2012 as a part of graduation work of the author. At those time it was renamed to nla3d.

Development of nla3d has next goals:

Currently, nla3d has next features under the hood:

What nla3d can't do:

Gallery

2D Transient Thermal 3D Large Strain Quasi-Static
Thermal transient 3D large strain hyperelasticity
see test/QUADTH/.. for details see `test/3d_damper/.. for details

Requirements

nla3d is written in C++ language. It uses C++11 standart in the code. It is compiled ok with clang, GNU g++, Visual Studio 2015 compilers. This is checked by Travis and Appveyor CI services (see badges on the top of this page).

nla3d uses CMake to deploy project files from the source code. CMake produces Visual Studio projects under Windows and make files under linux-based OS. One can find more information about how to compile nla3d using CMake in the section Compilation.

nla3d uses several external libraries:

Compiling

To compile nla3d first of all you need an environment and tools desribed in Requirements chapter. Here is an example how to do it under linux-based OS. Firs of all we need to clone current project and fetch all submodules:

git clone https://github.com/dmitryikh/nla3d
cd nla3d
git submodule update --init

Then you can deploy makefiles dy calling cmake program:

mkdir build
cd build
cmake ..

One will see the output like this:

...
-- Found MKL: /opt/intel  
-- Found EASYLOGGINGPP: /Users/foo/code/nla3d/site-src/easyloggingpp/src  
-- Found Eigen: /Users/foo/code/nla3d/site-src/eigen  
-- Configuring done
-- Generating done
...

That means that everything is ok with configuring. If cmake wasn't successed to find were are some dependencies are, you need to fix manually. The best way is to use cmake curses interface ccmake and provide missing pathes manually:

ccmake .

Then one can just launch the compilation:

cmake --build . --config Release

And after launch the functional tests:

ctest . --C Release -L FUNC

If all test pass ok, in this case here is fully worked nla3d binaries!

Compiling options

Here are some nla3d specific options that can affect on result binaries. This options are defined in nla3d/CMakeLists.txt:

nla3d by default use math::GaussDenseEquationSolver to solve a system of linear equations. This is very simple method named Gaussian Elimination with partial pivoting. It works fine for small systems but when you need to solve some large FE system your should use other math::EquationSolver. The best candidate for now is math::PARDISO_equationSolver. It uses MKL's PARDISO(...) subroutines to solve large scale sparce linear equations systems. Hence, if you have MKL dev libraries installed on your side you can -DNLA3d_USE_MKL=ON to build with MKL support. Once you did this nla3d.exe will use math::PARDISO_equationSolver.

Use -DNLA3D_PYTHON=ON with cmake to make python bindings, there will be nla3d_py and checkpy for building bindings and run tests.

Writing new finite element

Here is a try to help someone to get familiar with nla3d. In this chapter a pretty easy 3D truss finite element is described and is incorporated into nla3d library and then an excecutable program is shown. 3D truss is a finite element with two spatial nodes connected with a line, this line can be subjected only with compression or tension loads. The line has a few properties: cross-section area, Young's module (stiffness of the material).

The implementation of a such FE one can find in src/lib/elements/TRUSS3.h and src/lib/elements/TRUSS3.cpp.

Then ElementTRUSS3 is used to solve a very simple 2D problem described in src/main_truss.cpp.

All this sources are massively commented to make it clear how to use it and how to implement new FE into nla3d.

Python bindings

nla3d can be built with python bindings. Most of features are already available from python. See Compiling options above for details of compilation. You can found examples of nla3d usage with python in test/*.py scripts.

Contacts

In case if you are interested in the project or if you have questions, please contact with me by email: khdmitryi at gmail.com