CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Mesh Generation & Pre-Processing (https://www.cfd-online.com/Forums/mesh-generation/)
-   -   [GMSH] extrude rotation from arbitrary OpenCASCADE center (https://www.cfd-online.com/Forums/mesh-generation/240968-gmsh-extrude-rotation-arbitrary-opencascade-center.html)

crubio.abujas February 2, 2022 13:44

[GMSH] extrude rotation from arbitrary OpenCASCADE center
 
1 Attachment(s)
Hello everyone,

I'm trying to create a boundary around a cylinder in gmsh from a STEP file.
My idea is to extrude the seam line to generate a plane and afterwards revolute the plane around the cylinder axis. This approach is successfull as long as the center is precisely, but as soon as minor deviation are present the meshing crashes.

For simple models this works fine as I can cheat the axis to be in exact position, but for real geometries this center would not be in general positioned in a rounded number point. I've tried to add the considered by the CAD software for all the decimals available with success. I guess I need to use the exact position gmsh is using. I've seen that there is a property in gmsh which can be used for this (CenterOfMass), but I cannot make it work.

Code:


SetFactory("OpenCASCADE");

 Merge "Piece.step";


 // Extrude the seam line
Extrude {2, 0, 0} {
    Line{24}; Layers{3}; Recombine;
}

// First half
Extrude {{0, 0, 1}, {CenterOfMass Curve{19} }, Pi} {
    Surface{22}; Layers{30}; Recombine;
}
// Second half
Extrude {{0, 0, 1}, {0,30,0}, Pi} {
    Surface{27}; Layers{30}; Recombine;
}

Coherence;

But it gives me a syntax error. I've been checking the gmsh documentation and CenterOfMass Curve|Surface|Volume {expression} is a valid expresion-list-item so it shall work. I've also tried to save it in an external variable:


Code:

...

com() = CenterOfMass Curve {19};
Printf("",com());

Extrude {{0, 0, 1}, { com() }, Pi} {
    Surface{22}; Layers{30}; Recombine;
}
...

It prints me the center of mass on the Printf statement, but it gives me a syntax error when using it. Trying to manually introduce these coordinates lead to the same error.

Does anybody knows how to deal with this issue?


All times are GMT -4. The time now is 20:24.