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

System
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.

Issue
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.

participants:

    CalculiX:
        interfaces:
        - 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 Missing flow-over-heated-plate with CalculiX · Issue #103 · precice/tutorials · GitHub. 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. https://github.com/precice/tutorials/tree/master/CHT/flow-over-plate/buoyantPimpleFoam-nutils

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.

Hi,

I am able to reproduce the error.

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

I have commented in the PR https://github.com/precice/tutorials/pull/104 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.

Hi,

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.

2 Likes

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

    CalculiX:
        interfaces:
        - 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:

    CalculiX:
        interfaces:
        - 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.

Hi @Alphaoo1, hi @KyleDavisSA
I’m working on a similar setting, where I need a nodes mesh to write displacements and velocity and a faces mesh to read the pressure.
Which configuration in the yaml file did you finally chose to be able to run the simulation. Did you make any other changes than in the yaml file to solve the issue?
Thank you for your help.
Best regards, Matthias

@mattfrei Sorry for the late reply.
So, if I remember correctly, inside the CalculiX adapter, specific modules are activated for specific simulations.

So if I am not wrong, we will have to activate both the structural and thermal modules together.
If I am not wrong, here you can see only thermal is activated.
And here you see the structural module activated, which explicitly excludes the thermal part.

With the edits in this thread, the errors will go away but the end goal won’t be achieved as you have to do the module part. I haven’t modified the CalculiX adapter for this application yet, I plan to do it in the future as it is needed for my project, but the timeline for this is severely pushed. This is where I was stuck for a while. But due to comparatively lower priority, I had to move to some other work.

In any case, maybe a preCICE team member can confirm if what I suggested is correct or not.

Hi @Alphaoo1,
I’m not sure if I need both modules active for my simulation. Maybe there is a misunderstanding. I just want to configure a Faces-Mesh and a Nodes-Mesh within one FSI-Simulation. I don’t want to do a thermal analysis. All I want to do in CalculiX is write Displacements and Velocities and read Pressure. Therefore I did some changes in the adapter to be able to read the pressure on the CalculiX side. The critical point, where I think you could help me is to find the right config.yml setting for CalculiX to configure both meshes at the same time as supposed by you above:

I am trying to configure the config.yml file as follows:

   CalculiX:
       interfaces:
       - 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:

   CalculiX:
       interfaces:
       - 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

So to come back to my question: I thought there were other changes that you made, that made the given config.yml work to configure both, a Faces Mesh and a Nodes Mesh, independent from the analysis type (thermal in your case?, and FSI in my case). So I hope maybe my question is more clear now and I would be glad if you can help me with it.

1 Like

@mattfrei Yes, the question is clear. Sorry for the confusion.
The following edits do not depend on simulation type.

I made the following changes here

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() );
               }