CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[Gmsh] GmshToFoam: Problem meshing a circle in a square

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By alexeym
  • 1 Post By alexeym

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 9, 2016, 14:13
Default GmshToFoam: Problem meshing a circle in a square
  #1
New Member
 
Paul
Join Date: Jun 2016
Posts: 21
Rep Power: 10
ChasingNeutrons is on a distinguished road
Hi guys,

I'm trying to make a simple 2D (well, 3D in OpenFOAM!) mesh using Gmsh. Here's how I've written it:

Code:
//Inputs
w=1;//m
h=1;//m
r=0.3;//m
gridsize=w/20;

Point(1) = {0, 0, 0, gridsize};
Point(2) = {w, 0, 0, gridsize};
Point(3) = {w, h, 0, gridsize};
Point(4) = {0, h, 0, gridsize};
Point(5) = {w/2, h/2, 0, gridsize};
Point(6) = {(r+w/2), h/2, 0, gridsize};
Point(7) = {w/2, (r+h/2), 0, gridsize};
Point(8) = {(-r+w/2), h/2, 0, gridsize};
Point(9) = {w/2, (-r+h/2), 0, gridsize};
Line(1) = {4, 3};
Line(2) = {3, 2};
Line(3) = {2, 1};
Line(4) = {1, 4};
Circle(5) = {8, 5, 7};
Circle(6) = {7, 5, 6};
Circle(7) = {6, 5, 9};
Circle(8) = {9, 5, 8};
Line Loop(1) = {5, 6, 7, 8};
Line Loop(2) = {4, 1, 2, 3};
Ruled Surface(1) = {1};
Plane Surface(2) = {2, 1};
surfaceVector[] = Extrude {0, 0, 0.1} {
Surface{1,2};
Layers{1};
Recombine;};
Physical Volume("internal") = surfaceVector[1];
Physical Surface("LeftWall")=surfaceVector[2];
Physical Surface("RightWall")=surfaceVector[4];
Physical Surface("BottomWall")=surfaceVector[5];
Physical Surface("TopWall")=surfaceVector[3];
It seems to mesh all right when I run gmsh -3. However, when I run gmshToFoam I get a seg fault immediately after 'Create Time'. Does anyone have any suggestions on getting this thing working? I'm optimistic that such a simple geometry shouldn't pose too much of a challenge!

Cheers.
ChasingNeutrons is offline   Reply With Quote

Old   July 9, 2016, 19:45
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,938
Rep Power: 39
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

Can not reproduce your error with Gmsh 2.12.0 and neither with OpenFOAM 4.x, nor with OpenFOAM 2.4.x.

Though one of peculiarities of your geo file is that gmsh -3 produces only mesh inside circle, so, guess, you need to describe what you are trying to achieve, since "meshing a circle in a square" is rather vague.
alexeym is offline   Reply With Quote

Old   July 10, 2016, 09:32
Default
  #3
New Member
 
Paul
Join Date: Jun 2016
Posts: 21
Rep Power: 10
ChasingNeutrons is on a distinguished road
Hi Alexey, thanks for your reply.

Apologies for the vagueness - on a second read of the post it is a bit lacking!

What I'm trying to make is a mesh of a 'unit cell' in a nuclear reactor, i.e., a circular fuel pin surrounded by a square region of coolant. However, I'm not actually interested in the CFD aspects, rather the neutronics and hence I'm trying to mesh both of these parts of the cell together, albeit as regions with ultimately different properties. Also, I want to ensure that this mesh only has one layer as it's a 2D simulation I intend to run.

I now realise that while I did indeed get it to successfully mesh, it only meshes either the circular or square region with a hole, depending upon the order the surfaces are written in the extrude command.

From there, placing the .msh file in the system folder, when I run gmshToFoam XXXX.msh in the case file the segFault occurs:
Code:
Create time


#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::sigSegv::sigHandler(int) at ??:?
#2  ? in "/lib/x86_64-linux-gnu/libc.so.6"
#3  Foam::PtrList<Foam::polyPatch>::operator[](int) const at ??:?
#4  ? at ??:?
#5  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#6  ? at ??:?Segmentation fault (core dumped)
It is entirely possible that I'm doing something quite stupid. However, I suspect at least one part of the failure may be that (whether circular or square mesh) there's no wall defined around what is the hole in the square mesh or the circumference in the circular mesh. Ideally of course this shouldn't be a concern as I would like the two meshes joined together but it might be one part of the problem!
ChasingNeutrons is offline   Reply With Quote

Old   July 10, 2016, 10:10
Default
  #4
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,938
Rep Power: 39
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

The error you are mentioning in the last message is caused by non-existent XXXX.msh, since you put it into system folder and run gmshToFoam (I guess) from case folder.

Either put XXXX.msh into case folder, or run gmshToFoam system/XXXX.msh.
ChasingNeutrons likes this.
alexeym is offline   Reply With Quote

Old   July 10, 2016, 10:46
Default
  #5
New Member
 
Paul
Join Date: Jun 2016
Posts: 21
Rep Power: 10
ChasingNeutrons is on a distinguished road
Knew it was something stupid - thank you very much Alexey.

If anyone happens to know how I might combine the circular and square meshes that would also be brilliant although I do suspect it won't prove too difficult in the end!
ChasingNeutrons is offline   Reply With Quote

Old   July 10, 2016, 11:14
Default
  #6
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,938
Rep Power: 39
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Oh, I have missed second.

The reason for fancy meshing could be usage of the hole during construction of plane. Usually I try to avoid this functionality and split plane into continuous pieces. You can find example attached to the message.

Differences from your geo in your initial are:
- Mesh center is in (0, 0, 0).
- Sizes of cells are controlled by variables d1 (point density on the outer lines), d2 (points density on the internal lines), d3 (points density on the circle arcs) rather than by parameter in points definition.
Attached Files
File Type: gz test.geo.gz (579 Bytes, 16 views)
ChasingNeutrons likes this.
alexeym is offline   Reply With Quote

Reply


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
[ANSYS Meshing] ANSYS Meshing Problem Saikat_FM ANSYS Meshing & Geometry 1 September 15, 2016 03:25
[ICEM] Problem with meshing half NACA0009 in 3D Eizo ANSYS Meshing & Geometry 30 February 17, 2013 03:40
[snappyHexMesh] snappyHexMesh: problem meshing baffle (surface with zero thickness) julien.decharentenay OpenFOAM Meshing & Mesh Conversion 7 June 16, 2012 09:12
[GAMBIT] 3D boundary layer and meshing problem in GAMBIT 2.4.6 prashanthreddyh ANSYS Meshing & Geometry 1 December 20, 2011 01:35
GAMBIT meshing problem Gauthier Lambert Main CFD Forum 1 August 3, 2000 10:22


All times are GMT -4. The time now is 12:18.