Solfec-1.0 Installation

Solfec-1.0 is hosted on GitHub and you will need the git command installed in order to download its source code. Have a look at https://git-scm.com for instructions. Once the git command is available at your command line, type

git clone https://github.com/tkoziara/solfec.git

This will create a solfec directory in your current directory. The next thing you need is a Make/C/C++/Fortran/Python development environment at your command line. Users of Unix type systems (e.g. Linux, FreeBSD, Mac OS X) may use a package manager to install those tools. Windows users can install Cygwin or Mingw instead. Solfec-1.0 is written in C and it uses a simple makefile to get compiled. The file solfec-1.0/Config.mak needs to be modified in order to set up library paths and compilation flags. Here is an example:

#
# Operating System (WIN32, SOLARIS, LINUX, AIX, IRIX, OSX, FREEBSD)
#

OS = OSX

#
# Specify C compiler
#

CC = gcc

#
# Specify C++ compiler
#

CXX = g++

#
# Specify FORTRAN95 compiler and FORTRAN runtime library
#

FC = gfortran
FCLIB = -lgfortran

# 
# Debug or optimized version switch (yes/no)
#

# general debug tests
DEBUG = yes
# gprof profiling data
PROFILE = no
# switch off memory pools
MEMDEBUG = no
# geometrical debug tests
GEOMDEBUG = no
# light parallel consitency tests
PARDEBUG = yes
# heavy parallel self-consitency tests
PSCTEST = no
# disable TRY/CATCH
NOTHROW = yes

#
# TIMERS (enable/disable detailed solver timings)
#

TIMERS = yes

#
# POSIX
#

POSIX = yes

#
# HDF5
#

HDF5 = yes

HDF5INC = -I/opt/local/include
HDF5LIB = -L/opt/local/lib -lhdf5 -lhdf5_hl

#
# XDR (must be set when HDF5 = no)
#

XDR = no

XDRINC = 
XDRLIB = 

#
# BLAS
#

BLAS = -L/opt/local/lib/lapack -lblas

#
# LAPACK
#

LAPACK = -L/opt/local/lib/lapack -llapack

#
# Python
#

PYTHON = -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
PYTHONLIB = -L/opt/local/lib -lpython2.7

#
# FLTK (an alternative OpenGL GUI)
# 

FLTK = no
FLINC = -I/opt/local/include
FLLIB = -L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -lfltk_gl -framework OpenGL -lfltk -lpthread -framework Cocoa

#
# OpenGL (yes/no)
#

OPENGL = yes
GLINC = -DGL_SILENCE_DEPRECATION
GLLIB = -framework GLUT -framework OpenGL

#
# VBO  (OPENGL = yes)
#

VBO = yes

#
# MPI (yes/no)
#

MPI = yes
MPICC = mpicc

#
# Zoltan load balancer (MPI = yes); optional
#

ZOLTAN = no
ZOLTANINC = -I/usr/local/include
ZOLTANLIB = -L/usr/local/lib -lzoltan

#
# Dynlb load balancer (MPI = yes) available at:
# https://github.com/tkoziara/dynlb
# This option is used when ZOLTAN = no above;
# Use path to dynlb directory below;
#

DYNLB = ../dynlb

#
# PARMEC library available at:
# https://github.com/tkoziara/parmec
# This option is used to enable the HYBRID_SOLVER;
# If not required can be left as empty;
#

PARMEC = ../parmec

#
# MED paths (this need to be specified if PARMEC
# library has been compiled with MED support)
#

#MEDINC = -I/Users/tomek/Devel/med-3.2.0/build/include
#MEDLIB = -L/Users/tomek/Devel/med-3.2.0/build/lib -lmed

#
# Siconos (yes/no)
#

SICONOS = no
SICONOSINC = -I/usr/local/include/Siconos/Numerics
SICONOSLIB = -L/usr/local/lib -l SiconosNumerics

The above configuration works on Mac OS X. To recap, what you need is:

  • C, C++, FORTRAN 95 compilers
  • HDF5 library
  • (optional, deprecated) XDR (standard part of RPC on all Unix type systems)
  • BLAS and LAPACK libraries (standard on most systems)
  • Python together with development files and libraries (versions 2.x have been tested)
  • OpenGL libraries and developments files (this enables Solfec-1.0’s viewer)
  • (optional) VBO (Vertex Buffer Object extension of OpenGL for faster rendering)
  • MPI libraries and development files
  • either Zoltan or dynlb load balancing library
  • (optional) Parmec source path if you wish to use the HYBRID_SOLVER and hybrid modeling
  • (optional) Siconos contact solvers library

To compile Solfec-1.0, after editing the Config.mak file, the first compilation may look like this

cd solfec
make all

This will create files solfec-1.0/solfec and solec/solfec-mpi, that is, the serial and the parallel versions of the code. For every subsequent update and compilation you may like to do the following

  • Back up your Config.mak file. For example
cd solfec
cp Config.mak ..
  • Now update the sources
git pull
  • Recover your Config.mak file
mv ../Congig.mak ./
  • And finally compile again
make clean
make all

Use “DEBUG = no” most of the time: this will make Solfec-1.0 about 40% faster. Nonetheless, when you experience trouble with running the code, recompile it with “DEBUG = yes” (this is slower but outputs more information) and run it again. The solfec-1.0/inp directory contains example input files. If you haven’t used the “POSIX = yes” flag, you will need to create output directories yourself, before running calculations (on systems where “POSIX = yes” works, this is done automatically). It may be convenient to modify the PATH variable to point to the solfec directory, making it easier to run Solfec-1.0 form any location within your filesystem. You can ask for help, using the Solfec-1.0 mailing list.