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

how to get coordinate of liquid/gas interface using UDF?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 14, 2019, 07:03
Default how to get coordinate of liquid/gas interface using UDF?
  #1
New Member
 
Jun Yin
Join Date: Jan 2019
Posts: 5
Rep Power: 7
jyin is on a distinguished road
hello everyone:

I was trying to get coordinate from the whole domain and I am successful with the following code.

#include "udf.h"

DEFINE_ON_DEMAND(on_demand)
{
real x[ND_ND],x1,y1,z1;
int ID = 2;
cell_t c;
Domain *d = Get_Domain(1);
Thread *t;



thread_loop_c(t,d)
{
begin_c_loop(c,t)
{
C_CENTROID(x,c,t);
x1 = x [0];
y1 = x [1];
z1 = x [2];
Message(" %f,%f,%f\n",x1,y1,z1);
}
end_c_loop(c,t)
}
}


But when I add the IF code to the UDF, it always comes an error in Fluent.
my goal is trying to get coordinate at gas/liquid interface. But it can not work with the following UDF. Someone can help me with this?

DEFINE_ON_DEMAND(on_demand)
{
real x[ND_ND],x1,y1,z1;
int ID = 2;
cell_t c;
Domain *d = Get_Domain(1);
Thread *t;



thread_loop_c(t,d)
{
begin_c_loop(c,t)
{
if(C_VOF(c,t)>0 && C_VOF(c,t)<1)
{
C_CENTROID(x,c,t);
x1 = x [0];
y1 = x [1];
z1 = x [2];
Message(" %f,%f,%f\n",x1,y1,z1);
}
}
end_c_loop(c,t)
}
}
jyin is offline   Reply With Quote

Old   January 14, 2019, 22:43
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
what kind of error did you get?

may be the problem is in the brackets?
Code:
if ((C_VOF(c,t)>0) && (C_VOF(c,t)<1))
best regards
AlexanderZ 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
sliding mesh problem in CFX Saima CFX 46 September 11, 2021 08:38
Wrong flow in ratating domain problem Sanyo CFX 17 August 15, 2015 07:20
GETVAR Error in Multiband Monte Carlo Radiation Simulation with Directional Source silvan CFX 3 June 16, 2014 10:49
Radiation interface hinca CFX 15 January 26, 2014 18:11
An error has occurred in cfx5solve: volo87 CFX 5 June 14, 2013 18:44


All times are GMT -4. The time now is 15:49.