|
[Sponsors] |
March 28, 2023, 02:43 |
Count number of cells
|
#1 |
Member
BM
Join Date: Sep 2021
Posts: 35
Rep Power: 5 |
I am trying to extract the number of cells in each cell zone (for use in a separate calculation) with the following UDF:
Code:
#include “udf.h” #include “prox.h” DEFINE_ON_DEMAND(compute) { #if !RP_HOST Domain *domain; Thread *tc; domain = Get_Domain(ROOT_DOMAIN_ID); if (I_AM_NODE_ZERO_P) { int ntc = 0; int nc; thread_loop_c(tc,domain) { ntc += 1; nc = 0; begin_c_loop(c,tc) { nc += 1; } end_c_loop(c,tc) Message(“Number of cells: %d\n”,nc); } Message(“Number of cell threads: %d\n”,ntc); } #endif } I am also only doing the loop over node 0 for other reasons which I won't get in to. |
|
Tags |
udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Seakeeping Solver:Crashed | akbarbagusd | Fidelity CFD | 0 | November 5, 2021 13:42 |
decomposePar problem: Cell 0contains face labels out of range | vaina74 | OpenFOAM Pre-Processing | 37 | July 20, 2020 06:38 |
[snappyHexMesh] Error snappyhexmesh - Multiple outside loops | avinashjagdale | OpenFOAM Meshing & Mesh Conversion | 53 | March 8, 2019 10:42 |
[mesh manipulation] Mesh Refinement | Luiz Eduardo Bittencourt Sampaio (Sampaio) | OpenFOAM Meshing & Mesh Conversion | 42 | January 8, 2017 13:55 |
[snappyHexMesh] snappyHexMesh won't work - zeros everywhere! | sc298 | OpenFOAM Meshing & Mesh Conversion | 2 | March 27, 2011 22:11 |