I'm trying to get into OpenEMS as a tool for analysing the behaviour of microwave components. I think I understand the general workflow (setup in octave, view structures in AppCSXCAD, send data to OpenEMS, and process results in octave), as well as some of the general principles around FDTD, but only at a surface level.
I'm trying to simulate the following structure - a bad interdigital filter with no GND connections. My code seems to produce the correct structure, but when OpenEMS starts I get a message saying that all of the primitives are unused (except for the substrate).
close all
clear
clc
CSX = InitCSX();
% Define materials
CSX = AddMaterial(CSX, 'substrate'); % Substrate material
CSX = SetMaterialProperty(CSX, 'substrate', 'Epsilon', 4.2);
CSX = AddMetal(CSX, 'feed1');
CSX = AddMetal(CSX, 'res1');
CSX = AddMetal(CSX, 'res2');
CSX = AddMetal(CSX, 'res3');
CSX = AddMetal(CSX, 'res4');
CSX = AddMetal(CSX, 'res5');
CSX = AddMetal(CSX, 'feed2');
CSX = AddMetal(CSX, 'gnd');
%Define geometry
CSX = AddBox(CSX, 'substrate', 0, [0 0 0], [67.62 49.4 -1.5]);
CSX = AddBox(CSX, 'feed1', 0, [0 11.125 0], [6.75 14.075 0]);
CSX = AddBox(CSX, 'res1', 0, [6.75 10 0], [9.7 39.4 0]);
CSX = AddBox(CSX, 'res2', 0, [18.2 10 0], [21.15 39.3 0]);
CSX = AddBox(CSX, 'res3', 0, [32.75 10 0], [35.7 39.3 0]);
CSX = AddBox(CSX, 'res4', 0, [47.3 10 0], [50.25 39.3 0]);
CSX = AddBox(CSX, 'res5', 0, [58.75 10 0], [61.7 39.4 0]);
CSX = AddBox(CSX, 'feed2', 0, [61.7 11.125 0], [67.62 14.075 0]);
CSX = AddBox(CSX, 'gnd', 0, [0 0 -1.5], [67.62 49.4 -1.5]);
% Add ports
[CSX port{1}] = AddLumpedPort(CSX, 1, 1, 50, [0 11.125 0], [0 14.075 -1.5], [0 0 1], true);
[CSX port{2}] = AddLumpedPort(CSX, 1, 2, 50, [67.62 11.125 0], [67.62 14.075 -1.5], [0 0 1], false);
% Slice
mesh = DetectEdges(CSX);
% Extend mesh
mesh.x = [mesh.x -30 97.62]; % Two YZ planes at X = -25 and X = 25
mesh.y = [mesh.y -30 79.4]; % Two XZ planes at Y = -25 and Y = 25
mesh.z = [mesh.z -30 30]; % Two XY planes at Z = -15 and X = 15
% Smooth mesh
mesh = SmoothMesh(mesh, 0.5, 1.25); % (mesh, max_res, ratio)
% Set FDTD parameters:
F0 = 1.4*10^9; % Centre frequency
FC = 300*10^9; % Corner frequency
FDTD = InitFDTD('EndCriteria', 10^-3);
FDTD = SetGaussExcite(FDTD, F0, FC);
FDTD = SetBoundaryCond(FDTD, {'MUR','MUR','MUR','MUR','MUR','MUR'});
CSX = DefineRectGrid(CSX, 1/1000, mesh);
% Save data file that can be used by OpenEMS and AppCSXCAD
mkdir('temp');
WriteOpenEMS('temp/test.xml', FDTD, CSX);
% Display 3D model
CSXGeomPlot('temp/test.xml');
% Run OpenEMS
RunOpenEMS('temp', 'test.xml');
I have tried to follow this tutorial (youtube.com/watch?v=SPlrcp-gCKk), as well as any documentation I can find online - but the OpenEMS documentation seems a bit sparse, and without a background in the underlying theory I am a bit lost.
I did read the FAQs (
https://wiki.openems.de/index.php/Frequently_Asked_Questions.html), but as far as I can see none of the reasons it suggests unused primatives are met here - the structure is within the meshed area, the primatives are all of the same priority, and I assigned a primative to each property.
Any ideas as to where I am going wrong?
Additionally, if anyone is aware of any useful resources to try and learn more about the various options available in OpenEMS, I'd be grateful.