A finite element analysis of masonry walls under cyclic actions