Simulation and applications of nonlinear fiber Bragg gratings