Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

PETSc linear algebra solver

The PETSc library can be used to resolve linear system of equations assembled by the OpenFOAM routines.

PETSc is installed (the target is the object libpetsc.so) setting the library path (LDPATH) specifing the environment variables set to the petsc installation:

  • PETSC_DIR
  • PETSC_ARCH

The above env. variables are needed to compile and link the PETSc library.

Compilation of the solver

An OpenFOAM compatability layer must be created to allow the comunication from OpenFOAM to PETSc, hence a library must be generated:

cd $WM_PROJECT_DIR/module/external_solver
./Allwmake -config=openfoam

Then check the following

foamHasLibrary -verbose petscFoam

And try out one of the prepared tutorial cases:

cd $WM_PROJECT_DIR/module/external_solver/tutorial