Commit 245b1731 authored by Rémy Mozul's avatar Rémy Mozul

user 2017.rc1

parent c1e1eb32
......@@ -16,12 +16,30 @@ include(OutOfSourcesBuild)
project(LMGC90_dev Fortran C CXX)
SET(LMGC90_MAJOR_VERSION 2)
SET(LMGC90_MAJOR_VERSION 3)
SET(LMGC90_MINOR_VERSION 0)
SET(LMGC90_PATCH_VERSION 0)
MESSAGE(STATUS "You try to build LMGC90_dev")
# Try to find out if on ubuntu
# (does nothing if lsb_release executable does not exist)
find_program(LSB_RELEASE lsb_release)
execute_process(COMMAND ${LSB_RELEASE} -is
OUTPUT_VARIABLE LSB_RELEASE_ID_SHORT
OUTPUT_STRIP_TRAILING_WHITESPACE
)
#message(STATUS "lsb_release : ${LSB_RELEASE_ID_SHORT}")
# Get current year to help set version
include(GetCurrentYear)
TODAY(TODAY YEAR)
# Set release candidate number (used in sphinx doc)
set(RC 1)
if( RC )
set(RCWITHDOT ".rc${RC}")
endif( RC )
include(CTest)
......
......@@ -17,345 +17,9 @@ To stay aware, you can subscribe to this mailing list by asking to:
- Dubois Frédéric : frederic.dubois@umontpellier.fr
- Rémy Mozul : remy.mozul@umontpellier.fr
# Organization
# How does it work
*lmgc90_user* directory is organized in several
subdirectories:
To obtain up to date informations on how to download/install/use, please check the
[wiki](https://git-xen.lmgc.univ-montp2.fr/lmgc90/lmgc90_user/wikis/home#how-does-it-work)
* *src* : the sources of LMGC90 software
* *examples* : the user examples working with the sources
* *manuals* : a list of manuals/documentation for the software in pdf format
* *docs* : the html documentation generated from the sources
The software is originally designed for [Linux or MacOS](#linversion)
For Windows user, jump to [Windows Version section](#winversion)
# <a name="linversion"> Linux and MacOS version </a>
# Versionning
People contributing to the project can view up-to-date information
[here](https://git-xen.lmgc.univ-montp2.fr/lmgc90/lmgc90_user/tree/master)
The versionning tool used is git. To have more information the workflow used
and how to use git check [there](https://git-xen.lmgc.univ-montp2.fr/lmgc90/lmgc90_user/wikis/LMGC90_user)
With MacOS and Linux the installation and use of LMGC90 software is through
the use of the terminal. You must know how to open a terminal in a specific
directory and move through your directory tree.
## Update
To update to very last version from a terminal in current directory:
```
$> git pull origin master
```
To get as specific version, for example *2016* :
```
$> git pull origin 2016
```
## Compilation
### Pre-requisites
To compile you need:
* A Fortran compiler (GNU, Intel or PGI)
* Lapack library
* CMake
* Swig
* Python and Numpy
For visualisation:
* Python VTK module
* Paraview
To build the sphinx documentation:
* Latex distribution (with pdflatex utility)
* Sphinx and numpydoc
* Doxygen
* Graphviz
* dvipng
To read some tutorials:
* Jupyter
* iPython
### Ubuntu 12.04/14.04/16.04 Debian 7
To compile:
```
apt-get install cmake gcc g++ gfortran liblapack-dev swig python-dev python-numpy
```
To visualize:
```
apt-get install python-vtk paraview
```
To build the documentation:
```
apt-get install doxygen graphviz python-numpydoc texlive-latex-extra dvipng imagemagick
```
To read tutorials
```
apt-get install python-pip
pip install jupyter
```
### OpenSuse Leap 42.1
To compile:
```
zypper install cmake gcc gcc-c++ gcc-fortran lapack-devel swig python-devel python-numpy-devel
```
To visualize:
```
zypper install python-vtk paraview
```
Due to some problem one must add to the *.bashrc* file a line similar to:
```
export LD_LIBRARY_PATH=/usr/lib64/mpi/gcc/openmpi/lib64
```
To build the documentation:
```
zypper install doxygen graphviz python-numpydoc texlive-dvipng ImageMagick
```
To read tutorials
```
zypper install python-pip
pip install jupyter
```
### CentOS 7
To compile:
```
yum install git cmake gcc gcc-c++ gcc-gfortran lapack-devel swig python-devel numpy
```
To visualize, some extra packages, not provided by the standard package repository, are
needed. Thus an extra repository must be added before installing the dependencies:
```
yum install epel-release
yum install vtk-python paraview
```
To build the documentation:
```
yum install doxygen graphviz tex-preview textlive-latex texlive-dvipng python-sphinx python-numpydoc ImageMagick
```
To read tutorials
```
yum install python-pip
pip install jupyter
```
### Mac OS
On MacOs using macports (beware of the second line, the *+ python27* goes with *vtk*):
```
port install gcc49 python27 py27-numpy swig-python cmake +gui
port install vtk +python27
```
Then you need to set the compiler and python as the default on your system:
```
sudo port select gcc mp-gcc49
sudo port select python python27
```
To build the documentation:
```
doxygen graphviz py27-sphinx py27-numpydoc texlive-latex-extra dvipng ImageMagick
```
To read tutorials:
```
sudo port install py27-jupyter
```
## Building
You have several commands to run. If you are not familiar with the terminal and compilation in general
please read the output of each command carefully. And if an error occurs do not blindly run the next
commands, but try to correct it first.
In the *lmgc90_user* directory run:
```shell
mkdir build
cd build
cmake ..
make
```
Instead of cmake, one can use *ccmake* to change variable values on
the command line, or *cmake-gui* to use graphical interface.
If you are only interested in rigid computations, some external libraries
can be disabled ; before the ```make``` command, run:
```
cmake . -DMATLIB_VERSION=none -DMUMPS_VERSION=none
```
If you want to re-build the documentation run :
```
make docs
```
It will build the sphinx documentation in:
* docs/chipy/
* docs/dev/
* docs/Pre/
Where you should open the ```index.html``` file.
The doxygen documentation of the the core of the software would be in ```src/Docs/html/index.html```.
## Installing
Our policy is to not mess with default system paths. So instead we advise to
use a environment variable to add to python the path to our build directory.
In general adding the following lines to your *.bashrc* (Linux) or *.profile* (MacOS)
file does the trick. Of course you have to replace *mybuildpath* by the path to
your own building directory. Basically it is what returns the command *pwd* when
ran in the same directory you ran the commands *cmake* and *make*.
```shell
if [ -z ${PYTHONPATH} ]; then
export PYTHONPATH=mybuildpath
else
export PYTHONPATH=${PYTHONPATH}:mybuildpath
fi
```
## Getting started
There are several examples in the directory *examples*
sorted by the type of simulation.
A good entry point is the *Tutorials* directory where you
can find some **ipython notebooks** trying to introduce
step by step the use of the software.
### Linux
To read the notebooks, open a terminal there and run:
```shell
jupyter notebook
```
### MacOS
To read the notebooks, open a terminal there and run:
```shell
jupyter-notebook-2.7
```
Python being the interface language to the LMGC90 software,
[this introduction](https://www.python.org/about/gettingstarted/)
is recommended for those unfamiliar with the language or programming
in general.
# <a name=winversion> Windows version </a>
## Prerequisite
The only pre-requisite to use LMGC90 on Windows is the Python distribution used.
A binary build is provided to work with the Anaconda python distribution
which can be downloaded from here:
* [32 bits](https://repo.continuum.io/archive/.winzip/Anaconda2-2.5.0-Windows-x86.zip)
* [64 bits](https://repo.continuum.io/archive/.winzip/Anaconda2-2.5.0-Windows-x86.zip)
Once the file downloaded, unzip it and run the installer.
To generate visualization files the **vtk** python module must be added. To do that
launch the `Anaconda Prompt` software and type:
```shell
conda install vtk
```
To visualize the files the [Paraview](http://www.paraview.org/download) software
is also needed.
## Getting the pre-compiled version
Download the pre-compiled version of LMGC90 for Windows:
* [32 bits](https://mycore.core-cloud.net/public.php?service=files&t=9bb2e3561373c64a4855596873aa98bd)
* [64 bits](https://mycore.core-cloud.net/public.php?service=files&t=9525fc1c270aaddf7e8eae96214f4b49)
Then create a directory *build* in your *lmgc90_user* directory and unzip
the download file there, it should create a `pylmgc90-xxxx-py27` (where `xxxx`
is to replaced by `i686` if you download the 32 bits version or `x86_64` if you
downloaded the 64 bits version).
## Installation
Start `Spyder` then click on the upper line `tools` and `PYTHONPATH manager`.
Then click `Add a path` on lower left corner and select the path to the directory
previously unzipped (that is in this README: *lmgc90_user/build/pylmgc90-xxxx-py27*).
Finally, so that the previous step is taken into account in your current
environment, you have to open a new console by clicking `Console` and then
`Open a new IPython console`.
## Getting started
There are several examples in the directory *examples*
sorted by the type of simulation.
A good entry point is the *Tutorials* directory where you
can find some **ipython notebooks** trying to introduce
step by step the use of the software.
To read the notebook run the `Jupyter Notebook` application
installed with Anaconda.
Python being the interface language to the LMGC90 software,
[this introduction](https://www.python.org/about/gettingstarted/)
is recommended for those unfamiliar with the language or programming
in general.
# importing chipy module
from pylmgc90 import chipy
# Initializing
chipy.Initialize()
# checking/creating mandatory subfolders
chipy.checkDirectories()
# logMes
# chipy.utilities_DisableLogMes()
#
# defining some variables
#
# space dimension
dim = 3
# modeling hypothesis ( 1 = plain strain, 2 = plain stress, 3 = axi-symmetry)
mhyp = 0
# time evolution parameters
dt = 1e-2
nb_steps = 500
# theta integrator parameter
theta = 0.5
# deformable yes=1, no=0
deformable = 0
# interaction parameters
freq_detect = 1
Rloc_tol = 5.e-2
# nlgs parameters
tol = 1.666e-4
relax = 1.0
norm = 'Quad '
gs_it1 = 50
gs_it2 = 1000
solver_type='Stored_Delassus_Loops '
# write parameter
freq_write = 1
# display parameters
freq_display = 1
ref_radius = 1.e-1
#
# read and load
#
# Set space dimension
chipy.SetDimension(dim,mhyp)
#
chipy.utilities_logMes('INIT TIME STEPPING')
chipy.TimeEvolution_SetTimeStep(dt)
chipy.Integrator_InitTheta(theta)
#
chipy.utilities_logMes('READ BEHAVIOURS')
chipy.ReadBehaviours()
if deformable: chipy.ReadModels()
#
chipy.utilities_logMes('READ BODIES')
chipy.ReadBodies()
#
chipy.utilities_logMes('LOAD BEHAVIOURS')
chipy.LoadBehaviours()
if deformable: chipy.LoadModels()
#
chipy.utilities_logMes('READ INI DOF')
chipy.ReadIniDof()
#
if deformable:
chipy.utilities_logMes('READ INI GPV')
chipy.ReadIniGPV()
#
chipy.utilities_logMes('READ DRIVEN DOF')
chipy.ReadDrivenDof()
#
chipy.utilities_logMes('LOAD TACTORS')
chipy.LoadTactors()
#
chipy.utilities_logMes('READ INI Vloc Rloc')
chipy.ReadIniVlocRloc()
#
# paranoid writes
#
chipy.utilities_logMes('WRITE BODIES')
chipy.WriteBodies()
chipy.utilities_logMes('WRITE BEHAVIOURS')
chipy.WriteBehaviours()
chipy.utilities_logMes('WRITE DRIVEN DOF')
chipy.WriteDrivenDof()
#
# open display & postpro
#
chipy.utilities_logMes('DISPLAY & WRITE')
chipy.OpenDisplayFiles()
chipy.OpenPostproFiles()
#
# simulation part ...
#
# ... calls a simulation time loop
# since constant compute elementary mass once
chipy.utilities_logMes('COMPUTE MASS')
chipy.ComputeMass()
for k in xrange(0,nb_steps):
#
chipy.utilities_logMes('INCREMENT STEP')
chipy.IncrementStep()
chipy.utilities_logMes('COMPUTE Fext')
chipy.ComputeFext()
chipy.utilities_logMes('COMPUTE Fint')
chipy.ComputeBulk()
chipy.utilities_logMes('COMPUTE Free Vlocy')
chipy.ComputeFreeVelocity()
chipy.utilities_logMes('SELECT PROX TACTORS')
chipy.SelectProxTactors(freq_detect)
chipy.utilities_logMes('RESOLUTION' )
chipy.RecupRloc(Rloc_tol)
chipy.ExSolver(solver_type, norm, tol, relax, gs_it1, gs_it2)
chipy.UpdateTactBehav()
chipy.StockRloc()
chipy.utilities_logMes('COMPUTE DOF, FIELDS, etc.')
chipy.ComputeDof()
chipy.utilities_logMes('UPDATE DOF, FIELDS')
chipy.UpdateStep()
chipy.utilities_logMes('WRITE OUT DOF')
chipy.WriteOutDof(freq_write)
chipy.utilities_logMes('WRITE OUT Rloc')
chipy.WriteOutVlocRloc(freq_write)
chipy.utilities_logMes('VISU & POSTPRO')
chipy.WriteDisplayFiles(freq_display,ref_radius)
chipy.WritePostproFiles()
#
# close display & postpro
#
chipy.CloseDisplayFiles()
chipy.ClosePostproFiles()
# this is the end
chipy.Finalize()
import os,sys
import numpy
import math
from pylmgc90.pre import *
if not os.path.isdir('./DATBOX'):
os.mkdir('./DATBOX')
# WARNING : in 3D by default z-axis is upward
# this is very important to direct PLANx objects
dim = 3
bodies = avatars()
mat = materials()
svs = see_tables()
tacts = tact_behavs()
#create materials
tdur = material(name='TDURx',materialType='RIGID',density=1000.)
pdur = material(name='MOUxx',materialType='RIGID',density=100.)
mat.addMaterial(tdur,pdur)
# create a model of rigid
mod = model(name='rigid', physics='MECAx', element='Rxx3D', dimension=dim)
#create some bodies
x = 0.
y = 0.
z = 0.1
down1 = rigidPlan(axe1=0.1 , axe2=0.1, axe3=0.02, center=[x, y, 0.], material=tdur, model=mod, color='VERTx')
down1.imposeDrivenDof(component=[1, 2, 3, 4, 5, 6], dofty='vlocy')
bodies += down1
spher1= rigidSphere(r=0.05, center=[x, y, z], material=pdur, model=mod)
spher1.imposeInitValue(component=[3], value=[-1.0])
bodies += spher1
x += 0.5
down2 = rigidPlan(axe1=0.1 , axe2=0.1, axe3=0.02, center=[x, y, 0.], material=tdur, model=mod, color='VERTx')
down2.imposeDrivenDof(component=[1, 2, 3, 4, 5, 6], dofty='vlocy')
bodies += down2
spher2= rigidSphere(r=0.05, center=[x - 0.12, y, z], material=pdur, model=mod)
spher2.imposeInitValue(component=[3], value=[-1.0])
bodies += spher2
x += 0.5
down3 = rigidPlan(axe1=0.1 , axe2=0.1, axe3=0.02, center=[x, y, 0.], material=tdur, model=mod, color='VERTx')
down3.imposeDrivenDof(component=[1, 2, 3, 4, 5, 6], dofty='vlocy')
bodies += down3
spher3= rigidSphere(r=0.05, center=[x + 0.12, y, z], material=pdur, model=mod)
spher3.imposeInitValue(component=[3], value=[-1.0])
bodies += spher3
x += 0.5
down4 = rigidPlan(axe1=0.1 , axe2=0.1, axe3=0.02, center=[x, y, 0.], material=tdur, model=mod, color='VERTx')
down4.imposeDrivenDof(component=[1, 2, 3, 4, 5, 6], dofty='vlocy')
bodies += down4
spher4= rigidSphere(r=0.05, center=[x, y - 0.12, z</