Nonlinear optical sensors operate based on various nonlinear phenomena such as second harmonic generation (SHG), third harmonic generation (THG), and two-photon absorption (TPA). When an intense light source, typically a laser, interacts with a nonlinear medium, these phenomena generate new optical signals at different frequencies or intensities. The interaction of light with the nanomaterial alters these signals, which can then be measured to determine the presence or concentration of a specific substance.