# Best way to measure the contact angle in-situ in Fluent?

Hi,

For reasons specific to my application, I don't want to set a contact angle boundary condition. However, I would like to measure the contact angle during my simulation. What is the best way to do this? Currently, I'm looking at the gradient for the cell at the boundary that has a C_VOF value closest to 0.5 and extracting the contact angle from that. However, this doesn't seem like a super accurate way to do it since it seem like adjacent cells have quite different values for the gradient.

If there simply a command or something I can use to calculate it?

Thanks!

## Comments

No there is no simple command. Gradient at the interface close to the wall dot product with the face area normal.

Face area manual? I'm not sure what you mean exactly. Do you mean C_VOF_G dotted with the A vector from F_AREA?

I meant face area normal. However I still believe that the curvature you will get near the wall (which is mesh dependent) would not provide you with real angle.

So, are you saying this approach won't give an accurate angle?

It seems a bit odd to me to look at the VOF gradient in a

celland dot it with thefacearea normal. What face would you use? Also, it seems we would need an additional step to get to an angle.Currently, I find the cell with a VOF value closest to 0.5 that is in the row of cells closest to the wall. Then, I look at the volume fraction gradient in this cell and obtain the radial component of the gradient (in an axisymmetric simulation).

The manual states that for wall adhesion (which I'm not using but the same concepts should apply), the equation for the contact angle is n = n_w*cos(theta)+t_w*sin(theta), where n is the unit vector of the gradient of the volume fraction. Thus, the radial component of the gradient, divided by the magnitude of the gradient, should equal the t_w*sin(theta) term. So I take the arcsin of that value.

But I'm not very satisfied with the results. They seem to vary strangely and I'm not confident in the accuracy of the angle based on this gradient in a single cell. But, it seems that the approach you provided would be more or less the same unless I'm not understanding it properly.

Hmm, I don't quite understand this point. I need to have the contact angle measured every time step (I'm using non-iterative time advancement) because I will be adjusting things based on that.

I don't know what you mean by a post-processing step or what the distinction would be. I am implementing it in an EXECUTE_AT_END macro, if that's what you mean?

Is not a good idea to measure the contact angle, as the contact angle has to be either fixed or part of the solution.

What do you mean by "part of the solution"? As in - have a contact angle boundary condition and solve for a new one and set it to that value? Or do you mean something else?

It seems like if you can fix the contact angle and vary it during a simulation using a UDF (which I've done), surely Fluent must have access to the parameters that govern the contact angle and could measure them. If I can't get an accurate measurement based on these values, how would a fixed value from the boundary condition be any more accurate?

Part of the solution means you provide it as UDF depending on local flow conditions. Prescription of contact angle is part of the Boundary Value Problem for free surface flows and jump conditions.

But it seems that Fluent must have access to the parameters that would be used to calculate an accurate contact angle. For instance, how does Fluent calculate an accurate surface tension force? It must have an accurate representation of the curvature and gradient of the volume fraction per the formulation in the user manual. Does it calculate the surface tension force on a cell by cell basis using these parameters? If this can be done accurately, I don't quite understand why a contact angle could not be obtained accurately.

Providing the contact angle is part of the problem setup. How Fluent does implement the surface tension force is described in the manual.

Regardless of whether I specify a contact angle boundary condition, there is still a contact angle at the three-phase contact line - Fluent just doesn't measure it. I'm aware of how the manual says the surface tension force is defined.

What I'm saying is - the surface tension force is calculated from the curvature and gradient of the volume fraction, among other things. These are the same parameters I would need to determine an accurate contact angle. So if Fluent has the information available to calculate an accurate surface tension, I should be able to calculate an accurate contact angle manually shouldn't I? Unless the surface tension force isn't very accurate?

So I'm more so wondering now - how does Fluent determine the curvature and volume fraction gradient for the surface tension force calculation. I assume C_VOF_G would be used for the volume fraction gradient but what about the curvature? I know it is the divergence of the normal vector to the surface, but it there an easy way to get this?

In case anyone else references this. I've found that you can obtain a fairly accurate contact angle measurement by taking the acos of the axial component of the volume fraction gradient in an axisymmetric solution at the SECOND ROW OF CELLS AWAY FROM THE WALL.

acos(C_VOF_G(c,t)[0])*180./M_PI should give the angle if you use that at an interface cell in the second row from the wall.

It seems that the volume fraction gradients are not accurate in the row of cells closest to the wall. My contact angle measurements were ~15 degrees off. Looking at the second row of cells I'm able to get within 1 deg typically.

Is it possible to share the whole uds that you wrote to determine the contact angle at every iteration?