Talk Introduction to LibAster for thermomechanical simulation

Abstract

Description

LibAster is an open source python library for solving structural and thermomechanical problems using the finite element method. It is based on Code_Aster, a high-performance solver distributed under the GNU Public License version 2 by EDF R&D.

LibAster aims to be a python library based on FORTRAN routines. The Thermomechanical studies are described by python scripts using numpy/scipy combined with Code_Aster commands.

LibAster passes over 99% of Code_Aster's 2200 test-cases. LibAster is based on the latest stable version, STA10.3, and will keep up with future releases. LibAster is a friendly fork to Code_Aster that differs by using standard tools to compile (waf), track changes (mercurial), tests/study runner (stand-alone script), etc.

Usage and study description

LibAster aims to be a python library based on FORTRAN routines. The Thermomechanical studies are described into python scripts using numpy/scipy combined with Code_Aster commands. Running a study can be done by passing a Code_Aster command files directly to the python interpreter.

Here is a very simple example that update the Aster catalog:

$ ls
fort.4 update_catalog.py
$ cat update_catalog.py
from libaster import run_study as RS
RS.define_study(input_files='cataelem.4:4')
DEBUT(CATALOGUE=_F(FICHIER='CATAELEM', UNITE=4))
MAJ_CATA ( ELEMENT = _F())
FIN()
$ ASTER_ROOT_DIR=$PWD/build python build_cata.py
[...]

LibAster run Code_Aster comm file:

$ bin/run_study --med-file=forma01a.mmed forma01a.comm

Add a few lines at the begging of any Code_Aster comm file to convert it into simple python file:

$ python forma01a.py && echo 'ok'
ok
diff forma01a.diff forma01a.py
--- forma01a.comm 2011-02-25 15:51:14.822934097 +0100
+++ forma01a.py   2011-03-03 15:37:27.950937598 +0100
@@ -1,5 +1,8 @@
+from libaster import run_study as RS
+RS.define_study(input_med="forma01a.mmed",
+                output_files="forma01a.rmed:80")
 DEBUT(CODE=_F(NOM='FORMA01A',NIV_PUB_WEB='INTERNET'),DEBUG=_F(SDVERI='OUI'))
 # TITRE TRAVAUX PRATIQUES FORMATION DE BASEi

Tools used

Libaster source code is under the Mercurial version-control system. LibAster is free software and the source code can be downloaded using the python-science.org repositories:

$ hg clone https://hg.python-science.org/libaster/src

LibAster uses a new python based advanced build system (waf) for configuring and compiling the application. This allows very easy and fast build task:

$ ./waf configure build -j6 -p
Setting top to                           : /home/dede/libaster
Setting out to                           : /home/dede/libaster/build
Checking for 'gcc' (c compiler)          : ok
Checking for 'gfortran' (fortran compiler) : ok
Checking for program python                : /usr/bin/python
Checking for python version                : 2.6.6
Checking for library python2.6             : yes
Checking for program python2.6-config      : /usr/bin/python2.6-config
Checking for header Python.h               : yes'configure' finished successfully (0.666s)
Waf: Entering directory `/home/dede/libaster/build'
[8905/8905][100%][|][===============================================> [5m10.085s]

It is highly customizable:

  • enable/disable features (example: MED, scotch, mumps, petsc supports)
  • define specific libaries (example: laplace, blas, gotoblas, blacs, mpi, openmpi)
  • use specific compiler (example: ifort, gfortran, gcc)
  • define compilation flags
  • build with static/shared libraries
  • build with parallelization support
  • and more
Attachments
tagged by
no related entity