Conformal meshes with Gmsh

Hi, today I found how to make a conformal mesh (a mesh of several parts that share the nodes at the common faces) using a command file and the Gmsh standalone application.

First, parts must be well modeled in the CAD (better using boolean operations for complex parts to be sure of getting the coincident faces), and export the assembly as a unique step file.
After that, copy the attached .geo file to the same folder as the step, and edit with Notepad and change inside the name of the step file for the new one.
Finnaly, open Gmsh, open the .geo file (that will load the step file), adjust the parameters for meshing and mesh as usual. Then export the mesh (as an .msh file) and import in Mecway, to have the conformal mesh with the different bodies as Mecway parts, but with coincident nodes at the common faces.

I took the import.geo file from the Gmsh install folder, it has some lines that should not be there for just importing and meshing. Have tried to do it directly in Mecway, importing the assembly step and then in the Gmsh meshing options importing this geo file, but even if a mesh is created, it shows some error and the resulting mesh is not usefull

@Victor , can be this option of meshing conformal part be included in next versions of Mecway?














Comments

  • Rename this file to import.geo to use it.
  • Thanks for showing this Sergio. It looks great! Especially where the edges of the holes meet the surfaces of the studs.

    What is the key setting that makes it work? Is it related to that Box and Sphere or are they just the leftover things you mentioned?

    I'll have a look later to try and work out why it doesn't work through Mecway.
  • This are the keys that make it work, still was unnable to make it work within Mecway, but works with Gmesh aplication. I has to read the Gmsh documentation to see what they are doing

    ------------------------------------------------

    SetFactory("OpenCASCADE");

    Mesh.CharacteristicLengthMin = 2;
    Mesh.CharacteristicLengthMax = 10;
    Mesh.CharacteristicLengthFactor = 0.75;

    SetOrder 2;
    OptimizeMesh "Gmsh";

    a() = ShapeFromFile("bracket_assy.STEP");

    r() = BooleanFragments{ Volume{a()}; Delete; }{};

    Physical Volume("Combined volume", 1) = {r()};
    Physical Surface("Combined boundary", 2) = CombinedBoundary{ Volume{r()}; };
  • I've simplified that code and got it working in Mecway. I think the key is to specify the full path to the STEP file. Here's the code to add to Custom Gmsh Commands:

    SetFactory("OpenCASCADE");
    a() = ShapeFromFile("C:\Full\Path\To\bracket_assy.STEP");
    r() = BooleanFragments{ Volume{a()}; Delete; }{};
    Physical Volume("Combined volume") = {r()};
    Physical Surface("Combined boundary") = CombinedBoundary{ Volume{r()}; };

    A problem is that it loses associativity of the surfaces but this is still a pretty simple way to get a good mesh from an assembly! So thanks a lot Sergio!

    image
  • That's great! Very often is quicker to have a conformal mesh than using TIE.
  • Have tried with two models and works, but is there a way to keep the different bodies separated?
  • No, sorry unless you open the .msh file using File -> Open/Import.
  • Hi Victor, Sergio,

    Did you find a way to keep the different bodies separated when meshing solids?
    Victor ¿Are you planning to implement this nice work around.?

    https://mecway.com/forum/profile/cashan commented some days ago that its main problem when working with mecway was getting "consistent" meshes.

    Cashan considers "If tis problem will be updated/solved - mecway will be very strong competitor for other very expensive software"

    This kind of elements (shells) do not have hidden parts once meshed like solids. It would be very easy to identify the different shell plates and assign them their own names and materials with the edge detecting selection tool.

  • Congratulations for your accurate work SERGIO.

    MANUEL
  • Thanks! In fact for conformal meshes still I prefer Salome.
  • @disla, not sure if Gmsh identifies the separate parts. If it does, perhaps I can get Mecway to read that information. But I wonder if that code Sergio posted merges it all into one homogeneous thing?
  • Sounds like a great job!
    At the moment, in my little Mecway experience, 50% of the problems are related to meshing when importing STP files from a CAD software, even when the Step file is well done with all the faces perfectly coinciding!
  • yeah, i have the same problem. sometimes the heal geometry feature in netgen will fix the problems. i'm not sure what the problems are though. in cad the files are valid. however, netgen will have problems with them anyways. it's very hit and miss. i couldn't use one cad program at all because it's step files wouldn't import.
  • Hi! I am afraid I did not understand, but to create a conformal meshes when I have more than one step, I normally use any program that can create a compounds like PrePoMax, and save the compound. After that, I import the saved compound file to MecWay and use netgen or gmsh to create a conformal mesh. It takes no more then a minute, ad it is very easy.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!