We have an exciting announcement about badges coming in May 2025. Until then, we will temporarily stop issuing new badges for course completions and certifications. However, all completions will be recorded and fulfilled after May 2025.

Ansys Learning Forum Forums Discuss Simulation Photonics How to calculate modal overlap coefficient during the second harmonic generation Reply To: How to calculate modal overlap coefficient during the second harmonic generation

211123090062
Subscriber

Hello, Dear Amrita Pati!

After running the script and checking the matrix size,it shows that E11 is not a matrix type:

I realized it could be a numerical value.But isn't it defined in the formula as the square of the electric intensity? So I changed the formula to the following:

E111=(abs(Ex1))^2+(abs(Ey1))^2+(abs(Ez1))^2;
E211=(abs(Ex2))^2+(abs(Ey2))^2+(abs(Ez2))^2;

E1=sqrt((abs(Ex1))^2+(abs(Ey1))^2+(abs(Ez1))^2);

E2=sqrt((abs(Ex2))^2+(abs(Ey2))^2+(abs(Ez2))^2);

norm1 = integrate( E111*E1,1:2,x_new,y_new );

norm2 = integrate( E211*E2,1:2,x_new,y_new );

tempA = integrate( (conj( Ez1_temp))^2*Ez2_temp,[1,3],x_new,y_new );

overlap_result = tempA / (abs( norm1 ))^(2/3)/(abs(norm2))^(1/3);
?'overlap_result' +' = '+ num2str(overlap_result);
But after running, the following error occurred:
 
and the sizes returned  are:
I don't know where I went wrong...