Recently, I’m working on coupling OpenFOAM with our in-house code. Since the in-house code is a little bit complex, I choose to write a simple displacement generator to couple with interFoam as an exercise.
Firstly, as python bindings for preCICE is easy to get started, I adopted python bindings to do bidirectional coupling ( between a displacement generator and interFoam ) and it worked well. Then, I wrote a module which contained all the necessary subroutines and compile the adapter by adopting gfortran.
gfortran -o adapterTest preCICEmodule.f90 main.f90 -I /lib/x86_64-linux-gnu
There is no error during the compilation. However, when I executed the displacement generator, it seemed that the displacement generator didn’t connect to preCICE at all. I found that the time loop in the generator is not controlled by the subroutine
precicef_is_coupling_ongoing ( ongoing ) precicef_is_coupling_ongoing ( ongoing ). The generator just kept generating new displacements for the mesh nodes on the interface while the fluid participant ( interFoam ) was still waiting.
I doubt that this is due to the need of a config file such as
config.yml for solid solver CalculiX and
precice-adapter-config-fsi-s.json for solid solver fenics. But in my previous exercise, even though there is no such config file, the coupling between the displacement generator and interFoam works fine. So I wonder if this config file is a must.
If this config file is a must, how to make adapters read those information in the config file? In a previous topic, Makis suggested that there are two popular options YAML and JSON. However, I find that YAML does not support Fortran and if we have to make a config file, I probably need to adopt some methods to resd a JSON file.
Any advice will be appreciated!