CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   Dynamic contact angle issue: fluent UDF couldn't set the correct contact angle (

FelixJJ February 23, 2018 00:57

Dynamic contact angle issue: fluent UDF couldn't set the correct contact angle
5 Attachment(s)
Hi All,

I have been working on dynamic contact angle using fluent udf for 2 weeks and now, I still have some issues unresolved. Really hope someone could help me on this issue. Thanks in advance for your valuable time and help!
[My udf code is attached below]

I. Summary of the issue

The problem is that the contact angles from the results (I imported the .dat files to tecplot and visualized the phase fraction contour) are not the values the udf assigned.
For example:
1. At time t1, I give contact angle of 160, and at time t2, I give contact angle of 110. The results show that at t1, the contact angle is similar to 160, but at t2, it deviates too much from the prescribed value.
2. Moreover, the contact angle kind of oscillates as the time propagates.
II. Some efforts I have tried in debugging:

1. First, I thought it was the problem with my contact angle values. So, I update the dynamic contact angle boundary condition by my hand: I set a constant CA in the boundary condition panel in FLUENT, run it for 100 time steps, and then set a new CA in the panel and run it for another 100 time steps, and so on. Totally, I run 10000 time steps and this gave me correct dynamic contact angle behavior from the results. >>>So, the contact angle values should be physically reasonable.

2. I also write the contact angle values: 'dca' in the code and 'F_PROFILE(f,thread,position)' in the code to a separate txt files. This shows that the values at each face on the boundary, each iteration, each time step are the same as what I want. However, it just somehow couldn't give right angles from the calculation resultss.

3. I attached pictures containing the shape of the droplet at the wall for the first 5 camera times (I used high speed camera to measure the DCA) in the experiment (this corresponds to 100, 200, 300, 400, 500 time-steps, as the time step in the simulation is smaller than my camera recording time step), which should have contact angles of 154.79, 132.72, 117.04, 106.50 , 99.90 degress. However, from the pictures, we can see that the resulting contact angles are not the values the UDF assigned.

I have been really struggled with this problem for weeks. Really hope someone here could help me with this. Thanks again in advance!!!


Fluent UDF for Dynamic Contact Angle
/*The dynamic contact angle is written as a function of the time*/
/*Simulation in run in SERIAL*/
#include "udf.h"

face_t f;
/*real dca[ND_ND];//modification #1, original 30*/
/*int curr_ts;*/
real t,tt;
real dca;

FILE *file;


if PRINCIPAL_FACE_P(f,thread)
dca=-1.032244875620546e-04*pow(t,9)+0.005723424564095*pow(t,8)-0.133366560122603*pow(t,7)+1.700847927275960*pow(t ,6)-12.977642582601800*pow(t,5)+60.961695109221886*pow (t,4)-1.746424468335367e+02*pow(t,3)+2.865880427896289e+ 02*pow(t,2)-2.264048511404226e+02*t+1.606456866426765e+02;
F_PROFILE(f,thread,position) = dca;

file = fopen("DCA_realtime.txt", "a+");
fprintf(file,"dynamic_contact_angle=%f for time = %f ms of the time-step=%d\n",dca,t,N_TIME);

FelixJJ February 24, 2018 00:06

Can anyone help me with this....

All times are GMT -4. The time now is 06:54.