2D Newton-Raphson Solver for Beam Optimization