|
[Sponsors] |
March 23, 2010, 22:02 |
HELP:Fluent UDF
|
#1 |
New Member
xinyu zhao
Join Date: Sep 2009
Posts: 19
Rep Power: 17 |
The fluent udf manuall has a example "DEFINE_ON_DEMAND(get_coords)".When I use it, it can compile, but confronts error after execute on demand. As follow:
Error: FLUENT received fatal signal (ACCESS_VIOLATION) 1. Note exact events leading to error. 2. Save case/data under new name. 3. Exit program and restart to continue. 4. Report error to your distributor. Error Object: () I don't know why,please tell me if you know it. Thank you! The programm as follow: #include "udf.h" FILE *fout; void Print_Thread_Face_Centroids(Domain *domain, int id) { real FC[2]; face_t f; Thread *t=Lookup_Thread(domain,id); fprintf(fout,"thread id %d\n",id); begin_f_loop(f,t) { F_CENTROID(FC,f,t); fprintf(fout,"f%d %g %g %g\n",f,FC[0],FC[1],FC[2]); } end_f_loop(f,t) fprintf(fout,"\n"); } DEFINE_ON_DEMAND(get_coords) { Domain *domain; fout=fopen("faces.out","w"); Print_Thread_Face_Centroids(domain,4); Print_Thread_Face_Centroids(domain,5); fclose(fout); } |
|
March 24, 2010, 14:14 |
|
#2 |
Senior Member
Micael
Join Date: Mar 2009
Location: Canada
Posts: 157
Rep Power: 18 |
There is missing something in the function "get_coords"
The domaine variable should be assigned a value. You can add that line below the declaration of domain: domain = Get_Domain(1); So it becomes: DEFINE_ON_DEMAND(get_coords) }{ Domain *domain; domain = Get_Domain(1); fout = fopen("faces.out", "w"); Print_Thread_Face_Centroids(domain, 2); Print_Thread_Face_Centroids(domain, 4); fclose(fout); |
|
March 25, 2010, 21:20 |
|
#3 | |
New Member
xinyu zhao
Join Date: Sep 2009
Posts: 19
Rep Power: 17 |
Quote:
But I have another problem. When I execute it ,the result is only one face centroid. And the thread 2 have 100 faces in my example.Why not all face centroids of the thread 2 ? I hope your reply. |
||
March 26, 2010, 09:21 |
|
#4 |
Senior Member
Micael
Join Date: Mar 2009
Location: Canada
Posts: 157
Rep Power: 18 |
You previously wrote:
Print_Thread_Face_Centroids(domain,4); Print_Thread_Face_Centroids(domain,5); but I did not copy it correctly and wrote Print_Thread_Face_Centroids(domain,2); Print_Thread_Face_Centroids(domain,4); Can this be the problem? |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Dynamic Mesh UDF | Qureshi | FLUENT | 7 | March 23, 2017 08:37 |
UDF parallel error: chip-exec: function not found????? | shankara.2 | Fluent UDF and Scheme Programming | 1 | January 16, 2012 23:14 |
How to add a UDF to a compiled UDF library | kim | FLUENT | 3 | October 26, 2011 22:38 |
UDF...UDF...UDF...UDF | Luc SEMINEL | FLUENT | 0 | November 25, 2002 05:03 |
UDF, UDF, UDF, UDF | Luc SEMINEL | Main CFD Forum | 0 | November 25, 2002 05:01 |