-
Notifications
You must be signed in to change notification settings - Fork 3
/
ito1.m
232 lines (216 loc) · 7.85 KB
/
ito1.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
clear
clc
p = 3.6;
% p = 3.75;
% p = 3.68;
% p = 12;
matrix = [ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0
0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0
0 0 0 0 1 0 1 1 1 1 1 1 0 1 1 1 0 0 0 0
0 0 0 0 1 0 1 0 0 0 0 1 0 0 0 1 0 0 0 0
0 0 0 0 1 0 1 0 1 1 0 1 1 1 0 1 0 0 0 0
0 0 0 0 1 0 1 0 1 1 0 0 0 1 0 1 0 0 0 0
0 0 0 0 1 0 1 0 0 0 1 1 0 1 0 1 0 0 0 0
0 0 0 0 1 0 1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1 0 0 0 0 1 1 1 0 0 1 0 0 0 0 0
% 0 0 0 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0
% 0 0 0 0 0 1 0 0 1 1 1 1 1 1 0 0 0 0 1 0 0 0 0 0
% 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0
% 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
% 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0
% 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
% 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
% 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
% 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
% 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
[px, py] = size(matrix);
a = p / px;
b = p / py;
c = 185e-6;
% c = 0.01;
% c = 0;
t = 1.0;
% t = 3;
Frq = [5, 50];
cst = actxserver('CSTStudio.application');
mws = invoke(cst, 'NewMWS');
app = invoke(mws, 'GetApplicationName');
ver = invoke(mws, 'GetApplicationVersion');
invoke(mws, 'FileNew');
path = pwd;
filename='\metamaterialabsorber.cst';
fullname=[path filename];
invoke(mws, 'SaveAs', fullname, 'True');
invoke(mws, 'DeleteResults');
units = invoke(mws, 'Units');
invoke(units, 'Geometry', 'mm');
invoke(units, 'Frequency', 'ghz');
invoke(units, 'Time', 'ns');
invoke(units, 'TemperatureUnit', 'kelvin');
release(units);
solver = invoke(mws, 'Solver');
invoke(solver, 'FrequencyRange', Frq(1), Frq(2));
release(solver);
background = invoke(mws, 'Background');
invoke(background, 'Resetbackground');
invoke(background, 'Type','Normal');
release(background);
floquetport = invoke(mws, 'FloquetPort');
invoke(floquetport, 'Reset');
invoke(floquetport, 'SetDialogTheta', '0');
invoke(floquetport, 'SetDialogPhi', '0');
invoke(floquetport, 'SetSortcode', '+beta/pw');
invoke(floquetport, 'SetCustomizedListFlag', 'False');
invoke(floquetport, 'Port', 'Zmin');
invoke(floquetport, 'SetNumberOfModesConsidered', '2');
invoke(floquetport, 'Port', 'Zmax');
invoke(floquetport, 'SetNumberOfModesConsidered', '2');
release(floquetport);
boundary = invoke(mws, 'Boundary');
invoke(boundary, 'Xmin', 'unit cell');
invoke(boundary, 'Xmax', 'unit cell');
invoke(boundary, 'Ymin', 'unit cell');
invoke(boundary, 'Ymax', 'unit cell');
invoke(boundary, 'Zmin', 'expanded open');
invoke(boundary, 'Zmax', 'expanded open');
invoke(boundary, 'Xsymmetry', 'none');
invoke(boundary, 'Ysymmetry', 'none');
invoke(boundary, 'Zsymmetry', 'none');
invoke(boundary, 'XPeriodicShift', '0.0');
invoke(boundary, 'YPeriodicShift', '0.0');
invoke(boundary, 'ZPeriodicShift', '0.0');
invoke(boundary, 'SetPeriodicBoundaryAnglesDirection', 'inward');
invoke(boundary, 'UnitCellFitToBoundingBox', 'True');
invoke(boundary, 'UnitCellDs1', '0.0');
invoke(boundary, 'UnitCellDs2', '0.0');
invoke(boundary, 'UnitCellAngle', '90.0');
release(boundary);
meshsettings = invoke(mws, 'MeshSettings');
invoke(meshsettings, 'SetMeshType', 'Tet');
invoke(meshsettings, 'Set', 'version', '1%');
release(meshsettings);
mesh = invoke(mws, 'Mesh');
invoke(mesh, 'MeshType', 'Tetrahedral');
release(mesh);
material_glass = invoke(mws, 'Material');
substate = 'material_glass';
invoke(material_glass, 'Reset');
invoke(material_glass, 'Name', substate);
invoke(material_glass, 'FrqType', 'all');
invoke(material_glass, 'Type', 'Normal');
invoke(material_glass, 'Epsilon', 4.7);
invoke(material_glass, 'Colour', 0.8, 0.0, 0.9);
invoke(material_glass, 'Create');
release(material_glass);
brick = invoke(mws, 'Brick');
Str_Name = 'substate';
Str_Component = 'substate';
Str_Material = substate;
x = [0, px * a];
y = [0, py * b];
z = [0, t];
invoke(brick, 'Reset');
invoke(brick, 'Name', Str_Name);
invoke(brick, 'Component', Str_Component);
invoke(brick, 'Material', Str_Material);
invoke(brick, 'Xrange', x(1), x(2));
invoke(brick, 'Yrange', y(1), y(2));
invoke(brick, 'Zrange', z(1), z(2));
invoke(brick, 'Create');
material_ITO = invoke(mws, 'Material');
ITO = 'material_ITO';
invoke(material_ITO, 'Reset');
invoke(material_ITO, 'Name', ITO);
invoke(material_ITO, 'Rho', 0.0);
invoke(material_ITO, 'ThermalType', 'Normal');
invoke(material_ITO, 'FrqType', 'all');
invoke(material_ITO, 'Type', 'Lossy metal');
invoke(material_ITO, 'OhmicSheetImpedance', 30, 0);%ITOµÄ·½×è
invoke(material_ITO, 'OhmicSheetFreq', 0);
invoke(material_ITO, 'Colour', 0.0, 0.8, 0.9);
invoke(material_ITO, 'Create');
release(material_ITO);
brick = invoke(mws, 'Brick');
Str_Name = 'mirror';
Str_Component = 'mirror';
Str_Material = ITO;
x = [0, px * a];
y = [0, py * b];
z=[-c, 0];
invoke(brick, 'Reset');
invoke(brick, 'Name', Str_Name);
invoke(brick, 'Component', Str_Component);
invoke(brick, 'Material', Str_Material);
invoke(brick, 'Xrange', x(1), x(2));
invoke(brick, 'Yrange', y(1), y(2));
invoke(brick, 'Zrange', z(1), z(2));
invoke(brick, 'Create');
% brick = invoke(mws, 'Brick');
% Str_Name = 'mirror';
% Str_Component = 'mirror';
% Str_Material = 'PEC';
% x = [0, px * a];
% y = [0, py * b];
% z=[-c, 0];
% invoke(brick, 'Reset');
% invoke(brick, 'Name', Str_Name);
% invoke(brick, 'Component', Str_Component);
% invoke(brick, 'Material', Str_Material);
% invoke(brick, 'Xrange', x(1), x(2));
% invoke(brick, 'Yrange', y(1), y(2));
% invoke(brick, 'Zrange', z(1), z(2));
% invoke(brick, 'Create');
count = 0;
for yy = 1: py
for xx = 1: px
if matrix(xx, yy) == double(1)
count = count + 1;
Str_Name = num2str(count);
Str_Component = 'toplayer';
Str_Material = ITO;
x=[(xx - 1) * a, xx * a];
y=[(yy - 1) * b, yy * b];
z=[t, t + c];
invoke(brick, 'Reset');
invoke(brick, 'Name', Str_Name);
invoke(brick, 'Component', Str_Component);
invoke(brick, 'Material', Str_Material);
invoke(brick, 'Xrange', x(1), x(2));
invoke(brick, 'Yrange', y(1), y(2));
invoke(brick, 'Zrange', z(1), z(2));
invoke(brick, 'Create');
end
end
end
solid = invoke(mws, 'Solid');
for n = 1: count - 1
tmp = ['toplayer:', num2str(n + 1)];
invoke(solid, 'Add', 'toplayer:1', tmp);
end
invoke(solid, 'Rename', 'toplayer:1', 'toplayer')
release(solid);