Analysis and Optimization of Thermally-Regenerative Ammonia-Based Flow Battery Based on a 3-D Model