CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

My UDF won't go over all threads/domains

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 4, 2017, 04:44
Default My UDF won't go over all threads/domains
  #1
Member
 
Join Date: Nov 2016
Posts: 73
Rep Power: 10
h0rst is on a distinguished road
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
h0rst is offline   Reply With Quote

Old   April 4, 2017, 06:09
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
It looks like you close the file too early. You should move "fclose" two lines down.
pakk is offline   Reply With Quote

Old   April 4, 2017, 06:10
Default
  #3
Member
 
Join Date: Nov 2016
Posts: 73
Rep Power: 10
h0rst is on a distinguished road
I've just tested it and it works, thank you so much!
h0rst is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 19:21.