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

Gmsh - Bounding a Step file for Flow Visualisation

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 15, 2020, 03:30
Default Gmsh - Bounding a Step file for Flow Visualisation
  #1
New Member
 
Wesley Brooks
Join Date: Dec 2020
Posts: 2
Rep Power: 0
DocTrucker is on a distinguished road
Hi All,


I am working with *.geo files with a view to import a step file (opencascade), create a scaled up bounding box around the file and mesh it for fluid flow visualisation.


I can see the box and CAD on the gmsh gui, but the meshing goes through the Step volume. I tried using a boolean option, but the reference to the external faces was lost, and the mesh control was lost.


Can anyone share a link to a worked example that may help my learning?


Thanks. I will add my geo file when I get to my computer.
DocTrucker is offline   Reply With Quote

Old   December 15, 2020, 04:10
Default
  #2
New Member
 
Wesley Brooks
Join Date: Dec 2020
Posts: 2
Rep Power: 0
DocTrucker is on a distinguished road
As promised, this is what my *.geo is looking like at the moment:

Code:
gridsize = 0.05;

SetFactory("OpenCASCADE");

Geometry.OCCTargetUnit = "M";

v() = ShapeFromFile("CAD/Vehicle.step");
Physical Volume("vehicle") = v();

bbox() = BoundingBox Volume{v()};

xmin = bbox(0);
ymin = bbox(1);
zmin = bbox(2);
xmax = bbox(3);
ymax = bbox(4);
zmax = bbox(5);

dx = xmax - xmin;
dy = ymax - ymin;
dz = zmax - zmin;

cx = (xmax + xmin)/2.0;
cy = (ymax + ymin)/2.0;
cz = (zmax + zmin)/2.0;

g_dx = dx * 1.5;
g_dy = dy * 1.5;
g_dz = dz * 3.0; 

g_xmin = cx - (g_dx/2.0);
g_xmax = cx + (g_dx/2.0); 
g_ymin = cy - (g_dy/2.0);
g_ymax = cy + (g_dy/2.0); 
g_zmin = cz - (g_dz/2.0);
g_zmax = cz + (g_dz/2.0);

next_point_tag = newp;

Point(next_point_tag+0) = {g_xmin, g_ymin, g_zmin, gridsize};
Point(next_point_tag+1) = {g_xmax, g_ymin, g_zmin, gridsize};
Point(next_point_tag+2) = {g_xmax, g_ymax, g_zmin, gridsize};
Point(next_point_tag+3) = {g_xmin, g_ymax, g_zmin, gridsize};

next_curve_tag = newl;

Line(next_curve_tag+0) = {next_point_tag+0, next_point_tag+1};
Line(next_curve_tag+1) = {next_point_tag+1, next_point_tag+2};
Line(next_curve_tag+2) = {next_point_tag+2, next_point_tag+3};
Line(next_curve_tag+3) = {next_point_tag+3, next_point_tag+0};

next_curve_loop_tag = newll;

Line Loop(next_curve_loop_tag+0) = {next_curve_tag+0, next_curve_tag+1, next_curve_tag+2, next_curve_tag+3};

next_suface_tag = news;

Plane Surface(next_suface_tag+0) = next_curve_loop_tag+0;

Transfinite Surface {next_suface_tag+0};
Recombine Surface {next_suface_tag+0};

//+0.000001 Bodge on extrude to get all layers.
surfaceVector[] = 
Extrude {0, 0, g_dz+0.00001} {
    Surface{next_suface_tag+0};
    Layers{Round(g_dz/gridsize)};
    Recombine; 
};

Physical Surface("bottom") = {next_suface_tag+0};
Physical Surface("top") = surfaceVector[0];
Physical Surface("back") = surfaceVector[2];
Physical Surface("right") = surfaceVector[3];
Physical Surface("front") = surfaceVector[4];
Physical Surface("left") = surfaceVector[5];
Physical Volume("fluid") = surfaceVector[1];

next_volume_tag = newv;

//BooleanDifference(next_volume_tag) = { Volume{"fluid"}; Delete; }{ Volume{"vehicle"}; Delete; };
//BooleanDifference(next_volume_tag) = { Volume{surfaceVector[1]};}{ Volume{v()};};
BooleanDifference(next_volume_tag) = { Volume{surfaceVector[1]}; Delete; }{ Volume{v()}; Delete; };

 Physical Volume("tunnel") = next_volume_tag;
Edit: Advice on what to do to avoid the 'bodge' would also be appreciated! Without this I get an error after clicking 3D on the gmsh GUI that is a list of points that it can't find. Likely ones that are co-incident with the top of the extrusion.


Edit2: I am now working through the https://wiki.openfoam.com/"3_weeks"_series tutorial series.

Last edited by DocTrucker; December 15, 2020 at 05:14.
DocTrucker is offline   Reply With Quote

Old   November 29, 2021, 11:03
Default
  #3
New Member
 
Andrea Michelotti
Join Date: Mar 2021
Posts: 12
Rep Power: 3
AndreaMichelotti is on a distinguished road
Hi!

Have you solved the problem? I am facing the same issue simulating a wing.
AndreaMichelotti is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 35 April 29, 2022 16:35
[foam-extend.org] Problems installing foam-extend-4.0 on openSUSE 42.2 and Ubuntu 16.04 ordinary OpenFOAM Installation 19 September 3, 2019 19:13
OpenFoam "Permission denied" and "command not found" problems. iyidaniel@yahoo.co.uk OpenFOAM Running, Solving & CFD 11 January 2, 2018 07:47
[foam-extend.org] problem when installing foam-extend-1.6 Thomas pan OpenFOAM Installation 7 September 9, 2015 22:53
[OpenFOAM.org] Compile OF 2.3 on Mac OS X .... the patch gschaider OpenFOAM Installation 225 August 25, 2015 20:43


All times are GMT -4. The time now is 21:55.