-
-
September 14, 2022 at 4:02 pmkemackaySubscriber
Hello, I am attempting to write a script that takes two field profile monitors (exact same dimensions) and takes the point by point difference between the two. I then want to save this delta field profile as a .mat file, and import this field as an input for a second simulation. My script appears to work correctly when I call the image() function in the code, the issue is when I try to save this delta field. The saved .mat file just reverts back to one of the two original field monitors, which is not the desired result.
The following is my code:
matlabload("OutputMonitor_MMI.mat");
E3 = emeProfile.E;
E3_x = emeProfile.Ex;
E3_y = emeProfile.Ey;
E3_z = emeProfile.Ez;
x = emeProfile.x;
y = emeProfile.y;
z = emeProfile.z;
matlabload("OutputMonitor_Ports.mat");
E4 = emeProfile.E;
E4_x = emeProfile.Ex;
E4_y = emeProfile.Ey;
E4_z = emeProfile.Ez;
DeltaTE1_Ex = E4_x - E3_x;
DeltaTE1_Ey = E4_y - E3_y;
DeltaTE1_Ez = E4_z - E3_z;
DeltaMagTE1 = sqrt((DeltaTE1_Ex)^2+(DeltaTE1_Ey)^2+(DeltaTE1_Ez)^2);
image(y,z,DeltaMagTE1); #correct field is displayed here
EM = rectilineardataset("EM fields",x,y,z);
EM.addattribute("E",DeltaTE1_Ex,DeltaTE1_Ey,DeltaTE1_Ez);
matlabsave("TestingDeltaNew.mat",EM); #the field saved here is not the same as the one in the imageÂ
-
September 15, 2022 at 3:36 pmGuilin SunAnsys Employee
"the saved .mat file just reverts back to one of the two original field monitors"
Do you mean the dataset EM shows one of the original monitor data? or other data?
I did not find anything wrong with the script. Please clear the data, and save it again. You can use Visualizer to check them before saving: https://optics.ansys.com/hc/en-us/articles/360034929873-addattribute-Script-commandÂ
Just curious, do the two monitors record data at different wavelength? otherwise for the same simulaiton file, no need to use two different monitors exactly at the same location with same size.
-
September 15, 2022 at 3:58 pmkemackaySubscriber
Hello, the two monitors have the exact same y and z dimensions, but are located a very small distance away from each other on the x propagation axis (200nm). The waveguide cross-section changes between these two monitors so the goal is to see how the field profile changes in such a short distance. The wavelength is the same for both monitors.
The dataset EM shows the original monitor data.
Â
Â
-
September 15, 2022 at 5:04 pmGuilin SunAnsys Employee
I did not find anything wrong in your script. You may try to create a matrix dataset, similar to vector dataset, and see if they are the same. You may need to clear the data again. If there is no other script in between, there is no reason the data shows differently.
-
- The topic ‘Saving delta of two field profile monitors’ is closed to new replies.
- INTERCONNECT – No results unless rerun simulation until it gives any
- Errors Running Ring Modulator Example on Cluster
- Difference between answers in version 2024 and 2017 lumerical mode solution
- Import material .txt file with script
- Calculation of correlation values in laser modulation bandwidth simulation
- Trapezoidal ring
- Help for qINTERCONNECT
- Issues with getting result from interconnent analysis script
- Topology Optimization Error
- Edge Coupler EME Example Issue
-
1131
-
468
-
466
-
225
-
201
© 2024 Copyright ANSYS, Inc. All rights reserved.