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

UDF to track the interface in VOF method in Ansys Fluent

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 6, 2021, 06:02
Default UDF to track the interface in VOF method in Ansys Fluent
  #1
New Member
 
radin hosseini
Join Date: Nov 2017
Posts: 7
Rep Power: 9
radin_85 is on a distinguished road
I want to write a UDF to track the interface (in VOF model) on a boundary and find the location of the interface on that boundary at each timestep. I have developed the following code:


DEFINE_EXECUTE_AT_END(Interface_tracker)
{
Domain *d;
face_t f;
FILE *fp;
d = Get_Domain(1);
int zone_ID = 6;
Thread *t = Lookup_Thread(d,zone_ID);

real FC[2];
real ti = CURRENT_TIME;
real alpha;

begin_f_loop(f,t)
{
F_CENTROID(FC,f,t);
alpha = C_VOF(f,t);
if(alpha == 0.5)
{
fprintf(fp,"f%d %g %g %g\n", ti, FC[0], FC[1]);
}
}
end_c_loop(f,t)

}


when I am interpreting it I face the following error:

Error: C:/Users/radin/AppData/Local/Temp/interfacetracker.txt.28068.0.c: line 19: parse error.
Error: C:/Users/radin/AppData/Local/Temp/interfacetracker.txt.28068.0.c: line 20: parse error.
Error: C:/Users/radin/AppData/Local/Temp/interfacetracker.txt.28068.0.c: line 22: parse error.
Error: C:/Users/radin/AppData/Local/Temp/interfacetracker.txt.28068.0.c: line 23: parse error.
Error: C:/Users/radin/AppData/Local/Temp/interfacetracker.txt.28068.0.c: line 24: parse error.
Error: C:/Users/radin/AppData/Local/Temp/interfacetracker.txt.28068.0.c: line 26: t: undeclared variable


Can anyone tell me where is my mistake??
all the best
radin_85 is offline   Reply With Quote

Old   July 6, 2021, 12:31
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Can you tell which line is line 19 in your code?
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk is offline   Reply With Quote

Old   July 6, 2021, 14:33
Default
  #3
New Member
 
radin hosseini
Join Date: Nov 2017
Posts: 7
Rep Power: 9
radin_85 is on a distinguished road
Quote:
Originally Posted by pakk View Post
Can you tell which line is line 19 in your code?
int zone_ID = 6;
radin_85 is offline   Reply With Quote

Old   July 6, 2021, 17:11
Default
  #4
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Possible mistake: you declared a variable after assigning a variable. In older dialects of c, that is not allowed.

This is a declaration:
Code:
int zone_ID = 6;
This is an assignment:
Code:
d = Get_Domain(1);
The problem might thus be that all declarations should be done first. Try to move this assignment down (below the last declaration of alpha as real).


You would make it much easier for yourself if you would compile: you get better error messages.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk 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
Radiation in semi-transparent media with surface-to-surface model? mpeppels CFX 11 August 22, 2019 08:30
UDF Defining in ANSYS FLUENT 16.2 in Win 10 Sadegh.A Fluent UDF and Scheme Programming 11 February 15, 2017 15:45
Error - Solar absorber - Solar Thermal Radiation MichaelK CFX 12 September 1, 2016 06:15
How to apply heat flux at the interface when using VOF method? princekar FLUENT 0 November 15, 2015 08:47
An error has occurred in cfx5solve: volo87 CFX 5 June 14, 2013 18:44


All times are GMT -4. The time now is 14:43.