.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/atmosphere/plot_14_vaisala_brunt_buoyancy_frequency.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_atmosphere_plot_14_vaisala_brunt_buoyancy_frequency.py: Väisälä and Brunt's buoyancy frequency (1925) ============================================= Vilho Väisälä (1925) and David Brunt (1927) showed that a parcel displaced vertically in stable air oscillates about its level, with angular frequency ``N = sqrt(g / theta * dtheta/dz)``. In the troposphere the period is about ten minutes. Integrating the parcel equation ``z'' = -N^2 z`` recovers that period. .. GENERATED FROM PYTHON SOURCE LINES 11-31 .. image-sg:: /api/gallery/atmosphere/images/sphx_glr_plot_14_vaisala_brunt_buoyancy_frequency_001.png :alt: Buoyancy oscillation, period 10.6 min :srcset: /api/gallery/atmosphere/images/sphx_glr_plot_14_vaisala_brunt_buoyancy_frequency_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none buoyancy period: 10.6 min | .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from earthsciencekit.atmosphere import brunt_vaisala_squared from earthsciencekit.constants import GRAVITY from earthsciencekit.integrators import integrate_ode n2 = float(brunt_vaisala_squared(300, 0.003, GRAVITY)) period = 2 * np.pi / np.sqrt(n2) time = np.linspace(0, 3 * period, 601) result = integrate_ode(lambda t, y: [y[1], -n2 * y[0]], [100.0, 0.0], time, names=("height", "speed"), units=("m", "m/s")) np.testing.assert_allclose(result.values[:, 0], 100 * np.cos(np.sqrt(n2) * time), atol=1e-4) print(f"buoyancy period: {period / 60:.1f} min") fig, ax = plt.subplots() ax.plot(time / 60, result.values[:, 0]) ax.set(xlabel="time [min]", ylabel="displacement [m]", title=f"Buoyancy oscillation, period {period / 60:.1f} min") plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.112 seconds) .. _sphx_glr_download_api_gallery_atmosphere_plot_14_vaisala_brunt_buoyancy_frequency.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/atmosphere/plot_14_vaisala_brunt_buoyancy_frequency.ipynb :alt: Launch JupyterLite :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_14_vaisala_brunt_buoyancy_frequency.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_14_vaisala_brunt_buoyancy_frequency.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_14_vaisala_brunt_buoyancy_frequency.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_