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

[Other] Mesh Coordinates?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 14, 2015, 13:09
Default Mesh Coordinates?
  #1
New Member
 
Joshua Hinton
Join Date: May 2015
Location: Boca Raton, FL
Posts: 7
Rep Power: 11
jhint9 is on a distinguished road
Is there any way to extract the coordinates of surface cells? As in the 8 corners of each individual cell on the surface of an object once it is meshed. It's not imperative, but I have been tasked with trying. Thanks for any info!
jhint9 is offline   Reply With Quote

Old   July 16, 2015, 09:12
Smile
  #2
Senior Member
 
Join Date: Sep 2010
Posts: 226
Rep Power: 17
T.D. is on a distinguished road
Hi,

Try this:

Code:
forAll(mesh.C(),i)
{
    const unallocLabelList& ne = mesh.cellPoints()[i];  
    forAll(ne, neI)
    {
        const unallocLabelList& ne_adj = mesh.pointCells()[ne[neI]]; 
        forAll(ne_adj, ne_adjI)
        {
            
        vector Coord = mesh.C()[ne_adj[ne_adjI]];

        // then Do what you want with the vector Coord
        }
    }
}
Reagrds,
T.D.

Quote:
Originally Posted by jhint9 View Post
Is there any way to extract the coordinates of surface cells? As in the 8 corners of each individual cell on the surface of an object once it is meshed. It's not imperative, but I have been tasked with trying. Thanks for any info!
T.D. is offline   Reply With Quote

Old   July 18, 2015, 19:24
Default
  #3
New Member
 
Joshua Hinton
Join Date: May 2015
Location: Boca Raton, FL
Posts: 7
Rep Power: 11
jhint9 is on a distinguished road
Thanks for the info!
I saved the code in its own file name "coor"
I tried it and I'm getting a syntax error that reads:

./coor: line 1: syntax error near unexpected token `mesh.C'
./coor: line 1: `forAll(mesh.C(),i)'

I tried removing some parenthesis but then it didn't like the "i" argument.
Any ideas? Thanks again!

- Josh
jhint9 is offline   Reply With Quote

Old   July 24, 2015, 05:08
Default
  #4
J-P
New Member
 
Jukka-Pekka Keskinen
Join Date: Dec 2009
Location: Helsinki
Posts: 3
Rep Power: 16
J-P is on a distinguished road
Quote:
Originally Posted by jhint9 View Post
Thanks for the info!
I saved the code in its own file name "coor"
I tried it and I'm getting a syntax error that reads:

./coor: line 1: syntax error near unexpected token `mesh.C'
./coor: line 1: `forAll(mesh.C(),i)'

I tried removing some parenthesis but then it didn't like the "i" argument.
Any ideas? Thanks again!

- Josh
To me it seems that you tried executing the code as a shell script, which is incorrect. What you should do is to include the given piece of code to your solver or utility, compile it, and then run it with the case or mesh you are working with. The OF user's guide will tell you how to get started with making your own version of a solver or an utility.

J-P
J-P is offline   Reply With Quote

Old   July 25, 2015, 10:42
Default
  #5
New Member
 
Joshua Hinton
Join Date: May 2015
Location: Boca Raton, FL
Posts: 7
Rep Power: 11
jhint9 is on a distinguished road
That probably explains it. I'll spend some time looking into that. Thanks!

- Josh
jhint9 is offline   Reply With Quote

Old   December 19, 2016, 10:36
Default Where to put the code in?
  #6
New Member
 
HuangXin
Join Date: Dec 2016
Posts: 7
Rep Power: 9
Hxchange is on a distinguished road
Quote:
Originally Posted by J-P View Post
To me it seems that you tried executing the code as a shell script, which is incorrect. What you should do is to include the given piece of code to your solver or utility, compile it, and then run it with the case or mesh you are working with. The OF user's guide will tell you how to get started with making your own version of a solver or an utility.

J-P
Hey, I have the same question ,and I want to know which file should I add your code into? Sorry I dont konw much about OpenFOAM.
I used snappyMesh and chtMultiRegionSimpleFoam ,where should I put your code into?
I want to get the cooridates of all the cells ,8 points for each cells, instead of only the cell centre points.
Thank you!
Hxchange 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
y+ = 1 boundary layer mesh with snappyHexMesh Arzed23 OpenFOAM Running, Solving & CFD 6 November 23, 2022 16:15
[ICEM] Problem making structural mesh on a surface froztbear ANSYS Meshing & Geometry 1 November 10, 2011 09:52
[snappyHexMesh] snappyHexMesh won't work - zeros everywhere! sc298 OpenFOAM Meshing & Mesh Conversion 2 March 27, 2011 22:11
[snappyHexMesh] external flow with snappyHexMesh chelvistero OpenFOAM Meshing & Mesh Conversion 11 January 15, 2010 20:43
Icemcfd 11: Loss of mesh from surface mesh option? Joe CFX 2 March 26, 2007 19:10


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