IfPos function Issues

Hi all,

I’ve some issues with the IfPos function. I’m calculating the hydrodynamic pressure with Reynolds equation and want to use the simple Sommerfeld treatment to consider cavitation. I want to use the IfPos function to determine whether the pressure entries are positive or negative, so I need a coefficient function that contains 1 or 0.
cav_i = IfPos(p_rey_i,1,0)
However, the coefficient function that is output also contains other values, including values greater than 1 and even negative values. Shouldn’t the function only output the two values specified?

Thank you in advance,

Hi Jakob,

could you maybe post a minimal working example of your issue? How have you determined that the function has other values that 1 or 0? I have a feeling this might just be a visualisation issue, so maybe dry and do a point evaluation at points where it looks like the function has the wrong value.

Best wishes,

Hy Henry,
Thank 's for the quick response. I did indeed perform a point evaluation, or in a loop to evaluate the values across the width of the mesh. But the problem was that I set the coefficient function to a grid function before the evaluation and the interpolation of course leads to deviating values. Is there another way to set the COF function to a GFU or is there a way to limit the interpolation results to certain values?

Thanks a lot!