Please specify your questions so we can help you better.
If you do not know how to set the device, please refer the example page;
if you do not know how to set the simulation, please refer the 3D example file.
If you do not know how to use Python to run the 3D file, please try to learn something from online example files for 3D FDTD, or go to github to get the original information about adjoint optimization.