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

Help correct udf

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By AlexanderZ

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 10, 2019, 03:37
Default Help correct udf
  #1
New Member
 
WANG LU
Join Date: Sep 2019
Posts: 22
Rep Power: 6
smilingwl is on a distinguished road
I want to find the interface of the VOF model.
My code as follows:
DEFINE_EXECUTE_AT_END(climbing_high)
{ real cymax = 0.0;
cell_t c;
real z[ND_ND];
Domain *subdomain= Get_Domain(3);
Thread *t;
FILE *fout1;
thread_loop_c(t,subdomain)
{
begin_c_loop(c,t)
{
if (C_VOF(c,t) ==0.9)
{
C_CENTROID(z,c,t);
if (cymax < z[1])
cymax = z[1];
}
}
end_c_loop(c, t)
}
fout1 = fopen("Vertex on Y axis.txt", "a");
fprintf(fout1, "%g,%g\n", CURRENT_TIME, cymax);
fclose(fout1);
Message("\n Vertex on Y axis = %g\n", cymax);
The result as follow:
Vertex on Y axis = 0
I don't know what's wrong.Please help me.
smilingwl is offline   Reply With Quote

Old   November 10, 2019, 23:21
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
if (C_VOF(c,t) ==0.9) statement is not efficient, I believe you will never have exactly 0.9 in any cell

that's why your cymax is always 0

on the other hand, you are trying to access cymax from outside of the loop -> so you will have only 1 (last) value, which is 0
smilingwl likes this.
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   November 11, 2019, 03:01
Default
  #3
New Member
 
WANG LU
Join Date: Sep 2019
Posts: 22
Rep Power: 6
smilingwl is on a distinguished road
Dear AlexanderZ:
Thank you for your answer and your help again.I am so luck to get your help.
Best wishes!
WangLu
smilingwl is offline   Reply With Quote

Reply

Tags
udf


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
Dynamic contact angle issue: fluent UDF couldn't set the correct contact angle FelixJJ FLUENT 2 October 20, 2021 02:39
udf for correct adjacent cell T Adam_PHD Fluent UDF and Scheme Programming 8 February 27, 2018 02:33
Fluent Radiation/porous media Schmitt pierre-Louis FLUENT 26 September 1, 2016 10:29
how to correct the error of (c) file after the compile of udf? mokrane FLUENT 0 April 23, 2015 13:40
how can I correct the udf? happyrabbit FLUENT 9 January 28, 2011 09:50


All times are GMT -4. The time now is 12:38.