Optimal control of film casting processes