## Multi-grid and cylindrical coordinates problem

How to use openEMS. Discussion on examples, tutorials etc

Moderator: thorsten

Ant_designer
Posts: 6
Joined: Sun 07 Oct 2018, 13:34

### Multi-grid and cylindrical coordinates problem

Hello,

First, i'm new to openEMS and i'm very impressed with what you have accomplished.

I have some technical questions:

1. Multi-Grid:
- Besides avoiding the problems around r=0, this method has the potential for reducing running times by nesting.
in Your opinion/experience, how substantial can this be for speeding up solution times ?
- Can this strategy be also applied for a rectangular mesh in openEMS or in general ?

2. simple circular patch:
I tried to compare the solution if the same problem in rectangular and cylindrical coordinates, so i can learn how to use openEMS.
Rectangular mesh works fine.
When i apply a cylindrical mesh i get S11=0 identically and after going through all the documentation and blog i can't figure out what am i doing wrong.
I would appreciate your feedback on this (attached).

3. Future
- Are there more improvements/capabilities planned for the future ?
- Once i get more experience in this, i would like to see how i can help to improve the documentation and make it more accessible.

Many thanks !
Attachments
Circular_patch_5GHz_rect_mesh.m
Circular_patch_5GHz_cyl_mesh.m

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

### Re: Multi-grid and cylindrical coordinates problem

Besides avoiding the problems around r=0, this method has the potential for reducing running times by nesting.
in Your opinion/experience, how substantial can this be for speeding up solution times ?
* If you have a large enough mesh aroung r==0 it is not such a big issue.
* If you do it right for any subgrid you can double the time-step and thus half your simulation time... (If have often used 3 staggered grid breaking down the time step to one eight and a speedup of even a bit more then 8 times due to less mesh cells too...)
- Can this strategy be also applied for a rectangular mesh in openEMS or in general ?
No it cannot. In rect grids, subgrids are usually used to locally refine the mesh (everything else makes even less sense). But inside those you need a smaller time step than everywhere else. It is just a nightmare to get stable and most tools that tried abandoned it again...

As for 2.. I hope I can find some time to have a closer look.
- Are there more improvements/capabilities planned for the future ?
No there are no immediate plane. Mostly because I currently do not do any numerical simulations which have been the major driver for me to improve and work on openEMS.
I have started some time ago working on a python interface (just for fun since I mostly have abandon Matlab/Octave in favor of python these days). But I had not much time recently to finish it and it will be Linux only for the near future.
- Once i get more experience in this, i would like to see how i can help to improve the documentation and make it more accessible.
That would be highly appreciated. What I want to do (for a long time already) is to move away from the wiki documentation to something like read the docs (https://readthedocs.org/) or something similar. The python interface already has the syntax to generate docs from the source code automatically and a parser to extract the docs from some of the python tutorials...

regards
Thorsten

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

### Re: Multi-grid and cylindrical coordinates problem

2. simple circular patch:
Your error (which you could not know of): You put the lumped port at alpha=0 and your mesh seam is at alpha=0/2*pi. That causes problems for the current box (your current was only zero at all times).
openEMS should warn about voltage or current probes directly on the mesh edges, even if for the circular mesh both ends get stitched together...
Solution: Move the port e.g. to alpha=pi or move your mesh seam to somewhere else...

One Note: To create cylinder in cylindrical coordinates in the cylindrical mesh use AddBox not AddCylinder. A Box in openEMS is always defined with start/stop. In Cartesian this is x0,y0,z0 to x1,y1,z1 (a Cartesian box) and in a cylindrical mesh it is r0,a0,z0 and r1,a1,z1 (a cylindrical box, sometimes a cylinder or just parts of them...) With this boxes in a cylindrical mesh you can create cylindrical arcs (1D) or cylindrical faces (2D) or full cylinder easily... Check out the cylindrical patch antenna (http://openems.de/index.php/Tutorial:_B ... ch_Antenna).

regards
Thorsten

Ant_designer
Posts: 6
Joined: Sun 07 Oct 2018, 13:34

### Re: Multi-grid and cylindrical coordinates problem

Many thanks Thorsten for taking the time to answer my questions.

I tried to do what you say:
1. Placing the Lumped port away from the boundary condition.
2. Using cylindrical boxes

Still the basic circular patch in cylindrical coordinates doesn't work. Did it work for you ?
Here is it again attached with the corrections.

A few further questions:
- Is there a smith chart plot option is OpenEMS ? if not i will make one.
- Is there a built option/function to choose which antenna gain to present: Directivity/Gain/Realized gain ? I would like to overlay all of them on the same figure.
If not i will make it, just checking...

When you wanna start upgrading things, please let me know and i will gladly help with what i can (I can dedicate some time these days...)
Attachments
Circular_patch_5GHz_cyl_mesh_V2.m

Hale_812
Posts: 172
Joined: Fri 13 May 2016, 02:54

### Re: Multi-grid and cylindrical coordinates problem

@thorsten
>No it cannot. In rect grids, subgrids are usually used to locally refine the mesh
I should note another application again: for large antenna-to-antenna/radar simulations this can cut down free-space propagation time. So technically you don't have to set a small nested mesh, one inside other. But have just a stacked mesh spaces with matched grids, and boundaries, decimated by an integer. Maybe it is a bit simpler to implement?
Picture1.png (28.95 KiB) Viewed 6647 times

Hale_812
Posts: 172
Joined: Fri 13 May 2016, 02:54

### Re: Multi-grid and cylindrical coordinates problem

Ant_designer wrote:
Sat 13 Oct 2018, 11:41
- Is there a smith chart plot option is OpenEMS ? if not i will make one.
No. I've seen some scripts at Matlab official forum. But didn't try porting to Octave. This summer I posted here a good working script for radiation pattern, if you find it useful.
- Is there a built option/function to choose which antenna gain to present: Directivity/Gain/Realized gain ? I would like to overlay all of them on the same figure.
No. There are inconsistencies in tutorials. I've tried discussing it last winter. But no-one seems to be interested. It is easier to refer the book. And check the code for Thornsten's implementation. Technically all the same, just words used are sometimes confusing.
I put all the implemented tools aside, and use explicit formulas with Octave's basic plotting tools, except radiation pattern (see above).

Ant_designer
Posts: 6
Joined: Sun 07 Oct 2018, 13:34

### Re: Multi-grid and cylindrical coordinates problem

In the time passed i already implemented everything that i needed: smith chart, swept gain overlays, etc.

The main thing i still need your help with is to figure out what am i doing wrong in the basic circular patch in cylindrical coordinates example that i attached previously in this thread: Circular_patch_5GHz_cyl_mesh_V2.m.

Thorsten gave me some advice, but even after i implemented it, it doesn't work.
So i can't use cylindrical meshing yet.

I would appreciate if you can have a look.

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

### Re: Multi-grid and cylindrical coordinates problem

I tried it and noticed that the energy wasnt decaying. I saw the same problem when trying to set up the sinuous antenna. The cause for this issue was that the lumped port line did not coincide with the mesh cells exactly.

I checked your mesh and it does seem to coinside with the port line so I can't see whats going wrong. I'll check other things but at first glance the setup seems fine to me.

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

### Re: Multi-grid and cylindrical coordinates problem

On line 43 I removed the 'CoordSystem', 1 from inside the brackets right after InitFDTD, and put the rest of the arguments on one line. See attached file. Hope that helps. I'm not sure if it does what you want but the energy decays and the simulations ends before the maximum number of timesteps have been reached.
Attachments
Circular_patch_5GHz_cyl_mesh_V2_corrected.m
Corrected circular patch antenna

Ant_designer
Posts: 6
Joined: Sun 07 Oct 2018, 13:34

### Re: Multi-grid and cylindrical coordinates problem

Many thanks for checking this and for your fix.

It seems that there is still a problem that i cannot figure out:
"Warning: Unused primitive (type: Box) detected in property: port_resist_1!"

My goal is to simply compare a simple circular patch antenna in Rectangular Vs Cylindrical grid:
- The rectangular grid case works excellent - see attached.
- The cylindrical grid case has problems.

The setup of both of them looks to me almost identical.
What am i doing wrong ?
Attachments
Circular_patch_5GHz_rect_mesh.m