I actually did not write this, but another member of our team did who has since left.  The UDF was written for each component (U, W) of the velocity. Is this what you meant by it being a function of the shared velocity field? Because the way It is written it appears as though its not a function of the shared but rather of the components individually.