A Convex Optimization Framework For The Optimal Design, Energy, And Thermal Management Of Li-Ion Battery Packs