-
Notifications
You must be signed in to change notification settings - Fork 11
/
VoxHenry_generator_numex1_straight_conductor.m
153 lines (119 loc) · 6.04 KB
/
VoxHenry_generator_numex1_straight_conductor.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
clc; close all; clear all; format long e;
disp('------------------------------------------------------------------')
disp(' VoxHenry input file generator')
disp('------------------------------------------------------------------')
% -------------------------------------------------------------------------
% Add the Current Path to Workspace
% -------------------------------------------------------------------------
pre_define_the_path_for_folders
% -------------------------------------------------------------------------
% Inputs for the Structure
% -------------------------------------------------------------------------
%
% straight conductor
%
%
% These are the user parameters. Modify this section to generate different models
%
% voxel size (deltax)
Res = 0.01e-6;
% inputs for generating conductors with specified lengths and widths of arms
num_conds = 2; % number of conductors
num_ports = 2; % number of ports
len_cond=0.6e-6; % length of conductors
width_cond=0.2e-6; % width of conductor
height_cond=0.2e-6; % height of conductor
dist_btw_conds=0.5e-6; % distance between centers of conductors
%
% End of user parameters
%
% -------------------------------------------------------------------------
% Inputs for Simulation
% -------------------------------------------------------------------------
freq = [1e0 2.5e0 5e0 7.5e0 1e1 2.5e1 5e1 7.5e1 1e2 2.5e2 5e2 7.5e2 ...
1e3 2.5e3 5e3 7.5e3 1e4 2.5e4 5e4 7.5e4 1e5 2.5e5 5e5 7.5e5 ...
1e6 2.5e6 5e6 7.5e6 1e7 2.5e7 5e7 7.5e7 1e8 2.5e8 5e8 7.5e8 ...
1e9 2.5e9 5e9 7.5e9 1e10] ; % frequency
%freq = [1e10] ; % frequency
num_freq = length(freq);
freq_curr_plot=2.5e9; % frequency for plotting currents
er = 0; % epsilon_r of conductors
%se=[5.8e7 3.77e7]; % conductivity of conductors
se=5.8e8; % conductivity of conductors
lL=5e-8; % London penetration depth (zero for non superconductive)
fl_check_domain=0; % set to 1 for only plotting the structure (no simulation)
fl_check_geo=0; % set to 1 for only plotting the domain (no simulation)
fl_check_ports=0; % set to 1 for only plotting the port nodes (no simulation)
plot_option=1; % see the options of plotting in Visualization part
% output file name
fileoutname = sprintf('Input_files%sstraight_cond%d_len%.1fu_wid%.1fu_dist%.1fu.vhr', filesep, num_conds, len_cond*1e6, width_cond*1e6, dist_btw_conds*1e6)
cen_cond1=[len_cond/2 width_cond/2 height_cond/2];
Cnt = [cen_cond1;]; % centers of conductors
for kk=1:num_conds-1
for ll=1:1
Cnt=[Cnt; [Cnt(ll,1) Cnt(ll,2)+kk*dist_btw_conds Cnt(ll,3)]];
end
end
Dims_tmp = [len_cond width_cond height_cond;]; % dimensions of conductors(L(x),W(y),H(z))
Orients_tmp=['x';]; % orientations of conductors
Dims=[]; Orients=num2str([]);
for kk=1:num_conds
Dims=[Dims;Dims_tmp];
Orients=[Orients;Orients_tmp];
end
% -------------------------------------------------------------------------
% Initialize stuff
% -------------------------------------------------------------------------
disp(['Model type: straight conductors with width ', num2str(width_cond), ' m, height ', num2str(height_cond), ' m and length ', num2str(len_cond), ' m']);
disp([' number of conductors: ', num2str(num_conds), ', distance between conductors ', num2str(dist_btw_conds)]);
disp([' number of ports: ', num2str(num_ports)]);
disp('------------------------------------------------------------------')
firstline = sprintf('* Model type: straight conductors, width %g m, height %g m, length %g m\n* distance %g, number of conductors %d, ports %d\n', width_cond, height_cond, len_cond, dist_btw_conds, num_conds, num_ports);
if (issorted(freq) == 0) % not sorted
freq=sort(freq)
end
freq_all = freq;
freq = freq(1); % currently do everything for the lowest freq
EMconstants
bbox_min=[0 0 0]; % minimum coordinates of bounding box (bbox) - set to positive reals if possible
bbox_max=[len_cond (num_conds-1)*dist_btw_conds+width_cond height_cond]; % max coordinates of bbox
% -------------------------------------------------------------------------
% Input for Ports
% -------------------------------------------------------------------------
% At the end of this part, we need structures pnt_lft{xx} and pnt_rght{xx} which
% contains the coordinates of nodes on both sides of xxth port
% defining the nodes in first port
pnt_lft=cell(num_ports,1);
pnt_rght=cell(num_ports,1);
pnt_lft{1}=zeros(round(width_cond/Res)*round(height_cond/Res),3);
pnt_rght{1}=zeros(round(width_cond/Res)*round(height_cond/Res),3);
dum=1;
for kk=1:round(width_cond/Res)
for ll=1:round(height_cond/Res)
pnt_rght{1}(dum,1:3)=[len_cond (2*kk-1)*(0.5*Res) (2*ll-1)*(0.5*Res)]; % points on which excitation defined
pnt_lft{1}(dum,1:3)=[0 (2*kk-1)*(0.5*Res) (2*ll-1)*(0.5*Res)]; % points on which ground defined
dum=dum+1;
end
end
% defining the nodes in remaining ports
for kk=2:num_ports
pnt_lft{kk}(:,2)=pnt_lft{1}(:,2) + dist_btw_conds*(kk-1);
pnt_lft{kk}(:,[1 3])=pnt_lft{1}(:,[1 3]);
pnt_rght{kk}(:,2)=pnt_rght{1}(:,2) + dist_btw_conds*(kk-1);
pnt_rght{kk}(:,[1 3])=pnt_rght{1}(:,[1 3]);
end
% defining nodes connected ground if conductors without ports exist; if
% there is no, then leave as a empty array.
%pnt_well_cond=[pnt_lft{1}(1,1) pnt_lft{1}(1,2) + dist_btw_conds pnt_lft{1}(1,3);];
pnt_well_cond=[];
% -------------------------------------------------------------------------
% Define domain and constitutive parameters
% -------------------------------------------------------------------------
% generate domain 3D grid
[r] = generategridfrombbox(Res,[bbox_min(1) bbox_max(1)],[bbox_min(2) bbox_max(2)],[bbox_min(3) bbox_max(3)],fl_check_domain);
% assign constitutive parameters
[idx,epsilon_r,sigma_e,lambdaL,grid_intcon] = intcon_constparams(r,Res,Cnt,Dims,Orients,er,se,lL,fl_check_geo);
% -------------------------------------------------------------------------
% Output file
% -------------------------------------------------------------------------
pre_output_file