Including PETSc in an OF solver
Hello friends,
I'd like to include PETSc's headers in my solver but I can't figure out how to make it compile. A PETSc program's makefile is as follows: Code:
include ${PETSC_DIR}/lib/petsc/conf/variables 'options': Code:
EXE_INC = \ Code:
myLaplacianFoam.C I appreciate your time and thanks in advance! Basel |
Hi Basel,
I am trying to do the same thing. Have you been able to link petsc with your solver? |
For someone who might need the answer, I was able to link the icoFoam solver with petsc by doing the following steps:
Note: I am using petsc-3.4.5 and it is installed in my /home directory. 1. Create a shared library of petsc by invoking the following command from any directory in the PETSc source Code:
make BOPT=O shared 2. Include petsc.h into icoFoam.C Code:
#include "petsc.h" Code:
PETSC_DIR=$(HOME)/petsc/petsc-3.4.5 Code:
export PETSC_ARCH=arch-linux-cxx-opt Hope this can helps |
I am sorry, eventhough the solver was successfully compiled, it does not work.
The error is that libpetsc.so could not be found, even though it is still exist in my $PETSC_ARCH/lib directory: Code:
icoPetscFoam: error while loading shared libraries: libpetsc.so: cannot open shared object file: No such file or directory |
Problem solved!
Just need to define the LD_LIBRARY_PATH environmental variable in $HOME/.bashrc Code:
echo "export LD_LIBRARY_PATH=\$PETSC_DIR/\$PETSC_ARCH/lib">>$HOME/.bashrc |
All times are GMT -4. The time now is 08:39. |