Micromechanical and multiscale computational modeling for stability analysis of masonry elements