[solved] Very basic but can't get it to work: simple MSL sim does not converge

How to use openEMS. Discussion on examples, tutorials etc

Moderator: thorsten

Post Reply
dom11990
Posts: 5
Joined: Mon 10 Jun 2019, 10:16

[solved] Very basic but can't get it to work: simple MSL sim does not converge

Post by dom11990 » Mon 10 Jun 2019, 10:30

Hi,

I've only used EMPro in the past and am struggling a bit with some of the elements of openEMS. I was hoping someone could explain some minor items to me:

Boundary Conditions:
What is MUR? Is it also an absorbing layer? How does it differ from a Perfectly Matched Layer (PML)? When do I use one over the other. The only info I found was here which did not answer these questions. http://openems.de/index.php/FDTD_Mesh.html

I've tried to work off of the stub filter example to create a simple microstrip line. Unfortunately, I am not able to get it to simulate correctly after many many hours of playing with it. Could someone point out what I am doing wrong? See the gif below for what is going wrong. It seems like the port is continuing to inject / resonate. This is an xy slice taking at the top of the substrate.
ezgif.com-crop.gif
ezgif.com-crop.gif (1.64 MiB) Viewed 7949 times
I am using lumped ports because I have to admit that I did not understand the benefit of the MSL port. Could someone explain this? Also how would one specify a loss tangent for a material?

Thank you very much for any and all help!

Code: Select all

close all
clear
clc

#Setup the simulation & geometrical parameter
physical_constants;
unit = 1e-6; % specify everything in um
MSL_length = 50000;
MSL_width = 820;
substrate_thickness = 530;
substrate_epr = 4.2;
stub_length = 0;
f_max = 20e9;

#Setup the FDTD parameter including the excitation time signal and boundary conditions
FDTD = InitFDTD();
FDTD = SetGaussExcite( FDTD, f_max/2, f_max/2 );
BC   = {'PML_8' 'PML_8' 'MUR' 'MUR' 'PEC' 'MUR'};
#BC   = {'PML_8' 'PML_8' 'PML_8' 'PML_8' 'PEC' 'PML_8'};
FDTD = SetBoundaryCond( FDTD, BC );

#Setup the inhomogeneous FDTD mesh, including an improved handling of the thin metal 
#edges by using two mesh lines, one line is located 1/3 inside and the other one 2/3 outside of the thin metal.
CSX = InitCSX();
resolution = c0/(f_max*sqrt(substrate_epr))/unit /20; % resolution of lambda/50
mesh.x = SmoothMeshLines( [-MSL_length/2 MSL_length/2], resolution, 1.5 ,0 );
mesh.y = SmoothMeshLines( [0 MSL_width/2+[-resolution/3 +resolution/3*2]/4], resolution/4 , 1.5 ,0);
mesh.y = SmoothMeshLines( [-15*MSL_width -mesh.y mesh.y 15*MSL_width], resolution, 1.5 ,0);
mesh.z = SmoothMeshLines( [linspace(0,substrate_thickness,5) 10*substrate_thickness], resolution );
CSX = DefineRectGrid( CSX, unit, mesh );

#Add the MSL substrate
CSX = AddMetal( CSX, 'PEC' );
CSX = AddMaterial( CSX, 'FR4' );

#add substrate
CSX = SetMaterialProperty( CSX, 'FR4', 'Epsilon', substrate_epr );
start = [mesh.x(1),   mesh.y(1),   0];
stop  = [mesh.x(end), mesh.y(end), substrate_thickness];
CSX = AddBox( CSX, 'FR4', 0, start, stop );


#add microstrip
CSX = AddBox( CSX, 'PEC', 0, [mesh.x(1),-MSL_width/2,substrate_thickness], [mesh.x(end),   MSL_width/2,   substrate_thickness]);


portstart_L = [ mesh.x(1), -MSL_width/2, substrate_thickness];
portstop_L  = [ mesh.x(1),  MSL_width/2, 0];


[CSX port{1}] = AddLumpedPort(CSX, 1 ,1 , 50, portstart_L, portstop_L, [0 0 -1], true); 


portstart_L = [mesh.x(end)-10*resolution, -MSL_width/2, substrate_thickness];
portstop_L  = [mesh.x(end)-10*resolution,  MSL_width/2, 0];

[CSX port{2}] = AddLumpedPort(CSX, 1 ,2 , 50, portstop_L, portstart_L, [0 0 1], false); 


CSX = AddDump(CSX,'Etxy');
CSX = AddBox(CSX,'Etxy',0,[mesh.x(1),mesh.y(1)/2,substrate_thickness],[mesh.x(end),mesh.y(end)/2,substrate_thickness]); %assign box  

CSX = AddDump(CSX,'Etxz');
CSX = AddBox(CSX,'Etxz',0,[mesh.x(1),0,0],[mesh.x(end),0,mesh.y(end)/2]); %assign box  
  

Sim_Path = 'tmp';
Sim_CSX = 'msl.xml';


[status, message, messageid] = rmdir( Sim_Path, 's' ); % clear previous directory
[status, message, messageid] = mkdir( Sim_Path ); % create empty simulation folder

WriteOpenEMS( [Sim_Path '/' Sim_CSX], FDTD, CSX );
CSXGeomPlot( [Sim_Path '/' Sim_CSX] );
RunOpenEMS( Sim_Path, Sim_CSX );#

close all
f = linspace( 1e6, f_max, 1601 );
port = calcPort( port, Sim_Path, f, 'RefImpedance', 50);
 
s11 = port{1}.uf.ref./ port{1}.uf.inc;
s21 = port{2}.uf.ref./ port{1}.uf.inc;
 
plot(f/1e9,20*log10(abs(s11)),'k-','LineWidth',2);
hold on;
grid on;
plot(f/1e9,20*log10(abs(s21)),'r--','LineWidth',2);
legend('S_{11}','S_{21}');
ylabel('S-Parameter (dB)','FontSize',12);
xlabel('frequency (GHz) \rightarrow','FontSize',12);
ylim([-40 2]);

Last edited by dom11990 on Wed 12 Jun 2019, 20:08, edited 1 time in total.

asdf
Posts: 6
Joined: Sat 11 Aug 2018, 08:19

Re: Very basic but can't get it to work: simple MSL sim does not converge

Post by asdf » Tue 11 Jun 2019, 17:11

I looked at the geometry, I think the problems may be:
1. One port is placed at the boundary of your simulation box - your excitation is immediately absorbed by absorbing boundary condition.
2. The second port is not at the end of the line, the line should probably start on one port and finish on the second port (and both ports moved away from PML).

Look at:
http://openems.de/index.php/FDTD_Bounda ... tions.html

About losses of the material - you need to specify kappa (see http://openems.de/index.php/Material_Property.html and https://en.wikipedia.org/wiki/Dielectric_loss). Kappa can be calculated from loss factor at a frequency of interest, for example:
substrate.kappa = 1e-3 * 2*pi*2.45e9 * EPS0*substrate.epsR; (see tutorial http://openems.de/index.php/Tutorial:_S ... tenna.html)

epsilon_complex = epsilon' - j*epsilon'' = epsilon0*epsilonR - j*kappa/(2*pi*f)
and loss_factor = epsilon'' / epsilon'
so: kappa/(2*pi*f) = loss_factor * epsilon0*epsilonR
from the equation, the kappa is: kappa = loss_factor * epsilon0*epsilonR * 2*pi*f

dom11990
Posts: 5
Joined: Mon 10 Jun 2019, 10:16

[solved] Re: Very basic but can't get it to work: simple MSL sim does not converge

Post by dom11990 » Wed 12 Jun 2019, 20:07

I was expecting the PML to be added automagically since I specified what the boundary condition was. I now understand that I need to leave room for the PML. Apparently I missed this little warning> "Warning: In openEMS the last x lines in the respective direction are defined as this artificial absorbing material: Keep your structures far enough away!"

I was able to get it to simulate as expected. Thanks for your help!

smerrett79
Posts: 31
Joined: Thu 23 May 2019, 18:05

Re: [solved] Very basic but can't get it to work: simple MSL sim does not converge

Post by smerrett79 » Fri 21 Jun 2019, 15:18

@dom11990 I'm glad you solved this! Would you be kind enough to show us what the solved simulation visualisation looks like relative to your first animated gif? Seeing the before and after would help others troubleshoot in future, perhaps.

dom11990
Posts: 5
Joined: Mon 10 Jun 2019, 10:16

Re: [solved] Very basic but can't get it to work: simple MSL sim does not converge

Post by dom11990 » Wed 13 Nov 2019, 21:46

Good idea @smerrett79. My apologies for delay. Here is what a simulation like this should look like. The dimensions are now slightly different but this is how it should look:
working.gif
working.gif (1.15 MiB) Viewed 7157 times

PaulUK
Posts: 76
Joined: Wed 28 Oct 2015, 14:23

Re: [solved] Very basic but can't get it to work: simple MSL sim does not converge

Post by PaulUK » Fri 29 Nov 2019, 14:32

This might be a silly question but was the animated gif made from within ParaView?

dom11990
Posts: 5
Joined: Mon 10 Jun 2019, 10:16

Re: [solved] Very basic but can't get it to work: simple MSL sim does not converge

Post by dom11990 » Sat 18 Apr 2020, 12:34

Yes I exported it with paraview.

Post Reply