examples adapted to win32
parent
ab7a25d3ee
commit
d0427ea140
|
@ -1,15 +0,0 @@
|
||||||
function invoke_openEMS( opts )
|
|
||||||
|
|
||||||
if nargin < 1
|
|
||||||
opts = '';
|
|
||||||
end
|
|
||||||
% openEMS_opts = [openEMS_opts ' --disable-dumps'];
|
|
||||||
% openEMS_opts = [openEMS_opts ' --debug-material'];
|
|
||||||
|
|
||||||
filename = mfilename('fullpath');
|
|
||||||
dir = fileparts( filename );
|
|
||||||
openEMS_Path = [dir '/../../'];
|
|
||||||
|
|
||||||
command = [openEMS_Path 'openEMS.sh ' opts];
|
|
||||||
disp(command);
|
|
||||||
system(command);
|
|
|
@ -1,5 +1,5 @@
|
||||||
close all;
|
close all
|
||||||
clear all;
|
clear
|
||||||
clc
|
clc
|
||||||
|
|
||||||
%% setup the simulation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% setup the simulation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -18,7 +18,7 @@ f0 = 400e6;
|
||||||
p11 = 1.841;
|
p11 = 1.841;
|
||||||
kc = p11 / rad /unit;
|
kc = p11 / rad /unit;
|
||||||
k = 2*pi*f0/C0;
|
k = 2*pi*f0/C0;
|
||||||
fc = C0*kc/2/pi
|
fc = C0*kc/2/pi;
|
||||||
beta = sqrt(k^2 - kc^2);
|
beta = sqrt(k^2 - kc^2);
|
||||||
|
|
||||||
kc = kc*unit;
|
kc = kc*unit;
|
||||||
|
@ -28,8 +28,7 @@ func_Ea = [ num2str(1/kc) '*sin(a)*0.5*(j0(' num2str(kc) '*rho)-jn(2,' num2str
|
||||||
func_Ex = [func_Er '*cos(a) - ' func_Ea '*sin(a)'];
|
func_Ex = [func_Er '*cos(a) - ' func_Ea '*sin(a)'];
|
||||||
func_Ey = [func_Er '*sin(a) + ' func_Ea '*cos(a)'];
|
func_Ey = [func_Er '*sin(a) + ' func_Ea '*cos(a)'];
|
||||||
|
|
||||||
%% define file pathes and openEMS options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% define and openEMS options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
openEMS_Path = [pwd() '/../../']
|
|
||||||
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'];
|
||||||
|
@ -110,21 +109,14 @@ CSX = AddProbe(CSX,'ut1',0);
|
||||||
start = [ -rad 0 0/2 ];stop = [ rad 0 0/2 ];
|
start = [ -rad 0 0/2 ];stop = [ rad 0 0/2 ];
|
||||||
CSX = AddBox(CSX,'ut1', 0 ,start,stop);
|
CSX = AddBox(CSX,'ut1', 0 ,start,stop);
|
||||||
|
|
||||||
%current calc
|
|
||||||
CSX = AddProbe(CSX,'it1',1);
|
|
||||||
mid = 0.5*(coax_rad_i+coax_rad_ai);
|
|
||||||
start = [ -mid -mid length/2 ];stop = [ mid mid length/2 ];
|
|
||||||
CSX = AddBox(CSX,'it1', 0 ,start,stop);
|
|
||||||
|
|
||||||
%% Write openEMS compatoble xml-file %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% Write openEMS compatoble xml-file %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
WriteOpenEMS([Sim_Path '/' Sim_CSX],FDTD,CSX);
|
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
|
||||||
command = [openEMS_Path 'openEMS.sh ' Sim_CSX ' ' openEMS_opts];
|
args = [Sim_CSX ' ' openEMS_opts];
|
||||||
disp(command);
|
invoke_openEMS(args);
|
||||||
system(command)
|
|
||||||
cd(savePath);
|
cd(savePath);
|
||||||
|
|
||||||
%% do the plots %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% do the plots %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
close all;
|
close all
|
||||||
clear all;
|
clear
|
||||||
clc
|
clc
|
||||||
|
|
||||||
%% setup the simulation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% setup the simulation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -22,15 +22,14 @@ f0 = 400e6;
|
||||||
p11 = 1.841;
|
p11 = 1.841;
|
||||||
kc = p11 / rad /unit;
|
kc = p11 / rad /unit;
|
||||||
k = 2*pi*f0/C0;
|
k = 2*pi*f0/C0;
|
||||||
fc = C0*kc/2/pi
|
fc = C0*kc/2/pi;
|
||||||
beta = sqrt(k^2 - kc^2);
|
beta = sqrt(k^2 - kc^2);
|
||||||
|
|
||||||
kc = kc*unit;
|
kc = kc*unit;
|
||||||
func_Er = [ num2str(-1/kc^2,15) '/rho*cos(a)*j1(' num2str(kc,15) '*rho)'];
|
func_Er = [ num2str(-1/kc^2,15) '/rho*cos(a)*j1(' num2str(kc,15) '*rho)'];
|
||||||
func_Ea = [ num2str(1/kc,15) '*sin(a)*0.5*(j0(' num2str(kc,15) '*rho)-jn(2,' num2str(kc,15) '*rho))'];
|
func_Ea = [ num2str(1/kc,15) '*sin(a)*0.5*(j0(' num2str(kc,15) '*rho)-jn(2,' num2str(kc,15) '*rho))'];
|
||||||
|
|
||||||
%% define file pathes and openEMS options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% define openEMS options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
openEMS_Path = [pwd() '/../../']
|
|
||||||
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'];
|
||||||
|
@ -117,9 +116,8 @@ 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
|
||||||
command = [openEMS_Path 'openEMS.sh ' Sim_CSX ' ' openEMS_opts];
|
args = [Sim_CSX ' ' openEMS_opts];
|
||||||
disp(command);
|
invoke_openEMS(args);
|
||||||
system(command)
|
|
||||||
cd(savePath);
|
cd(savePath);
|
||||||
|
|
||||||
%% do the plots %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% do the plots %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
close all;
|
close all
|
||||||
clear all;
|
clear
|
||||||
clc
|
clc
|
||||||
|
|
||||||
%% setup the simulation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% setup the simulation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -18,8 +18,7 @@ Z0 = sqrt(MUE0/EPS0);
|
||||||
f0 = 0.5e9;
|
f0 = 0.5e9;
|
||||||
epsR = 1;
|
epsR = 1;
|
||||||
|
|
||||||
%% define file pathes and openEMS options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% define openEMS options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
openEMS_Path = [pwd() '/../../']
|
|
||||||
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'];
|
||||||
|
@ -98,9 +97,8 @@ 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
|
||||||
command = [openEMS_Path 'openEMS.sh ' Sim_CSX ' ' openEMS_opts];
|
args = [Sim_CSX ' ' openEMS_opts];
|
||||||
disp(command);
|
invoke_openEMS(args)
|
||||||
system(command)
|
|
||||||
cd(savePath);
|
cd(savePath);
|
||||||
|
|
||||||
%% postproc & do the plots %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% postproc & do the plots %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
close all;
|
close all
|
||||||
clear all;
|
clear
|
||||||
clc
|
clc
|
||||||
|
|
||||||
%% setup the simulation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% setup the simulation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -21,8 +21,7 @@ max_alpha = max_mesh;
|
||||||
N_alpha = ceil(rad_a * 2*pi / max_alpha);
|
N_alpha = ceil(rad_a * 2*pi / max_alpha);
|
||||||
mesh_res = [max_mesh 2*pi/N_alpha max_mesh];
|
mesh_res = [max_mesh 2*pi/N_alpha max_mesh];
|
||||||
|
|
||||||
%% define file pathes and openEMS options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% define and openEMS options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
openEMS_Path = [pwd() '/../../'];
|
|
||||||
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'];
|
||||||
|
@ -107,9 +106,8 @@ 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
|
||||||
command = [openEMS_Path 'openEMS.sh ' Sim_CSX ' ' openEMS_opts];
|
args = [Sim_CSX ' ' openEMS_opts];
|
||||||
disp(command);
|
invoke_openEMS(args);
|
||||||
system(command)
|
|
||||||
cd(savePath);
|
cd(savePath);
|
||||||
|
|
||||||
%% postproc & do the plots %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% postproc & do the plots %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -129,5 +127,3 @@ plot(UI.FD{1}.f,real(Z),'Linewidth',2);
|
||||||
plot(UI.FD{1}.f,imag(Z),'r','Linewidth',2);
|
plot(UI.FD{1}.f,imag(Z),'r','Linewidth',2);
|
||||||
xlim([0 2*f0]);
|
xlim([0 2*f0]);
|
||||||
legend('Z_L','\Re\{Z\}','\Im\{Z\}','Location','Best');
|
legend('Z_L','\Re\{Z\}','\Im\{Z\}','Location','Best');
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
close all;
|
close all
|
||||||
clear all;
|
clear
|
||||||
clc
|
clc
|
||||||
|
|
||||||
EPS0 = 8.85418781762e-12;
|
EPS0 = 8.85418781762e-12;
|
||||||
|
@ -21,7 +21,6 @@ max_alpha = max_mesh;
|
||||||
N_alpha = ceil(rad_a * 2*pi * partial / max_alpha);
|
N_alpha = ceil(rad_a * 2*pi * partial / max_alpha);
|
||||||
mesh_res = [max_mesh 2*pi*partial/N_alpha max_mesh];
|
mesh_res = [max_mesh 2*pi*partial/N_alpha max_mesh];
|
||||||
|
|
||||||
openEMS_Path = [pwd() '/../../']
|
|
||||||
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'];
|
||||||
|
@ -105,9 +104,8 @@ 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
|
||||||
command = [openEMS_Path 'openEMS.sh ' Sim_CSX ' ' openEMS_opts];
|
args = [Sim_CSX ' ' openEMS_opts];
|
||||||
disp(command);
|
invoke_openEMS(args)
|
||||||
system(command)
|
|
||||||
cd(savePath);
|
cd(savePath);
|
||||||
|
|
||||||
UI = ReadUI({'ut1_1','ut1_2','it1'},'tmp/');
|
UI = ReadUI({'ut1_1','ut1_2','it1'},'tmp/');
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
close all;
|
close all
|
||||||
clear;
|
clear
|
||||||
clc
|
clc
|
||||||
|
|
||||||
%% setup the simulation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% setup the simulation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -16,8 +16,7 @@ port_resist = 1000;
|
||||||
f_max = 100e6;
|
f_max = 100e6;
|
||||||
f_excite = 300e6;
|
f_excite = 300e6;
|
||||||
|
|
||||||
%% define file pathes and openEMS options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% define openEMS options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
openEMS_Path = [pwd() '/../../']
|
|
||||||
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'];
|
||||||
|
@ -27,8 +26,8 @@ openEMS_opts = [openEMS_opts ' --debug-boxes'];
|
||||||
Sim_Path = 'tmp';
|
Sim_Path = 'tmp';
|
||||||
Sim_CSX = 'helix.xml';
|
Sim_CSX = 'helix.xml';
|
||||||
|
|
||||||
rmdir(Sim_Path,'s');
|
[status, message, messageid] = rmdir(Sim_Path,'s');
|
||||||
mkdir(Sim_Path);
|
[status,message,messageid] = mkdir(Sim_Path);
|
||||||
|
|
||||||
%% setup FDTD parameter & excitation function %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% setup FDTD parameter & excitation function %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
FDTD = InitFDTD(30000,1e-6);
|
FDTD = InitFDTD(30000,1e-6);
|
||||||
|
@ -120,11 +119,10 @@ CSX = AddBox(CSX,'Ht_',0 , start,stop);
|
||||||
WriteOpenEMS([Sim_Path '/' Sim_CSX],FDTD,CSX);
|
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
|
||||||
command = [openEMS_Path 'openEMS.sh ' Sim_CSX ' ' openEMS_opts];
|
args = [Sim_CSX ' ' openEMS_opts];
|
||||||
disp(command);
|
invoke_openEMS(args);
|
||||||
system(command)
|
|
||||||
cd(savePath);
|
cd(savePath);
|
||||||
|
|
||||||
%% postproc & do the plots %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% postproc & do the plots %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
close all;
|
close all
|
||||||
clear all;
|
clear
|
||||||
clc
|
clc
|
||||||
|
|
||||||
%% setup the simulation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% setup the simulation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -14,8 +14,7 @@ mesh_res = [5 5 10];
|
||||||
EPS0 = 8.85418781762e-12;
|
EPS0 = 8.85418781762e-12;
|
||||||
MUE0 = 1.256637062e-6;
|
MUE0 = 1.256637062e-6;
|
||||||
|
|
||||||
%% define file pathes and openEMS options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% define openEMS options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
openEMS_Path = [pwd() '/../../']
|
|
||||||
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'];
|
||||||
|
@ -86,8 +85,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
|
||||||
command = [openEMS_Path 'openEMS.sh ' Sim_CSX ' ' openEMS_opts];
|
args = [Sim_CSX ' ' openEMS_opts];
|
||||||
disp(command);
|
invoke_openEMS(args);
|
||||||
system(command)
|
|
||||||
cd(savePath);
|
cd(savePath);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
close all;
|
close all
|
||||||
clear all;
|
clear
|
||||||
clc
|
clc
|
||||||
|
|
||||||
%% setup the simulation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% setup the simulation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -12,8 +12,7 @@ mesh_res = 25;
|
||||||
EPS0 = 8.85418781762e-12;
|
EPS0 = 8.85418781762e-12;
|
||||||
MUE0 = 1.256637062e-6;
|
MUE0 = 1.256637062e-6;
|
||||||
|
|
||||||
%% define file pathes and openEMS options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% define openEMS options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
openEMS_Path = [pwd() '/../../']
|
|
||||||
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'];
|
||||||
|
@ -25,7 +24,7 @@ Sim_CSX = 'plane_wave.xml';
|
||||||
mkdir(Sim_Path);
|
mkdir(Sim_Path);
|
||||||
|
|
||||||
%% setup FDTD parameter & excitation function %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% setup FDTD parameter & excitation function %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
FDTD = InitFDTD(5e5,1e-6,'OverSampling',10);
|
FDTD = InitFDTD(5e5,1e-5,'OverSampling',10);
|
||||||
FDTD = SetGaussExcite(FDTD,0.5e9,0.5e9);
|
FDTD = SetGaussExcite(FDTD,0.5e9,0.5e9);
|
||||||
BC = [1 1 0 0 0 0];
|
BC = [1 1 0 0 0 0];
|
||||||
FDTD = SetBoundaryCond(FDTD,BC);
|
FDTD = SetBoundaryCond(FDTD,BC);
|
||||||
|
@ -71,9 +70,8 @@ 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
|
||||||
command = [openEMS_Path 'openEMS.sh ' Sim_CSX ' ' openEMS_opts];
|
args = [Sim_CSX ' ' openEMS_opts];
|
||||||
disp(command);
|
invoke_openEMS(args);
|
||||||
system(command)
|
|
||||||
cd(savePath);
|
cd(savePath);
|
||||||
|
|
||||||
%% do the plots %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% do the plots %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -83,4 +81,3 @@ PlotArgs.component=2;
|
||||||
PlotArgs.Limit = 'auto';
|
PlotArgs.Limit = 'auto';
|
||||||
|
|
||||||
PlotHDF5FieldData('tmp/Et.h5',PlotArgs)
|
PlotHDF5FieldData('tmp/Et.h5',PlotArgs)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
close all;
|
close all
|
||||||
clear all;
|
clear
|
||||||
clc
|
clc
|
||||||
|
|
||||||
%% setup the simulation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% setup the simulation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -24,14 +24,13 @@ f0 = 1e9;
|
||||||
|
|
||||||
k = 2*pi*f0/C0;
|
k = 2*pi*f0/C0;
|
||||||
kc = sqrt((m*pi/a/unit)^2 + (n*pi/b/unit)^2);
|
kc = sqrt((m*pi/a/unit)^2 + (n*pi/b/unit)^2);
|
||||||
fc = C0*kc/2/pi
|
fc = C0*kc/2/pi;
|
||||||
beta = sqrt(k^2 - kc^2);
|
beta = sqrt(k^2 - kc^2);
|
||||||
|
|
||||||
func_Ex = [num2str(n/b/unit) '*cos(' num2str(m*pi/a) '*x)*sin(' num2str(n*pi/b) '*y)'];
|
func_Ex = [num2str(n/b/unit) '*cos(' num2str(m*pi/a) '*x)*sin(' num2str(n*pi/b) '*y)'];
|
||||||
func_Ey = [num2str(m/a/unit) '*sin(' num2str(m*pi/a) '*x)*cos(' num2str(n*pi/b) '*y)'];
|
func_Ey = [num2str(m/a/unit) '*sin(' num2str(m*pi/a) '*x)*cos(' num2str(n*pi/b) '*y)'];
|
||||||
|
|
||||||
%% define file pathes and openEMS options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% define and openEMS options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
openEMS_Path = [pwd() '/../../']
|
|
||||||
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'];
|
||||||
|
@ -95,9 +94,8 @@ 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
|
||||||
command = [openEMS_Path 'openEMS.sh ' Sim_CSX ' ' openEMS_opts];
|
args = [Sim_CSX ' ' openEMS_opts];
|
||||||
disp(command);
|
invoke_openEMS(args);
|
||||||
system(command)
|
|
||||||
cd(savePath);
|
cd(savePath);
|
||||||
|
|
||||||
%% do the plots %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% do the plots %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -107,4 +105,3 @@ PlotArgs.component=2;
|
||||||
PlotArgs.Limit = 'auto';
|
PlotArgs.Limit = 'auto';
|
||||||
|
|
||||||
PlotHDF5FieldData('tmp/Et.h5',PlotArgs)
|
PlotHDF5FieldData('tmp/Et.h5',PlotArgs)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
function invoke_openEMS( opts )
|
||||||
|
|
||||||
|
if nargin < 1
|
||||||
|
error 'specify the xml file to simulate'
|
||||||
|
end
|
||||||
|
|
||||||
|
% opts = [opts ' --disable-dumps'];
|
||||||
|
% opts = [opts ' --debug-material'];
|
||||||
|
% opts = [opts ' --debug-boxes'];
|
||||||
|
% opts = [opts ' --engine=sse'];
|
||||||
|
% opts = [opts ' --engine=multithreaded'];
|
||||||
|
|
||||||
|
filename = mfilename('fullpath');
|
||||||
|
dir = fileparts( filename );
|
||||||
|
openEMS_Path = [dir filesep '..' filesep];
|
||||||
|
|
||||||
|
if isunix
|
||||||
|
openEMS_Path = [openEMS_Path 'openEMS.sh'];
|
||||||
|
else
|
||||||
|
openEMS_Path = [openEMS_Path 'openEMS'];
|
||||||
|
end
|
||||||
|
|
||||||
|
command = [openEMS_Path ' ' opts];
|
||||||
|
disp( ['invoking openEMS simulator: ' command] );
|
||||||
|
system(command);
|
Loading…
Reference in New Issue