"""Paper-style figures for Sec. 7.5 (far-field geometry and decay). Conventions (Sec. 7): z-c = u^2-v^2, rho=2uv, R=u^2+v^2, electrode u=u0, exterior u>u0, kappa=v/u=tan(theta/2), theta from the +z axis. Decay data: high-precision quadrature of the Hankel integral, from decay_proof/bc_highprec.log (mpmath dps=40), Gaussian a~(lam)=exp(-lam^2/4)/2, u0=sqrt(5), a~(0)=1/2. No invented values. """ import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from matplotlib.patches import FancyArrowPatch, Arc, Polygon, FancyBboxPatch from matplotlib.lines import Line2D from pathlib import Path HERE = Path(__file__).resolve().parent # Write PDFs/PNGs in this directory (the paper's anc folder). Copy the PDFs # to ../figures/ if you are rebuilding the manuscript figures. OUT = HERE plt.rcParams.update({ 'font.size': 9, 'font.family': 'serif', 'mathtext.fontset': 'cm', 'axes.linewidth': 0.7, 'xtick.direction': 'out', 'ytick.direction': 'out', }) # --------------------------------------------------------------------------- # Figure A: geometry # --------------------------------------------------------------------------- u0 = np.sqrt(5.0) # same as the Gaussian example / Table 4 def rho_of_uZ(u, Z): # rho^2 = 4 u^2 (u^2 - Z), for Z <= u^2 return 2 * u * np.sqrt(np.maximum(u**2 - Z, 0.0)) fig, ax = plt.subplots(figsize=(5.6, 4.55), constrained_layout=True) # view window (rho >= 0, matching other paper meridian plots) xmin, xmax = 0.0, 14.0 zmin, zmax = -5.0, 13.5 ax.set_xlim(xmin, xmax) ax.set_ylim(zmin, zmax) ax.set_aspect('equal') # --- shade the cone of the theorem, K=1, in the exterior only --- # theta <= pi/2 <=> Z >= 0; exterior u >= u0 <=> R+Z >= 2 u0^2 # Build a polygon: along electrode from vertex to (rho,0), then along # the cone boundary (the Z=0 ray) to the right edge, up and around the frame, # back down the axis to the vertex. rho_el = np.linspace(0, 2 * u0**2, 400) # electrode from vertex to Z=0 Z_el_right = u0**2 - rho_el**2 / (4 * u0**2) # at Z=0, rho=2 u0^2 = 10 poly_r = np.concatenate([ rho_el, np.array([xmax, xmax, 0.0]), ]) poly_z = np.concatenate([ Z_el_right, np.array([0.0, zmax, zmax]), ]) ax.fill(poly_r, poly_z, color='0.90', zorder=0, lw=0) # --- u = const curves (exterior), dotted, to show u growing --- Z_grid = np.linspace(zmin, zmax, 800) u_curves = [(2.8, r'$u=2.8$'), (3.6, r'$u=3.6$')] u_label_Z = {2.8: 2.0, 3.6: 9.4} for u, lab in u_curves: Zc = Z_grid[Z_grid <= u**2] rc = rho_of_uZ(u, Zc) ax.plot(rc, Zc, ':', color='0.35', lw=1.0, zorder=2) # label near the right of the visible arc, slightly outside # pick a point with Z around 1.5--3 Zlab = u_label_Z[u] i = np.argmin(np.abs(Zc - Zlab)) ax.annotate(lab, xy=(rc[i], Zc[i]), xytext=(rc[i] + 0.25, Zc[i] + 0.70), fontsize=8, color='0.25', arrowprops=dict(arrowstyle='-', color='0.5', lw=0.4), zorder=5) # --- electrode u=u0, bold C0 --- Zc = Z_grid[Z_grid <= u0**2] rc = rho_of_uZ(u0, Zc) ax.plot(rc, Zc, color='C0', lw=2.2, zorder=4, label=r'electrode $u=u_0$') # --- axis --- ax.plot([0, 0], [zmin, zmax], color='0.15', lw=0.7, zorder=3) ax.annotate('', xy=(0, zmax - 0.05), xytext=(0, zmax - 1.4), arrowprops=dict(arrowstyle='-|>', color='0.15', lw=0.7, mutation_scale=8)) ax.text(0.35, zmax - 0.85, r'axis', fontsize=8, color='0.15') # --- cone boundary (theta = pi/2), the horizontal from the focus --- ax.plot([0, xmax], [0, 0], color='0.35', lw=0.8, ls='--', zorder=3) ax.text(xmax - 0.15, 0.28, r'$\theta=\pi/2$', fontsize=7.5, color='0.3', ha='right', va='bottom') # --- sample ray at theta = pi/3 --- theta = np.pi / 3 R_P = 11.5 R_el = u0**2 * (1.0 + np.tan(theta/2)**2) # where the ray meets the electrode r_in = np.linspace(0, R_el, 80) r_out = np.linspace(R_el, 16, 120) ax.plot(r_in * np.sin(theta), r_in * np.cos(theta), color='0.15', lw=0.8, ls='--', zorder=5) ax.plot(r_out * np.sin(theta), r_out * np.cos(theta), color='0.15', lw=1.05, zorder=5) # point P xP = R_P * np.sin(theta) zP = R_P * np.cos(theta) ax.plot(xP, zP, 'o', color='0.1', ms=4.5, zorder=7) ax.annotate(r'$P$', xy=(xP, zP), xytext=(xP + 0.55, zP + 0.55), fontsize=10, zorder=7) # R sits on the exterior part of the ray, clearly between the electrode and P rm = 0.5 * (R_el + R_P) ax.text(7.15, 6.55, r'$R$', fontsize=11, ha='center', va='bottom', zorder=7) # --- focus --- ax.plot(0, 0, 'o', color='0.1', ms=5, zorder=8) ax.annotate('focus', xy=(0, 0), xytext=(1.15, -1.55), fontsize=8, color='0.1', arrowprops=dict(arrowstyle='-', color='0.3', lw=0.5), zorder=8) # --- theta arc near the focus --- arc_r = 2.15 arc = Arc((0, 0), 2 * arc_r, 2 * arc_r, angle=0, theta1=90 - np.degrees(theta), theta2=90, color='0.15', lw=0.8, zorder=6) ax.add_patch(arc) # label at mid-angle ang = theta / 2 ax.text(0.55 * arc_r * np.sin(ang) + 0.15, 0.55 * arc_r * np.cos(ang) + 0.05, r'$\theta$', fontsize=10, ha='center', va='center', zorder=6) # --- kappa label, in the exterior above the ray --- ax.text(7.15, 2.85, r'$\kappa=v/u=\tan(\theta/2)$', fontsize=8, color='0.1', zorder=6) # --- electrode label, on the interior (white) side, no leader line --- ax.text(6.3, -1.55, r'electrode $u=u_0$', fontsize=8, color='C0', zorder=8) # --- cone label, in the shaded region --- ax.text(3.6, 11.3, r'cone $\theta\leq 2\arctan K$', fontsize=8, color='0.2', ha='left') ax.text(3.6, 10.45, r'(here $K=1$, so $\theta\leq\pi/2$)', fontsize=7.5, color='0.3', ha='left') ax.text(3.6, 9.6, r'Theorem 7.1 holds uniformly', fontsize=7.5, color='0.3', ha='left', style='italic') # --- a small "exterior / interior" cue --- ax.text(1.15, 6.40, r'exterior $u>u_0$', fontsize=8, color='0.3') # interior under the electrode, clear of the angle arc ax.text(2.85, 0.48, r'interior $u 1 ax = axs[1] ax.axhline(1.0, color='0.45', ls='--', lw=1.0, zorder=1) # two-term axis (start at R=80 so the curve stays in the frame; # at R=40 the two-term value is 1.76, still a large correction) Rtt = Rfine[Rfine >= 80] Lfine = L_of_R(Rtt, 0.0) twoterm = 1.0 + (np.pi**2) / (12.0 * Lfine**2) ax.plot(Rtt, twoterm, color='C0', ls=':', lw=1.3, zorder=2, label=r'axis, two-term $1+\pi^2/(12L^2)$') for key, d in data.items(): ax.plot(d['R'], d['ratio'], d['marker'], color=d['color'], ms=5, mfc='none', mew=1.0, zorder=3, label=d['label']) ax.set_xscale('log') ax.set_xlim(30, 6e4) ax.set_ylim(0.75, 1.55) ax.set_xlabel(r'$R$') ax.set_ylabel(r'$VR\ln(R/(u u_0))/\tilde{a}(0)$') ax.set_title(r'(a)'.replace('a', 'b') + r' ratio approaching $1$', fontsize=9) ax.legend(fontsize=7, loc='upper right', frameon=False) for a in axs: a.tick_params(labelsize=8) for dest in (OUT / 'fig_farfield_decay.pdf', OUT / 'fig_farfield_decay.png', HERE / '../figures/farfield_decay.pdf'): fig.savefig(dest, dpi=200, bbox_inches='tight') print('wrote decay') plt.close(fig)