|
[Sponsors] |
June 13, 2022, 11:26 |
F_W(f,t) crashing inside c_face_loop
|
#1 |
New Member
Max
Join Date: Feb 2022
Posts: 8
Rep Power: 4 |
Hi,
I would like to do some calculation for each cell depending on its faces. Therefore I tried to loop over all cell threads, followed by a cell loop and inside this I added the loop over all faces of a single cell. Up to this my code works fine... Also calculation of the face "IDs" and face threads. Calling functions like F_CENTROID also works quite good but if I wanna use F_W, I get some errors/segmentation faults and crashes... Here is my code with cc is the integer for the cells fc is the integer for faces in cell system ff is the integer for faces in face system tc is the pointer to my cell threads tf is the pointer to my face threads Code:
DEFINE_EXECUTE_ON_LOADING(FaceLoop, libname) { cell_t cc; face_t fc, ff; Thread *tc, *tf; Domain *d = Get_Domain(1); real xf[ND_ND]; thread_loop_c(tc,d) { begin_c_loop(cc,tc) { c_face_loop(cc,tc,fc) { ff = C_FACE(cc,tc,fc); tf = C_FACE_THREAD(cc,tc,fc); if(BOUNDARY_FACE_THREAD_P(tf) != 0) // Face is part of boundary field { F_CENTROID(xf,ff,tf); //F_AREA(A,ff,tf); // Also works Message("%d %d || %g %g %g || %g %g\n",ff,tf,xf[0],xf[1],xf[2],C_W(cc,tc),F_W(ff,tf)); } } } end_c_loop(c,t) } } What I mean is, that for e.g. a simple example of 10 cells in Z-direction, 1 cell in X- and Y-direction, all boundary cells that surround my cell center should have the same value (when inlet velocity is given only in Z-direction). But the print out from message shows four different values for each face of a cell. Interesting is that over all cells, I can find each value of F_W four times, meaning there is something wrong with the order of printing/function calling. Why do I need to use F_W as function of my cell counting system, and not as function of my face system (I expected that both should result in the same value, but one does not work and one is wrong)? Thanks for any help in advance Max |
|
June 14, 2022, 07:49 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
fc should be integer not face_t type, may be this could be the problem
if you are running in parallel message function could write 4 times in case you are using 4 cores
__________________
best regards ****************************** press LIKE if this message was helpful |
|
June 14, 2022, 10:30 |
|
#3 |
New Member
Max
Join Date: Feb 2022
Posts: 8
Rep Power: 4 |
Hello
and thank you for the answer. The simulation is done in serial so this can not be the problem. Also I have tried out to change fc to an integer which results in the same error. If I´m right, cell_t and face_t should be also integer just as a synonym when using fluent udf. I also know that my output is not 100% correct since I print a pointer as an integer. This is just to see some output, removing the whole print line does not change my error. Any other ideas? Thanks Max |
|
Tags |
c_face_loop, f_w |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
fixValues inside of a Mesh openFoam | syntex | Main CFD Forum | 1 | May 20, 2019 07:10 |
[snappyHexMesh] snappyHexMesh not deleting the inside cells | Bdew8556 | OpenFOAM Meshing & Mesh Conversion | 9 | May 14, 2019 11:53 |
regarding simulation of heat and mass transfer inside thermosyphon | 1757003@kiit.ac.in | ANSYS | 1 | May 14, 2019 03:06 |
Immersed Solid Momentum Sources inside function | Martinw | CFX | 1 | October 10, 2013 18:14 |
How to determine a point is inside a tetrahedral? | G.P. Xia | Main CFD Forum | 16 | January 12, 2000 12:15 |