|
[Sponsors] |
April 4, 2017, 04:44 |
My UDF won't go over all threads/domains
|
#1 |
Member
Join Date: Nov 2016
Posts: 73
Rep Power: 10 |
Hello everybody,
I have used a UDF to write the cell temperatures to a file. Now, I have added another component into the model and the UDF will not loop over all cells. Do I maybe have more than one domain? How can I check this? The UDF works and writes the values in the text file but it does not loop over all cells of my model. float array5[142436]; //Model has 142436 cells in total DEFINE_ON_DEMAND(array_exp) { Domain *d; FILE *test; int n=0; real temp1,volume; Thread *t; cell_t c; d = Get_Domain(1); test=fopen("test.txt","w"); thread_loop_c(t,d) { begin_c_loop(c,t) { volume = C_VOLUME(c,t); temp1 = C_T(c,t); array5[n]=temp1; fprintf(test,"%g \n",array5[n]); } end_c_loop(c,t) fclose(test); n=n+1; } } Does someone has an idea about that? Best regards h0rst |
|
April 4, 2017, 06:09 |
|
#2 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
It looks like you close the file too early. You should move "fclose" two lines down.
|
|
April 4, 2017, 06:10 |
|
#3 |
Member
Join Date: Nov 2016
Posts: 73
Rep Power: 10 |
I've just tested it and it works, thank you so much!
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF Compilation Error - Loading Library - COMMON Problem! Help! | robtheslob | Fluent UDF and Scheme Programming | 8 | July 24, 2015 01:53 |
Parallelize UDF? Which kind of UDF? | Lilly | FLUENT | 5 | March 25, 2014 03:05 |
Help! Delete the UDM codes in the UDF | Messi | Fluent UDF and Scheme Programming | 2 | January 28, 2014 10:01 |
UDF parallel error: chip-exec: function not found????? | shankara.2 | Fluent UDF and Scheme Programming | 1 | January 16, 2012 23:14 |
UDF, UDF, UDF, UDF | Luc SEMINEL | Main CFD Forum | 0 | November 25, 2002 05:01 |