Conformal mesh at interfaces of composite solid

Hi everybody,

i got some questions concerning thermal simulation of a composite solid consisting of different materials. As a MWE, i designed a model of three adjacent blocks in Freecad and exported it as a .step file (see attachment).

My first question is, how to get a conformal mesh at the interface between the regions. When looking at a section of the interface, one can see that the mesh is nonconformal at the moment.

Although the heat conduction over the interface works, i guess the nodal values are interpolated and contain an interpolation error.
I’m quite new to cad design and it may be that the problem lies within my step file.

In addition, i have two smaller issues:
I managed to set different conductivities and sourceterms for the subdomains, but failed visualizing them.
I tried with Draw(sources,mesh,‘piecewise’), but the result is just some random colorization on the surfaces of the body.
I also cant get the mesh.SetMaterial() routine on the different domains of the ngsolve.comp.Mesh to work. They are named [domain_0,domain_1,domain_2] by default and i would like to change that.

Thanks for your support, have a great weekend!



Attachment: cube_compound_2020-05-31-2.step

Hi Lukas,

you have to glue your objects to get a conforming mesh at the interface. You have to do it in Freecad - or
you update to the coming nightly Netgen/NGSolve version, in which a


is available.

To visualize the conductivities, you have to visualize them in the clipping-plane. Otherwise, the coefficients are associated with the surface numbers.

Draw(sources,mesh,'piecewise', draw_surf=False)

You can set material names in the Netgen-mesh, a member of the NGSolve-mesh. Be aware that numbering is 1-based, here:

mesh.ngmesh.SetMaterial(1, "mymat")


Hello Joachim,

thank you for the quick response! The two minor issues are all clear now.

Unfortunately i could not find out yet, how to export the composite solid with the correct Interface from FreeCAD (When meshed in FreeCAD, the Interface seems to be all good).
Could you specify the geo.Glue() option? I updated to the newest NetGen version (via conda) and the OCCGeometry object yet has no attribute ‘Glue’. Which version do I need exactly and how would the workflow look like?


You can try the ngsolve-nightly conda package. I just updated it to the current master.