If I use FDTD to simulate, this problem won't happen. And I found an alternative method for this. That is you can copy all the codes in the model to the script file that you want to run, which can change the geometry and run the correct simulation. I am wondering if there is something special that needs to be set for the RCWA simulation as compared with the FDTD simulation.