<div dir="ltr"><div dir="ltr">Dear All,</div><div dir="ltr"><br></div><div dir="ltr">Thanks so much for all of your prompt responses!<br></div><div dir="ltr"><br></div><div>By defining the LD_LIBRARY_PATH env variable in .bashrc, I have been able to call the solver. <br></div><div>However, as Berry mentioned, I cannot directly call for Petsc solver at the moment. So I guess I would need to create an interface for Petsc and OpenFOAM. <br></div><div>I have taken a look at rheoTool and it seems like the latest version provides some really nice reference.</div><div><br></div><div>Thanks again for your help.</div><div><br></div><div>Best regards,</div><div><br></div><div>Vu<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Apr 11, 2019 at 4:55 AM Mark Olesen <<a href="mailto:Mark.Olesen@esi-group.com" target="_blank">Mark.Olesen@esi-group.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The paper that Barry mentioned gives some generalities, but probably <br>
won't help much. There are some PETSc/OpenFOAM interfaces in rheoTool <br>
that are probably much more helpful.<br>
<br>
As Barry also rightly noted, there are some config files in the OpenFOAM <br>
tree that were put in some time ago for helping with setting up PETSc <br>
and OpenFOAM. Assuming that you have set the appropriate values in the <br>
etc/<a href="http://config.sh/petsc" rel="noreferrer" target="_blank">config.sh/petsc</a> file you will be able to use those when using wmake. <br>
For running you will still need to ensure that the LD_LIBARY_PATH is set <br>
correctly. For example, what some build scripts exhibit:<br>
<br>
wmake(petsc) :<br>
==> Before running, verify that PETSc libraries can be found<br>
<br>
Enable in the OpenFOAM etc/bashrc, define manually or try with the<br>
following (POSIX shell):<br>
<br>
eval $(foamEtcFile -sh -config petsc -- -force)<br>
<br>
==<br>
<br>
<br>
There is currently a PRACE project running via CINECA (Bologna) with <br>
binding in PETSc as a runtime selectable linear solver in OpenFOAM. This <br>
is still at the stage of early testing and performance benchmarking.<br>
<br>
Cheers,<br>
/mark<br>
<br>
On 4/10/19 6:37 PM, Smith, Barry F. via petsc-users wrote:<br>
> <br>
> We don't know much about OpenFoam but<br>
> <br>
> 1) if I do a<br>
> <br>
> git grep -i petsc<br>
> <br>
> in the <a href="https://develop.openfoam.com/Development/OpenFOAM-plus.git" rel="noreferrer" target="_blank">https://develop.openfoam.com/Development/OpenFOAM-plus.git</a> repository I see various configuration files specifically for PETSc.<br>
> <br>
> etc/config.csh/petsc etc/<a href="http://config.sh/petsc" rel="noreferrer" target="_blank">config.sh/petsc</a> wmake/scripts/have_petsc<br>
> <br>
> 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<br>
> you using these? If you have trouble with them perhaps you can ask the OpenFOAM user community how to use them.<br>
> <br>
> <br>
> 2) if you are editing the Make/options file directly you can try changing<br>
> <br>
> -L$(PETSC_DIR)/$(PETSC_ARCH)/lib -lpetsc<br>
> <br>
> to<br>
> <br>
> -Wl,-rpath,$(PETSC_DIR)/$(PETSC_ARCH)/lib -L$(PETSC_DIR)/$(PETSC_ARCH)/lib -lpetsc<br>
> <br>
> <br>
> <br>
> 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 <a href="https://www.researchgate.net/publication/319045499_Insertion_of_PETSc_in_the_OpenFOAM_Framework" rel="noreferrer" target="_blank">https://www.researchgate.net/publication/319045499_Insertion_of_PETSc_in_the_OpenFOAM_Framework</a> 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.<br>
> <br>
> 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).<br>
> <br>
> Barry<br>
> <br>
> <br>
> <br>
> <br>
> <br>
>> On Apr 10, 2019, at 8:23 AM, Balay, Satish via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>> wrote:<br>
>><br>
>> Runtime error? You might have to add the path to $PETSC_ARCH/lib in LD_LIBRARY_PATH env variable<br>
>> or - to your link command. If linux/gcc - the linker option is -Wl,-rpath,$PETSC_ARCH/lib<br>
>><br>
>> If not - send detail logs.<br>
>><br>
>> Satish<br>
>><br>
>> On Wed, 10 Apr 2019, Vu Do Quoc via petsc-users wrote:<br>
>><br>
>>> Hi all,<br>
>>><br>
>>> I am trying to insert Petsc to OpenFOAM opensource software.<br>
>>> I have been successfully compiling Petsc with an available solver in<br>
>>> OpenFOAM by linking it with the shared library libpetsc.so. However, when I<br>
>>> call the solver to run a test case, I got an error saying that:<br>
>>> "libpetsc.so cannot be found", even though the library still exists in the<br>
>>> $PETSC_ARCH/lib folder.<br>
>>><br>
>>> I have been struggling for weeks but still, have not been able to figure it<br>
>>> out. Therefore I would be very grateful for any suggestion to solve this<br>
>>> problem.<br>
>>><br>
>>> Thanks in advance for your time,<br>
>>><br>
>>> Best regards,<br>
>>><br>
>>> Vu Do<br>
>>><br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="m_4262083764246913905gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr" style="font-size:12.8px"><div><b>Vu Q. Do<br></b>------------------------------------------------<br><i style="font-size:12.8px">Student of Aeronautical Engineering</i><br>Programme de Formation d'Ingénieurs d'Excellence au Vietnam <i>- PFIEV</i><br></div><div>School of Transportation Engineering<i><br></i></div>Hanoi University of Science and Technology</div><div dir="ltr" style="font-size:12.8px">01 Dai Co Viet Avenue, Hanoi, Vietnam<br>E-mail: <a href="mailto:vu.doquochust@gmail.com" target="_blank">vu.doquochust@gmail.com</a></div></div></div></div></div></div></div></div></div></div></div>