summaryrefslogtreecommitdiff
path: root/openEMS/matlab/Tutorials/Parallel_Plate_Waveguide.m
blob: cbf76c0506ec718429aa6ada92d89ca3efb06553 (plain)
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
%
% Tutorials / Parallel_Plate_Waveguide
%
% Describtion at:
% http://openems.de/index.php/Tutorial:_Parallel_Plate_Waveguide
%
% Tested with
%  - Matlab 2011a / Octave 4.0
%  - openEMS v0.0.33
%
% (C) 2011,2012 Sebastian Held <sebastian.held@gmx.de>
% (C) 2011-2015 Thorsten Liebig <thorsten.liebig@gmx.de>

close all
clear
clc

% init and define FDTD parameter
FDTD = InitFDTD(100,0,'OverSampling',50);
FDTD = SetSinusExcite(FDTD,10e6);
BC = {'PMC' 'PMC' 'PEC' 'PEC' 'MUR' 'MUR'};
FDTD = SetBoundaryCond(FDTD,BC);

% init and define FDTD mesh
CSX = InitCSX();
mesh.x = -10:10;
mesh.y = -10:10;
mesh.z = -10:30;
CSX = DefineRectGrid(CSX, 1, mesh);

% define the excitation
CSX = AddExcitation(CSX,'excitation',0,[0 1 0]);
CSX = AddBox(CSX,'excitation',0,[-10 -10 0],[10 10 0]);

% define a time domain e-field dump box
CSX = AddDump(CSX,'Et','DumpMode',0);
CSX = AddBox(CSX,'Et',0,[-10 0 -10],[10 0 30]);

% remove old simulation results (if exist)
rmdir('tmp','s');mkdir('tmp');

% write openEMS xml data file
WriteOpenEMS('tmp/tmp.xml',FDTD,CSX);

% view defined structure
CSXGeomPlot( 'tmp/tmp.xml' );

% run openEMS simulation
RunOpenEMS('tmp','tmp.xml','');

disp('use Paraview to visualize the FDTD result...');