Forward and Inverse Numerical Methods Leveraging Gradient Flows and Optimal Transport