Dear preCICE developers and community members,
First of all, I’d like to say thank you for developing and maintaining this powerful open-source coupling library. I am a new user exploring the capabilities of preCICE for a research project, and I am very impressed so far.
I am currently working with the standard fluid-structure interaction (FSI) tutorials, specifically the case of coupling OpenFOAM (for the fluid domain) with CalculiX (for the solid domain). This setup works well and has provided me with a great starting point.
My research objective is to explore alternative approaches for the fluid solver. Specifically, I want to replace the OpenFOAM solver and its corresponding adapter with a custom-built participant written in Python. The CalculiX participant and its adapter would remain unchanged.
I envision two potential scenarios for my Python-based participant:
- A simplified, custom Python solver: A script that receives boundary data (e.g., displacements from CalculiX), performs some calculations (e.g., using simplified physics models or surrogate models), and sends back the resulting data (e.g., forces) to CalculiX.
- A data-driven Neural Network (NN) solver: A more advanced version where the Python script loads a pre-trained neural network. This NN would take the structural displacements as input and directly predict the fluid forces on the structure, effectively acting as the entire fluid solver.
From an architectural standpoint, does preCICE support such a workflow? In other words, is it feasible to have a “heterogeneous” coupling where one participant is a traditional FEM solver (CalculiX) and the other is a custom Python script (acting as a solver/NN), communicating through the preCICE library?
My assumption is that as long as my Python script correctly implements the preCICE API via the Python bindings to exchange the required data (e.g., Forces
and Displacements
), preCICE should be able to manage the coupling process seamlessly. I would just need to write a custom Python “adapter” script for my “solver”.
To make it more concrete, I would be very grateful if you could provide some guidance on the following points:
- General Feasibility: Is my overall understanding correct? Is coupling a solver like CalculiX with a custom Python script a supported and valid use case for preCICE?
- Implementation Strategy: For the Python side, would the recommended approach be to create a single Python script that a) contains the solver/NN logic and b) directly calls the preCICE API functions (e.g.,
initialize
,read_data
,write_data
,advance
,finalize
)? - Neural Network Considerations: Are there any specific challenges or best practices I should be aware of when the “solver” is a neural network? For example, related to time stepping, data mapping, or performance?
- Relevant Examples: Are you aware of any tutorials, examples, or community projects that demonstrate a similar coupling (i.e., coupling with a pure Python-based participant)? The existing Python examples seem to focus on teaching the API with simple analytical functions, and I’m looking for something closer to a real physics simulation.
Thank you in advance for your time and any insights you can share. This would be a great help for my research.
Best regards