example updates & fix in HDF5 plot and mesh handling
parent
1b52834e89
commit
403a2d9e34
|
@ -25,7 +25,10 @@ mesh = ReadHDF5Mesh(file);
|
||||||
fields = ReadHDF5FieldData(file);
|
fields = ReadHDF5FieldData(file);
|
||||||
|
|
||||||
if (mesh.type==0)
|
if (mesh.type==0)
|
||||||
[X Y Z] = meshgrid(double(mesh.lines{1}),double(mesh.lines{2}),double(mesh.lines{3}));
|
% matlab is building a meshgrid incorrect, adressing it like X(y,x,z)
|
||||||
|
% ??it's not a bug, it's a feature??
|
||||||
|
% check if this workaround is correct (TL)
|
||||||
|
[X Y Z] = meshgrid(mesh.lines{2},mesh.lines{1},mesh.lines{3});
|
||||||
else
|
else
|
||||||
disp(['PlotHDF5FieldData:: Error: unknown mesh type ' num2str(mesh.type)]);
|
disp(['PlotHDF5FieldData:: Error: unknown mesh type ' num2str(mesh.type)]);
|
||||||
end
|
end
|
||||||
|
@ -34,13 +37,13 @@ max_amp = 0;
|
||||||
|
|
||||||
if (component>0)
|
if (component>0)
|
||||||
for n=1:numel(fields.values)
|
for n=1:numel(fields.values)
|
||||||
Field{n} = double(fields.values{n}(:,:,:,component));
|
Field{n} = fields.values{n}(:,:,:,component);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
for n=1:numel(fields.values)
|
for n=1:numel(fields.values)
|
||||||
fx = double(fields.values{n}(:,:,:,1));
|
fx = fields.values{n}(:,:,:,1);
|
||||||
fy = double(fields.values{n}(:,:,:,2));
|
fy = fields.values{n}(:,:,:,2);
|
||||||
fz = double(fields.values{n}(:,:,:,3));
|
fz = fields.values{n}(:,:,:,3);
|
||||||
Field{n} = sqrt(fx.^2 + fy.^2 + fz.^2);
|
Field{n} = sqrt(fx.^2 + fy.^2 + fz.^2);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -22,7 +22,7 @@ end
|
||||||
|
|
||||||
hdf_mesh.names = names;
|
hdf_mesh.names = names;
|
||||||
for n=1:numel(names)
|
for n=1:numel(names)
|
||||||
hdf_mesh.lines{n} = hdf5read(file,names{n});
|
hdf_mesh.lines{n} = double(hdf5read(file,names{n}));
|
||||||
end
|
end
|
||||||
|
|
||||||
if (strcmp(names{1},'/mesh/rho'))
|
if (strcmp(names{1},'/mesh/rho'))
|
||||||
|
|
|
@ -33,16 +33,19 @@ openEMS_opts = '';
|
||||||
% openEMS_opts = [openEMS_opts ' --disable-dumps'];
|
% openEMS_opts = [openEMS_opts ' --disable-dumps'];
|
||||||
% openEMS_opts = [openEMS_opts ' --debug-material'];
|
% openEMS_opts = [openEMS_opts ' --debug-material'];
|
||||||
% openEMS_opts = [openEMS_opts ' --debug-operator'];
|
% openEMS_opts = [openEMS_opts ' --debug-operator'];
|
||||||
% openEMS_opts = [openEMS_opts ' --engine=multithreaded'];
|
openEMS_opts = [openEMS_opts ' --engine=sse-compressed'];
|
||||||
|
|
||||||
Sim_Path = 'tmp';
|
Sim_Path = 'tmp';
|
||||||
Sim_CSX = 'Circ_WG.xml';
|
Sim_CSX = 'Circ_WG.xml';
|
||||||
|
|
||||||
|
if (exist(Sim_Path,'dir'))
|
||||||
|
rmdir(Sim_Path,'s');
|
||||||
|
end
|
||||||
mkdir(Sim_Path);
|
mkdir(Sim_Path);
|
||||||
|
|
||||||
%% setup FDTD parameter & excitation function %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% setup FDTD parameter & excitation function %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
FDTD = InitFDTD(1000,1e-6,'OverSampling',5);
|
FDTD = InitFDTD(1000,1e-6,'OverSampling',5);
|
||||||
T = 1/f0;
|
T = 4*1/f0;
|
||||||
FDTD = SetCustomExcite(FDTD,f0,[ '(1-exp(-1*(t/' num2str(T) ')^2) ) * sin(2*pi*' num2str(f0) '*t)' ]);
|
FDTD = SetCustomExcite(FDTD,f0,[ '(1-exp(-1*(t/' num2str(T) ')^2) ) * sin(2*pi*' num2str(f0) '*t)' ]);
|
||||||
BC = [1 1 1 1 1 1] * 0;
|
BC = [1 1 1 1 1 1] * 0;
|
||||||
FDTD = SetBoundaryCond(FDTD,BC);
|
FDTD = SetBoundaryCond(FDTD,BC);
|
||||||
|
@ -85,23 +88,13 @@ CSX = SetExcitationWeight(CSX, 'excite', weight );
|
||||||
CSX = AddCylinder(CSX,'excite', 5 ,[0 0 -0.1],[0 0 0.1],rad);
|
CSX = AddCylinder(CSX,'excite', 5 ,[0 0 -0.1],[0 0 0.1],rad);
|
||||||
|
|
||||||
%% define dump boxes... %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% define dump boxes... %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
CSX = AddDump(CSX,'Et','SubSampling','2,2,4','FileType',1,'DumpMode',2);
|
CSX = AddDump(CSX,'Et','SubSampling','2,2,2','FileType',1,'DumpMode',2);
|
||||||
start = [mesh.x(1) , mesh.y(1) , mesh.z(1)];
|
start = [mesh.x(1) , mesh.y(1) , mesh.z(1)];
|
||||||
stop = [mesh.x(end) , mesh.y(end) , mesh.z(end)];
|
stop = [mesh.x(end) , mesh.y(end) , mesh.z(end)];
|
||||||
CSX = AddBox(CSX,'Et',0 , start,stop);
|
CSX = AddBox(CSX,'Et',0 , start,stop);
|
||||||
|
|
||||||
% CSX = AddDump(CSX,'Ht','SubSampling','2,2,4','DumpType',1,'FileType',1,'DumpMode',2);
|
CSX = AddDump(CSX,'Ht','SubSampling','2,2,2','DumpType',1,'FileType',1,'DumpMode',2);
|
||||||
% CSX = AddBox(CSX,'Ht',0,start,stop);
|
CSX = AddBox(CSX,'Ht',0,start,stop);
|
||||||
|
|
||||||
% CSX = AddDump(CSX,'Excite_');
|
|
||||||
% start = [mesh.x(1) , mesh.y(1) , 0];
|
|
||||||
% stop = [mesh.x(end) , mesh.y(end) ,0];
|
|
||||||
% CSX = AddBox(CSX,'Excite_',0 , start,stop);
|
|
||||||
%
|
|
||||||
% CSX = AddDump(CSX,'Exy');
|
|
||||||
% start = [mesh.x(1) , mesh.y(1) , length/2];
|
|
||||||
% stop = [mesh.x(end) , mesh.y(end) , length/2];
|
|
||||||
% CSX = AddBox(CSX,'Exy',0 , start,stop);
|
|
||||||
|
|
||||||
%% define voltage calc boxes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% define voltage calc boxes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
%voltage calc
|
%voltage calc
|
||||||
|
@ -124,6 +117,7 @@ UI = ReadUI('ut1','tmp/');
|
||||||
plot(UI.TD{1}.t,UI.TD{1}.val);
|
plot(UI.TD{1}.t,UI.TD{1}.val);
|
||||||
grid on;
|
grid on;
|
||||||
|
|
||||||
|
figure
|
||||||
% plotting
|
% plotting
|
||||||
if exist('tmp/Et.h5','file')
|
if exist('tmp/Et.h5','file')
|
||||||
PlotArgs.slice = {mesh.x(round(end/2)) mesh.y(round(end/2)) mesh.z(round(end/2))};
|
PlotArgs.slice = {mesh.x(round(end/2)) mesh.y(round(end/2)) mesh.z(round(end/2))};
|
||||||
|
|
|
@ -34,7 +34,6 @@ openEMS_opts = '';
|
||||||
% openEMS_opts = [openEMS_opts ' --disable-dumps'];
|
% openEMS_opts = [openEMS_opts ' --disable-dumps'];
|
||||||
% openEMS_opts = [openEMS_opts ' --debug-material'];
|
% openEMS_opts = [openEMS_opts ' --debug-material'];
|
||||||
% openEMS_opts = [openEMS_opts ' --debug-operator'];
|
% openEMS_opts = [openEMS_opts ' --debug-operator'];
|
||||||
% openEMS_opts = [openEMS_opts ' --engine=multithreaded'];
|
|
||||||
|
|
||||||
if (do_Half_Waveguide)
|
if (do_Half_Waveguide)
|
||||||
Sim_Path = 'tmp_half_CWG_CC';
|
Sim_Path = 'tmp_half_CWG_CC';
|
||||||
|
@ -43,6 +42,9 @@ else
|
||||||
end
|
end
|
||||||
Sim_CSX = 'Circ_WG_CC.xml';
|
Sim_CSX = 'Circ_WG_CC.xml';
|
||||||
|
|
||||||
|
if (exist(Sim_Path,'dir'))
|
||||||
|
rmdir(Sim_Path,'s');
|
||||||
|
end
|
||||||
mkdir(Sim_Path);
|
mkdir(Sim_Path);
|
||||||
|
|
||||||
%% setup FDTD parameter & excitation function %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% setup FDTD parameter & excitation function %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -88,18 +90,19 @@ stop(3)=0.5;
|
||||||
CSX = AddBox(CSX,'excite', 5 ,start,stop);
|
CSX = AddBox(CSX,'excite', 5 ,start,stop);
|
||||||
|
|
||||||
%% define dump boxes... %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% define dump boxes... %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
CSX = AddDump(CSX,'Et','FileType',1,'DumpMode',0,'SubSampling','1,1,5');
|
CSX = AddDump(CSX,'Et','FileType',1,'DumpMode',0,'SubSampling','2,2,5');
|
||||||
start = [mesh.x(1) , mesh.y(1)-y_delta , 0];
|
start = [mesh.x(1) , mesh.y(1)-y_delta , 0];
|
||||||
stop = [mesh.x(end) , mesh.y(end)+y_delta , length];
|
stop = [mesh.x(end) , mesh.y(end)+y_delta , length];
|
||||||
CSX = AddBox(CSX,'Et',0 , start,stop);
|
CSX = AddBox(CSX,'Et',0 , start,stop);
|
||||||
|
|
||||||
CSX = AddDump(CSX,'Ht','FileType',1,'DumpType',1,'DumpMode',0,'SubSampling','1,1,5');
|
CSX = AddDump(CSX,'Ht','FileType',1,'DumpType',1,'DumpMode',0,'SubSampling','2,2,5');
|
||||||
CSX = AddBox(CSX,'Ht',0 , start,stop);
|
CSX = AddBox(CSX,'Ht',0 , start,stop);
|
||||||
|
|
||||||
CSX = AddDump(CSX,'Et_rz_','FileType',0,'DumpMode',2,'SubSampling','1,1,5');
|
% % dumpt r-z-plane to vtk-file
|
||||||
start = [mesh.x(1) , 0 , 0];
|
% CSX = AddDump(CSX,'Et_rz_','FileType',0,'DumpMode',2,'SubSampling','1,1,5');
|
||||||
stop = [mesh.x(end) , 0 , length];
|
% start = [mesh.x(1) , 0 , 0];
|
||||||
CSX = AddBox(CSX,'Et_rz_',0 , start,stop);
|
% stop = [mesh.x(end) , 0 , length];
|
||||||
|
% CSX = AddBox(CSX,'Et_rz_',0 , start,stop);
|
||||||
|
|
||||||
%% define voltage calc boxes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% define voltage calc boxes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
CSX = AddProbe(CSX,'ut_exc',0);
|
CSX = AddProbe(CSX,'ut_exc',0);
|
||||||
|
|
|
@ -20,18 +20,24 @@ epsR = 1;
|
||||||
|
|
||||||
%% define openEMS options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% define openEMS options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
openEMS_opts = '';
|
openEMS_opts = '';
|
||||||
openEMS_opts = [openEMS_opts ' --disable-dumps'];
|
|
||||||
% openEMS_opts = [openEMS_opts ' --debug-material'];
|
% openEMS_opts = [openEMS_opts ' --debug-material'];
|
||||||
|
% openEMS_opts = [openEMS_opts ' --debug-operator'];
|
||||||
|
|
||||||
|
% openEMS_opts = [openEMS_opts ' --disable-dumps --engine=fastest'];
|
||||||
|
openEMS_opts = [openEMS_opts ' --engine=sse-compressed'];
|
||||||
|
|
||||||
Sim_Path = 'tmp';
|
Sim_Path = 'tmp';
|
||||||
Sim_CSX = 'coax.xml';
|
Sim_CSX = 'coax.xml';
|
||||||
|
|
||||||
|
if (exist(Sim_Path,'dir'))
|
||||||
|
rmdir(Sim_Path,'s');
|
||||||
|
end
|
||||||
mkdir(Sim_Path);
|
mkdir(Sim_Path);
|
||||||
|
|
||||||
%% setup FDTD parameter & excitation function %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% setup FDTD parameter & excitation function %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
FDTD = InitFDTD(5e5,1e-5);
|
FDTD = InitFDTD(5e5,1e-5);
|
||||||
FDTD = SetGaussExcite(FDTD,f0,f0);
|
FDTD = SetGaussExcite(FDTD,f0,f0);
|
||||||
BC = [1 1 1 1 1 1] * 0;
|
BC = [0 0 0 0 0 0]; %electric walls only
|
||||||
FDTD = SetBoundaryCond(FDTD,BC);
|
FDTD = SetBoundaryCond(FDTD,BC);
|
||||||
|
|
||||||
%% setup CSXCAD geometry & mesh %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% setup CSXCAD geometry & mesh %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
|
@ -29,6 +29,9 @@ openEMS_opts = [openEMS_opts ' --disable-dumps'];
|
||||||
Sim_Path = 'tmp';
|
Sim_Path = 'tmp';
|
||||||
Sim_CSX = 'coax.xml';
|
Sim_CSX = 'coax.xml';
|
||||||
|
|
||||||
|
if (exist(Sim_Path,'dir'))
|
||||||
|
rmdir(Sim_Path,'s');
|
||||||
|
end
|
||||||
mkdir(Sim_Path);
|
mkdir(Sim_Path);
|
||||||
|
|
||||||
%% setup FDTD parameter & excitation function %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% setup FDTD parameter & excitation function %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
|
@ -1,128 +0,0 @@
|
||||||
close all
|
|
||||||
clear
|
|
||||||
clc
|
|
||||||
|
|
||||||
EPS0 = 8.85418781762e-12;
|
|
||||||
MUE0 = 1.256637062e-6;
|
|
||||||
C0 = 1/sqrt(EPS0*MUE0);
|
|
||||||
Z0 = sqrt(MUE0/EPS0);
|
|
||||||
|
|
||||||
f0 = 0.5e9;
|
|
||||||
epsR = 3.6;
|
|
||||||
|
|
||||||
abs_length = 250;
|
|
||||||
length = 6000;
|
|
||||||
port_dist = 1500;
|
|
||||||
rad_i = 100;
|
|
||||||
rad_a = 230;
|
|
||||||
partial = 0.25;
|
|
||||||
max_mesh = 10;
|
|
||||||
max_alpha = max_mesh;
|
|
||||||
N_alpha = ceil(rad_a * 2*pi * partial / max_alpha);
|
|
||||||
mesh_res = [max_mesh 2*pi*partial/N_alpha max_mesh];
|
|
||||||
|
|
||||||
openEMS_opts = '';
|
|
||||||
openEMS_opts = [openEMS_opts ' --disable-dumps'];
|
|
||||||
% openEMS_opts = [openEMS_opts ' --debug-material'];
|
|
||||||
|
|
||||||
Sim_Path = 'tmp';
|
|
||||||
Sim_CSX = 'coax.xml';
|
|
||||||
|
|
||||||
mkdir(Sim_Path);
|
|
||||||
|
|
||||||
%setup FDTD parameter
|
|
||||||
FDTD = InitCylindricalFDTD(1e5,1e-5);
|
|
||||||
FDTD = SetGaussExcite(FDTD,f0,f0);
|
|
||||||
BC = [0 0 1 1 0 0];
|
|
||||||
FDTD = SetBoundaryCond(FDTD,BC);
|
|
||||||
|
|
||||||
%setup CSXCAD geometry
|
|
||||||
CSX = InitCSX();
|
|
||||||
mesh.x = rad_i : mesh_res(1) : rad_a;
|
|
||||||
mesh.y = -pi*partial-mesh_res(2)/2 : mesh_res(2) : pi*partial+mesh_res(2)/2;
|
|
||||||
mesh.z = 0 : mesh_res(3) : length;
|
|
||||||
CSX = DefineRectGrid(CSX, 1e-3,mesh);
|
|
||||||
|
|
||||||
%%%fake pml
|
|
||||||
finalKappa = 0.3/abs_length^4;
|
|
||||||
finalSigma = finalKappa*MUE0/EPS0/epsR;
|
|
||||||
CSX = AddMaterial(CSX,'pml');
|
|
||||||
CSX = SetMaterialProperty(CSX,'pml','Kappa',finalKappa,'Epsilon',epsR);
|
|
||||||
CSX = SetMaterialProperty(CSX,'pml','Sigma',finalSigma);
|
|
||||||
CSX = SetMaterialWeight(CSX,'pml','Kappa',['pow(abs(z)-' num2str(length-abs_length) ',4)']);
|
|
||||||
CSX = SetMaterialWeight(CSX,'pml','Sigma',['pow(abs(z)-' num2str(length-abs_length) ',4)']);
|
|
||||||
|
|
||||||
start = [rad_i mesh.y(1) length-abs_length];
|
|
||||||
stop = [rad_a mesh.y(end) length];
|
|
||||||
CSX = AddBox(CSX,'pml',0 ,start,stop);
|
|
||||||
|
|
||||||
|
|
||||||
CSX = AddMaterial(CSX,'fill');
|
|
||||||
CSX = SetMaterialProperty(CSX,'fill','Epsilon',epsR);
|
|
||||||
start = [mesh.x(1) mesh.y(1) 0];
|
|
||||||
stop = [mesh.x(end) mesh.y(end) length];
|
|
||||||
CSX = AddBox(CSX,'fill',0 ,start,stop);
|
|
||||||
|
|
||||||
|
|
||||||
start = [rad_i mesh.y(1) 0];
|
|
||||||
stop = [rad_a mesh.y(end) 0];
|
|
||||||
|
|
||||||
CSX = AddExcitation(CSX,'excite',0,[1 0 0]);
|
|
||||||
weight{1} = '1/rho';
|
|
||||||
weight{2} = 0;
|
|
||||||
weight{3} = 0;
|
|
||||||
CSX = SetExcitationWeight(CSX, 'excite', weight );
|
|
||||||
CSX = AddBox(CSX,'excite',0 ,start,stop);
|
|
||||||
|
|
||||||
%dump
|
|
||||||
CSX = AddDump(CSX,'Et_','DumpMode',2);
|
|
||||||
start = [mesh.x(1) , 0 , mesh.z(1)];
|
|
||||||
stop = [mesh.x(end) , 0 , mesh.z(end)];
|
|
||||||
CSX = AddBox(CSX,'Et_',0 , start,stop);
|
|
||||||
|
|
||||||
CSX = AddDump(CSX,'Ht_','DumpType',1,'DumpMode',2);
|
|
||||||
CSX = AddBox(CSX,'Ht_',0,start,stop);
|
|
||||||
|
|
||||||
% voltage calc (take a voltage average to be at the same spot as the
|
|
||||||
% current calculation)
|
|
||||||
CSX = AddProbe(CSX,'ut1_1',0);
|
|
||||||
start = [ rad_i 0 port_dist ];stop = [ rad_a 0 port_dist ];
|
|
||||||
CSX = AddBox(CSX,'ut1_1', 0 ,start,stop);
|
|
||||||
CSX = AddProbe(CSX,'ut1_2',0);
|
|
||||||
start = [ rad_i 0 port_dist+mesh_res(3) ];stop = [ rad_a 0 port_dist+mesh_res(3) ];
|
|
||||||
CSX = AddBox(CSX,'ut1_2', 0 ,start,stop);
|
|
||||||
|
|
||||||
% current calc
|
|
||||||
CSX = AddProbe(CSX,'it1',1);
|
|
||||||
mid = 0.5*(rad_i+rad_a);
|
|
||||||
start = [ 0 mesh.y(1) port_dist ];stop = [ mid mesh.y(end) port_dist ];
|
|
||||||
CSX = AddBox(CSX,'it1', 0 ,start,stop);
|
|
||||||
|
|
||||||
%Write openEMS compatoble xml-file
|
|
||||||
WriteOpenEMS([Sim_Path '/' Sim_CSX],FDTD,CSX);
|
|
||||||
|
|
||||||
%cd to working dir and run openEMS
|
|
||||||
savePath = pwd();
|
|
||||||
cd(Sim_Path); %cd to working dir
|
|
||||||
args = [Sim_CSX ' ' openEMS_opts];
|
|
||||||
invoke_openEMS(args)
|
|
||||||
cd(savePath);
|
|
||||||
|
|
||||||
UI = ReadUI({'ut1_1','ut1_2','it1'},'tmp/');
|
|
||||||
u_f = (UI.FD{1}.val + UI.FD{2}.val)/2; %averaging voltages to fit current
|
|
||||||
i_f = UI.FD{3}.val / partial;
|
|
||||||
|
|
||||||
delta_t = UI.TD{3}.t(1) - UI.TD{1}.t(1); % half time-step (s)
|
|
||||||
i_f2 = i_f .* exp(-1i*2*pi*UI.FD{1}.f*delta_t); % compensate half time-step advance of H-field
|
|
||||||
|
|
||||||
ZL = Z0/2/pi/sqrt(epsR)*log(rad_a/rad_i); %analytic line-impedance of a coax
|
|
||||||
plot(UI.FD{1}.f,ZL*ones(size(u_f)),'g');
|
|
||||||
hold on;
|
|
||||||
grid on;
|
|
||||||
Z = u_f./i_f2;
|
|
||||||
plot(UI.FD{1}.f,real(Z),'Linewidth',2);
|
|
||||||
plot(UI.FD{1}.f,imag(Z),'r','Linewidth',2);
|
|
||||||
xlim([0 2*f0]);
|
|
||||||
legend('Z_L','\Re\{Z\}','\Im\{Z\}','Location','Best');
|
|
||||||
|
|
||||||
|
|
|
@ -18,11 +18,13 @@ f_excite = 300e6;
|
||||||
|
|
||||||
%% define openEMS options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% define openEMS options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
openEMS_opts = '';
|
openEMS_opts = '';
|
||||||
% openEMS_opts = [openEMS_opts ' --disable-dumps'];
|
% openEMS_opts = [openEMS_opts ' --debug-material'];
|
||||||
openEMS_opts = [openEMS_opts ' --debug-material'];
|
% openEMS_opts = [openEMS_opts ' --debug-boxes'];
|
||||||
openEMS_opts = [openEMS_opts ' --debug-boxes'];
|
|
||||||
% openEMS_opts = [openEMS_opts ' --debug-operator'];
|
% openEMS_opts = [openEMS_opts ' --debug-operator'];
|
||||||
|
|
||||||
|
% openEMS_opts = [openEMS_opts ' --disable-dumps --engine=fastest'];
|
||||||
|
openEMS_opts = [openEMS_opts ' --engine=sse-compressed'];
|
||||||
|
|
||||||
Sim_Path = 'tmp';
|
Sim_Path = 'tmp';
|
||||||
Sim_CSX = 'helix.xml';
|
Sim_CSX = 'helix.xml';
|
||||||
|
|
||||||
|
|
|
@ -14,15 +14,16 @@ MUE0 = 1.256637062e-6;
|
||||||
|
|
||||||
%% define openEMS options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% define openEMS options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
openEMS_opts = '';
|
openEMS_opts = '';
|
||||||
openEMS_opts = [openEMS_opts ' --disable-dumps'];
|
% openEMS_opts = [openEMS_opts ' --disable-dumps'];
|
||||||
% openEMS_opts = [openEMS_opts ' --debug-material'];
|
% openEMS_opts = [openEMS_opts ' --debug-material'];
|
||||||
openEMS_opts = [openEMS_opts ' --engine=multithreaded'];
|
openEMS_opts = [openEMS_opts ' --engine=fastest'];
|
||||||
% openEMS_opts = [openEMS_opts ' --engine=sse'];
|
|
||||||
openEMS_opts = [openEMS_opts ' --engine=sse-compressed'];
|
|
||||||
|
|
||||||
Sim_Path = 'tmp';
|
Sim_Path = 'tmp';
|
||||||
Sim_CSX = 'plane_wave.xml';
|
Sim_CSX = 'plane_wave.xml';
|
||||||
|
|
||||||
|
if (exist(Sim_Path,'dir'))
|
||||||
|
rmdir(Sim_Path,'s');
|
||||||
|
end
|
||||||
mkdir(Sim_Path);
|
mkdir(Sim_Path);
|
||||||
|
|
||||||
%% setup FDTD parameter & excitation function %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% setup FDTD parameter & excitation function %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -63,7 +64,7 @@ start = [mesh.x(1) , mesh.y(1) , mesh.z(1)];
|
||||||
stop = [mesh.x(end) , mesh.y(end) , mesh.z(end)];
|
stop = [mesh.x(end) , mesh.y(end) , mesh.z(end)];
|
||||||
CSX = AddBox(CSX,'Et',0 , start,stop);
|
CSX = AddBox(CSX,'Et',0 , start,stop);
|
||||||
|
|
||||||
CSX = AddDump(CSX,'Ht','DumpType',1,'FileType',1,'SubSampling','4,4,1');
|
CSX = AddDump(CSX,'Ht','DumpType',1,'FileType',1,'SubSampling','4,4,1','DumpMode',2);
|
||||||
CSX = AddBox(CSX,'Ht',0,start,stop);
|
CSX = AddBox(CSX,'Ht',0,start,stop);
|
||||||
|
|
||||||
%% Write openEMS compatoble xml-file %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% Write openEMS compatoble xml-file %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -72,6 +73,7 @@ WriteOpenEMS([Sim_Path '/' Sim_CSX],FDTD,CSX);
|
||||||
%% cd to working dir and run openEMS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% cd to working dir and run openEMS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
savePath = pwd();
|
savePath = pwd();
|
||||||
cd(Sim_Path); %cd to working dir
|
cd(Sim_Path); %cd to working dir
|
||||||
|
|
||||||
args = [Sim_CSX ' ' openEMS_opts];
|
args = [Sim_CSX ' ' openEMS_opts];
|
||||||
invoke_openEMS(args);
|
invoke_openEMS(args);
|
||||||
cd(savePath);
|
cd(savePath);
|
||||||
|
@ -79,7 +81,7 @@ cd(savePath);
|
||||||
%% do the plots %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% do the plots %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
PlotArgs.slice = {mesh.x(round(end/2)) mesh.y(round(end/2)) mesh.z(round(end/2))};
|
PlotArgs.slice = {mesh.x(round(end/2)) mesh.y(round(end/2)) mesh.z(round(end/2))};
|
||||||
PlotArgs.pauseTime=0.01;
|
PlotArgs.pauseTime=0.01;
|
||||||
PlotArgs.component=2;
|
PlotArgs.component=1;
|
||||||
PlotArgs.Limit = 'auto';
|
PlotArgs.Limit = 'auto';
|
||||||
|
|
||||||
PlotHDF5FieldData('tmp/Et.h5',PlotArgs)
|
PlotHDF5FieldData('tmp/Ht.h5',PlotArgs)
|
||||||
|
|
|
@ -34,11 +34,14 @@ func_Ey = [num2str(m/a/unit) '*sin(' num2str(m*pi/a) '*x)*cos(' num2str(n*pi/b)
|
||||||
openEMS_opts = '';
|
openEMS_opts = '';
|
||||||
% openEMS_opts = [openEMS_opts ' --disable-dumps'];
|
% openEMS_opts = [openEMS_opts ' --disable-dumps'];
|
||||||
% openEMS_opts = [openEMS_opts ' --debug-material'];
|
% openEMS_opts = [openEMS_opts ' --debug-material'];
|
||||||
% openEMS_opts = [openEMS_opts ' --engine=multithreaded'];
|
openEMS_opts = [openEMS_opts ' --engine=sse-compressed'];
|
||||||
|
|
||||||
Sim_Path = 'tmp';
|
Sim_Path = 'tmp';
|
||||||
Sim_CSX = 'rect_wg.xml';
|
Sim_CSX = 'rect_wg.xml';
|
||||||
|
|
||||||
|
if (exist(Sim_Path,'dir'))
|
||||||
|
rmdir(Sim_Path,'s');
|
||||||
|
end
|
||||||
mkdir(Sim_Path);
|
mkdir(Sim_Path);
|
||||||
|
|
||||||
%% setup FDTD parameter & excitation function %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% setup FDTD parameter & excitation function %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -51,7 +54,7 @@ FDTD = SetBoundaryCond(FDTD,BC);
|
||||||
CSX = InitCSX();
|
CSX = InitCSX();
|
||||||
mesh.x = 0 : mesh_res(1) : width;
|
mesh.x = 0 : mesh_res(1) : width;
|
||||||
mesh.y = 0 : mesh_res(2) : height;
|
mesh.y = 0 : mesh_res(2) : height;
|
||||||
mesh.z = -length: mesh_res(3) : length;
|
mesh.z = 0 : mesh_res(3) : length;
|
||||||
CSX = DefineRectGrid(CSX, unit,mesh);
|
CSX = DefineRectGrid(CSX, unit,mesh);
|
||||||
|
|
||||||
%% fake pml %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% fake pml %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -80,12 +83,12 @@ CSX = SetExcitationWeight(CSX,'excite',weight);
|
||||||
CSX = AddBox(CSX,'excite',0 ,start,stop);
|
CSX = AddBox(CSX,'excite',0 ,start,stop);
|
||||||
|
|
||||||
%% define dump boxes... %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% define dump boxes... %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
CSX = AddDump(CSX,'Et','FileType',1);
|
CSX = AddDump(CSX,'Et','FileType',1,'SubSampling','4,4,4');
|
||||||
start = [mesh.x(1) , height/2 , mesh.z(1)];
|
start = [mesh.x(1) , mesh.y(1) , mesh.z(1)];
|
||||||
stop = [mesh.x(end) , height/2 , mesh.z(end)];
|
stop = [mesh.x(end) , mesh.y(end) , mesh.z(end)];
|
||||||
CSX = AddBox(CSX,'Et',0 , start,stop);
|
CSX = AddBox(CSX,'Et',0 , start,stop);
|
||||||
|
|
||||||
CSX = AddDump(CSX,'Ht','DumpType',1,'FileType',1);
|
CSX = AddDump(CSX,'Ht','DumpType',1,'FileType',1,'SubSampling','4,4,4');
|
||||||
CSX = AddBox(CSX,'Ht',0,start,stop);
|
CSX = AddBox(CSX,'Ht',0,start,stop);
|
||||||
|
|
||||||
%% Write openEMS compatoble xml-file %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% Write openEMS compatoble xml-file %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
Loading…
Reference in New Issue