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: Failure to translate .stl file (https://www.cfd-online.com/Forums/mesh-generation/232503-gmsh-failure-translate-stl-file.html)

ryanc6 December 16, 2020 13:46

GMSH: Failure to translate .stl file
 
1 Attachment(s)
Hello all. I am new to cfd meshing and could use a little guidance regarding proper GMSH syntax and procedure.

Context: I am running a case of a vessel floating within a flowing river. For simplicity sake this is not a moving mesh. I have a larger background mesh which describes the control volume of the fluid. I need to import my .stl vessel and subtract that vessel from the domain.

Problem: After importing the .stl vessel I am unable to translate the .stl to the proper location within the mesh. For now the vessel is a rectangular prism. However, I will receive a more complex .stl later. Therefore I need to move the vessel from where it is imported (the local coordinate system of the .stl) into the proper place of the center of the background volume. I attached an image to reference here for further clarification.

Attempted Solutions: I first tried to use the GMSH gui and translate the vessel. I do not know why but the vessel never moved. Next, I tried to use commands by editing my .geo file. I tried to use the Translate command to move the Volume 1 and Surface 1. These are the correct tags because I imported the vessel first for this reason. For some reason this doesn't work. The vessel corner is still at 0,0 instead of my new location. I do not have any errors when loading the .geo file which would help me fix the problem. According to https://gmsh.info/doc/texinfo/gmsh.html#Transformations my Translate command should have moved the volume and surfaces, but it hasn't.


Any help is greatly appreciated. Thank you very much for your time.

Code:
For some reason I was unable to attach the geo and stl files. Instead, here is a copy of the .geo file. The stl is a ASCII file of a rectangular prism dimensions: 0.5,1,2.

Code:

SetFactory("Built-in");

Merge "vessel.stl";
Surface Loop (1)= {1};
Volume (1)= {1};

Point(1) = {0.0,0.064,-1.2,1};
Point(2) = {0.0,0.064,1.2,1};
Point(3) = {0.0,0.364,2.4,1};
Point(4) = {0.0,1.9,2.4,1};
Point(5) = {0.0,1.9,-2.4,1};
Point(6) = {0.0,0.364,-2.4,1};
Point(7) = {6.4,0.0,-1.2,1};
Point(8) = {6.4,0.0,1.2,1};
Point(9) = {6.4,0.3,2.4,1};
Point(10) = {6.4,1.9,2.4,1};
Point(11) = {6.4,1.9,-2.4,1};
Point(12) = {6.4,0.3,-2.4,1};

Line(1) = {1,2};
Line(2) = {2,3};
Line(3) = {3,4};
Line(4) = {4,5};
Line(5) = {5,6};
Line(6) = {6,1};

Line(7) = {7,8};
Line(8) = {8,9};
Line(9) = {9,10};
Line(10) = {10,11};
Line(11) = {11,12};
Line(12) = {12,7};

Line(13) = {1,7};
Line(14) = {2,8};
Line(15) = {3,9};
Line(16) = {4,10};
Line(17) = {5,11};
Line(18) = {6,12};

Curve Loop(2) = {4, 5, 6, 1, 2, 3};
Curve Loop(3) = {10, 11, 12, 7, 8, 9};
Curve Loop(4) = {4, 17, -10, -16};
Curve Loop(5) = {1, 14, -7, -13};
Curve Loop(6) = {5, 18, -11, -17};
Curve Loop(7) = {6, 13, -12, -18};
Curve Loop(8) = {9, -16, -3, 15};
Curve Loop(9) = {2, 15, -8, -14};

Plane Surface(2) = {2};
Plane Surface(3) = {3};
Plane Surface(4) = {4};
Plane Surface(5) = {5};
Plane Surface(6) = {6};
Plane Surface(7) = {7};
Plane Surface(8) = {8};
Plane Surface(9) = {9};

Surface Loop(2) = {1, 3, 5, 6, 4, 8, 7, 2};

Translate {3.2,0.5,-1} { Volume{1}; Surface{1}; }




ryanc6 April 15, 2021 09:30

Update:
 
I have concluded that as of GMSH 4.8.3 the failure to translate STL volumes is a bug. However, for anyone who has potential problems like this in the future, there is a work around.



First convert the stl to an IGES or similar type. GMSH then has no problem translating the file via the normal method of translation specified in the documentation. (4.8.3 Translation documentation here: https://gmsh.info/doc/texinfo/gmsh.h...formations)You can then run the 2d mesh and export that mesh as an stl. When exporting it should retain the translated global coordinate system location.



Hope this helps.


All times are GMT -4. The time now is 11:10.