Hierarchical Approach to Improve Performance of Legacy Scientific Applications on Large-Scale Platforms