In this paper, a time-dependent dynamic equation for the potential energy anomaly, phi, is rigorously derived front dynamic equations for potential temperature and salinity, the continuity equation and the equation of state for sea water. The terms locally changing phi are (A) the phi-advection, (B) the depth-mean straining, (C) the non-mean straining, (D) the vertical advection, (E) the vertical mixing, (F) surface and bottom density fluxes, (G) inner sources of density e.g. due to absorption of solar radiation and the non-linearity of the equation of state, and (H) horizontal divergence of horizontal turbulent density fluxes. In order to derive the equation in concise form, a vertical velocity (linearly varying with depth) with respect to depth-proportional vertical coordinates had to be defined. The evaluation of the terms in the phi-equation is then carried out for a one-dimensional tidal straining study and a two-dimensional estuarine circulation study. Comparisons to empirical estimates for these terms are made for the one-dimensional study. It is concluded that the phi-equation provides a general reference for empirical bulk parameterisations of stratification and mixing processes in estuaries and coastal seas and that it is a tool for complete analysis of the relevant terms from numerical models. (c) 2007 Elsevier Ltd. All rights reserved.