Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
389 views
unlisted
ubuntu2204
Kernel: Python 3 (system-wide)

Figures 3 and 4

Data fields are 2D snapshots from the z-component of the vorticity field: e.g. 'zvort07_xy_88' represents a horizontal slice taken in the plane z=0 at time t=88 from the simulation with initial Froude number Fr=0.71, whilst 'zvort1_xz_148' is a vertical slice taken in the plane y=0 at time t=148 from the simulation with initial Froude number Fr=1

import cmocean import numpy as np import h5py import matplotlib.pyplot as plt from matplotlib import cm import seaborn as sns from matplotlib.gridspec import GridSpec from matplotlib.colors import ListedColormap, LinearSegmentedColormap import matplotlib.ticker as mticker rc = {'figure.figsize':(10,5), 'axes.facecolor':'white', 'grid.color': '.8', 'font.size' : 11} plt.rcParams.update(rc)
zvort07_xz_88 = np.load('zvort07_xz_88.npy') zvort07_xz_118 = np.load('zvort07_xz_118.npy') zvort07_xz_148 = np.load('zvort07_xz_148.npy')
zvort1_xz_88 = np.load('zvort1_xz_88.npy') zvort1_xz_118 = np.load('zvort1_xz_118.npy') zvort1_xz_148 = np.load('zvort1_xz_148.npy')
zvort2_xz_88 = np.load('zvort2_xz_88.npy') zvort2_xz_118 = np.load('zvort2_xz_118.npy') zvort2_xz_148 = np.load('zvort2_xz_148.npy')
cmap = sns.diverging_palette(255, 20, s=500, sep=5, l=80, center='dark', as_cmap=True) #For a light background, uncomment the line below # cmap = sns.diverging_palette(255, 15, s=100, sep=5, l=45, center='light', as_cmap=True) cmap2 = cmap vmin=-1.5 vmax=1.5 vmin1 = -1.5 vmax1 = 1.5
cmap = sns.diverging_palette(255, 20, s=500, sep=5, l=80, center='dark', as_cmap=True) #For a light background, uncomment the line below # cmap = sns.diverging_palette(255, 15, s=100, sep=5, l=45, center='light', as_cmap=True) vmin=-1.5 vmax=1.5 vmin1 = -1.5 vmax1 = 1.5 fig=plt.figure(figsize=(8,5)) gs=GridSpec(3,3, width_ratios = [1,1,1], height_ratios=[1,1,1], wspace=0.1, hspace=0.3) ax1=fig.add_subplot(gs[0,0]) ax2=fig.add_subplot(gs[0,1]) ax3=fig.add_subplot(gs[0,2]) ax4=fig.add_subplot(gs[1,0]) ax5=fig.add_subplot(gs[1,1]) ax6=fig.add_subplot(gs[1,2]) ax7=fig.add_subplot(gs[2,0]) ax8=fig.add_subplot(gs[2,1]) ax9=fig.add_subplot(gs[2,2]) ax1.pcolormesh(zvort07_xz_88, vmin=vmin1, vmax=vmax1,cmap=cmap2, shading='gouraud', rasterized=True) ax2.pcolormesh(zvort07_xz_118, vmin=vmin1, vmax=vmax1,cmap=cmap2, shading='gouraud', rasterized=True) ax3.pcolormesh(zvort07_xz_148, vmin=vmin1, vmax=vmax1,cmap=cmap2, shading='gouraud', rasterized=True) ax1.set_xticklabels([]) ax1.set_xticks([0,512,1024]) ax1.set_ylabel('$z$') ax2.set_xticks([0,512,1024]) ax2.set_xticklabels([]) ax3.set_xticks([0,512,1024]) ax3.set_xticklabels([]) ax1.set_yticks([0,512]) ax1.set_yticklabels(['$0$', '$L_z$']) ax2.set_yticks([0,512]) ax2.set_yticklabels([]) ax3.set_yticks([0,512]) ax3.set_yticklabels([]) ax1.annotate('$a)$', (0,531), annotation_clip=False) ax2.annotate('$b)$', (0,531), annotation_clip=False) ax3.annotate('$c)$', (0,531), annotation_clip=False) ax4.pcolormesh(zvort1_xz_88, vmin=vmin, vmax=vmax,cmap=cmap, shading='gouraud', rasterized=True) ax5.pcolormesh(zvort1_xz_118, vmin=vmin, vmax=vmax,cmap=cmap, shading='gouraud', rasterized=True) ax6.pcolormesh(zvort1_xz_148, vmin=vmin, vmax=vmax,cmap=cmap, shading='gouraud', rasterized=True) ax4.set_xticks([0,512,1024]) ax4.set_xticklabels([]) ax4.set_ylabel('$z$') ax5.set_xticks([0,512,1024]) ax5.set_xticklabels([]) ax6.set_xticks([0,512,1024]) ax6.set_xticklabels([]) ax4.set_yticks([0,512]) ax4.set_yticklabels(['$0$', '$L_z$']) ax5.set_yticks([0,512]) ax5.set_yticklabels([]) ax6.set_yticks([0,512]) ax6.set_yticklabels([]) ax4.annotate('$d)$', (0,531), annotation_clip=False) ax5.annotate('$e)$', (0,531), annotation_clip=False) ax6.annotate('$f)$', (0,531), annotation_clip=False) ax7.pcolormesh(zvort2_xz_88, vmin=vmin, vmax=vmax,cmap=cmap, shading='gouraud', rasterized=True) ax8.pcolormesh(zvort2_xz_118, vmin=vmin, vmax=vmax,cmap=cmap, shading='gouraud', rasterized=True) ax9.pcolormesh(zvort2_xz_148, vmin=vmin, vmax=vmax,cmap=cmap, shading='gouraud', rasterized=True) ax7.set_xticks([0,512,1024]) ax7.set_xticklabels(['$0$', '$L_x/2$', '$L_x$']) ax8.set_xticks([0,512,1024]) ax8.set_xticklabels(['$0$', '$L_x/2$', '$L_x$']) ax9.set_xticks([0,512,1024]) ax9.set_xticklabels(['$0$', '$L_x/2$', '$L_x$']) ax7.set_yticks([0,512]) ax7.set_yticklabels(['$0$', '$L_z$']) ax7.set_ylabel('$z$') ax8.set_yticks([0,512]) ax8.set_yticklabels([]) ax9.set_yticks([0,512]) ax9.set_yticklabels([]) ax7.set_xlabel('$x$') ax8.set_xlabel('$x$') ax9.set_xlabel('$x$') ax7.annotate('$g)$', (0,531), annotation_clip=False) ax8.annotate('$h)$', (0,531), annotation_clip=False) ax9.annotate('$i)$', (0,531), annotation_clip=False) plt.show()
Image in a Jupyter notebook