Abstract. We present developments to the physical model and the open-source numerical code IMEX_SfloW2D (de' Michieli Vitturi et al., 2019). These developments consist of a generalization of the depth-averaged (shallow-water) fluid equations to describe a polydisperse fluid–solid mixture, including terms for sedimentation and entrainment, transport equations for solid particles of different sizes, transport equations for different components of the carrier phase, and an equation for temperature/energy. Of relevance for the simulation of volcanic mass flows, vaporization and entrainment of water are implemented in the new model. The model can be easily adapted to simulate a wide range of volcanic mass flows (pyroclastic avalanches, lahars, pyroclastic surges), and here we present its application to transient dilute pyroclastic density currents (PDCs). The numerical algorithm and the code have been improved to allow for simulation of sub- to supercritical regimes and to simplify the setting of initial and boundary conditions. The code is open-source. The results of synthetic numerical benchmarks demonstrate the robustness of the numerical code in simulating transcritical flows interacting with the topography. Moreover, they highlight the importance of simulating transient in comparison to steady-state flows and flows in 2D versus 1D. Finally, we demonstrate the model capabilities to simulate a complex natural case involving the propagation of PDCs over the sea surface and across topographic obstacles, through application to Krakatau volcano, showing the relevance, at a large scale, of non-linear fluid dynamic features, such as hydraulic jumps and von Kármán vortices, to flow conditions such as velocity and runout.