Can I couple OpenFOAM and Diffpack?


I’m would like to know if is possible to couple OpenFOAM with Diffpack (FEM library toolbox coded in C++) ?

In my case, OpenFOAM will be used to solve fluid dynamics of a gas mixture (multicomponent gas) above a solid region where the diffusion of species inside the solid depends on external gas composition. Diffusion in solid is solved by FEM using Diffpack library. Until now, there is no coupling between these two solver and I’m interested by using preCICE to couple OpenFOAM with Diffpack.

Maybe the difficulty in coupling these solver is that in OpenFOAM we have a hexa dominant mesh, while in Diffpack we have tetra mesh, but also they have different mesh format.

Could it be possible to know if there is a way to couple both solver ? And maybe have an example with a Diffpack adapter ?


Best regards,


Hi @AdrIPIV,

that’s a good question. I don’t know Diffpack, but it sounds like a perfect use case for preCICE in general.

As you probably know, we have an official adapter and support for OpenFOAM coupling: The OpenFOAM adapter | preCICE - The Coupling Library. However, I’m not aware of anyone who used the gas composition in OpenFOAM as a coupling quantity. Hence, you probably need to add the respective read/write functions to the OpenFOAM adapter.
For Diffpack, there is no previous work as far as I know, so you would need to integrate preCICE into your code yourself. Depending on your motivation to use Diffpack, I also want to point out that we have ready-to-use diffusion solvers coupled with preCICE relying on other FEM libraries such as Fenics or deal.II.

That’s not a problem at all from the preCICE perspective: you need to specify the coupling interface vertex location.

I’m really convinced that it is possible to couple both solvers. If you want to get a first impression of the OpenFOAM coupling you might want to checkout our Quickstart: Quickstart | preCICE - The Coupling Library.
Regarding the adapter: maybe someone else of the community can prove me wrong that there is already some adapter out there for Diffpack.

Hope this helps and kind regards,

1 Like

Hi @DavidSCN,

Thank you for your fast reply.

I noticed that the gas composition in OpenFOAM is not a coupling quantity (yet :slight_smile: ), but I think is not a problem for me to add these functions in the OpenFOAM adapter. Indeed I should check the FEM libraries you mentioned (Fenics and deal.II).

That a good point if I just need to specify the vertex location.

If there is already some adapter for Diffpack, I don’t know if it can be shared because Diffpack is not a free licence library.

Thank again for your help.

Best regards,


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.