## Fluids

#### can anyone help me in parllelizing Dynamic contact angle udf?

• harsha2209
Subscriber

I have a udf for finding the dynamic contact angle. I interpret this code usually and is working perfectly fine in serial mode. I want to parllelize this udf to reduce my computation time. Can someone help me to parllelize this udf? I went through Ansys udf manual but still I am not able to do it. Please help

#include "udf.h"

// Initializing values

double dynamic_contact_angle, equilibrium_CA = 124.0, Ca;

double sum=0.0,R;

FILE *datafile;

float d=3,u=0.5;

// DEFINE_ADJUST is used to manipulate the values

{

cell_t cell;

face_t f;

double x_hoff;

int n;

sum=0.0;

if(first_time==0) //after droplet touches the surface

{

if(CURRENT_TIME!=last_time){

printf("inside firsttime =0 ");

time=CURRENT_TIME;

last_time=CURRENT_TIME;

}

Ca = (0.001/(2*0.0702))*sqrt(3*u*0.001*d)/sqrt(time-adjust_starttime);  // v = sqrt(D*0.3/t)/2

printf("Ca = %f ",Ca);

x_hoff= Ca +  0.00402;

if(Ca>=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*equilibrium_CA*(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  ;

}

printf("DCA = %e",dynamic_contact_angle);

datafile = fopen("datafile.txt", "a+");

fclose(datafile);

}

}

if(first_time==1) // to check if the droplet touched the surface

{

begin_c_loop_all (cell,pt[1])

{

sum+=C_VOF(cell,pt[1]);

}

end_c_loop_all (cell,pt[1])

//R=sqrt(sum*1.0e-08/M_PI);

if(sum>0){

first_time=0;

}

}

}

// DEFINE_PROFILE is used to set the contact angle value

DEFINE_PROFILE(Contact_Angle_Set,t,i)

{

face_t f;

begin_f_loop(f,t)

{

F_PROFILE(f,t,i) = dynamic_contact_angle;

}

end_f_loop(f,t)

}

• Rob
Ansys Employee