|
[Sponsors] |
code for locating cell faces in domain isn't working as intended |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 16, 2015, 18:51 |
code for locating cell faces in domain isn't working as intended
|
#1 |
New Member
Join Date: Apr 2015
Posts: 7
Rep Power: 11 |
My geometry is rod with radius 0.3m and a concentric cylinder with radius 1.5m. The right face of the geometry serves as the window for radiation input. I've split faces on the window (which consists of the two faces, the rod and the cylinder face) and now I am trying to locate all the split faces. The code I've written only locates faces from 0 to 0.3m. I am using the thread_loop_f function so it should locate ALL the faces in the domain, but it doesnt. I am trying to locate all split faces located at z=0, Can someone help me? Thank you in advance.
#include "udf.h" DEFINE_ON_DEMAND(count_window) { FILE *win_data; real face_c[3]; real face_a[3]; real r; real crit; Domain *d; cell_t c; Thread *t; face_t f; int ID; crit = 1.5; win_data = fopen("window_data.txt","w"); d=Get_Domain(1); printf("Locating window faces...\n"); thread_loop_f(t,d){ F_CENTROID(face_c,f,t); F_AREA(face_a,f,t); ID = THREAD_ID(t); r = sqrt(face_c[0]*face_c[0]+face_c[1]*face_c[1]+face_c[2]*face_c[2]); if(r<=crit && face_c[2]==0){ fprintf(win_data,"%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%. 3e\t%d\n",face_c[0],face_c[1],face_c[2],face_a[0],face_a[1],face_a[2],ID); } } printf("done.\n"); fclose(win_data); } |
|
June 16, 2015, 19:05 |
|
#2 | |
New Member
Join Date: Apr 2015
Posts: 7
Rep Power: 11 |
Quote:
I figured out the answer.. There wasn't anything wrong with the thread_loop_f function. The code wrote all faces at z=0. However the faces I was looking for were at z=-3.44e-17. So I rewrote the bounds crit = -4e-17; if(face_c[2]>=crit && face_c[2]<=0) Thanks for the help. This forum is great! |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Foam::error::PrintStack | almir | OpenFOAM Running, Solving & CFD | 92 | May 21, 2024 08:56 |
[snappyHexMesh] Add Mesh Layers doesnt work on the whole surface | Kryo | OpenFOAM Meshing & Mesh Conversion | 13 | February 17, 2022 08:34 |
[Other] refineWallLayer Error | Yuby | OpenFOAM Meshing & Mesh Conversion | 2 | November 11, 2021 12:04 |
injection problem | Mark New | FLUENT | 0 | August 4, 2013 02:30 |
Design Integration with CFD? | John C. Chien | Main CFD Forum | 19 | May 17, 2001 16:56 |