preCICE mesh id (-1) error (OpenFOAM+CalculiX CHT)

Kubuntu 18.04LTS
preCICE v2.1
OpenFOAM v7
CalculiX v2.15

What I am trying to do:
I am trying to run a 2-way coupling between OpenFOAM and CalculiX, but for heat transfer in of FSI.

For OpenFOAM , I took the Fluid folder from OpenFOAM (OF) adapter CHT tutorial. But I am using chtMultiRegionFoam instead of bouyantPimpleFoam.(Same as heat exchanger tutorial)
I am also using the same precice-config.xml, with only one modification of changing participant name of Solid from Solid to CalculiX .(just for a bit better readability)

I then replaced the blockMeshDict with the one from flap_perp tutorial case.
And I did the necessary modification/adaptions to boundaryField of each file.

I ran this pure OF case, and it runs fines.

For CalculiX (CCX), I took the Solid folder from flap_perp tutorial case same as for Fluid participant.
I have modified the flap.inp to make a COUPLED TEMPERATURE-DISPLACEMENT simulation.
I ran this pure CalculiX case under gravity and some temperature at the fix1
, this runs fine as well. (But I remove the gravity for the coupled OF+CCX simulation).

I modified the confg.yml file to have Temperature and Heat-Flux instead of FSI keywords Forces and Displacements.

My Fluid participant waits for the Solid participant, while the Solid (CalculiX) participant fails with the following error message:

---[precice] ERROR:  The given Mesh ID "-1" is unknown to preCICE.

I am attaching the log file for Solid and Fluid.Fluid.log (8.9 KB) Solid.log (9.5 KB)

Thank you for the help. :slight_smile:

From preCICE perspective this means that you give a mesh ID to preCICE (with value -1) that preCICE does not know, meaning a mesh ID that you did not get from preCICE via getMeshID.
So, the problem happens in the adapter. More specifically, in the CalculiX adapter. Please check if the mesh names there in the adapter config config.yml match those of the preCICE config.

Yes, I checked, I even thought there might be an issue with indentation may be in config.yml, but there isn’t. I tried giving it a different mesh name, the new preCICE tells you in the error message that you should check if the mesh name matches. And I get a different, error which is mesh empty.


        - nodes-mesh: Solid
          patch: surface
          read-data: [Temperature]
          write-data: [Heat-Flux]
precice-config-file: ./precice-config.xml

My runSolid command

ccx_preCICE -i Solid/flap -precice-participant Calculix

precice-config.xml (2.4 KB)

I have tried to keep the .inp file as close to the OpenFOAM+CalculiX heat exchanger problem, I am attaching that as well, just on case if I don’t know if I am making any mistakes in there.
flap.inp (509 Bytes)

ccx_preCICE -i Solid/flap -precice-participant Calculix

Maybe just a typo here, but in your preCICE config the participant’s name is CalculiX.

Do you now get a “mesh empty” error message or “mesh ID unknown” error?

Could you please double check that in your CalculiX mesh files surface is defined correctly?

If you want you could already open a draft PR in the tutorials repository as what you do would be a (first step towards a) solution to Then, we could try to run your complete case and reproduce your problem.

Why do you want to use chtMultiRegionFoam and not bouyantPimpleFoam here?

My bad, just a typo here. In the files, the participant name matches.

If there is a mismatch in the participant name or mesh name anywhere, I get the following error:

---[precice] ERROR:  The provided mesh "Solid" is empty. Please set the mesh using setMeshXXX() prior to calling initialize().

Yes, I will do that immediately.

I had some issues which I could not really solve for bouyantPimpleFoam. I saw that the heat-exchanger tutorial uses chtMRF so I switched. I am able to run the solo Fluid part for chtMRF.

For the OpenFOAM setup you could also copy from the other CHT examples, e.g.

There, we use buoyantPimpleFoam.

Will do.
I think I already have a fork to the tutorials directory, I should be able to add it all there, correct?

Yes, just do a new branch there.
See also: I was asked to try a Pull Request. How can I do that?

You can find the files for this case in PR #92

I just checked the solo simulation using the same flap.inp as the coupled simulation.
(Just modified the path to the files, but I have been doing the same thing a lot so I don’t think it’s the path.)

I put a 1000°K on fix1, and use 200°K in the body(Nall)

I ran this solo simulation since I was not sure about the .dfl and .flm files I exported. But I think since it did not throw any errors, the files are fine. I also cross-checked the contents with that of the heat-exchanger case and they look ok.

I have some CalculiX issues for the flow over plate problem with these files though. So I will sort these issues and push them after they are ok.

@Alphaoo1 could you please also enable debug output in preCICE and post your respective Solid.log?

It looks like you get this error, which we would like to be clearer since preCICE v2.1. Then maybe it also makes sense to open an issue about the unclear error in the precice/preice repository.


I am able to reproduce the error.

 ---[precice] ERROR:  The given Mesh ID "-1" is unknown to preCICE.

I have commented in the PR to try and resolve this issue. I believe it is because Heat-Flux works on the face centres, but in this case we have only defined the nodes of the mesh.

@MakisHPlease find the debug log file. I used the following in the .xml file for getting this output. I hope this is what you are looking for.
<sink type="file" output="debug_Solid.log" filter="%Participant% = CalculiX" />
debug_Solid.log (58.5 KB)

@KyleDavisSA Should I used nodes-mesh-with-connectivity in this case, I have exported the .sur file.

Also, I want to take this chance to ask what is the difference (in terms of physical meaning) between Temperature and Sink-Temperature?
I did not use Sink-Temperature because I was not sure what it meant.

From the output I understand that it is failing here:
interface->fluxDataID = precicec_getDataID( "Heat-Flux", interface->faceCentersMeshID );
but I think that @KyleDavisSA already has a lead here.

In a Dirichlet-Neumann coupling we are using Temperature and Heat flux. However, we can also do a Robin-Robin coupling, where we are using Sink Temperature and Heat transfer coefficient.

You can read more about this for example in Lucia Cheung Yau’s thesis or in CHT-related literature.


I managed to run the problem when including the interface.sur file and modifying the config reader (ConfigReader.cpp). I had to change to

if( config["participants"][participantName]["interfaces"][i]["faces-mesh"] )
			interface.facesMeshName = strdup( config["participants"][participantName]["interfaces"][i]["faces-mesh"].as<std::string>().c_str() );
			interface.nodesMeshName = strdup( config["participants"][participantName]["interfaces"][i]["faces-mesh"].as<std::string>().c_str() );

You then need to use faces-mesh in the config. The temperature was using the nodes mesh and the heatf-flux uses the faces. I am not sure what the long term affects of this change is, but the error should be solved. I don’t know if the CalculiX setup itself is correct.

1 Like

@KyleDavisSA I made the changes and build a new adapter for calculix.
I am trying to configure the config.yml file as follows:

        - faces-mesh: Solid
          patch: interface
          write-data: [Heat-Flux]
          read-data: [Temperature]

But I get an error Nodes mesh not provided in YAML config file .
Should I configure the case something like:

        - faces-mesh: Solid-faces
          patch: interface
          write-data: [Heat-Flux]
        - nodes-mesh: Solid-nodes
          patch: interface
          read-data: [Temperature]

And then adapt other files accordingly.

I was finally able to run the simulation, but I agree with Kyle, there might be an issue with the CalculiX setup. I will try and correct it.