Integrating my FORTRAN based CFD solver to work with Precice adapter

I am facing some issue regarding integration of preCICE with my in-house CFD solver based on FORTRAN.

Following is a short description of the problem I am facing:

  • preCICE version: 3.3.1
  • Operating system or platform: Ubuntu 24.04
  • Installation method : building with CMake

I installed precice using the process given on the precice website. The precice folder is present on the $HOME folder. Given, I need fortran bindings, the precice-fortran folder is also available on the $HOME. I have edited the CMakeLists.txt file within the build folder of my in-house solver as per the following details:

file(GLOB precice_adapter_files "PALM_Coupler/*")
add_library(fl_precice ${precice_adapter_files})
target_include_directories(fl_precice PRIVATE <<<COMPILE_LANGUAGE:Fortran>:${MPI_Fortran_INCLUDE_DIRS}>)
find_package(precice REQUIRED CONFIG)
target_link_libraries(SOLVER PUBLIC precice::precice)

and also updated the associated list(Append … ) file

After making these changes, I tried running the command make, but I recieve the following error:

Fatal Error: Cannot open module file ‘precice.mod’ for reading at (1): No such file or directory

Note, I have created a directory PALM_Coupler/ within the solver file, wherein a mod_precice.f90 file containing the precice functions has been implemented as a separate module.

I have already used the precice FORTRAN bindings to run a dummy solver avaialble within the tutorials and the solver is able to find the preCICE library, and runs accoring to the requirement.

Please help me solve this error.

Regards

@Manish I understand that you are using the Fortran module, which builds on top of the intrinsic Fortran bindings. For that, you first need to build this precice.mod and make it findable by your solver. Not sure if CMake would be able to just pick it up, but you can use pkg-config.

See an example in the solver dummy of the Fortran module: