.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/oceanography/plot_01_newton_equilibrium_tide.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 or to run this example in your browser via JupyterLite. .. rst-class:: sphx-glr-example-title .. _sphx_glr_api_gallery_oceanography_plot_01_newton_equilibrium_tide.py: Newton's equilibrium tide (1687) ================================ Isaac Newton explained the tides as the difference between the Moon's (and the Sun's) attraction across the Earth. An ocean in equilibrium with that field bulges by ``(3/4) (M/E) (R/d)**3 R`` in each semidiurnal constituent at the equator, about 27 cm for the Moon and 12 cm for the Sun. The two constituents beat into spring and neap tides every 14.8 days. .. GENERATED FROM PYTHON SOURCE LINES 11-39 .. image-sg:: /api/gallery/oceanography/images/sphx_glr_plot_01_newton_equilibrium_tide_001.png :alt: Spring-neap cycle of 14.77 days :srcset: /api/gallery/oceanography/images/sphx_glr_plot_01_newton_equilibrium_tide_001.png :class: sphx-glr-single-img .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from earthsciencekit.constants import EARTH_RADIUS from earthsciencekit.oceanography import tidal_elevation from earthsciencekit.units import convert earth_mass = 5.972e24 lunar = 0.75 * (7.342e22 / earth_mass) * (EARTH_RADIUS / 3.844e8) ** 3 * EARTH_RADIUS solar = 0.75 * (1.989e30 / earth_mass) * (EARTH_RADIUS / 1.496e11) ** 3 * EARTH_RADIUS m2, s2 = 12.4206 * 3600, 12.0 * 3600 spring_neap = 1 / (1 / s2 - 1 / m2) assert 0.45 < solar / lunar < 0.47 assert np.isclose(convert(spring_neap, "s", "day"), 14.77, atol=0.01) time = np.linspace(0, convert(30, "day", "s"), 20001) tide = tidal_elevation(time, lunar, m2, 0) + tidal_elevation(time, solar, s2, 0) assert np.isclose(tide.max(), lunar + solar, rtol=1e-3) fig, ax = plt.subplots(figsize=(8, 3.5)) ax.plot(convert(time, "s", "day"), 100 * tide, lw=0.6) ax.axhline(100 * (lunar + solar), color="tab:red", ls="--", label="spring: Moon + Sun") ax.axhline(100 * (lunar - solar), color="tab:green", ls="--", label="neap: Moon - Sun") ax.set(xlabel="time [days]", ylabel="equilibrium tide [cm]", title=f"Spring-neap cycle of {convert(spring_neap, 's', 'day'):.2f} days") ax.legend(loc="lower right") plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.096 seconds) .. _sphx_glr_download_api_gallery_oceanography_plot_01_newton_equilibrium_tide.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: lite-badge .. image:: images/jupyterlite_badge_logo.svg :target: ../../../lite/lab/index.html?path=api/gallery/oceanography/plot_01_newton_equilibrium_tide.ipynb :alt: Launch JupyterLite :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_01_newton_equilibrium_tide.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_01_newton_equilibrium_tide.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_01_newton_equilibrium_tide.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_