Simulation of multilevel polarization in ferroelectric tunnel junctions