Skip to main content

lib_jsl_electromagnetics/antenna_models/
dish.rs

1//! Circular aperture (reflector dish) antennas.
2//!
3//! See the book entry [Antenna models](https://jwkunz.github.io/lib_jsl/book/em-arrays/antennas.html).
4
5use super::{Antenna, Excitation};
6use crate::conventions::{C64, Medium, TimeConvention};
7use lib_jsl_core::constants::em::C0;
8use lib_jsl_special_functions::bessel_functions_integer::bessel_j_integer;
9use std::f64::consts::{PI, TAU};
10
11/// A circular aperture of diameter `D` in the `xy` plane, radiating along `+z`, modelled as a
12/// Huygens source with a `ŷ`-polarized aperture field `E₀ (1 - ρ²/a²)^p` (`a = D/2`; `p = 0`
13/// uniform, larger `p` tapers the edge and lowers the sidelobes). Far field per unit `E₀`, in
14/// the `e^{+jωt}` convention:
15///
16/// `[E_θ, E_φ] = j k a² 2^p p! J_{p+1}(u)/u^{p+1} · (1 + cos θ)/2 · [sin φ, cos φ]`, `u = ka sin θ`.
17///
18/// Directivity `(πD/λ)² (2p+1)/(p+1)²`, i.e. aperture efficiency 1, 0.75, 0.556, ... for
19/// `p = 0, 1, 2`. Radiated power is computed from the aperture field, `∫ |E_a|² dA / (2η)`.
20#[derive(Debug, Clone, Copy, PartialEq)]
21pub struct Dish {
22    pub diameter: f64,
23    pub taper: u32,
24}
25
26impl Dish {
27    /// A uniformly illuminated aperture.
28    pub fn new(diameter: f64) -> Self {
29        Dish { diameter, taper: 0 }
30    }
31
32    /// An aperture with the parabolic-on-pedestal taper `(1 - ρ²/a²)^p`.
33    pub fn with_taper(diameter: f64, taper: u32) -> Self {
34        Dish { diameter, taper }
35    }
36
37    /// The aperture efficiency `(2p+1)/(p+1)²` of the taper.
38    pub fn aperture_efficiency(&self) -> f64 {
39        let p = f64::from(self.taper);
40        (2.0 * p + 1.0) / ((p + 1.0) * (p + 1.0))
41    }
42
43    /// The exact boresight directivity `(πD/λ)² × efficiency`.
44    pub fn boresight_directivity(&self, frequency: f64) -> f64 {
45        (PI * self.diameter * frequency / C0).powi(2) * self.aperture_efficiency()
46    }
47
48    /// The half-power beamwidth (radians) found from the pattern in the `xz` plane.
49    pub fn half_power_beamwidth(&self, frequency: f64) -> f64 {
50        let peak = self.radiation_intensity(0.0, 0.0, frequency);
51        let (mut lo, mut hi) = (0.0, PI / 2.0);
52        // The main lobe falls monotonically to the first null; bisect the -3 dB point inside it.
53        let first_null = 3.8317 / (TAU * frequency / C0 * self.diameter / 2.0);
54        hi = f64::min(hi, first_null * (1.0 + f64::from(self.taper)));
55        for _ in 0..100 {
56            let mid = 0.5 * (lo + hi);
57            if self.radiation_intensity(mid, 0.0, frequency) > 0.5 * peak {
58                lo = mid;
59            } else {
60                hi = mid;
61            }
62        }
63        2.0 * lo
64    }
65}
66
67impl Antenna for Dish {
68    fn far_field(&self, theta: f64, phi: f64, frequency: f64, convention: TimeConvention) -> [C64; 2] {
69        let k = TAU * frequency / C0;
70        let a = self.diameter / 2.0;
71        let u = k * a * theta.sin();
72        let p = self.taper as i32;
73        let factorial: f64 = (1..=self.taper).map(f64::from).product();
74        // 2^p p! J_{p+1}(u) / u^{p+1}, with its limit 1/(2(p+1)) at u = 0.
75        let lambda = if u.abs() < 1e-6 { 1.0 / (2.0 * (f64::from(self.taper) + 1.0)) } else { 2f64.powi(p) * factorial * bessel_j_integer(p + 1, u) / u.powi(p + 1) };
76        let amplitude = convention.unit() * (k * a * a * lambda * (1.0 + theta.cos()) / 2.0);
77        [amplitude * phi.sin(), amplitude * phi.cos()]
78    }
79
80    fn excitation(&self) -> Excitation {
81        Excitation::ApertureField
82    }
83
84    fn radiated_power(&self, _frequency: f64) -> f64 {
85        let a = self.diameter / 2.0;
86        let eta = Medium::VACUUM.impedance(TimeConvention::PlusJ).re;
87        PI * a * a / (2.0 * eta * (2.0 * f64::from(self.taper) + 1.0))
88    }
89
90    fn peak_directivity(&self, frequency: f64) -> f64 {
91        self.boresight_directivity(frequency)
92    }
93}
94
95#[cfg(test)]
96mod tests {
97    use super::*;
98    use crate::fields::domain::{Axis, Domain};
99    use crate::fields::physics::radiated_power;
100    use std::sync::Arc;
101
102    #[test]
103    fn boresight_directivity_matches_the_aperture_formula() {
104        let f = 10e9;
105        let lambda = C0 / f;
106        for taper in [0, 1, 2] {
107            let dish = Dish::with_taper(10.0 * lambda, taper);
108            let d = dish.directivity(0.0, 0.0, f);
109            assert!((d - dish.boresight_directivity(f)).abs() < 1e-9 * d, "taper {taper}");
110        }
111        assert!((Dish::new(1.0).aperture_efficiency() - 1.0).abs() < 1e-15);
112        assert!((Dish::with_taper(1.0, 1).aperture_efficiency() - 0.75).abs() < 1e-15);
113        // (πD/λ)² for D = 10λ: ≈ 987 (29.9 dBi).
114        assert!((Dish::new(10.0 * lambda).boresight_directivity(f) - 986.96).abs() < 0.01);
115    }
116
117    #[test]
118    fn analytic_power_agrees_with_the_far_field_integral_and_tapers_widen_the_beam() {
119        let f = 10e9;
120        let lambda = C0 / f;
121        let dish = Dish::with_taper(4.0 * lambda, 1);
122        // Integrate the far field over the sphere (fine θ grid near the narrow main beam).
123        let d = Arc::new(Domain::far_field_sphere(Axis::gauss_legendre_polar(160).unwrap(), Axis::periodic(0.0, TAU, 16).unwrap()).unwrap());
124        let e = dish.far_field_pattern(d, f, TimeConvention::PlusJ).unwrap();
125        let numeric = radiated_power(&e, &crate::conventions::Medium::VACUUM).unwrap();
126        // The Huygens far field is approximate off boresight; agreement is close for D ≫ λ.
127        assert!((numeric - dish.radiated_power(f)).abs() < 0.03 * numeric, "{numeric} vs {}", dish.radiated_power(f));
128        // Uniform illumination: HPBW = 1.029 λ/D. Tapering widens it.
129        let uniform = Dish::new(20.0 * lambda);
130        let hpbw = uniform.half_power_beamwidth(f);
131        assert!((hpbw - 1.029 * lambda / (20.0 * lambda)).abs() < 2e-3 * hpbw.max(1.0), "{hpbw}");
132        assert!(Dish::with_taper(20.0 * lambda, 2).half_power_beamwidth(f) > hpbw);
133        // Polarization: ŷ aperture field gives E_θ in the yz plane and E_φ in the xz plane.
134        let [et, ep] = uniform.far_field(0.01, PI / 2.0, f, TimeConvention::PlusJ);
135        assert!(et.norm() > 0.0 && ep.norm() < 1e-12 * et.norm());
136    }
137}