The use of variational principles as the initial basis for constructing continuum models was investigated by Sedov and his disciples. In this study the variational formalism is developed for calculating time-dependent fluid flows through porous and fractured-porous media with inhomogeneous, discontinuous, and, in particular, piecewise-constant properties. It is proved that, in the case of a medium with discontinuous properties, from the basic variational relation δW = 0 there follows not only the differential equations of the flow models but also the conditions on the surfaces of discontinuity of the reservoir properties. This clears the way for the generalization and effective use of direct variational methods for calculating flow fields in complex-structure reservoirs. The methods proposed are illustrated by particular examples. © Springer Science+Business Media, Inc. 2004.