The mechanical and electrical response of acoustophoretic microfluidic devices attached to an ac-voltage-driven piezoelectric transducer is studied by means of numerical simulations. The governing equations are formulated in a variational framework that, introducing Lagrangian and Hamiltonian densities, is used to derive the weak form for the finite-element discretization of the equations and to characterize the device response in terms of frequency-dependent figures of merit or indicators. The effectiveness of the device in focusing microparticles is quantified by two mechanical indicators: the average direction of the pressure gradient and the amount of acoustic energy localized in the microchannel. Furthermore, we derive the relations between the Lagrangian, the Hamiltonian, and three electrical indicators: the resonance Q value, the impedance, and the electric power. The frequency response of the hard-to-measure mechanical indicators is correlated to that of the easy-to-measure electrical indicators, and, by introducing optimality criteria, it is clarified to which extent the latter suffices to identify optimal driving frequencies as the geometric configuration and the material parameters vary. The latter have been varied by considering both Pyrex and aluminium nitroxide top-lid materials.