We present two-dimensional multi-fluid numerical modelling of the upper atmosphere of the hot Jupiter WASP-12b. The model includes hydrogen chemistry, and self-consistently describes the expansion of the planetary upper atmosphere and mass loss due to intensive stellar irradiation, assuming a weakly magnetized planet. We simulate the planetary upper atmosphere and its interaction with the stellar wind (SW) with and without the inclusion of tidal force and consider different XUV irradiation conditions and SW parameters. With the inclusion of tidal force, even for a fast SW, the escaping planetary material forms two streams, propagating towards and away from the star. The atmospheric escape and related mass loss rate reaching the value of 10 12 gs -1 appear to be mostly controlled by the stellar gravitational pull. We computed the column density and dynamics of MgII ions considering three different sets of SW parameters and XUV fluxes. The simulations enable to compute the absorption at the position of the Mg h line and to reproduce the times of ingress and egress. In case of a slow SW and without accounting for tidal force, the high orbital velocity leads to the formation of a shock approximately in the direction of the planetary orbital motion. In this case, mass loss is proportional to the stellar XUV flux. At the same time, ignoring of tidal effects for WASP-12b is a strong simplification, so the scenario with a shock, altogether is an unrealistic one.Keywords: planets and satellites: individual: exoplanetplanets and satellites: gaseous planetsplanets and satellites: atmosphereplanets and satellites: dynamical evolution and stabilityplanets and satellites: atmosphereplanet-star interactions