|
[Sponsors] |
probelm about UDF marco called "CX_Find_Cell_With_Point" |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 28, 2020, 22:56 |
probelm about UDF marco called "CX_Find_Cell_With_Point"
|
#1 |
New Member
Hongli LIU
Join Date: Jun 2020
Posts: 3
Rep Power: 6 |
Hi, everybody in this wonderful community.
My recent research goal is to obtain the scalar values of neighborhood cells around a specific cell. To realize this, I wrote a UDF coupling CX_Find_Cell_With_Point and begin_c_loop. The UDF tries to obtain the pressure of a neighborhood cell around a specific cell. Unfortunately, the UDF failed to run. Can anybody give some advice? The UDF is posted as follows: #include <udf.h> #include "cxndsearch.h" static ND_Search *domain_table = NULL; DEFINE_ADJUST(test, domain) { cell_t c,c1; Thread *t, *t1; CX_Cell_Id *cx_cell; real P[3]; real P_Cell[3]; real PR; thread_loop_c (t,domain) { begin_c_loop(c,t) { domain_table = CX_Start_ND_Point_Search(domain_table,TRUE,-1); C_CENTROID(P_Cell,c,t); /*obtain the postion of specific cell*/ P[0]=P_Cell[0]+0.001; /* obtain the postion of cell on the right side*/ P[1]=P_Cell[1]; P[2]=0; cx_cell = CX_Find_Cell_With_Point(domain_table,P,0.0); c1 = RP_CELL(cx_cell); t1 = RP_THREAD(cx_cell); domain_table = CX_End_ND_Point_Search(domain_table); C_UDMI(c,t,0)=C_P(c1,t1); /* storage the value of pressure*/ } end_c_loop(c,t); } } |
|
June 29, 2020, 05:22 |
|
#2 |
New Member
Hongli LIU
Join Date: Jun 2020
Posts: 3
Rep Power: 6 |
Hello,friends.
I guess that I found the reason. The issue may come from the wrong use of CX_Start_ND_Point_Search. Whatever, I corrected my UDF. And it works. The corrected UDF is posted here: #include <udf.h> #include "cxndsearch.h" static ND_Search *domain_table = NULL; DEFINE_ADJUST(test, domain) { cell_t c,c1; Thread *t, *t1, **pt; CX_Cell_Id *cx_cell; real P[3]; real P_Cell[3]; real vof; real dx=0.2e-3; /*mesh size x direction*/ real dy=0.2e-3; /*mesh size y direction*/ domain_table = CX_Start_ND_Point_Search(domain_table,TRUE,-1); thread_loop_c (t,domain) { begin_c_loop(c,t) { C_CENTROID(P_Cell,c,t); /*position of speicific cell*/ P[0]=P_Cell[0]+dx; /*position of cell on the right side*/ P[1]=P_Cell[1]; P[2]=0; cx_cell = CX_Find_Cell_With_Point(domain_table,P,0.0); if(cx_cell) { c1 = RP_CELL(cx_cell); t1 = RP_THREAD(cx_cell); pt = THREAD_SUB_THREADS(t1); C_UDMI(c,t,0)=C_VOF(c1,pt[0]); } else { C_UDMI(c,t,0)=0; } end_c_loop(c,t); } } domain_table = CX_End_ND_Point_Search(domain_table); } |
|
Tags |
udf;define_adjust;fluent |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF for vapor pressure | anuarun | Fluent UDF and Scheme Programming | 13 | June 23, 2024 14:12 |
Replicating Scalable Wall Function with a UDF | yousefaz | FLUENT | 0 | August 4, 2017 03:30 |
Probelm with source term UDF (fluent) | alinik | FLUENT | 0 | October 30, 2016 16:54 |
Source Term UDF VS Porous Media Model | pchoopanya | Fluent UDF and Scheme Programming | 1 | August 28, 2013 07:12 |
UDF...UDF...UDF...UDF | Luc SEMINEL | FLUENT | 0 | November 25, 2002 05:03 |