DrAmine
Ansys Employee

Before digging deep here is it possible that you use the simple Fluent Expressions to implement this simple logic?