CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

2D C++ code for reading mesh (gmsh)

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By mprinkey

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 27, 2016, 09:15
Default 2D C++ code for reading mesh (gmsh)
  #1
Member
 
LUQILIN
Join Date: May 2016
Location: Harbin, China
Posts: 35
Rep Power: 9
LUQILIN is on a distinguished road
Hi Guys,
I want to write my own C++ code for 2D flow problems while I have difficulties for reading 2D mesh. I use the mesh generator called Gmsh.

Could anyone give me some advice? If there are for some open codes for beginners, that would be very helpful.

Thank You.
LUQILIN is offline   Reply With Quote

Old   August 27, 2016, 17:10
Default
  #2
Senior Member
 
Michael Prinkey
Join Date: Mar 2009
Location: Pittsburgh PA
Posts: 363
Rep Power: 25
mprinkey will become famous soon enough
The gmsh file format is easily available:

http://gmsh.info/doc/texinfo/gmsh.ht...II-file-format

OpenFVM using gmsh for its mesh input format and it is written in C. OpenFOAM has a gmsh input filter that is written in C++. You could refer to those.

Honestly though, the *hard* part here is sorting out how your are going to store face, cell, node, and edge data, both location and property data, but also connectivity and access structures. Those design decisions will drive the way you read the mesh file and populate the data structures. So, example code is not really going to be very helpful unless you are using the same data structures...and at that point, then why are you not just using the other code as a base.

Good luck.
arjun likes this.
mprinkey is offline   Reply With Quote

Old   August 27, 2016, 20:07
Default
  #3
Member
 
LUQILIN
Join Date: May 2016
Location: Harbin, China
Posts: 35
Rep Power: 9
LUQILIN is on a distinguished road
Thank you very much.
LUQILIN 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
[snappyHexMesh] Add Mesh Layers doesnt work on the whole surface Kryo OpenFOAM Meshing & Mesh Conversion 13 February 17, 2022 07:34
Very small job: converting an OpenFOAM mesh to a format needed by another code SFr CFD Freelancers 1 June 24, 2016 05:45
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20
3D Hybrid Mesh Errors DarrenC ANSYS Meshing & Geometry 11 August 5, 2013 06:42
[Gmsh] background mesh in gmsh Nick_J OpenFOAM Meshing & Mesh Conversion 1 March 20, 2013 04:20


All times are GMT -4. The time now is 03:47.