CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Special Topics > Mesh Generation & Pre-Processing

GMSH: Failure to translate .stl file

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 16, 2020, 14:46
Default GMSH: Failure to translate .stl file
  #1
New Member
 
Join Date: Jun 2019
Location: United States
Posts: 15
Rep Power: 7
ryanc6 is on a distinguished road
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}; }


Attached Images
File Type: jpg Screenshot (41).jpg (47.2 KB, 11 views)
ryanc6 is offline   Reply With Quote

Old   April 15, 2021, 10:30
Default Update:
  #2
New Member
 
Join Date: Jun 2019
Location: United States
Posts: 15
Rep Power: 7
ryanc6 is on a distinguished road
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.
ryanc6 is offline   Reply With Quote

Reply

Tags
gmsh 4.7.1


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using PengRobinsonGas EoS with sprayFoam Jabo OpenFOAM Running, Solving & CFD 36 July 16, 2024 04:52
polynomial BC srv537 OpenFOAM Pre-Processing 4 December 3, 2016 10:07
[OpenFOAM.org] Compile OF 2.3 on Mac OS X .... the patch gschaider OpenFOAM Installation 225 August 25, 2015 20:43
centOS 5.6 : paraFoam not working yossi OpenFOAM Installation 2 October 9, 2013 02:41
ParaView Compilation jakaranda OpenFOAM Installation 3 October 27, 2008 12:46


All times are GMT -4. The time now is 13:15.