Note
Go to the end to download the full example code.
Gill Model: Forced Stationary Motion¶
This example reproduces the Matsuno forced stationary-motion experiment. The plots show the horizontal response to the forcing and its diagnosed vertical cross sections.
import numpy as np
from easyclimate.field.simulation.gill import (
simulate,
plot_snapshot,
plot_cross_sections,
)
Run the forced stationary-motion experiment.
result_forced_stationary = simulate(case = "matsuno_heating")
result_forced_stationary
<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 -18.85 -18.56 -18.26 ... 17.97 18.26 18.56
* 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 -1.218e-22 -4.863e-08 ... 4.863e-08
eta (y, x) float64 62kB 5.038e-06 5.72e-06 ... 3.365e-06 4.248e-06
u (y, x) float64 62kB 3.025e-06 4.533e-06 ... -1.55e-07 1.45e-06
v (y, x) float64 62kB -8.06e-07 -7.814e-07 ... 8.132e-07
v_staggered (y_staggered, x) float64 61kB -1.612e-06 ... 1.626e-06
Attributes: (12/17)
case: matsuno_heating
case_label: Matsuno: forced stationary motion
short_name: MatsunoHeating
t: 50.0
nt: 500
nx: 128
... ...
damping: 0.2
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-18.85 -18.56 ... 18.26 18.56
array([-18.849556, -18.555032, -18.260507, -17.965983, -17.671459, -17.376934, -17.08241 , -16.787886, -16.493361, -16.198837, -15.904313, -15.609788, -15.315264, -15.02074 , -14.726216, -14.431691, -14.137167, -13.842643, -13.548118, -13.253594, -12.95907 , -12.664545, -12.370021, -12.075497, -11.780972, -11.486448, -11.191924, -10.8974 , -10.602875, -10.308351, -10.013827, -9.719302, -9.424778, -9.130254, -8.835729, -8.541205, -8.246681, -7.952156, -7.657632, -7.363108, -7.068583, -6.774059, -6.479535, -6.185011, -5.890486, -5.595962, -5.301438, -5.006913, -4.712389, -4.417865, -4.12334 , -3.828816, -3.534292, -3.239767, -2.945243, -2.650719, -2.356194, -2.06167 , -1.767146, -1.472622, -1.178097, -0.883573, -0.589049, -0.294524, 0. , 0.294524, 0.589049, 0.883573, 1.178097, 1.472622, 1.767146, 2.06167 , 2.356194, 2.650719, 2.945243, 3.239767, 3.534292, 3.828816, 4.12334 , 4.417865, 4.712389, 5.006913, 5.301438, 5.595962, 5.890486, 6.185011, 6.479535, 6.774059, 7.068583, 7.363108, 7.657632, 7.952156, 8.246681, 8.541205, 8.835729, 9.130254, 9.424778, 9.719302, 10.013827, 10.308351, 10.602875, 10.8974 , 11.191924, 11.486448, 11.780972, 12.075497, 12.370021, 12.664545, 12.95907 , 13.253594, 13.548118, 13.842643, 14.137167, 14.431691, 14.726216, 15.02074 , 15.315264, 15.609788, 15.904313, 16.198837, 16.493361, 16.787886, 17.08241 , 17.376934, 17.671459, 17.965983, 18.260507, 18.555032]) - 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)float64-1.218e-22 -4.863e-08 ... 4.863e-08
array([[-1.21773069e-22, -4.86339415e-08, -9.62151051e-08, ..., 1.41713502e-07, 9.62151051e-08, 4.86339415e-08], [-3.23834993e-22, -1.29333786e-07, -2.55867886e-07, ..., 3.76863219e-07, 2.55867886e-07, 1.29333786e-07], [-8.33100182e-22, -3.32725009e-07, -6.58247526e-07, ..., 9.69520972e-07, 6.58247526e-07, 3.32725009e-07], ..., [-8.33100182e-22, -3.32725009e-07, -6.58247526e-07, ..., 9.69520972e-07, 6.58247526e-07, 3.32725009e-07], [-3.23834993e-22, -1.29333786e-07, -2.55867886e-07, ..., 3.76863219e-07, 2.55867886e-07, 1.29333786e-07], [-1.21773069e-22, -4.86339415e-08, -9.62151051e-08, ..., 1.41713502e-07, 9.62151051e-08, 4.86339415e-08]], shape=(61, 128)) - eta(y, x)float645.038e-06 5.72e-06 ... 4.248e-06
array([[5.03812858e-06, 5.71965465e-06, 6.27736747e-06, ..., 2.40963435e-06, 3.36500944e-06, 4.24754224e-06], [1.14433560e-05, 1.42261352e-05, 1.67009615e-05, ..., 1.87508023e-06, 5.20025642e-06, 8.41286275e-06], [2.84632190e-05, 3.56538884e-05, 4.20727589e-05, ..., 3.88000929e-06, 1.24024458e-05, 2.06564068e-05], ..., [2.84632190e-05, 3.56538884e-05, 4.20727589e-05, ..., 3.88000929e-06, 1.24024458e-05, 2.06564068e-05], [1.14433560e-05, 1.42261352e-05, 1.67009615e-05, ..., 1.87508023e-06, 5.20025642e-06, 8.41286275e-06], [5.03812858e-06, 5.71965465e-06, 6.27736747e-06, ..., 2.40963435e-06, 3.36500944e-06, 4.24754224e-06]], shape=(61, 128)) - u(y, x)float643.025e-06 4.533e-06 ... 1.45e-06
array([[ 3.02458507e-06, 4.53320421e-06, 5.94369316e-06, ..., -1.75713405e-06, -1.54998244e-07, 1.45049281e-06], [ 1.00218543e-05, 1.28372805e-05, 1.53748182e-05, ..., 5.39760386e-07, 3.80581505e-06, 6.98948532e-06], [ 2.57584604e-05, 3.23560924e-05, 3.82533127e-05, ..., 3.24828054e-06, 1.10453068e-05, 1.86032355e-05], ..., [ 2.57584604e-05, 3.23560924e-05, 3.82533127e-05, ..., 3.24828054e-06, 1.10453068e-05, 1.86032355e-05], [ 1.00218543e-05, 1.28372805e-05, 1.53748182e-05, ..., 5.39760386e-07, 3.80581505e-06, 6.98948532e-06], [ 3.02458507e-06, 4.53320421e-06, 5.94369316e-06, ..., -1.75713405e-06, -1.54998244e-07, 1.45049281e-06]], shape=(61, 128)) - v(y, x)float64-8.06e-07 -7.814e-07 ... 8.132e-07
array([[-8.06002545e-07, -7.81402195e-07, -7.39886846e-07, ..., -7.74880161e-07, -8.02705847e-07, -8.13155375e-07], [-3.18955713e-06, -3.08681692e-06, -2.91725645e-06, ..., -3.08210482e-06, -3.18717530e-06, -3.22325307e-06], [-8.51714216e-06, -8.22723210e-06, -7.75922731e-06, ..., -8.27555195e-06, -8.54156644e-06, -8.62268181e-06], ..., [ 8.51714216e-06, 8.22723210e-06, 7.75922731e-06, ..., 8.27555195e-06, 8.54156644e-06, 8.62268181e-06], [ 3.18955713e-06, 3.08681692e-06, 2.91725645e-06, ..., 3.08210482e-06, 3.18717530e-06, 3.22325307e-06], [ 8.06002545e-07, 7.81402194e-07, 7.39886846e-07, ..., 7.74880161e-07, 8.02705846e-07, 8.13155375e-07]], shape=(61, 128)) - v_staggered(y_staggered, x)float64-1.612e-06 -1.563e-06 ... 1.626e-06
array([[-1.61200509e-06, -1.56280439e-06, -1.47977369e-06, ..., -1.54976032e-06, -1.60541169e-06, -1.62631075e-06], [-4.76710918e-06, -4.61082946e-06, -4.35473920e-06, ..., -4.61444932e-06, -4.76893891e-06, -4.82019538e-06], [-1.22671751e-05, -1.18436347e-05, -1.11637154e-05, ..., -1.19366546e-05, -1.23141940e-05, -1.24251682e-05], ..., [ 1.22671751e-05, 1.18436347e-05, 1.11637154e-05, ..., 1.19366546e-05, 1.23141940e-05, 1.24251682e-05], [ 4.76710918e-06, 4.61082946e-06, 4.35473920e-06, ..., 4.61444932e-06, 4.76893891e-06, 4.82019538e-06], [ 1.61200509e-06, 1.56280439e-06, 1.47977369e-06, ..., 1.54976032e-06, 1.60541169e-06, 1.62631075e-06]], shape=(60, 128))
- case :
- matsuno_heating
- case_label :
- Matsuno: forced stationary motion
- short_name :
- MatsunoHeating
- t :
- 50.0
- nt :
- 500
- nx :
- 128
- ny :
- 60
- nz :
- 20
- lx :
- 37.69911184307752
- ly :
- 15.707963267948966
- lz :
- 3.141592653589793
- damping :
- 0.2
- kernel :
- reyon
- dt :
- 0.1
- dx :
- 0.2945243112740431
- dy :
- 0.25750759455654043
- dz :
- 0.16534698176788384
Plot eta and the horizontal wind vector field.
plot_snapshot(
result_forced_stationary,
quiver_kwargs={"scale": 10},
contourf_kwargs = {"levels": np.linspace(-2, 2, 21)}
)

<Axes: title={'center': 'Matsuno: forced stationary motion\nt = 50.00'}, xlabel='x', ylabel='y'>
Plot the derived vertical cross-section diagnostics.
plot_cross_sections(
result_forced_stationary,
contourf_uw_kwargs = {"levels": np.linspace(-0.5, 0.5, 21)},
contourf_vw_kwargs = {"levels": np.linspace(-0.05, 0.05, 21)},
contourf_u_kwargs = {"levels": np.linspace(-0.05, 0.05, 21)}
)

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