nec2++  1.7.0
nec_ground.h
1 /*
2  Copyright (C) 2004 Timothy C.A. Molteno
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18 #ifndef __nec_ground__
19 #define __nec_ground__
20 
21 #include "common.h"
22 #include "math_util.h"
23 #include "nec_debug.h"
24 
25 /*
26  \section{NEC Ground Specification}
27 
28  \subsection{the GN Card}
29 
30  The GN card specifies the relative dielectric constant and conductivity of ground in the vicinity of the antenna.
31  In addition, a second set of ground parameters for a second medium can be specified,
32  or a radial wire ground screen can be modeled using a reflection coefficient approximation.
33 
34  The parameters of the second medium can also be specified on another data card whose mnemonic is GD.
35  With the GD card, the parameters of the second medium can be varied and only the radiated fields
36  need to be recalculated.
37  Furthermore, if a radial wire ground screen has been specified on the GN card,
38  the GD card is the only way to include a second medium.
39  See Section~\ref{sec_card_gd} for details.
40 
41  \subsection{"gd" card: ground representation}
42  \label{sec_card_gd}
43 
44  To specify the ground parameters of a second medium which is not in the immediate vicinity of the antenna.
45  This card may only be used if a GN card has also been used.
46  It does not affect the fields of surface patches.
47 
48  <ground type=finite>
49  <dielectric_constant = 80/>
50  <conductivity = 4/>
51  <radial-wire>
52  <count=12>
53  <length=15 unit=cm>
54  <
55  </radial-wire>
56  </ground>
57 
58 */
60 {
61 public:
62 
63  nec_ground()
64  {
65  default_values();
66  }
67 
68  nec_ground(const nec_ground& in_ground)
69  {
70  iperf = in_ground.iperf;
71  ksymp = in_ground.ksymp;
72  epsr = in_ground.epsr; // relative dielectric constant
73  sig = in_ground.sig; // Conductivity
74 
75  // radial wire ground
76  radial_wire_count = in_ground.radial_wire_count;
77  radial_wire_length = in_ground.radial_wire_length;
78  radial_wire_radius = in_ground.radial_wire_radius;
79 
80  // second medium parameters
81  cliff_edge_distance = in_ground.cliff_edge_distance;
82  cliff_height = in_ground.cliff_height;
83  epsr2 = in_ground.epsr2; // Relative dielectric constant
84  sig2 = in_ground.sig2; // Conductivity in mhos/meter
85  }
86 
87  void default_values()
88  {
89  zrati=cplx_10();
90  ksymp=1;
91  radial_wire_count = 0;
92  radial_wire_length = 0.0;
93  radial_wire_radius = 0.0;
94  iperf=0;
95  /*22/09/2005 : added initialization for sig and epsr*/
96  epsr = 0;
97  sig = 0;
98  }
99  /*
100  Parse a GN card. The input parameters here are the fields of the
101  GN card.
102  */
103  void parse_gn(int itmp1, int itmp2,
104  nec_float tmp1, nec_float tmp2,
105  nec_float tmp3, nec_float tmp4,
106  nec_float tmp5, nec_float tmp6
107  );
108 
109  /*
110  Setup a cliff (two medium ground)
111  */
112  void setup_cliff(nec_float in_eprs2,
113  nec_float in_sig2,
114  nec_float clt, nec_float cht);
115 
116  nec_complex get_zrati2(nec_float wavelength);
117 
118  nec_float get_cl(nec_float wavelength) // cliff edge in wavelengths,
119  {
120  return cliff_edge_distance / wavelength;
121  }
122 
123  nec_float get_ch(nec_float wavelength) // cliff Height in wavelengths.
124  {
125  return cliff_height / wavelength;
126  }
127 
128  nec_complex get_zrati_sqr() const
129  {
130  return zrati*zrati;
131  }
132 
133  // accessors for the ground type
134  inline bool type_finite_reflection() { return (0 == iperf); }
135  inline bool type_perfect() { return (1 == iperf); }
136  inline bool type_sommerfeld_norton() { return (2 == iperf); }
137 
138 
139  bool is_valid() const
140  {
141  if (iperf < 0) return false;
142  if (iperf > 2) return false;
143 
144  if (ksymp < 1) return false;
145  if (ksymp > 2) return false;
146 
147  return true;
148  }
149 
151  bool present() const
152  {
153  ASSERT(is_valid());
154 
155  if (2 == ksymp)
156  return true;
157 
158  return false;
159  }
160 
161  nec_float epsr; // relative dielectric constant
162  nec_float sig; // Conductivity
163 
164  // radial wire ground
165  int radial_wire_count;
166  nec_float radial_wire_length;
167  nec_float radial_wire_radius;
168 
169  // second medium parameters
170  nec_float cliff_edge_distance;
171  nec_float cliff_height;
172  nec_float epsr2; // Relative dielectric constant
173  nec_float sig2; // Conductivity in mhos/meter
174 
175 // MOVE THESE TO THE GROUND
176 
177  nec_float scrwl; // length of wires in radial-wire ground-screen in wavelengths
178  nec_float scrwr; // radius of wires in radial-wire ground-screen in wavelengths
179 
180  nec_complex m_t1;
181  nec_float t2; // constants for the radial-wire ground-screen impedance
182 
183  nec_complex zrati, frati;
184 
185  nec_float t1; // constants for the radial-wire ground-screen impedance
186 
188  int ksymp;
189 private:
190  /* iperf: Ground-type flag. The options are:
191  -1 - nullifies ground parameters previously used and sets free- space condition. The remainder of the card is left blank in this case.
192  O - finite ground, reflection-coefficient approximation.
193  1 - perfectly conducting ground.
194  2 - finite ground, Sommerfeld/Norton method.
195  */
196  int iperf;
197 
198 
199 };
200 
201 #endif /* __nec_ground__ */
202 
int ksymp
Definition: nec_ground.h:188
bool present() const
Return true if a ground is present.
Definition: nec_ground.h:151
Definition: nec_ground.h:59