Volume fluid-fluid and CHT coupling with OpenFOAM and Nutils

Hello!

I am new to preCICE and have a few questions.

I will first sketch the situation for more clarity. I am using OpenFOAM to solve the velocity field in a turbulent flow. I am using simpleFOAM with a RANS model, so this model will reach a steady state, with in the end the average velocity field in the flow.

There is also a solid attached at the bottom of the flow (just like in the example from CHT), however with a constant heat source at the bottom of the solid. The solid is solved in python using Nutils. After the average velocity field is obtained in the fluid, I want to use this as an input for another model, which solves the Temperature distribution in the fluid and solid together until it has also reached a steady state.

I want to use preCICE however I have a few questions about what is possible with it and how it works.

  • One idea was to solve the velocity field in OpenFOAM and then export this to Nutils, and solving the temperature distribution in fluid and solid in Nutils. I saw one way coupling was possible in preCICE. I saw in the examples that data was transfered via an interface boundary. Is it also possible to export data from a whole mesh, to another mesh? so for example the velocity field in the fluid mesh of OpenFOAM to a velocity field in the nutils mesh of the fluid.
  • In the other case, the velocity field will be solved using OpenFOAM and then another model is used in OpenFOAM for the temperature distribution. Then nutils and openfoam run simultaneous in the temperature distribution calculation and distribute temperature data every iteration until it reaches steady state (It is not a time dependent problem, but i assume that is also possible?). I was however wondering how OpenFOAM is calling the preCICE adapter. I saw that a function was defined in the controlDict. See the figure below. However is there no other adjustment required for OpenFOAM in the solver or somewhere else?

Thank you for your time in advance.

Kind regards,

Cars van Otterlo

image

Welcome, @CarsvO!

A figure would help, but I think I understand your scenario: you want something like our flow over a heated plate tutorial, with a fluid-fluid volume coupling between the flow channel and a clone of itself. This will require some code changes in the OpenFOAM adapter, but it is doable.

Yes, uni-directional coupling is easy with preCICE (and easier than bi-directional).

The initial goal of preCICE was for surface coupling (as, for example, in fluid-structure interaction). But the design is generic enough that several people have now successfully done volume coupling with preCICE.

But beware that this is kind of unexplored territory and you will need to do a bit more coding than usual and we have no tutorial for this. However, this Pull Request to the precice/openfoam-adapter may help. If you want, you are very welcome to help drive the review process forward as well (this is a bit old and stalled by now).

We already have tutorial cases that are steady state, for example CHT with OpenFOAM and CalculiX or with OpenFOAM and code_aster. We simply assume that PIMPLE time is the same as a SIMPLE iteration.

There are a few more configuration steps involved, see the configuration page and potentially my thesis. For a more up-to-date and easy read, I also recommend the slides of our training session at the 15th OpenFOAM Workshop.

I am renaming the topic to give it a more specific title, feel free to follow-up with anything else we should clarify in terms of concepts already, or open new topics for any individual issues you get while trying this out. Of course, I would be very happy to know if you better understand everything now! :smile:

Hey @MakisH,

Thank you for your explanation! It is a lot clearer now and the links to the pages with extra information will be very helpful. I think everything is clear to me, but I will let you know if I don’t understand something.

Thank you very much.

Kind regards,

Cars

1 Like

Brief add-on: volume coupling with Nutils is really simple:

  topo, geom = mesh.rectilinear(...)
  ...
  ns.x      = geom
  ...
  meshID = interface.get_mesh_id("MyMesh")
  couplingsample = topo.sample('gauss', degree=degree*2) # coupling at Gauss points
  vertices = couplingsample.eval(ns.x)
  dataIndices = interface.set_mesh_vertices(meshID, vertices)