The paper presents a modification of the digital method by S. K. Godunov for calculating real gas flows under conditions close to a critical state. The method is generalized to the case of the Van der Waals equation of state using the local approximation algorithm. Test calculations of flows in a shock tube have shown the validity of this approach for the mathematical description of gas-dynamic processes in real gases with shock waves and contact discontinuity both in areas with classical and nonclassical behavior patterns. The modified digital scheme by Godunov with local approximation of the Van der Waals equation by a two-term equation of state was used for simulating a spatial flow of real gas based on Navier – Stokes equations in the area of a complex shape, which is characteristic of the internal space of a safety valve. We have demonstrated that, under near-critical conditions, areas of nonclassical gas behavior may appear, which affects the nature of flows. We have studied nonlinear processes in a safety valve arising from the movement of the shut-off element, which are also determined by the device design features and the gas flow conditions.