.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/fields/induction/plot_faraday_induction_mutual_inductance.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_api_gallery_fields_induction_plot_faraday_induction_mutual_inductance.py: Faraday's law of induction: mutual inductance and a spinning loop ================================================================= On 29 August 1831 Michael Faraday wound two coils on an iron ring and saw a galvanometer on one kick whenever he switched the current in the other on or off. A steady current did nothing; only a *changing* one induced a current. In modern form the emf around a circuit is .. math:: \mathcal E = -\frac{d\Phi}{dt}. When the flux through circuit 2 comes from a current in circuit 1, :math:`\Phi_2 = M I_1`. In 1845 Franz Neumann showed that the mutual inductance :math:`M` depends only on the geometry, .. math:: M = \frac{\mu_0}{4\pi}\oint\oint \frac{d\boldsymbol\ell_1\cdot d\boldsymbol\ell_2}{|\mathbf r_1 - \mathbf r_2|}. :func:`~physicskit.fields.mutual_inductance` evaluates this double integral over polyline circuits. This example checks it against Maxwell's elliptic-integral formula for two coaxial loops, the dipole limit :math:`\mu_0\pi a^2b^2/2d^3`, and a small loop inside a long solenoid (:math:`\mu_0 n\pi a^2`). It then spins a loop in a uniform field, the principle of every AC generator, and switches on an RL circuit. .. GENERATED FROM PYTHON SOURCE LINES 30-44 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from physicskit.fields import ( MU0, circular_loop_path, coaxial_loops_mutual_inductance, motional_emf, mutual_inductance, rl_transient, solenoid_path, ) .. GENERATED FROM PYTHON SOURCE LINES 45-50 Two coaxial loops: Neumann against Maxwell ------------------------------------------ Loops of radius 10 cm and 7 cm, their planes a distance d apart. Close together M grows like a logarithm; far apart it falls as the dipole coupling 1/d^3. .. GENERATED FROM PYTHON SOURCE LINES 50-60 .. code-block:: Python a, b = 0.1, 0.07 d = np.geomspace(0.003, 2.0, 25) loop_a = circular_loop_path(a, 400) M_neumann = np.array([mutual_inductance(loop_a, circular_loop_path(b, 400, center=(0, 0, dk))) for dk in d]) M_maxwell = coaxial_loops_mutual_inductance(a, b, d) M_dipole = MU0 * np.pi * a**2 * b**2 / (2 * d**3) for dk, mn, mm in zip(d[::6], M_neumann[::6], M_maxwell[::6]): print(f"d = {dk:7.4f} m Neumann {mn * 1e9:9.4f} nH Maxwell {mm * 1e9:9.4f} nH") .. rst-class:: sphx-glr-script-out .. code-block:: none d = 0.0030 m Neumann 122.6897 nH Maxwell 122.6922 nH d = 0.0152 m Neumann 112.5042 nH Maxwell 112.5069 nH d = 0.0775 m Neumann 41.7693 nH Maxwell 41.7712 nH d = 0.3936 m Neumann 1.3864 nH Maxwell 1.3865 nH d = 2.0000 m Neumann 0.0120 nH Maxwell 0.0120 nH .. GENERATED FROM PYTHON SOURCE LINES 61-65 A small loop inside a long solenoid ----------------------------------- Inside an ideal solenoid B = mu0 n I, so the flux through a coaxial loop of radius r is mu0 n I pi r^2, and M = mu0 n pi r^2. .. GENERATED FROM PYTHON SOURCE LINES 65-71 .. code-block:: Python Rs, Ls, N, r = 0.05, 2.0, 800, 0.01 M_sol = mutual_inductance(solenoid_path(Rs, Ls, N, points_per_turn=48), circular_loop_path(r, 256)) M_ideal = MU0 * (N / Ls) * np.pi * r**2 print(f"loop in solenoid: M = {M_sol * 1e9:.4f} nH, mu0 n pi r^2 = {M_ideal * 1e9:.4f} nH") .. rst-class:: sphx-glr-script-out .. code-block:: none loop in solenoid: M = 157.7011 nH, mu0 n pi r^2 = 157.9137 nH .. GENERATED FROM PYTHON SOURCE LINES 72-78 A loop spinning in a uniform field ---------------------------------- A loop turning at angular velocity omega about an axis in its plane, perpendicular to B, sees the flux B A cos(omega t), so the emf is B A omega sin(omega t). Here it comes from the force v x B on the charges in each moving segment, :func:`~physicskit.fields.motional_emf`. .. GENERATED FROM PYTHON SOURCE LINES 78-92 .. code-block:: Python B0, R, omega = 0.3, 0.2, 2 * np.pi * 50 n = 512 flat = circular_loop_path(R, n) area = 0.5 * n * R**2 * np.sin(2 * np.pi / n) # area of the 512-gon t = np.linspace(0.0, 0.04, 161) emf = np.empty_like(t) for k, tk in enumerate(t): th = omega * tk rot = np.array([[1, 0, 0], [0, np.cos(th), -np.sin(th)], [0, np.sin(th), np.cos(th)]]) path = flat @ rot.T emf[k] = motional_emf(path, np.cross([omega, 0.0, 0.0], path), [0.0, 0.0, B0]) emf_exact = B0 * area * omega * np.sin(omega * t) .. GENERATED FROM PYTHON SOURCE LINES 93-97 Self-induction: switching on an RL circuit ------------------------------------------ The back emf -L di/dt keeps the current from jumping. It rises as (V/R)(1 - exp(-t R/L)). .. GENERATED FROM PYTHON SOURCE LINES 97-125 .. code-block:: Python V, Rr, L = 12.0, 4.0, 0.2 tau = L / Rr t_rl = np.linspace(0, 5 * tau, 400) i_rl = rl_transient(V, Rr, L, t_rl) fig, axes = plt.subplots(1, 3, figsize=(14, 4)) axes[0].loglog(d, M_maxwell * 1e9, "k-", label="Maxwell (elliptic integrals)") axes[0].loglog(d, M_neumann * 1e9, "o", ms=4, label="Neumann (numerical)") axes[0].loglog(d, M_dipole * 1e9, "--", label=r"$\mu_0\pi a^2b^2/2d^3$") axes[0].set_xlabel("separation d (m)") axes[0].set_ylabel("M (nH)") axes[0].set_title("coaxial loops, a = 10 cm, b = 7 cm") axes[0].legend() axes[1].plot(t * 1e3, emf, label="motional emf") axes[1].plot(t * 1e3, emf_exact, "k--", label=r"$BA\omega\sin\omega t$") axes[1].set_xlabel("t (ms)") axes[1].set_ylabel("emf (V)") axes[1].set_title("loop spinning at 50 Hz in 0.3 T") axes[1].legend() axes[2].plot(t_rl / tau, i_rl) axes[2].axhline(V / Rr, color="k", ls="--", lw=0.8) axes[2].set_xlabel(r"t / $\tau$") axes[2].set_ylabel("i (A)") axes[2].set_title("RL circuit switched on") fig.tight_layout() plt.show() .. image-sg:: /api/gallery/fields/induction/images/sphx_glr_plot_faraday_induction_mutual_inductance_001.png :alt: coaxial loops, a = 10 cm, b = 7 cm, loop spinning at 50 Hz in 0.3 T, RL circuit switched on :srcset: /api/gallery/fields/induction/images/sphx_glr_plot_faraday_induction_mutual_inductance_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 126-132 Check ----- Neumann's integral matches Maxwell's closed form at every separation and the dipole limit far away; the loop in the solenoid gives mu0 n pi r^2; the spinning loop gives B A omega sin(omega t); the RL current reaches 1 - 1/e of V/R after one time constant. .. GENERATED FROM PYTHON SOURCE LINES 132-137 .. code-block:: Python assert np.max(np.abs(M_neumann / M_maxwell - 1)) < 1e-3 assert abs(M_maxwell[-1] / M_dipole[-1] - 1) < 1e-2 assert abs(M_sol / M_ideal - 1) < 2e-3 assert np.max(np.abs(emf - emf_exact)) < 1e-10 * B0 * area * omega assert abs(rl_transient(V, Rr, L, tau) / (V / Rr) - (1 - np.exp(-1))) < 1e-12 .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.255 seconds) .. _sphx_glr_download_api_gallery_fields_induction_plot_faraday_induction_mutual_inductance.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_faraday_induction_mutual_inductance.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_faraday_induction_mutual_inductance.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_faraday_induction_mutual_inductance.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_