Upscaling CO2 Migration Under Buoyancy and Capillary Heterogeneity Effects -- A New Approach Using Optimization