|
[Sponsors] |
August 24, 2014, 12:31 |
number of cells in each direction
|
#1 |
Senior Member
Join Date: Dec 2011
Posts: 121
Rep Power: 14 |
Hi,
Assume that i have a simple cubic domain with Cartesian grids. Does anybody know how i can access these values, either with a function, or accessing to the 'blockMeshDict' file. 1) number of cells in each direction. I know mesh.nCells() or mesh.cells().size() returns the total number of cells, but i need the number in each direction. 2) length of the domain (x, y and z) 3) length of cells edges in each direction to have dx, dy and dz.(the cells are uniform in each direction) (at the moment, i compute dx, dy and dz by computing the distance between cell's centers, but i'm looking for any other ways) Of course, either (1) or (2) can solve my problem, because having two of those three cases can be used to evaluate the remained one. Tnx, |
|
August 24, 2014, 22:40 |
|
#2 |
Member
Christian Butcher
Join Date: Jul 2013
Location: Japan
Posts: 85
Rep Power: 12 |
If you have access to the polyMesh object, then
Code:
meshObject.edges()[edgeLabel].mag() Using Code:
labelList listOfCellEdges(meshObject.cEdges()[cellLabel]); forAll(listOfCellEdges, edgeI) { // Iterate through the edges of cellI, which if your cells are uniform, // can be any cell // Use meshObject.edges()[edgeI].vec() to get the vector along the edge, or // meshObject.edges()[edgeI].mag() to get it's magnitude. } Comparing these with the directions you're interested in shouldn't be too hard, I don't think. Then you just need to selectively store the ones you're interested in (eg first x, first y, first z direction). If your region is cube/cuboid, then you can get the range of the directions by taking Code:
vector extent(mesh_.cellCentres[mesh_.nCells()] - mesh_.cellCentres[0]); extent += vector(dx, dy, dz) // where dx,y,z are set already, // since these take cell centres... scalar sizeInXDirection = extent[0]; //etc |
|
August 26, 2014, 02:35 |
|
#3 |
Senior Member
|
Are you trying to replicate a structured code on the unstructured FV method, implemented in OpenFOAM?
__________________
Blog: sourceflux.de/blog "The OpenFOAM Technology Primer": sourceflux.de/book Twitter: @sourceflux_de Interested in courses on OpenFOAM? |
|
August 26, 2014, 04:38 |
|
#4 |
Senior Member
Join Date: Dec 2011
Posts: 121
Rep Power: 14 |
||
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[mesh manipulation] Mesh Refinement | Luiz Eduardo Bittencourt Sampaio (Sampaio) | OpenFOAM Meshing & Mesh Conversion | 42 | January 8, 2017 12:55 |
Getting crazy with all the problems I have in OpenFoam | Nicacio | OpenFOAM Running, Solving & CFD | 7 | June 9, 2014 19:08 |
Cluster ID's not contiguous in compute-nodes domain. ??? | Shogan | FLUENT | 1 | May 28, 2014 15:03 |
[Other] Number of cells in each direction | IvanaS | OpenFOAM Meshing & Mesh Conversion | 3 | April 16, 2013 06:05 |
Unaligned accesses on IA64 | andre | OpenFOAM | 5 | June 23, 2008 10:37 |