Thirds Rule (FDTD Mesh Grid)

How to use openEMS. Discussion on examples, tutorials etc

Moderator: thorsten

FourierTransformer
Posts: 12
Joined: Fri 30 Nov 2018, 21:21

Thirds Rule (FDTD Mesh Grid)

Post by FourierTransformer » Sat 12 Jan 2019, 19:31

Hi everyone!
In the online manual (http://openems.de/index.php/FDTD_Mesh.html), I found the "thirds rule" which says that "it is preferred in precision calculation to put a mesh line 1/3 inside and 2/3 outside the metal".
Based on the "Simple Patch Antenna Tutorial" (http://openems.de/index.php/Tutorial:_S ... tenna.html) I designed some simple geometries (like a rectangle) and in the preview window, I noticed that the grid does not follow this rule. The mesh lines, are tangential to the edges of the PEC patch.

Am I doing something wrong?

thorsten
Posts: 1393
Joined: Mon 27 Jun 2011, 12:26

Re: Thirds Rule (FDTD Mesh Grid)

Post by thorsten » Sat 12 Jan 2019, 21:22

Hi,

did or did you not apply a third rule in your design? Because I think the basic patch antenna tutorial does not use this mesh rule to keep it as simple as possible...

regards
Thorsten

FourierTransformer
Posts: 12
Joined: Fri 30 Nov 2018, 21:21

Re: Thirds Rule (FDTD Mesh Grid)

Post by FourierTransformer » Sun 13 Jan 2019, 14:19

thorsten wrote:
Sat 12 Jan 2019, 21:22
did or did you not apply a third rule in your design? Because I think the basic patch antenna tutorial does not use this mesh rule to keep it as simple as possible...
How do I apply the third rule?

The corresponding code is shown below:

Code: Select all

% Finalize the Mesh
% -----------------
% detect all edges except of the patch
 mesh = DetectEdges(CSX, mesh,'ExcludeProperty','patch');
% detect and set a special 2D metal edge mesh for the patch
 mesh = DetectEdges(CSX, mesh,'SetProperty','patch','2D_Metal_Edge_Res', c0/(f0+fc)/unit/50); 
% generate a smooth mesh with max. cell size: lambda_min / 20 
 mesh = SmoothMesh(mesh, c0/(f0+fc)/unit/20);
 CSX = DefineRectGrid(CSX, unit, mesh);
The only relevant think I found is in DetectEdges.m :

Code: Select all

% advanced options: 'keyword', value
%   '2D_Metal_Edge_Res' define a one-third/two-third metal edge resolution
It seems that the argument '2D_Metal_Edge_Res' enables the Thirds rule, but I'm not sure and I don't understand why we need a value for this argument (e.g c0/(f0+fc)/unit/50).

thorsten
Posts: 1393
Joined: Mon 27 Jun 2011, 12:26

Re: Thirds Rule (FDTD Mesh Grid)

Post by thorsten » Sun 13 Jan 2019, 15:28

The argument tells the edge detector what size of a cell ("edge_res") it should place over the edge with 1/3 inside and 2/3 outside. Without that number it will just place one line at the edge directly...

FourierTransformer
Posts: 12
Joined: Fri 30 Nov 2018, 21:21

Re: Thirds Rule (FDTD Mesh Grid)

Post by FourierTransformer » Sun 13 Jan 2019, 16:58

Code: Select all

% detect and set a special 2D metal edge mesh for the patch
 mesh = DetectEdges(CSX, mesh,'SetProperty','patch','2D_Metal_Edge_Res', c0/(f0+fc)/unit/50);
Hmm... I use the code above, but the result looks like this:
...
grid.PNG
Grid
grid.PNG (64.23 KiB) Viewed 4334 times
:(
(The preview is in 2D mode)
Do you have any comment?

thorsten
Posts: 1393
Joined: Mon 27 Jun 2011, 12:26

Re: Thirds Rule (FDTD Mesh Grid)

Post by thorsten » Sun 13 Jan 2019, 17:56

- Remove the semicolon and look at the output
- Make sure the "mesh" variable does not get overridden later
- Make sure your patch objects are boxes

Other than that I do not see an obvious reason...

I just saw that the Simple_Patch tutorial does use the third rule after-all... Look how/why it works there...

regards
Thorsten

FourierTransformer
Posts: 12
Joined: Fri 30 Nov 2018, 21:21

Re: Thirds Rule (FDTD Mesh Grid)

Post by FourierTransformer » Sun 13 Jan 2019, 18:46

thorsten wrote:
Sun 13 Jan 2019, 17:56
- Remove the semicolon and look at the output
- Make sure the "mesh" variable does not get overridden later
- Make sure your patch objects are boxes
Here it is!!! I'm using AddPolygon to create my patch! I use this one, because my original patch has a little bit more complicated geometry.

Code: Select all

 CSX = AddPolygon(CSX,'patch',13,2,substrate.thickness,points(1:2,:));
-Is there any easy way to achieve this "Thirds Rule" using AddPolygon?
-Will I have any significant calculation error NOT using Thirds Rule?

thorsten
Posts: 1393
Joined: Mon 27 Jun 2011, 12:26

Re: Thirds Rule (FDTD Mesh Grid)

Post by thorsten » Sun 13 Jan 2019, 20:42

-Is there any easy way to achieve this "Thirds Rule" using AddPolygon?
Someone would need to write some code that would detect poly edges of some min. length in Cartesian direction to be added to this rule.
But it's not an easy task. First you would need to determine what is inside and outside of an edge and so on...
-Will I have any significant calculation error NOT using Thirds Rule?
No, just try the simple patch antenna tutorial with and without to see the difference for that example. With the third rule you can simply get away with a coarser mesh...

FourierTransformer
Posts: 12
Joined: Fri 30 Nov 2018, 21:21

Re: Thirds Rule (FDTD Mesh Grid)

Post by FourierTransformer » Mon 14 Jan 2019, 20:20

Thank you very much!

The result is decent! If I decide to apply the "Thirds Rule" using a function to detect those edges, I' ll post it here! ;)

thorsten
Posts: 1393
Joined: Mon 27 Jun 2011, 12:26

Re: Thirds Rule (FDTD Mesh Grid)

Post by thorsten » Mon 14 Jan 2019, 20:57

What I did mostly in those more complex cases I added mesh lines with the third rule while I was implementing the edges at the same time.
Thus I did not use (at all) the DetectEdges but did the meshing "manually". This way you have max. control (e.g. which edges are important and which are just internal) about the meshing too.

regards
Thorsten

Post Reply