Dynamics of Electrochemical Thin Films for Memory and Battery Applications