A flexible and robust yield function for geomaterials