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

Accessing value at the corner of a mesh

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 9, 2010, 10:53
Default Accessing value at the corner of a mesh
  #1
Senior Member
 
Ben K
Join Date: Feb 2010
Location: Ottawa, Canada
Posts: 140
Rep Power: 19
benk is on a distinguished road
Hi, I'm trying to get the value at the corner of a 2D mesh. I can easily get the values along the boundary by doing something like:

Code:
label topWall = 2DMesh.boundaryMesh().findPatchID("topWall");
fixedGradientFvPatchScalarField& bufferC = refCast<fixedGradientFvPatchScalarField>(C2D.boundaryField()[topWall]);
scalarField& valC  = bufferC;
	
forAll (valCsPositive, i)
{
cBoundary[i] =   C2D.boundaryField()[topWall][i];
}
But this doesn't include the values at the corners. How can I get these?

I've tried something like this which I found from http://www.cfd-online.com/Forums/ope...iven-cell.html:

Code:
vector probePoint(x,y,z); //these are the coordinates of the value I need
label probeCell = mesh.findCell(probePoint); // this is the nearest cell to the point that I need
const cell& c = mesh.cells()[probeCell]; // a cell is a list of faces 

forAll (c, i) 
{ 
// This gives you the patch ID for a face. If the face is internal, you get -1 
label patchID = mesh.boundaryMesh().whichPatch(c[i]); 

if (patchID > -1) 
{ 
label faceID = mesh.boundaryMesh()[patchID].whichFace(c[i]); 

Info << "values=" << field.boundaryField()[patchID][faceID] << endl;

} 
}
But this will only give me the values at the patches of the specified cell (not the corner) and moreover, it gives me a segmentation fault during runtime after spitting out the values at the patches.
benk is offline   Reply With Quote

Old   December 9, 2010, 17:39
Default
  #2
Senior Member
 
Julien de Charentenay
Join Date: Jun 2009
Location: Australia
Posts: 231
Rep Power: 17
julien.decharentenay is on a distinguished road
Send a message via Skype™ to julien.decharentenay
I am no expert in OpenFoam. But it looks like you might be trying to access a node value, whilst OpenFoam only let you access the face values.
julien.decharentenay 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] Number of cells in mesh don't match with size of cellLevel colinB OpenFOAM Meshing & Mesh Conversion 14 December 12, 2018 08:07
[ICEM] Generating Mesh for STL Car in Windtunnel Simulation tommymoose ANSYS Meshing & Geometry 48 April 15, 2013 04:24
[ICEM] how to mesh a sail (and the rest of the boat) matteoL ANSYS Meshing & Geometry 4 May 7, 2012 10:23
engrid -> save as .stl with boundarie codes Zymon enGrid 31 August 29, 2011 13:40
Icemcfd 11: Loss of mesh from surface mesh option? Joe CFX 2 March 26, 2007 18:10


All times are GMT -4. The time now is 20:35.