Automated grid generation