Warning: Unused primitive

How to use openEMS. Discussion on examples, tutorials etc

Moderator: thorsten

Post Reply
jschall
Posts: 14
Joined: Sun 07 Jan 2018, 13:29

Warning: Unused primitive

Post by jschall » Sun 07 Jan 2018, 14:02

I am using openems to simulate a helical antenna. Depending on the parameters of the antenna, I occasionally get the following warning:
Warning: Unused primitive (type: Box) detected in property: port_excite_1!
Executing the following code will reproduce the issue:

Code: Select all

physical_constants;

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

f_0 = 6.4896e9;
f_c = 0.4992e9 / 0.3925;

helix_radius = 0.02153686745286278;
helix_length = 0.017860927152317883;
helix_pitch = 0.0097439548589000682;
taper_ratio = 1.4172185430463575;

helix_turns = helix_length/helix_pitch;

lambda0 = C0/f_0;

feed_height = 1e-3;
ground_radius = 3e-2;
ground_height = 0.5e-3;
feed_R = 50;

ang = linspace(0,2*pi*helix_turns,200*helix_turns);

helix_points(1,:) = helix_radius*(1 - taper_ratio*ang/(2*pi*helix_turns)).*cos(ang);
helix_points(2,:) = helix_radius*(1 - taper_ratio*ang/(2*pi*helix_turns)).*sin(ang);
helix_points(3,:) = ang/2/pi*helix_pitch + feed_height;

mesh_res = C0 / (f_0 + f_c) / 10;

CSX = InitCSX();
CSX = AddMetal(CSX, 'Ground');
CSX = AddCylinder(CSX,'Ground',1,[0 0 -ground_height],[0 0 0],ground_radius);

CSX = AddMetal(CSX, 'Helix');
CSX = AddCurve(CSX, 'Helix', 2, helix_points);

[CSX port] = AddLumpedPort(CSX, 10, 1, feed_R, [helix_radius 0 0], [helix_radius 0 feed_height], [0 0 1], true);

mesh.x = [-(2*lambda0+ground_radius) linspace(-helix_radius, helix_radius, 21) (2*lambda0+ground_radius)];
mesh.y = [-(2*lambda0+ground_radius) linspace(-helix_radius, helix_radius, 21) (2*lambda0+ground_radius)];
mesh.z = [-(2*lambda0+ground_height) 0 linspace(feed_height, feed_height+helix_turns*helix_pitch, 17) (2*lambda0+feed_height+helix_turns*helix_pitch)];
mesh = SmoothMesh(mesh, mesh_res/2);
CSX = DefineRectGrid(CSX, 1, mesh);

start = [mesh.x(10)     mesh.y(10)     mesh.z(10)];
stop  = [mesh.x(end-9) mesh.y(end-9) mesh.z(end-9)];
[CSX nf2ff] = CreateNF2FFBox(CSX, 'nf2ff', start, stop);

FDTD = InitFDTD( 'NrTs', 50000, 'EndCriteria', 1e-5, 'OverSampling', 2);
FDTD = SetGaussExcite(FDTD, f_0, f_c );
BC   = {'PML_8' 'PML_8' 'PML_8' 'PML_8' 'PML_8' 'PML_8'};
FDTD = SetBoundaryCond(FDTD, BC);

confirm_recursive_rmdir(0);
[status, message, messageid] = rmdir( Sim_Path, 's' );
[status, message, messageid] = mkdir( Sim_Path );

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

RunOpenEMS( Sim_Path, Sim_CSX);

jschall
Posts: 14
Joined: Sun 07 Jan 2018, 13:29

Re: Warning: Unused primitive

Post by jschall » Sun 07 Jan 2018, 14:06

Also, hi, I'm new here, and I'm totally, totally new to CEM. I am somewhat aware that my mesh has something to do with this.

Stupid question: should the ends of my LumpedPort be in the center of a mesh grid cell or in a corner? Can someone help me optimize my mesh?

jschall
Posts: 14
Joined: Sun 07 Jan 2018, 13:29

Re: Warning: Unused primitive

Post by jschall » Sun 07 Jan 2018, 15:21

This is super frustrating... it doesn't seem to matter what I do to the mesh, this always seems to happen. I am trying to run an optimizer, and I need the simulation to work reliably.

jschall
Posts: 14
Joined: Sun 07 Jan 2018, 13:29

Re: Warning: Unused primitive

Post by jschall » Sun 07 Jan 2018, 18:59

I think I might have solved this by truncating the precision of the parameters. I am running a couple hundred simulations and will see if any of them failed tomorrow.

LowDepth
Posts: 20
Joined: Mon 10 Nov 2014, 16:59

Re: Warning: Unused primitive

Post by LowDepth » Sun 07 Jan 2018, 21:43

Your mesh lines should include the edges of all your box primitives - as you probably already found out.
Rounding the edge lengths of your box to a certain number of digits is certainly a good idea.

Post Reply