A new criterion for the optimisation of casting design by numerical simulation is proposed. Based on the determination of flow length values during filling in castings, possible locations of defects can be predicted together with their effect on mechanical properties. This approach is demonstrated for a magnesium casting with special emphasis on comparison with experimental results.