|
[Sponsors] |
December 26, 2016, 12:47 |
|
#21 |
New Member
Anders Simonsen
Join Date: Sep 2013
Posts: 18
Rep Power: 13 |
Try and delete all the file writing stuff and just display it in the console using Message();
Also, CX_Find_Cell_With_Point might only work with 3d inputs, so try adding a third index to pt (pt[2]);. Also, I'm using "real" values instead of "static double", although "real" and "double" should be the same on 64-bit machines. You should also have an if-condition, if the cell couldn't be found. Something like this: (I've not tested it). Code:
#include "udf.h" #include "cxndsearch.h" static ND_Search *domain_table = NULL; static float c_centroid[2]; static cell_t c; static Thread *t; static CX_Cell_Id *cx_cell; real pt[3]; FILE *fp_p01; DEFINE_EXECUTE_AT_END(execute) { #if !RP_HOST theta = theta + 0.001 * 10; xTheory = 0.17 + R * cos(theta); yTheory = 0.10 + R * sin(theta); pt[0] = xTheory; pt[1] = yTheory; pt[2] = 0.0; domain_table = CX_Start_ND_Point_Search(domain_table,TRUE,-1); cx_cell = CX_Find_Cell_With_Point(domain_table,pt,0.0); if (cx_cell) { c = RP_CELL(cx_cell); t = RP_THREAD(cx_cell); C_CENTROID(c_centroid,c,t); p01 = C_P(c,t); } else { Message("Could not find cell!\n"); } domain_table = CX_End_ND_Point_Search(domain_table); #endif } |
|
December 26, 2016, 20:33 |
|
#22 | |
New Member
You
Join Date: Dec 2016
Posts: 3
Rep Power: 9 |
Quote:
Thank you so much. My problem has been solved with your help. |
||
July 12, 2018, 00:05 |
Trouble in running this code
|
#23 | |
New Member
Siddani Bhargav Sriram
Join Date: Feb 2017
Posts: 2
Rep Power: 0 |
Quote:
I would be really glad if someone could help me with my issue. I have tried running this code on ANSYS R 19.0 Academic version and it gives me the following error. error C2664: 'CX_Find_Cell_With_Point' : cannot convert parameter 2 from 'real [3]' to 'double []' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast Thanks Bhargav Sriram Siddani |
||
October 16, 2018, 09:34 |
|
#24 |
New Member
anonymous
Join Date: May 2018
Posts: 2
Rep Power: 0 |
Hi, youjfwhu!
If running fluent with multiple nodes, your udf code might generate access-violation because of lacking search error treatment. You should consider the case cx_cell = NULL. CX_Find_Cell_With_Point() is run on all nodes containing partial mesh, and does not always return valid cell ID. |
|
January 16, 2020, 02:27 |
|
#25 | |
New Member
Ba Liming
Join Date: Jan 2020
Posts: 1
Rep Power: 0 |
Quote:
|
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF compiling problem | Wouter | Fluent UDF and Scheme Programming | 6 | June 6, 2012 05:43 |
Incoherent problem table in hollow-fiber spinning | Gianni | FLUENT | 0 | April 5, 2008 11:33 |
natural convection problem for a CHT problem | Se-Hee | CFX | 2 | June 10, 2007 07:29 |
Adiabatic and Rotating wall (Convection problem) | ParodDav | CFX | 5 | April 29, 2007 20:13 |
Is this problem well posed? | Thomas P. Abraham | Main CFD Forum | 5 | September 8, 1999 15:52 |