Modeling And Simulation of Microstructures, Mechanisms, And Diffraction Effects In Energy Materials: Ferroelectrics And Lithium Ion Battery Cathode Materials