Automated optimization of numerical methods for partial differential equations