Ansys Learning Forum Forums Discuss Simulation Photonics How to make a mapping image E=f(x,y) Reply To: How to make a mapping image E=f(x,y)

w.k.sky.x
Subscriber

Thank you Guilin.  I am trying to get the figure underneath similar to How to find out Phase shift of transmitted wave varying radius vs wavelength (ansys.com).

However, I am not sure how to export E field as a result in sweep. Should I use e-outlined or other analysis functions to export E strength? Thank you! 

-------------------------------------------------

clear;
clc;

# define the parameter
r = (1e-9)*10; #radius of structure 10 nm
T = (1e-9)*12; #E point monitor location 12 nm

r1 = 16*(1e-9); #radius of structure 16 nm
T1 = (1e-9)*16; #E point monitor location 16 nm

value1=3; # number of sweep points between r to r1 and T to T1

# add a new sweep and set basic properties
addsweep;
setsweep("sweep", "name", "sweep_pitch_script");
setsweep("sweep_pitch_script", "type", "Ranges");
setsweep("sweep_pitch_script", "number of points", value1); 

# define the parameter pitch
para1 = struct;
para1.Name = "radius";
para1.Parameter = "::model::Structure::radius";
para1.Type = "Length";
para1.Start = r;
para1.Stop = r1;
para1.Units = "nanometers";

# add the parameter pitch to the sweep
addsweepparameter("sweep_pitch_script", para1);


# define the parameter pitch for point monitor location for E 
para2 = struct;
para2.Name = "FDTD-monitor_1";
para2.Parameter = "::model::monitor_1::z";
para2.Type = "Length";
para2.Start = T;
para2.Stop = T1;
para2.Units = "nanometers";

# add the parameter pitch to the sweep
addsweepparameter("sweep_pitch_script", para2);

# define results
result_1 = struct;
result_1.Name = "E";
result_1.Result = "::model::monitor_1::E";

# add the results R & T to the sweep
addsweepresult("sweep_pitch_script", result_1);

# run the sweep
runsweep("sweep_pitch_script");

# save & view the results
#mname="monitor_1";       # monitor name
#E=getdata(mname,"E");
#E2=getelectric("monitor_1");

# mapping
X=1:para1;
Y=1:para2;
Z=1:result_1;
data=readmatrix(para1,para2,result_1);
dataset=rectilineardataset("dataset",para1,para2,results_1);
dataset.addattribute("data",data);
visualize(dataset);

--------------------------------

 

 

Â