[petsc-users] Problem coupling Petsc into OpenFOAM
Smith, Barry F.
bsmith at mcs.anl.gov
Wed Apr 10 11:37:41 CDT 2019
We don't know much about OpenFoam but
1) if I do a
git grep -i petsc
in the https://develop.openfoam.com/Development/OpenFOAM-plus.git repository I see various configuration files specifically for PETSc.
etc/config.csh/petsc etc/config.sh/petsc wmake/scripts/have_petsc
so it appears that OpenFOAM has the tools to be linked against PETSc (to me the documentation on how to use them is rather terse). Are
you using these? If you have trouble with them perhaps you can ask the OpenFOAM user community how to use them.
2) if you are editing the Make/options file directly you can try changing
-L$(PETSC_DIR)/$(PETSC_ARCH)/lib -lpetsc
to
-Wl,-rpath,$(PETSC_DIR)/$(PETSC_ARCH)/lib -L$(PETSC_DIR)/$(PETSC_ARCH)/lib -lpetsc
Note also that simply including petsc.h into the OpenFoam source code and linking against -lpetsc will not immediately allow calling the PETSc solvers from OpenFOAM. One needs to write all the interface code that sets up and calls the PETSc solvers from OpenFOAM. There is a paper https://www.researchgate.net/publication/319045499_Insertion_of_PETSc_in_the_OpenFOAM_Framework that describes at an abstract level how they wrote code that calls the PETSc solvers from OpenFOAM but the source code that actually does the work does not appear to be available.
Note that PETSc is now at version 3.11 we recommend working with that version (unless you already have a lot of code that calls PETSc written with a previous version of PETSc, for that we recommend first upgrading to petsc 3.11 and then continuing to add code).
Barry
> On Apr 10, 2019, at 8:23 AM, Balay, Satish via petsc-users <petsc-users at mcs.anl.gov> wrote:
>
> Runtime error? You might have to add the path to $PETSC_ARCH/lib in LD_LIBRARY_PATH env variable
> or - to your link command. If linux/gcc - the linker option is -Wl,-rpath,$PETSC_ARCH/lib
>
> If not - send detail logs.
>
> Satish
>
> On Wed, 10 Apr 2019, Vu Do Quoc via petsc-users wrote:
>
>> Hi all,
>>
>> I am trying to insert Petsc to OpenFOAM opensource software.
>> I have been successfully compiling Petsc with an available solver in
>> OpenFOAM by linking it with the shared library libpetsc.so. However, when I
>> call the solver to run a test case, I got an error saying that:
>> "libpetsc.so cannot be found", even though the library still exists in the
>> $PETSC_ARCH/lib folder.
>>
>> I have been struggling for weeks but still, have not been able to figure it
>> out. Therefore I would be very grateful for any suggestion to solve this
>> problem.
>>
>> Thanks in advance for your time,
>>
>> Best regards,
>>
>> Vu Do
>>
>
More information about the petsc-users
mailing list