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

UDF compilation error

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes
  • 1 Post By AlexanderZ
  • 1 Post By pakk
  • 1 Post By pakk
  • 2 Post By AlexanderZ

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 13, 2021, 06:11
Default UDF compilation error
  #1
New Member
 
Ajit
Join Date: Sep 2021
Posts: 8
Rep Power: 5
ajitk350 is on a distinguished road
this is my code:

#include "udf.h"

double contact_line_position=0;
double time=0;
double theta_e_radian=(15.0*M_PI/180.0);
double dynamic_contact_angle=15.0;
int first_time=1;
double contact_velocity=0;
FILE *file;
double sum=0.0,R;


DEFINE_ADJUST(Contact_Angle_Update, domain)
{
int ID = 6;
Thread *thread = Lookup_Thread(domain, ID);
Thread **pt = THREAD_SUB_THREADS(thread);
cell_t c;
face_t f;
real x[ND_ND];
double max_x=0, f_Hoff_inverse, x_hoff,temp, Ca, volume;
int n;

sum=0.0;

begin_c_loop_all (c,pt[1])
{
if(C_VOF(c,pt[1])!=0 /*&& ABS(x[1]-0.000125)<1e-6 && ABS(x[2]+0.003)<1e-6 */)
{
C_CENTROID(x,c,pt[1]);
//printf("## x=%f y=%f z=%f vof=%f\n",x[0],x[1],x[2],C_VOF(c,pt[1]));
if(x[1]>max_x)
max_x=x[1];
}
sum+=C_VOF(c,pt[1]);
}
end_c_loop_all (c,pt[1])

R=sqrt(sum*1.0e-08/M_PI);
printf("max_x=%f R=%f contact_velocity=%f time=%f dynamic_contact_angle=%f sum=%f\n",max_x,R,contact_velocity,time,dynamic_co ntact_angle,sum);

if(first_time==0)
{
contact_velocity= (R-contact_line_position)/(RP_Get_Real("flow-time")-time);
contact_line_position = R;
time=RP_Get_Real("flow-time");
Ca = contact_velocity*1e-3/0.0728;
temp= 0.5-0.5 * cos(theta_e_radian);
temp= 0.5 * log( (1.0+temp)/(1.0-temp) );//atanh(0.5-0.5 * cos(theta_e_radian))
f_Hoff_inverse = -(9.78546 * pow( temp,1.416430594900850))/(12.819 * pow(temp,1.41643)-100.0);
x_hoff= Ca + f_Hoff_inverse ;
if(contact_velocity>=0)
dynamic_contact_angle= acos( 1-2*tanh(5.16*pow((x_hoff/(1+1.31*pow(x_hoff,.99))),0.706) ) ) *180.0/M_PI ;
else
dynamic_contact_angle= 2*theta_e_radian*180.0/M_PI -acos( 1-2*tanh(5.16*pow((x_hoff/(1+1.31*pow(x_hoff,.99))),0.706) ) ) *180.0/M_PI ;
file = fopen("file.txt", "a+");
fprintf(file,"max_x=%f R=%f contact_velocity=%f time=%f dynamic_contact_angle=%f\n",max_x,R,contact_veloci ty,time,dynamic_contact_angle);
fclose(file);
}
if(R>1e-18 && first_time==1)
{
contact_line_position = R;
time=RP_Get_Real("flow-time");
first_time=0;
file = fopen("file.txt", "a+");
fprintf(file,"max_x=%f R=%f contact_velocity=%f time=%f\n",max_x,R,contact_velocity,time);
fclose(file);
}
}

DEFINE_PROFILE(Contact_Angle_Set_Profile, thread,i)
{
face_t f;
begin_f_loop(f,thread)
{
F_PROFILE(f,thread,i) = dynamic_contact_angle;
}
end_f_loop(f,thread)
}

When I compile this UDF, I receive some error message such as:

Creating library libudf.lib and object libudf.exp
.obj : error LNK2019: unresolved external symbol __imp__RP_Get_Float referenced in function _Contact_Angle_Update
.obj : error LNK2019: unresolved external symbol __imp__n_phase_solver referenced in function _Contact_Angle_Update
.obj : error LNK2019: unresolved external symbol __imp__Lookup_Thread referenced in function _Contact_Angle_Update
libudf.dll : fatal error LNK1120: 3 unresolved externals

I use fluent 19.1 and Visual Studio 2008.
Need suggestions
ajitk350 is offline   Reply With Quote

Old   September 13, 2021, 07:49
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
open fluent from visual studio console and compile your code
__________________
best regards


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

Old   September 14, 2021, 01:26
Default UDF compilation error
  #3
New Member
 
Ajit
Join Date: Sep 2021
Posts: 8
Rep Power: 5
ajitk350 is on a distinguished road
Hello AlexanderZ,
I did it but it is not working.
ajitk350 is offline   Reply With Quote

Old   September 14, 2021, 01:40
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
i've compiled this code without any errors
ajitk350 likes this.
__________________
best regards


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

Old   September 14, 2021, 14:51
Default
  #5
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Quote:
Originally Posted by ajitk350 View Post
Hello AlexanderZ,
I did it but it is not working.
How do you compile? Which buttons do you click?
ajitk350 likes this.
__________________
"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   September 24, 2021, 03:30
Default UDF compilation error
  #6
New Member
 
Ajit
Join Date: Sep 2021
Posts: 8
Rep Power: 5
ajitk350 is on a distinguished road
Thanks, it is working.
ajitk350 is offline   Reply With Quote

Old   September 24, 2021, 08:39
Default
  #7
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
If you remember what you needed to do to get this working, please add it to help other people with this problem.
ajitk350 likes this.
__________________
"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   October 1, 2021, 10:09
Default
  #8
New Member
 
Ajit
Join Date: Sep 2021
Posts: 8
Rep Power: 5
ajitk350 is on a distinguished road
Hello Alexander Z
First of all, I would like to say thanks for helping me.
my code is running but I am no sure this code is correct or not for dynamic contact angle. could you please check my code?

I am a developing a model " DROPLET IMPACT ON THE SURFACE". Please help me.
ajitk350 is offline   Reply With Quote

Old   October 5, 2021, 01:50
Default
  #9
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
I can't say you if your code works as you want or not
it depends on what you want and how you are hooking this functions.

this code works properly only on single core, parallel is not available (modifications required)
pakk and ajitk350 like this.
__________________
best regards


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

Old   October 13, 2021, 10:10
Default
  #10
New Member
 
Ajit
Join Date: Sep 2021
Posts: 8
Rep Power: 5
ajitk350 is on a distinguished road
Hi Alexander Z
I want to activate the level set method with VOF in ANsys fluent 2020 R2. There is one option to activate the level set method directly. So, my question is, if I activate the level set method, will it work? or I will have to write UDF for CLSVOF ?
ajitk350 is offline   Reply With Quote

Old   October 24, 2021, 02:51
Default Dynamic contact angle
  #11
New Member
 
Ajit
Join Date: Sep 2021
Posts: 8
Rep Power: 5
ajitk350 is on a distinguished road
Dear Alexander Z

The code is running well on a single core. but, the code is working only static contact angle, not dynamic contact angle. could you please suggest to me what changes make dynamic contact angle instead of static contact angle?
ajitk350 is offline   Reply With Quote

Old   October 25, 2021, 01:26
Default
  #12
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
I have no idea what you mean under dynamic contact angle

in code above dynamic_contact_angle is hard coded
Code:
double dynamic_contact_angle=15.0;
change this value and you will get other result
__________________
best regards


******************************
press LIKE if this message was helpful

Last edited by AlexanderZ; October 25, 2021 at 05:06.
AlexanderZ is offline   Reply With Quote

Old   October 25, 2021, 03:26
Default
  #13
New Member
 
Ajit
Join Date: Sep 2021
Posts: 8
Rep Power: 5
ajitk350 is on a distinguished road
Dynamic contact angle means static contact angle should be changed when droplet spreading and recoiling. So, when I fixed the static contact angle, the dynamic contact angle should be changed during the simulation. But, in my problem, dynamic contact angle is not changing. It becomes fixed like 15.0.
ajitk350 is offline   Reply With Quote

Reply

Tags
guvennergiz, kalium, meksem, pranab_jha


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
[OpenFOAM] ParaView command in Foam-extend-4.1 mitu_94 ParaView 0 March 4, 2021 14:46
[swak4Foam] swak4foam openfoam 7 installation problem Andrea23 OpenFOAM Community Contributions 1 February 17, 2020 19:11
[OpenFOAM] Native ParaView Reader Bugs tj22 ParaView 270 January 4, 2016 12:39
[swak4Foam] groovyBC: problems compiling: "flex: not found" and "undefined reference to ..." sega OpenFOAM Community Contributions 12 February 17, 2010 10:30
How to get the max value of the whole field waynezw0618 OpenFOAM Running, Solving & CFD 4 June 17, 2008 06:07


All times are GMT -4. The time now is 17:47.