  A variational coarse-graining framework for heterogeneous media is developed
that allows for a seamless transition from the traditional static scenario to a
arbitrary loading conditions, including inertia effects and body forces. The
strategy is formulated in the spirit of computational homogenization methods
(FE$^2$) and is based on the discrete version of Hill's averaging results
recently derived by the authors. In particular, the traditional static
multiscale scheme is proved here to be equivalent to a direct homogenization of
the principle of minimum potential energy and to hold exactly under a finite
element discretization. This perspective provides a unifying variational
framework for the FE$^2$ method, in the static setting, with Dirichlet or
Neumann boundary conditions on the representative volume element; and it
directly manifests the approximate duality of the effective strain energy
density obtained with these two types of boundary conditions in the sense of
Legendre transformation. Its generalization to arbitrary loading conditions and
material constitutive relations is then immediate through the incremental
minimum formulation of the dynamic problem \`a la Radovitzky and Ortiz (1999),
which, in the discrete setting, is in full analogy to the static problem. These
theoretical developments are then translated into an efficient multiscale
FE$^2$ computational strategy for the homogenization of a microscopic explicit
dynamics scheme, with two noteworthy properties. Firstly, each time incremental
problem can be solved exactly with a single Newton-Raphson iteration with a
constant Hessian, regardless of the specific non-linearities or
history-dependence of the micro-constituents' behavior. Secondly, the scheme
concurrently solves for the microscopic and macroscopic degrees of freedom, in
contrast to standard approaches based on sequential or nested minimizations.
