Using preCICE to couple python and OpenFOAM

Hello,

I am working on a CFD case in which an electrical propulsor is located within the boundary layer formed on the aircraft fuselage.

I am wondering whether is possible to create a coupled OpenFOAM and Python case with preCICE:

  • OF: fan inlet and fan outlet will be mesh boundaries
  • Python: use the pressure and velocity fields from fan inlet patch to calculate the pressure and velocity field at the fan outlet (imposing a pressure ratio, simple thermodynamic calculations)

I have seen a couple of tutorials in preCICE but I am not sure if a functionality like this is available. There will be essentially two interfaces (fan_in, fan_exit) where the pressure and velocity fields are either read or written.

Thanks in advance.

Hi!

To me it sounds like a good use case for preCICE.

There is a Python interface available and also an adapter for OpenFOAM. I am not sure whether the OpenFOAM adapter would support all features already or whether you would have to implement something yourself. Having two different interfaces should not be a problem either.

I guess some of the real experts will comment here later. :slight_smile:

1 Like

Welcome, @ddiamant!

This sounds indeed very reasonable for preCICE. I understand that you want a surface coupling (not volume coupling) of an incompressible flow in OpenFOAM, coupled to an in-house compressible flow solver/model in Python.

You can start with this tutorial for the OpenFOAM part: Partitioned pipe flow | preCICE - The Coupling Library

The Python interface is also very easy: Application programming interface | preCICE - The Coupling Library

By the way, I am also working on fluid-fluid coupling of different models, so I would be very interested to see how your research goes and maybe I can help a bit in the meanwhile! I am also coupling OpenFOAM to a Python code at the moment.

2 Likes

Thank you for the info!

Yes, I was talking about surface coupling and not volume coupling.
I will start with the tutorials you mentioned and if I face any issues I will come back here for more questions.

1 Like

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