Note
Go to the end to download the full example code.
Gill Model: Symmetric Heating¶
This example simulates the steady linear response to heating that is symmetric about the equator. The horizontal snapshot shows the geopotential-height perturbation and horizontal circulation; the cross sections diagnose the corresponding vertical structure.
import numpy as np
from easyclimate.field.simulation.gill import (
simulate,
plot_snapshot,
plot_cross_sections,
)
Run the symmetric Gill-heating experiment. The returned xarray Dataset holds the final horizontal fields and the coordinates needed by the plotting helpers.
result_symmetric_heating = simulate(case = "gill_sym")
result_symmetric_heating
<xarray.Dataset> Size: 313kB
Dimensions: (y: 61, x: 128, y_staggered: 60, z: 20)
Coordinates:
* y (y) float64 488B -7.725 -7.468 -7.21 ... 7.21 7.468 7.725
* x (x) float64 1kB -12.57 -12.27 -11.98 ... 24.25 24.54 24.84
* y_staggered (y_staggered) float64 480B -7.725 -7.468 -7.21 ... 7.21 7.468
* z (z) float64 160B 0.0 0.1653 0.3307 0.496 ... 2.811 2.976 3.142
Data variables:
q (y, x) float64 62kB 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0
eta (y, x) float64 62kB -1.904e-06 -1.969e-06 ... -1.841e-06
u (y, x) float64 62kB 1.187e-06 1.183e-06 ... 1.188e-06 1.189e-06
v (y, x) float64 62kB 2.706e-08 2.894e-08 ... -2.446e-08
v_staggered (y_staggered, x) float64 61kB 5.411e-08 ... -4.892e-08
Attributes: (12/17)
case: gill_sym
case_label: Gill: symmetric heating
short_name: Gill_sym
t: 50.0
nt: 500
nx: 128
... ...
damping: 0.1
kernel: reyon
dt: 0.1
dx: 0.2945243112740431
dy: 0.25750759455654043
dz: 0.16534698176788384xarray.Dataset
- y: 61
- x: 128
- y_staggered: 60
- z: 20
- y(y)float64-7.725 -7.468 -7.21 ... 7.468 7.725
array([-7.725228, -7.46772 , -7.210213, -6.952705, -6.695197, -6.43769 , -6.180182, -5.922675, -5.665167, -5.407659, -5.150152, -4.892644, -4.635137, -4.377629, -4.120122, -3.862614, -3.605106, -3.347599, -3.090091, -2.832584, -2.575076, -2.317568, -2.060061, -1.802553, -1.545046, -1.287538, -1.03003 , -0.772523, -0.515015, -0.257508, 0. , 0.257508, 0.515015, 0.772523, 1.03003 , 1.287538, 1.545046, 1.802553, 2.060061, 2.317568, 2.575076, 2.832584, 3.090091, 3.347599, 3.605106, 3.862614, 4.120122, 4.377629, 4.635137, 4.892644, 5.150152, 5.407659, 5.665167, 5.922675, 6.180182, 6.43769 , 6.695197, 6.952705, 7.210213, 7.46772 , 7.725228]) - x(x)float64-12.57 -12.27 ... 24.54 24.84
array([-12.566371, -12.271846, -11.977322, -11.682798, -11.388273, -11.093749, -10.799225, -10.5047 , -10.210176, -9.915652, -9.621128, -9.326603, -9.032079, -8.737555, -8.44303 , -8.148506, -7.853982, -7.559457, -7.264933, -6.970409, -6.675884, -6.38136 , -6.086836, -5.792311, -5.497787, -5.203263, -4.908739, -4.614214, -4.31969 , -4.025166, -3.730641, -3.436117, -3.141593, -2.847068, -2.552544, -2.25802 , -1.963495, -1.668971, -1.374447, -1.079922, -0.785398, -0.490874, -0.19635 , 0.098175, 0.392699, 0.687223, 0.981748, 1.276272, 1.570796, 1.865321, 2.159845, 2.454369, 2.748894, 3.043418, 3.337942, 3.632467, 3.926991, 4.221515, 4.516039, 4.810564, 5.105088, 5.399612, 5.694137, 5.988661, 6.283185, 6.57771 , 6.872234, 7.166758, 7.461283, 7.755807, 8.050331, 8.344855, 8.63938 , 8.933904, 9.228428, 9.522953, 9.817477, 10.112001, 10.406526, 10.70105 , 10.995574, 11.290099, 11.584623, 11.879147, 12.173672, 12.468196, 12.76272 , 13.057244, 13.351769, 13.646293, 13.940817, 14.235342, 14.529866, 14.82439 , 15.118915, 15.413439, 15.707963, 16.002488, 16.297012, 16.591536, 16.886061, 17.180585, 17.475109, 17.769633, 18.064158, 18.358682, 18.653206, 18.947731, 19.242255, 19.536779, 19.831304, 20.125828, 20.420352, 20.714877, 21.009401, 21.303925, 21.598449, 21.892974, 22.187498, 22.482022, 22.776547, 23.071071, 23.365595, 23.66012 , 23.954644, 24.249168, 24.543693, 24.838217]) - y_staggered(y_staggered)float64-7.725 -7.468 -7.21 ... 7.21 7.468
array([-7.725228, -7.46772 , -7.210213, -6.952705, -6.695197, -6.43769 , -6.180182, -5.922675, -5.665167, -5.407659, -5.150152, -4.892644, -4.635137, -4.377629, -4.120122, -3.862614, -3.605106, -3.347599, -3.090091, -2.832584, -2.575076, -2.317568, -2.060061, -1.802553, -1.545046, -1.287538, -1.03003 , -0.772523, -0.515015, -0.257508, 0. , 0.257508, 0.515015, 0.772523, 1.03003 , 1.287538, 1.545046, 1.802553, 2.060061, 2.317568, 2.575076, 2.832584, 3.090091, 3.347599, 3.605106, 3.862614, 4.120122, 4.377629, 4.635137, 4.892644, 5.150152, 5.407659, 5.665167, 5.922675, 6.180182, 6.43769 , 6.695197, 6.952705, 7.210213, 7.46772 ]) - z(z)float640.0 0.1653 0.3307 ... 2.976 3.142
array([0. , 0.165347, 0.330694, 0.496041, 0.661388, 0.826735, 0.992082, 1.157429, 1.322776, 1.488123, 1.65347 , 1.818817, 1.984164, 2.149511, 2.314858, 2.480205, 2.645552, 2.810899, 2.976246, 3.141593])
- q(y, x)float640.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0
array([[0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.], ..., [0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.]], shape=(61, 128)) - eta(y, x)float64-1.904e-06 ... -1.841e-06
array([[-1.90380481e-06, -1.96935335e-06, -2.03777628e-06, ..., -1.72227969e-06, -1.78035034e-06, -1.84073602e-06], [-1.52375496e-06, -1.63165943e-06, -1.74863682e-06, ..., -1.24526815e-06, -1.33100600e-06, -1.42336307e-06], [-2.79804044e-06, -3.05466960e-06, -3.33495249e-06, ..., -2.14632780e-06, -2.34509154e-06, -2.56114745e-06], ..., [-2.79804044e-06, -3.05466960e-06, -3.33495249e-06, ..., -2.14632780e-06, -2.34509154e-06, -2.56114745e-06], [-1.52375496e-06, -1.63165943e-06, -1.74863682e-06, ..., -1.24526815e-06, -1.33100600e-06, -1.42336307e-06], [-1.90380481e-06, -1.96935335e-06, -2.03777628e-06, ..., -1.72227969e-06, -1.78035034e-06, -1.84073602e-06]], shape=(61, 128)) - u(y, x)float641.187e-06 1.183e-06 ... 1.189e-06
array([[ 1.18742991e-06, 1.18257389e-06, 1.17388562e-06, ..., 1.18411966e-06, 1.18793978e-06, 1.18929274e-06], [-4.35034339e-07, -5.17931411e-07, -6.09646037e-07, ..., -2.30577341e-07, -2.91846767e-07, -3.59588110e-07], [-2.28575329e-06, -2.51969338e-06, -2.77560912e-06, ..., -1.69551785e-06, -1.87483837e-06, -2.07063213e-06], ..., [-2.28575329e-06, -2.51969338e-06, -2.77560912e-06, ..., -1.69551785e-06, -1.87483837e-06, -2.07063213e-06], [-4.35034339e-07, -5.17931411e-07, -6.09646037e-07, ..., -2.30577341e-07, -2.91846767e-07, -3.59588110e-07], [ 1.18742991e-06, 1.18257389e-06, 1.17388562e-06, ..., 1.18411966e-06, 1.18793978e-06, 1.18929274e-06]], shape=(61, 128)) - v(y, x)float642.706e-08 2.894e-08 ... -2.446e-08
array([[ 2.70572758e-08, 2.89427000e-08, 3.19057264e-08, ..., 2.05655959e-08, 2.28355123e-08, 2.44597069e-08], [ 1.10622605e-07, 1.18544809e-07, 1.30392114e-07, ..., 8.43355544e-08, 9.34038137e-08, 1.00241169e-07], [ 3.06852053e-07, 3.29234702e-07, 3.61494958e-07, ..., 2.34558169e-07, 2.59242152e-07, 2.78589409e-07], ..., [-3.06852053e-07, -3.29234702e-07, -3.61494958e-07, ..., -2.34558169e-07, -2.59242152e-07, -2.78589409e-07], [-1.10622605e-07, -1.18544809e-07, -1.30392114e-07, ..., -8.43355544e-08, -9.34038137e-08, -1.00241169e-07], [-2.70572758e-08, -2.89427000e-08, -3.19057264e-08, ..., -2.05655959e-08, -2.28355123e-08, -2.44597069e-08]], shape=(61, 128)) - v_staggered(y_staggered, x)float645.411e-08 5.789e-08 ... -4.892e-08
array([[ 5.41145517e-08, 5.78853999e-08, 6.38114528e-08, ..., 4.11311917e-08, 4.56710245e-08, 4.89194138e-08], [ 1.67130658e-07, 1.79204217e-07, 1.96972775e-07, ..., 1.27539917e-07, 1.41136603e-07, 1.51562924e-07], [ 4.46573449e-07, 4.79265187e-07, 5.26017140e-07, ..., 3.41576420e-07, 3.77347702e-07, 4.05615895e-07], ..., [-4.46573449e-07, -4.79265187e-07, -5.26017140e-07, ..., -3.41576420e-07, -3.77347702e-07, -4.05615895e-07], [-1.67130658e-07, -1.79204217e-07, -1.96972775e-07, ..., -1.27539917e-07, -1.41136603e-07, -1.51562924e-07], [-5.41145517e-08, -5.78853999e-08, -6.38114528e-08, ..., -4.11311918e-08, -4.56710245e-08, -4.89194138e-08]], shape=(60, 128))
- case :
- gill_sym
- case_label :
- Gill: symmetric heating
- short_name :
- Gill_sym
- t :
- 50.0
- nt :
- 500
- nx :
- 128
- ny :
- 60
- nz :
- 20
- lx :
- 37.69911184307752
- ly :
- 15.707963267948966
- lz :
- 3.141592653589793
- damping :
- 0.1
- kernel :
- reyon
- dt :
- 0.1
- dx :
- 0.2945243112740431
- dy :
- 0.25750759455654043
- dz :
- 0.16534698176788384
Plot eta as filled contours with the horizontal wind vector field.
plot_snapshot(
result_symmetric_heating,
quiver_kwargs={"scale": 30},
)

<Axes: title={'center': 'Gill: symmetric heating\nt = 50.00'}, xlabel='x', ylabel='y'>
Plot the derived u-w and v-w streamfunctions and the zonal-mean zonal wind.
plot_cross_sections(
result_symmetric_heating,
contourf_uw_kwargs = {"levels": np.linspace(-0.2, 0.2, 21)},
contourf_vw_kwargs = {"levels": np.linspace(-0.02, 0.02, 21)},
contourf_u_kwargs = {"levels": np.linspace(-0.2, 0.2, 21)}
)

<Figure size 800x800 with 6 Axes>
Total running time of the script: (0 minutes 8.915 seconds)