Mesh alignment between disimilar objects

Mesh generators, CAD programs, and other tools
Gary R
Posts: 162
Joined: 12 Apr 2012, 07:23
Antispam: Yes
Location: Long Beach CA, USA

Mesh alignment between disimilar objects

Post by Gary R »

Hi all,
Operating System: Debian GNU/Linux 11
KDE Plasma Version: 5.20.5
KDE Frameworks Version: 5.78.0
Qt Version: 5.15.2
Kernel Version: 5.10.0-20-amd64
OS Type: 64-bit
Processors: 4 × AMD FX(tm)-4350 Quad-Core Processor
Memory: 31.3 GiB of RAM
Graphics Processor: AMD CAICOS
Gmsh version 4.10.3

I have consistently run into the problem of not being able to run Elmer analyses on joined parts created by freecad. My normal work flow is to create a freecad object and export it as either a .brep file or a .step file. I then load the file into Gmsh and create the Elmer mesh using "ElmerGrid 14 2 FileName.brep -autoclean -merge 'real N' ". This works fine for a single object but doesn't work for objects of dissimilar materials or shapes. I have posed this problem on a previous post - Diaphragm displacement on Helmholtz resonator - but never got to the real fix. I also posted a simpler problem with two square blocks in contact. This was too simple. So to try again here is a simple heat flow problem where a steel cylinder is butted against an aluminum square block. One end of the assembly is at 400 deg and the other at zero. Attached is a FreeCAD file that uses the compound method of attachment and another that uses the assembly attachment method. Neither work. The use of a union will obviously not work because there are no longer two parts. I can not believe that this problem hasn't come up with others but have not found a definitive answer in the forum. Hope I am not beating a dead horse but am still very confused. Any help will be appreciated.
Screenshot_20230224_123401.png
Screenshot_20230224_123401.png (18.14 KiB) Viewed 1189 times
Gary R.
Attachments
ContactPartsCompound.tar.gz
(92.27 KiB) Downloaded 60 times
CubeCylinderAssy.tar.gz
(103.63 KiB) Downloaded 64 times
kevinarden
Posts: 2316
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: Mesh alignment between disimilar objects

Post by kevinarden »

The problem is that there are two volumes that do not know about each other. The each have a surface that lies on a same plane but this is not enough, The block by itself is just a block, it has no circle feature defined in it. Therefore it can not be coherence to the cylinder. As you said you can't just union them then there is just one part.
The solution in gmsh is to use boolean fragments. It helps to select the volumes by turning on the volume visibility on from tools, geometry, visibility.
To fragment the block with the cylinder choose boolean fragment, you must uncheck the delete the tool option because you need to retain the tool in this case. Select the block hit e to end, it then prompts you to select the tool, select the cylinder then hit end. The cylinder fragments the block creating the circle feature in the block. Now you can coherence, there will still be two volumes, but they now know about each other.
Mesh, save mesh, open in Elmer, and there are two bodies with conforming meshes at the boundary.
Gary R
Posts: 162
Joined: 12 Apr 2012, 07:23
Antispam: Yes
Location: Long Beach CA, USA

Re: Mesh alignment between disimilar objects

Post by Gary R »

Thank you Kevin.
I think this is finally getting to the heart of my problem. One not so minor problem, my copy of gmsh doesn't have boolean options. Could it be in one of the myriad of plugins available? My copy of gmsh was installed from the standard stable Debian package management system. I have noticed before that people have talked about functions in gmsh that I can not find. My copy seems to be pretty bare bones. Please comment.
Thanks again.
Gary R

P.S. By adding a .geo file containing the line
SetFactory("OpenCASCADE");
in my project file, I can now access the booleanFragment command. I unlocked the Delete tool check box but did not find a way to select the individual components. I chose select volumes, ran coherence and meshed the file. When I started the project in Elmer, gmsh had exploded every line and face. The Elmer merge elements function doesn't seem to work anymore.
kevinarden
Posts: 2316
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: Mesh alignment between disimilar objects

Post by kevinarden »

gmsh is easy to install the latest version from https://gmsh.info/
it is an executable download
gmsh.png
gmsh.png (86.75 KiB) Viewed 1164 times
yes opencascade is the way to go
kevinarden
Posts: 2316
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: Mesh alignment between disimilar objects

Post by kevinarden »

The next step is optional but very helpful. You can use the physical group command to name bodies and boundaries. Each named volume becomes a body. And each named surface becomes a boundary.
Gary R
Posts: 162
Joined: 12 Apr 2012, 07:23
Antispam: Yes
Location: Long Beach CA, USA

Re: Mesh alignment between disimilar objects

Post by Gary R »

Hi Kevin,
As you suggested, I used Boolean Fragments, unchecked Delete Tools and got the following screen:
Screenshot_20230301_161511.png
Screenshot_20230301_161511.png (28.16 KiB) Viewed 1146 times
At this point I got lost. I could not figure out how to select the block or the tool. I went ahead and ran coherence on the objects and meshed them. I ran the .msh file through "ElmerGrid 14 2 <file.msh> -autoclean -merge 0.01" and tried to set up the project in Elmer. I got 13 Body Properties and 22 Boundary Properties and the combine surfaces function would not group any of them together. I assume that this happened because I didn't run Select Block and Select Tool. What am I missing?

I did look a the selection mode drop down but was not sure what to do with it.

Thanks again for your help and I hope patience.
Gary R.
kevinarden
Posts: 2316
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: Mesh alignment between disimilar objects

Post by kevinarden »

Detailed steps with pictures.
It took me a few times to get used to looking at the top of the screen for keyboard directions when selecting things in gmsh.
gmsh_steps.pdf
(523.22 KiB) Downloaded 69 times
Gary R
Posts: 162
Joined: 12 Apr 2012, 07:23
Antispam: Yes
Location: Long Beach CA, USA

Re: Mesh alignment between disimilar objects

Post by Gary R »

Thanks Kevin,
Your .pdf file is very specific. Even I should be able to follow it. Unfortunately, when I switched on the Volume bubbles nothing happened. I am using either .brep or .step files exported from FreeCAD as my input to Gmsh. Could that be causing the problem? I went to Geometry > Tools > Geometry > Visibility and checked the Volume box. This produced no noticeable effect. I am using the very latest version of Gmsh 4.11.1 . Any suggestions?

Gary R.
kevinarden
Posts: 2316
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: Mesh alignment between disimilar objects

Post by kevinarden »

I am using the same step file you generated, so that is not the issue. It may be color, the volume bubbles are white by default, if you have a white background they may not show. There are options for colors under tools options. Somethimes just changing to dark mode, black background works.
Gary R
Posts: 162
Joined: 12 Apr 2012, 07:23
Antispam: Yes
Location: Long Beach CA, USA

Re: Mesh alignment between disimilar objects

Post by Gary R »

Hi Kevin,
I thought I posted this but it never showed up. I finally got everything to work. The results shown below.
Screenshot_20230305_175534.png
Screenshot_20230305_175534.png (45.69 KiB) Viewed 1119 times
I'm not sure what was wrong with my gmsh setup but when set the options to default suddenly things worked. I also attached a tarball of the whole project. I learned a lot about gmsh with this problem. Thanks for the help. I is seriously appreciated.

Gary R.
Attachments
CubCylinder.tar.gz
(108.39 KiB) Downloaded 59 times
Post Reply