I need to simulate a valve that acts as an orifice with constant area, wich opens or closes according to the logical statement that can be established in UDF (pressure dependent). I need to know how I can write the code in the UDF so that it can be done. I will leave a small fragment of an article which talks about the problem that I need to solve and also some images of the simulation that I have done so far, in order to simulate the opening and closing of the valves I decided to use the dynamic mesh events, the which consist of creating time-dependent sliding meshes. But I really need to simulate opening and closing as a function of cylinder internal pressure, I would greatly appreciate any possible help.