The software package FEATFLOW2
The software package FEATFLOW2 is the successor of the original software package FEATFLOW. Based on the techniques and ideas of the original package, this finite element library exploits all possibilities of the Fortran 90 language to perform highly efficient finite element calculations, while still being flexible enough to be used for academic purposes.
Some of the main highlights read as follows:
- Based on the Fortran 90/95 programming language standard. No more 6-letters variables and subroutine names.
- Fully documented source code.
- Automated build system based on shell and perl scripts. Auto tuning of the code to the current processor, compiler, etc., for most up-to-date computer systems like
- Sun solaris
- Mac OSX
- Simple extension of the makefile system to new processors and compiler settings.
- Multiple compiler configurations can be maintained simultaneously (e.g. precompiled libraries for debug and release mode).
- Preprocessor support.
- Support for Cygwin/Windows via GFortran
- Support for native Windows. Project files for Visual Studio + Intel Fortran.
- Basic support for OpenMP.
- Basic support for CUDA (in development).
- Support for ParaView output files for postprocessing.
- Support for h-adaptivity.
- Highly advanced numerical solver algorithms like geometrical multigrid.
Example applications already realized with this code or in development:
- Standard examples (Poisson, heat equation, laminar Stokes, Navier-Stokes,...)
- Allen-Cahn equations (not in the package)
- Linear elasticity (not in the package)
- Particulate flow (not in the package)
- Shallow water (not in the package)
- Compressible (M)HD (not in the package)
- Optimal Control of the Poisson equation, heat equation, Navier-Stokes equations (not in the package)
The package is under heavy development and is therefore labeled as BETA software. Any user who likes to download and test the software is welcome, but we remark that we can only give very limited support for this project.
The following prerequisites are necessary to download and compile the software:
- An SVN client (e.g., TortoiseSVN in Windows)
- A Fortran 90 compiler (e.g., gfortran, Intel Fortran compiler or similar)
- Linux, Unix, MacOS (with GCC + GFortran + wget + perl), Windows (with Cygwin and Fortran compiler + wget + make + perl) or Windows with Visual Studio and Intel Fortran compiler
- An internet connection
- 500 MB disc space (depending on the configuration)
- ParaView for postprocessing of VTK files
We decided to mirror our own SVN repository to a SVN repository on Sourceforge. The main repository can be found on the following link:
For a simple checkout, if you use Linux/Unix, enter the following command:
svn co http://svn.code.sf.net/p/featflow2/code/Featflow2
In Windows, you can use, e.g., TortoiseSVN to check out the code.
The package is organized in the following directories:
- Contains the main applications like a poisson example, a heat equation example, cc2d for laminar Stokes/Navier-Stokes in 2D and others)
- Here you can put your own applications. Just copy one of the main examples from the applications/ folder to this folder and change as you like.
- This directory contains a benchmark system we use for regression tests and for massive computations on cluster systems.
- Basic shell scripts and makefile system
- The basic FEATFLOW2 kernel with all mathematical basics (Finite element spaces, linear solvers, etc.)
- Contains the basic libraries in a compressed form or download routines for these (as we are not allowed to distribute the source of all libraries with our package). The makefile system will automatically download these libraries via an existing Internet connection in Linux/Unix.
- Template scripts for different architectures for the creation of makefiles.
- Auxiliary programs (e.g., creation of EPS files from meshes)
- A set of tutorials, in correspondence to this Website
The makefile system in Linux/Unix
As an example application, we show here how to compile the poisson example under a Linux/gcc/gfortran based system. Proceed as follows:
1.) Switch to applications/poisson
2.) Create a makefile script via a configure command. This will look at your system, detect your CPU and your compiler settings:
Note: This is not the usual "configure" command which is provided by many Linux software packages. We wrote this configure on our own. It is a specialized shell/perl script and creates you a makefile "GNUmakefile".
3.) Compile the application
Note: During the first build, the makefile system will automatically download some basic libraries from the internet, untar/unzip the libraries and compile them (e.g., AMD, UMFPACK, LAPACK).
4.) Run the application
5.) Start paraview and open one of the VTK files in the gmv/ subdirectory. These files were produced by the application and represent the solution of a poisson equation on the unit square.
You can configure the makefile system in various ways. This can be done by passing appropriate parameters to the ./configure command. Here some examples:
Print all parameters.
./configure --no-opt --debug
Configures the makefile to not use optimization and to generate debug symbols.
Print all configuration IDs which are valid vor this system. Every ID stands for one compiler setting.
Configure the makefile to use a special compiler setting. The ID "..." can be one of the IDs you got with the "--list-ids" parameter.
--list-idsmay output you
Valid build IDs (for pc64-opteron6100-linux hosts) match against the following regular expressions: ... (pc|pc64)-.*-.*-g95-.* (pc|pc64)-.*-.*-gcc-.* (pc|pc64)-.*-.*-intel-.* ... Use any of these build IDs as argument for the --id option. The current build ID for nightwish is: pc64-opteron6100-linux-gcc-blas
Then you can enforce the use of the intel compiler by forcing the build id which stands for the intel compiler by replacing "gcc" by "intel":
Note that you can have multiple IDs precompiled simultaneously. You can switch between two IDs by using
./configure --id=... followed by a
Furthermore, the make process itself can be influenced by various parameters, e.g.,
Print all parameters.
Delete all object files and force a complete rebuild with the next "make" for the current build id.
VERY VERY HELPFUL, TO BE DONE AT FIRST IF YOUR COMPILER DOES NOT WANT TO COMPILE THE CODE AFTER AN UPDATE!!!
Show the current compiler settings
Delete all object files for all IDs. That way, you do a complete tabula-rasa...
Customizing the makefiles
If you want to customize the makefiles to a system which is not yet supported, you have to modify the compiler files as follows:
If you have a complete new CPU, modify
bin/guess_idwhich detects the CPU to generate a basic build ID.
To define the default ID for a specific architecture, modify
./Makefile.buildID.inc. For every architecture ID created by
guess_id, this appends a default configuration string to get the actual build ID.
To define the actual compiler settings, modify the file
Makefile.cpu.inc. For every possible compiler ID, there is a block in this file which defines the actual compiler.
Each such a block defines the compiler settings based on a template makefile in the
templates/directory. If no template makefile suites to your needs, create one based on one of the templates and include it in the compiler block you want to add
Compiling applications with CYGWIN in Windows
Compiling applications using the CYGWIN environment is basically the same as using a Unix/Linux system, see above. However, one has to take care that a couple of additional tools are installed using the SETUP of CYGWIN. The following tools have to be installed:
- Devel / GCC4-GFORTRAN
- Devel / GCC4-G++
- Devel / MAKE
- Interpreters / Perl
- Web / WGET
and all their dependencies (which are detected automatically by the CYGWIN setup).
Compiling applications in native Windows
With the appropriate tools, Featflow 2 can be compiled natively in a Windows environment. However, there is a bit preparation necessary, as some libraries have to be compiled in advance. The process is done automatically as far as possible.
The following tools are necessary:
- Visual Studio 2010 or higher
- Intel Fortran Compiler 12 or higher
For downloading of the SVN repository, a SVN implementation is needed, e.g. TortoiseSVN. After the checkout has been completed, the following scripts have to be executed manually (e.g. with a double-click):
- Downloads external libraries from the internet and extracts the sourcefiles on the local hard disc.
- Invokes the Visual Studio compiler and pre-compiles all libraries as well as the Featflow-2 kernel. Compiler detection and compilation should be done automatically and will take a while.
buildlibs_win32.cmd compiles the libraries using a 32 bit compiler, while
buildlibs_win64.cmd applies a 64 bit compiler for the compilation. You should compile the version which you plan to use later.
Afterwards, one can find appropriate
.sln project files in every project directory, which can be opened with Visual Studio. For example, there is a file
applications/poisson/poisson.sln which defines the complete project settings for the Poisson equation. Open the
.sln file of your choice. Afterwards, you have the choice between four targets: Debug/Release in 32 or 64 bit mode. Choose a target which fits to the libraries compiled in the previous step, then you can compile and run the project.
Remark: Currently, there are still some project files in the directory
winXXXX of every application. These directories contain project files for Visual Studio 2003 and are deprecated. They will be removed in future.