Computational fluid dynamics and aerodynamics, which complement more expensive empirical approaches, are critical for developing aerospace vehicles. During the past three decades, computational aerodynamics capability has improved remarkably, following advances in computer hardware and algorithm development. However, for complex applications, the demands on computational fluid dynamics continue to increase in a quest to gain a few percent improvements in accuracy. Herein, we numerically demonstrate, in the context of tensor-product discretizations on hexahedral elements, that computing the metric terms with an optimization-based approach leads to a solution whose accuracy is overall on par and often better than the one obtained using the widely adopted Thomas and Lombard metric terms computation (Geometric conservation law and its application to flow computations on moving grids, AIAA Journal, 1979). We show the efficacy of the proposed technique in the context of low and high-order accurate nonlinearly stable (entropy stable) schemes on distorted, high-order tensor product elements, considering smooth three-dimensional inviscid and viscous compressible test cases for which an analytical solution is known. The methodology, originally developed by Crean et al. (2018) in the context of triangular/tetrahedral grids, is not limited to tensor-product cells and it can be applied to other cell-based diagonal-norm summation-by-parts discretizations, including spectral differences, discontinuous Galerkin finite elements, and flux reconstruction schemes.