For the control of the outlet flow rate of a constant-flow water-saving device under different water pressures, this study developed and implemented a custom User-Defined Function (UDF) program to simulate the dynamic motion of the water-saving valve within the Fluent environment. This simulation realistically represents the valve’s behavior under varying water pressures, thereby accurately predicting the valve opening height to comply with national regulatory standards. Firstly, a dynamic grid transient CFD simulation model of the water-saving valve was established using a Fluent UDF program written in C language. The parameters of the elastic elements in the water-saving device flow control system were designed to achieve control of the outlet flow rate. Then, the benchmarking analysis of the aforementioned simulation model was completed based on the flow rate test results of the water-saving device. Finally, the relationship between physical quantities and flow field distribution characteristics of the water-saving valve was analyzed under three different water pressures specified in the national standard. Based on the optimization calculations, the valve opening heights under three different water pressures were obtained, ensuring that the outlet flow rates meet the regulatory standards set by the national authorities. Compared with traditional methods that rely solely on steady-state simulations or empirical data, the method proposed in this paper represents a significant advancement.