|
[Sponsors] |
September 13, 2021, 06:11 |
UDF compilation error
|
#1 |
New Member
Ajit
Join Date: Sep 2021
Posts: 8
Rep Power: 5 |
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 |
|
September 13, 2021, 07:49 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
open fluent from visual studio console and compile your code
__________________
best regards ****************************** press LIKE if this message was helpful |
|
September 14, 2021, 01:26 |
UDF compilation error
|
#3 |
New Member
Ajit
Join Date: Sep 2021
Posts: 8
Rep Power: 5 |
Hello AlexanderZ,
I did it but it is not working. |
|
September 14, 2021, 01:40 |
|
#4 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
i've compiled this code without any errors
__________________
best regards ****************************** press LIKE if this message was helpful |
|
September 14, 2021, 14:51 |
|
#5 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
How do you compile? Which buttons do you click?
__________________
"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". |
|
September 24, 2021, 03:30 |
UDF compilation error
|
#6 |
New Member
Ajit
Join Date: Sep 2021
Posts: 8
Rep Power: 5 |
Thanks, it is working.
|
|
September 24, 2021, 08:39 |
|
#7 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
If you remember what you needed to do to get this working, please add it to help other people with this problem.
__________________
"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". |
|
October 1, 2021, 10:09 |
|
#8 |
New Member
Ajit
Join Date: Sep 2021
Posts: 8
Rep Power: 5 |
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. |
|
October 5, 2021, 01:50 |
|
#9 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
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)
__________________
best regards ****************************** press LIKE if this message was helpful |
|
October 13, 2021, 10:10 |
|
#10 |
New Member
Ajit
Join Date: Sep 2021
Posts: 8
Rep Power: 5 |
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 ? |
|
October 24, 2021, 02:51 |
Dynamic contact angle
|
#11 |
New Member
Ajit
Join Date: Sep 2021
Posts: 8
Rep Power: 5 |
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? |
|
October 25, 2021, 01:26 |
|
#12 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
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;
__________________
best regards ****************************** press LIKE if this message was helpful Last edited by AlexanderZ; October 25, 2021 at 05:06. |
|
October 25, 2021, 03:26 |
|
#13 |
New Member
Ajit
Join Date: Sep 2021
Posts: 8
Rep Power: 5 |
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.
|
|
Tags |
guvennergiz, kalium, meksem, pranab_jha |
|
|
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 |