Text provided under a Creative Commons Attribution license, CC-BY. All code is made available under the FSF-approved BSD-3 license.
Copyright (c) 2020, Felipe N. Schuch.
@fschuch
import xarray as xr
import numpy as np
from tqdm.notebook import tqdm as tqdm
import dask.array as da
import matplotlib
import matplotlib.pyplot as plt
import netCDF4
Dask provides support for parallel computing and larger-than-memory arrays, both features are very useful for this application. For further information, see Dask's Documentation.
import dask
from dask.distributed import Client
client = Client()
The complete spatio-temporal analysis of the relevant quantities is possible in a layer averaged context per width unit, that is computed according to the equations
$$ Uh(x_1,t) = \dfrac{1}{L_3} \int_0^{L_3} \int_{x_{2r}}^{x_{2i}} u_1(x_1,x_2,x_3,t) ~ dx_2 dx_3 $$$$ U^2h(x_1,t) = \dfrac{1}{L_3} \int_0^{L_3} \int_{x_{2r}}^{x_{2i}} \big( u_1(x_1,x_2,x_3,t) \big)^2 ~ dx_2 dx_3 $$$$ UCh(x_1,t) = \dfrac{1}{L_3} \int_0^{L_3} \int_{x_{2r}}^{x_{2i}} u_1 (x_1,x_2,x_3,t) ~ c_t (x_1,x_2,x_3,t) ~ dx_2 dx_3 $$For the vertical integration, $x_{2r}$ represents the bed position and $x_{2i}$ represents the interface between the underflow turbidity current and the ambient fluid, considered in this work as the position where $u_1 \times c_t = 0.005$. This step has been done in the previous example (see 00-LA-and-Convert-to-NetCDF.ipynb), the datasets are available at Zenodo. After downloading them, the files for all cases can be loaded and concatenate in a single variable using:
ds = xr.open_mfdataset('LA-case-?.nc', concat_dim='case', combine='nested').compute()
ds = ds.assign_coords({'case': [2, 4, 5, 6, 7]})
And we can show in the screen all the variables in the xarray.Dataset
:
ds
<xarray.Dataset> Dimensions: (case: 5, n: 3, t: 2401, x: 801, y: 121, z: 90) Coordinates: * z (z) float32 0.0 0.26666668 0.53333336 ... 23.2 23.466667 23.733334 * t (t) float32 0.0 2.5 5.0 7.5 10.0 ... 5992.5 5995.0 5997.5 6000.0 * n (n) int64 0 1 2 * y (y) float32 16.875 16.734375 16.59375 ... 0.28125 0.140625 0.0 * x (x) float32 0.0 0.3125 0.625 0.9375 ... 249.375 249.6875 250.0 * case (case) int32 2 4 5 6 7 Data variables: uset (case, n) float64 1.9e-05 0.0009 0.0039 ... 1.9e-05 0.0009 0.0039 Ri0 (case, n) float64 0.003153 0.003153 0.003153 ... 0.008767 0.008767 Fr0 (case, n) float64 17.81 17.81 17.81 8.452 ... 10.68 10.68 10.68 Sc (case, n) float64 1.0 1.0 1.0 1.0 1.0 1.0 ... 1.0 1.0 1.0 1.0 1.0 Re (case) float64 4.3e+03 2.5e+03 3.3e+03 4.3e+03 4.3e+03 S (case) float64 0.05 0.05 0.05 0.05 0.05 ramp (case, x) float32 1.0 1.015625 1.03125 ... 13.46875 13.484375 13.5 Uh (case, x, t) float32 0.0 -1.0121834 ... -1.2522296 -1.2549425 U2h (case, x, t) float32 0.0 -1.0192424 ... -0.30240095 -0.3035403 UCh (case, x, t, n) float32 0.0 0.0 0.0 ... -0.2581251 -0.06844864 utau (case, x, t) float32 0.048941012 0.048703995 ... 0.015408344 dep (case, n, x, t) float32 0.0 6.311286e-06 ... 0.0006873559 Attributes: title: The Plunging of Hyperpycnal Plumes on Tilted Bed by Three-Dimen... authors: F. N. Schuch, J. H. Silvestrini, E. Meiburg & S. Laizet url: https://github.com/fschuch/the-plunging-flow-by-3D-LES doi: 10.5281/zenodo.3968993
array([ 0. , 0.266667, 0.533333, 0.8 , 1.066667, 1.333333, 1.6 , 1.866667, 2.133333, 2.4 , 2.666667, 2.933333, 3.2 , 3.466667, 3.733333, 4. , 4.266667, 4.533333, 4.8 , 5.066667, 5.333333, 5.6 , 5.866667, 6.133333, 6.4 , 6.666667, 6.933333, 7.2 , 7.466667, 7.733333, 8. , 8.266666, 8.533334, 8.8 , 9.066667, 9.333333, 9.6 , 9.866667, 10.133333, 10.4 , 10.666667, 10.933333, 11.2 , 11.466666, 11.733334, 12. , 12.266666, 12.533334, 12.8 , 13.066667, 13.333333, 13.6 , 13.866667, 14.133333, 14.4 , 14.666667, 14.933333, 15.2 , 15.466666, 15.733334, 16. , 16.266666, 16.533333, 16.8 , 17.066668, 17.333334, 17.6 , 17.866667, 18.133333, 18.4 , 18.666666, 18.933332, 19.2 , 19.466667, 19.733334, 20. , 20.266666, 20.533333, 20.8 , 21.066668, 21.333334, 21.6 , 21.866667, 22.133333, 22.4 , 22.666666, 22.933332, 23.2 , 23.466667, 23.733334], dtype=float32)
array([0.0000e+00, 2.5000e+00, 5.0000e+00, ..., 5.9950e+03, 5.9975e+03, 6.0000e+03], dtype=float32)
array([0, 1, 2], dtype=int64)
array([16.875 , 16.734375, 16.59375 , 16.453125, 16.3125 , 16.171875, 16.03125 , 15.890625, 15.75 , 15.609375, 15.46875 , 15.328125, 15.1875 , 15.046875, 14.90625 , 14.765625, 14.625 , 14.484375, 14.34375 , 14.203125, 14.0625 , 13.921875, 13.78125 , 13.640625, 13.5 , 13.359375, 13.21875 , 13.078125, 12.9375 , 12.796875, 12.65625 , 12.515625, 12.375 , 12.234375, 12.09375 , 11.953125, 11.8125 , 11.671875, 11.53125 , 11.390625, 11.25 , 11.109375, 10.96875 , 10.828125, 10.6875 , 10.546875, 10.40625 , 10.265625, 10.125 , 9.984375, 9.84375 , 9.703125, 9.5625 , 9.421875, 9.28125 , 9.140625, 9. , 8.859375, 8.71875 , 8.578125, 8.4375 , 8.296875, 8.15625 , 8.015625, 7.875 , 7.734375, 7.59375 , 7.453125, 7.3125 , 7.171875, 7.03125 , 6.890625, 6.75 , 6.609375, 6.46875 , 6.328125, 6.1875 , 6.046875, 5.90625 , 5.765625, 5.625 , 5.484375, 5.34375 , 5.203125, 5.0625 , 4.921875, 4.78125 , 4.640625, 4.5 , 4.359375, 4.21875 , 4.078125, 3.9375 , 3.796875, 3.65625 , 3.515625, 3.375 , 3.234375, 3.09375 , 2.953125, 2.8125 , 2.671875, 2.53125 , 2.390625, 2.25 , 2.109375, 1.96875 , 1.828125, 1.6875 , 1.546875, 1.40625 , 1.265625, 1.125 , 0.984375, 0.84375 , 0.703125, 0.5625 , 0.421875, 0.28125 , 0.140625, 0. ], dtype=float32)
array([ 0. , 0.3125, 0.625 , ..., 249.375 , 249.6875, 250. ], dtype=float32)
array([2, 4, 5, 6, 7])
array([[1.9e-05, 9.0e-04, 3.9e-03], [3.2e-05, 1.6e-03, 6.7e-03], [2.5e-05, 1.2e-03, 5.0e-03], [1.9e-05, 9.0e-04, 3.9e-03], [1.9e-05, 9.0e-04, 3.9e-03]])
array([[0.003153, 0.003153, 0.003153], [0.014 , 0.014 , 0.014 ], [0.008029, 0.008029, 0.008029], [0.00473 , 0.00473 , 0.00473 ], [0.008767, 0.008767, 0.008767]])
array([[17.8089377 , 17.8089377 , 17.8089377 ], [ 8.45154255, 8.45154255, 8.45154255], [11.16013045, 11.16013045, 11.16013045], [14.54016817, 14.54016817, 14.54016817], [10.68007978, 10.68007978, 10.68007978]])
array([[1., 1., 1.], [1., 1., 1.], [1., 1., 1.], [1., 1., 1.], [1., 1., 1.]])
array([4300., 2500., 3300., 4300., 4300.])
array([0.05, 0.05, 0.05, 0.05, 0.05])
array([[ 1. , 1.015625, 1.03125 , ..., 13.46875 , 13.484375, 13.5 ], [ 1. , 1.015625, 1.03125 , ..., 13.46875 , 13.484375, 13.5 ], [ 1. , 1.015625, 1.03125 , ..., 13.46875 , 13.484375, 13.5 ], [ 1. , 1.015625, 1.03125 , ..., 13.46875 , 13.484375, 13.5 ], [ 1. , 1.015625, 1.03125 , ..., 13.46875 , 13.484375, 13.5 ]], dtype=float32)
array([[[ 0. , -1.0121834 , -1.0115463 , ..., -1.0197 , -1.0194162 , -1.0194073 ], [ 0. , -1.0122241 , -1.0116568 , ..., -1.0197344 , -1.0194525 , -1.0196333 ], [ 0. , -1.0123235 , -1.0117472 , ..., -1.019852 , -1.0192299 , -1.0195599 ], ..., [ 0. , 0. , 0. , ..., -0.99935925, -0.99901485, -1.0005902 ], [ 0. , 0. , 0. , ..., -1.0001459 , -0.9997926 , -1.001382 ], [ 0. , 0. , 0. , ..., -1.0001299 , -0.99977654, -1.001368 ]], [[ 0. , -1.011406 , -1.010426 , ..., -1.0135825 , -1.0135456 , -1.0136008 ], [ 0. , -1.0114607 , -1.0105599 , ..., -1.0135968 , -1.0137407 , -1.0137978 ], [ 0. , -1.0115181 , -1.0105851 , ..., -1.013567 , -1.0137528 , -1.0137583 ], ... [ 0. , 0. , 0. , ..., -1.0359932 , -1.036408 , -1.0365726 ], [ 0. , 0. , 0. , ..., -1.040074 , -1.0399691 , -1.0396081 ], [ 0. , 0. , 0. , ..., -1.0449517 , -1.0443466 , -1.0435117 ]], [[ 0. , -1.0121549 , -1.0115292 , ..., -1.0196329 , -1.0195066 , -1.0199201 ], [ 0. , -1.0121922 , -1.0116401 , ..., -1.0197532 , -1.0196769 , -1.0200605 ], [ 0. , -1.0122892 , -1.0117315 , ..., -1.0197008 , -1.019896 , -1.0201149 ], ..., [ 0. , 0. , 0. , ..., -1.2486709 , -1.2491068 , -1.2515813 ], [ 0. , 0. , 0. , ..., -1.2501101 , -1.2506851 , -1.2531136 ], [ 0. , 0. , 0. , ..., -1.251286 , -1.2522296 , -1.2549425 ]]], dtype=float32)
array([[[ 0. , -1.0192424 , -1.0292085 , ..., -1.0616426 , -1.0668445 , -1.0658171 ], [ 0. , -1.0116158 , -1.0229062 , ..., -1.052375 , -1.056452 , -1.0574099 ], [ 0. , -1.0013479 , -1.0129899 , ..., -1.044704 , -1.0461203 , -1.047368 ], ..., [ 0. , 0. , 0. , ..., -0.08811905, -0.08807641, -0.08831943], [ 0. , 0. , 0. , ..., -0.08797789, -0.08793958, -0.08818666], [ 0. , 0. , 0. , ..., -0.08782287, -0.08778892, -0.08804006]], [[ 0. , -1.0298531 , -1.0424974 , ..., -1.0602046 , -1.0627049 , -1.0617119 ], [ 0. , -1.0195962 , -1.0322083 , ..., -1.0489767 , -1.0559229 , -1.0547012 ], [ 0. , -1.0067489 , -1.0192434 , ..., -1.038758 , -1.04556 , -1.0440611 ], ... [ 0. , 0. , 0. , ..., -0.18130778, -0.18169266, -0.18204626], [ 0. , 0. , 0. , ..., -0.18259914, -0.1827482 , -0.18289901], [ 0. , 0. , 0. , ..., -0.18422577, -0.18411265, -0.18403798]], [[ 0. , -1.0190408 , -1.0290927 , ..., -1.0586995 , -1.0510812 , -1.0608938 ], [ 0. , -1.0114089 , -1.0228517 , ..., -1.0566534 , -1.0540484 , -1.0569438 ], [ 0. , -1.0011264 , -1.0129056 , ..., -1.0469124 , -1.0541633 , -1.0492861 ], ..., [ 0. , 0. , 0. , ..., -0.30083272, -0.3013219 , -0.3030763 ], [ 0. , 0. , 0. , ..., -0.30156398, -0.30170012, -0.30320647], [ 0. , 0. , 0. , ..., -0.30251655, -0.30240095, -0.3035403 ]]], dtype=float32)
array([[[[ 0. , 0. , 0. ], [-0.3235277 , -0.367495 , -0.3216158 ], [-0.32323998, -0.36715382, -0.32134375], ..., [-0.3249326 , -0.3674839 , -0.32138914], [-0.32475984, -0.3672266 , -0.32118607], [-0.32476678, -0.3670487 , -0.32094616]], [[ 0. , 0. , 0. ], [-0.3226425 , -0.36711848, -0.32147813], [-0.32235304, -0.36667988, -0.3208488 ], ..., [-0.3251323 , -0.36763936, -0.32055977], [-0.3248553 , -0.36715612, -0.3201311 ], [-0.3249344 , -0.36769623, -0.32038894]], [[ 0. , 0. , 0. ], [-0.32128763, -0.36463073, -0.3187071 ], [-0.3238545 , -0.36728466, -0.32113 ], ..., ... ..., [-0.31994528, -0.25429952, -0.06526845], [-0.32239553, -0.25760275, -0.06875025], [-0.32478473, -0.26118264, -0.07025732]], [[ 0. , 0. , 0. ], [ 0. , 0. , 0. ], [ 0. , 0. , 0. ], ..., [-0.31863037, -0.25294912, -0.06391645], [-0.32099825, -0.25556985, -0.06710977], [-0.32423604, -0.26005396, -0.06956282]], [[ 0. , 0. , 0. ], [ 0. , 0. , 0. ], [ 0. , 0. , 0. ], ..., [-0.3177069 , -0.25174096, -0.0634841 ], [-0.31949636, -0.25366333, -0.0653943 ], [-0.32291818, -0.2581251 , -0.06844864]]]], dtype=float32)
array([[[0.04894101, 0.04870399, 0.04782631, ..., 0.04129469, 0.04214036, 0.04097195], [0.0020597 , 0.04779124, 0.04663219, ..., 0.04075554, 0.04090002, 0.04053126], [0.00101975, 0.04653672, 0.04523258, ..., 0.03999873, 0.03893493, 0.03885133], ..., [0. , 0.01166767, 0.01133935, ..., 0.00353894, 0.0035112 , 0.00351936], [0. , 0.01146322, 0.01112653, ..., 0.00362327, 0.00359726, 0.00361095], [0. , 0.01164967, 0.01118198, ..., 0.00372966, 0.00370753, 0.00372622]], [[0.06417751, 0.0631018 , 0.0608415 , ..., 0.05696672, 0.05483773, 0.057524 ], [0.00270839, 0.06183949, 0.05927436, ..., 0.05436765, 0.05365494, 0.05533029], [0.00134092, 0.06035407, 0.05762066, ..., 0.05256789, 0.0517932 , 0.05336702], ... [0. , 0.01166758, 0.01133938, ..., 0.01459093, 0.0145896 , 0.01457906], [0. , 0.01146309, 0.01112651, ..., 0.01454803, 0.01454926, 0.01454097], [0. , 0.01164964, 0.01118197, ..., 0.01461884, 0.01462413, 0.01461888]], [[0.04895945, 0.04871318, 0.04783088, ..., 0.0413951 , 0.04068612, 0.04055017], [0.0020606 , 0.04780653, 0.04664681, ..., 0.04041406, 0.04037254, 0.03977992], [0.00102011, 0.04654837, 0.04522705, ..., 0.03883636, 0.03942551, 0.03907688], ..., [0. , 0.01166756, 0.01133941, ..., 0.01525297, 0.01522191, 0.01519121], [0. , 0.0114631 , 0.01112653, ..., 0.01525186, 0.01527988, 0.01524457], [0. , 0.01164962, 0.011182 , ..., 0.01533984, 0.0154058 , 0.01540834]]], dtype=float32)
array([[[[0.00000000e+00, 6.31128614e-06, 6.31060993e-06, ..., 6.31093781e-06, 6.31093326e-06, 6.31094008e-06], [0.00000000e+00, 6.27618419e-06, 6.30833301e-06, ..., 6.29914166e-06, 6.29829674e-06, 6.29975739e-06], [0.00000000e+00, 6.27174632e-06, 6.25819848e-06, ..., 6.28966518e-06, 6.28761563e-06, 6.28575208e-06], ..., [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ..., 5.98369206e-06, 5.98370434e-06, 5.98371435e-06], [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ..., 5.98350243e-06, 5.98351062e-06, 5.98351926e-06], [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ..., 5.98331098e-06, 5.98331144e-06, 5.98331553e-06]], [[0.00000000e+00, 3.40683764e-04, 3.40673811e-04, ..., 3.40683764e-04, 3.40683764e-04, 3.40683764e-04], [0.00000000e+00, 3.39418591e-04, 3.40656145e-04, ..., 3.40665691e-04, 3.40667844e-04, 3.40666738e-04], [0.00000000e+00, 3.39328515e-04, 3.38399550e-04, ..., 3.40646366e-04, 3.40644445e-04, 3.40647879e-04], ... 2.73052719e-04, 2.73292419e-04, 2.73323676e-04], [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ..., 2.73073092e-04, 2.73126439e-04, 2.73582380e-04], [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ..., 2.73072510e-04, 2.73056299e-04, 2.73568090e-04]], [[0.00000000e+00, 1.29188760e-03, 1.29184814e-03, ..., 1.29188644e-03, 1.29188644e-03, 1.29188586e-03], [0.00000000e+00, 1.28725218e-03, 1.29177235e-03, ..., 1.29179866e-03, 1.29179400e-03, 1.29180751e-03], [0.00000000e+00, 1.28685671e-03, 1.28354691e-03, ..., 1.29167445e-03, 1.29167107e-03, 1.29162776e-03], ..., [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ..., 6.85740844e-04, 6.86777814e-04, 6.86594693e-04], [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ..., 6.85988052e-04, 6.85330771e-04, 6.87811931e-04], [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ..., 6.86234562e-04, 6.84756960e-04, 6.87355874e-04]]]], dtype=float32)
For further information see Why xarray, and off course, xarray's Documentation.
For the specific case of the plunging flow configuration, the vertical coordinate was moved to the top of the computational domain, and it points down, so we need to inverse the signals before any other computation:
ds['Uh'] *= -1
ds['U2h'] *= -1
ds['UCh'] *= -1
And now, we can compute and plot all layer-averaged quantities:
ds['U'] = ds.U2h/ds.Uh
ds.U.attrs = {'name': 'Layer-averaged Velocity', 'long_name': r'$U$'}
ds.U.plot(col='case', robust=True, norm=matplotlib.colors.LogNorm());
ds['H'] = ds.Uh**2./ds.U2h
ds.H.attrs = {'name': 'Flow depth', 'long_name': r'$H$'}
ds.H.plot(col='case', robust=True);
ds['mixing'] = ds.U*ds.H - 1.
ds.mixing.attrs = {'name': 'Mixing coefficient', 'long_name': r'$\gamma$'}
ds.mixing.plot(col='case', robust=True);
ds['C'] = ds.UCh.sum('n')/ds.Uh
ds.C.attrs = {'name': 'Layer-averaged total Concentration', 'long_name': r'$C_t$'}
ds.C.plot(col='case', robust=True);
ds['Fr'] = ds.Fr0.mean('n')*ds.Uh*(ds.C**(-1./2.))*(ds.H**(-3./2.))
ds.Fr.attrs = {'name': 'Local densimetric Fround number', 'long_name': r'$Fr$'}
ds.Fr.plot(col='case', robust=True, norm=matplotlib.colors.LogNorm());
And plot the spanwise-avareged quantities:
ds.utau.attrs = {'name': 'Bed shear velocity', 'long_name': r'$u_\tau$'}
ds.utau.plot(col='case', robust=True, norm=matplotlib.colors.LogNorm());
ds['dept'] = ds.dep.sum('n')
ds.dept.attrs = {'name': 'Total deposition rate', 'long_name': r'$\dot{D}_t$'}
ds.dept.plot(col='case', robust=True);
Some of the flow features can be obtained with the layer-averaged quantities, for instance:
# Fill NaN with a large number just to avoid problems and get where it is minimum
ixp = ds.Fr.fillna(1e3).argmin(dim='x')
# Then obtain plunge point position (where it is inside the test section)
ds['xp'] = ds.x[ixp].where(ixp != ds.x.size - 1)
ds.xp.attrs = {'name': 'Distance for plunging', 'long_name': r'$x_p$'}
ds.xp.plot.line(x='t');
# It is the minimum value inside the test section
ds['Frp'] = ds.Fr.min(dim='x').where(ixp != ds.x.size - 1)
ds.Frp.attrs = {'name': 'Densimetric Frounde number at plunge point', 'long_name': r'$Fr_p$'}
ds.Frp.plot.line(x='t')
plt.axhline(0.45, c='k', ls='--')
plt.yscale('log')
C:\Users\felip\anaconda3\lib\site-packages\xarray\core\nputils.py:215: RuntimeWarning: All-NaN slice encountered result = getattr(npmodule, name)(values, axis=axis, **kwargs)
What is the time and case averaged densimetric Froude number at plunge point?
ds.Frp.sel(t=slice(4000,6000)).mean('t').mean('case')
<xarray.DataArray 'Frp' ()> array(0.44416183)
array(0.44416183)
ixf = ds.Uh.argmin(dim='x')
ds['xf'] = ds.x[ixf].where(ds.t <= ds.t[ixf.argmax(dim='t')])
ds.xf.attrs = {'name': 'Front position', 'long_name': r'$x_f$'}
ds.xf.plot.line(x='t');
# a rolling average is used to reduce the noise
ds['uf'] = ds.xf.differentiate('t').rolling(t=50).mean()
ds.uf.attrs = {'name': 'Front velocity', 'long_name': r'$u_f$'}
ds.uf.plot.line(x='t');
C:\Users\felip\anaconda3\lib\site-packages\xarray\core\nanops.py:142: RuntimeWarning: Mean of empty slice return np.nanmean(a, axis=axis, dtype=dtype)
Lets load the spanwise-averaged planes from case 4 as an example:
xyplanes = xr.load_dataset('xy-planes-case-4.nc')
xyplanes
<xarray.Dataset> Dimensions: (n: 3, t: 1201, x: 801, y: 121, z: 90) Coordinates: * n (n) int64 0 1 2 * x (x) float32 0.0 0.3125 0.625 0.9375 ... 249.375 249.6875 250.0 * y (y) float32 16.875 16.734375 16.59375 ... 0.28125 0.140625 0.0 * z (z) float32 0.0 0.26666668 0.53333336 ... 23.2 23.466667 23.733334 * t (t) float32 0.0 5.0 10.0 15.0 20.0 ... 5985.0 5990.0 5995.0 6000.0 Data variables: uset (n) float64 3.2e-05 0.0016 0.0067 Ri0 (n) float64 0.014 0.014 0.014 Fr0 (n) float64 8.452 8.452 8.452 Sc (n) float64 1.0 1.0 1.0 Re float64 2.5e+03 S float64 0.05 ramp (x) float32 1.0 1.015625 1.03125 ... 13.46875 13.484375 13.5 ux (x, y, t) float32 0.0 0.0 0.0 ... -0.023010366 -0.022613643 uy (x, y, t) float32 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 uz (x, y, t) float32 0.0 0.0 0.0 ... 0.001034194 0.001030162 phi (n, x, y, t) float32 0.0 0.0 0.0 ... 5.4308202e-17 6.7705944e-17 Attributes: title: The Plunging of Hyperpycnal Plumes on Tilted Bed by Three-Dimen... authors: F. N. Schuch, J. H. Silvestrini, E. Meiburg & S. Laizet url: https://github.com/fschuch/the-plunging-flow-by-3D-LES doi: 10.5281/zenodo.3968993
array([0, 1, 2], dtype=int64)
array([ 0. , 0.3125, 0.625 , ..., 249.375 , 249.6875, 250. ], dtype=float32)
array([16.875 , 16.734375, 16.59375 , 16.453125, 16.3125 , 16.171875, 16.03125 , 15.890625, 15.75 , 15.609375, 15.46875 , 15.328125, 15.1875 , 15.046875, 14.90625 , 14.765625, 14.625 , 14.484375, 14.34375 , 14.203125, 14.0625 , 13.921875, 13.78125 , 13.640625, 13.5 , 13.359375, 13.21875 , 13.078125, 12.9375 , 12.796875, 12.65625 , 12.515625, 12.375 , 12.234375, 12.09375 , 11.953125, 11.8125 , 11.671875, 11.53125 , 11.390625, 11.25 , 11.109375, 10.96875 , 10.828125, 10.6875 , 10.546875, 10.40625 , 10.265625, 10.125 , 9.984375, 9.84375 , 9.703125, 9.5625 , 9.421875, 9.28125 , 9.140625, 9. , 8.859375, 8.71875 , 8.578125, 8.4375 , 8.296875, 8.15625 , 8.015625, 7.875 , 7.734375, 7.59375 , 7.453125, 7.3125 , 7.171875, 7.03125 , 6.890625, 6.75 , 6.609375, 6.46875 , 6.328125, 6.1875 , 6.046875, 5.90625 , 5.765625, 5.625 , 5.484375, 5.34375 , 5.203125, 5.0625 , 4.921875, 4.78125 , 4.640625, 4.5 , 4.359375, 4.21875 , 4.078125, 3.9375 , 3.796875, 3.65625 , 3.515625, 3.375 , 3.234375, 3.09375 , 2.953125, 2.8125 , 2.671875, 2.53125 , 2.390625, 2.25 , 2.109375, 1.96875 , 1.828125, 1.6875 , 1.546875, 1.40625 , 1.265625, 1.125 , 0.984375, 0.84375 , 0.703125, 0.5625 , 0.421875, 0.28125 , 0.140625, 0. ], dtype=float32)
array([ 0. , 0.266667, 0.533333, 0.8 , 1.066667, 1.333333, 1.6 , 1.866667, 2.133333, 2.4 , 2.666667, 2.933333, 3.2 , 3.466667, 3.733333, 4. , 4.266667, 4.533333, 4.8 , 5.066667, 5.333333, 5.6 , 5.866667, 6.133333, 6.4 , 6.666667, 6.933333, 7.2 , 7.466667, 7.733333, 8. , 8.266666, 8.533334, 8.8 , 9.066667, 9.333333, 9.6 , 9.866667, 10.133333, 10.4 , 10.666667, 10.933333, 11.2 , 11.466666, 11.733334, 12. , 12.266666, 12.533334, 12.8 , 13.066667, 13.333333, 13.6 , 13.866667, 14.133333, 14.4 , 14.666667, 14.933333, 15.2 , 15.466666, 15.733334, 16. , 16.266666, 16.533333, 16.8 , 17.066668, 17.333334, 17.6 , 17.866667, 18.133333, 18.4 , 18.666666, 18.933332, 19.2 , 19.466667, 19.733334, 20. , 20.266666, 20.533333, 20.8 , 21.066668, 21.333334, 21.6 , 21.866667, 22.133333, 22.4 , 22.666666, 22.933332, 23.2 , 23.466667, 23.733334], dtype=float32)
array([0.000e+00, 5.000e+00, 1.000e+01, ..., 5.990e+03, 5.995e+03, 6.000e+03], dtype=float32)
array([3.2e-05, 1.6e-03, 6.7e-03])
array([0.014, 0.014, 0.014])
array([8.45154255, 8.45154255, 8.45154255])
array([1., 1., 1.])
array(2500.)
array(0.05)
array([ 1. , 1.015625, 1.03125 , 1.046875, 1.0625 , 1.078125, 1.09375 , 1.109375, 1.125 , 1.140625, 1.15625 , 1.171875, 1.1875 , 1.203125, 1.21875 , 1.234375, 1.25 , 1.265625, 1.28125 , 1.296875, 1.3125 , 1.328125, 1.34375 , 1.359375, 1.375 , 1.390625, 1.40625 , 1.421875, 1.4375 , 1.453125, 1.46875 , 1.484375, 1.5 , 1.515625, 1.53125 , 1.546875, 1.5625 , 1.578125, 1.59375 , 1.609375, 1.625 , 1.640625, 1.65625 , 1.671875, 1.6875 , 1.703125, 1.71875 , 1.734375, 1.75 , 1.765625, 1.78125 , 1.796875, 1.8125 , 1.828125, 1.84375 , 1.859375, 1.875 , 1.890625, 1.90625 , 1.921875, 1.9375 , 1.953125, 1.96875 , 1.984375, 2. , 2.015625, 2.03125 , 2.046875, 2.0625 , 2.078125, 2.09375 , 2.109375, 2.125 , 2.140625, 2.15625 , 2.171875, 2.1875 , 2.203125, 2.21875 , 2.234375, 2.25 , 2.265625, 2.28125 , 2.296875, 2.3125 , 2.328125, 2.34375 , 2.359375, 2.375 , 2.390625, 2.40625 , 2.421875, 2.4375 , 2.453125, 2.46875 , 2.484375, 2.5 , 2.515625, 2.53125 , 2.546875, 2.5625 , 2.578125, 2.59375 , 2.609375, 2.625 , 2.640625, 2.65625 , 2.671875, 2.6875 , 2.703125, 2.71875 , 2.734375, 2.75 , 2.765625, 2.78125 , 2.796875, 2.8125 , 2.828125, 2.84375 , 2.859375, ... 11.6875 , 11.703125, 11.71875 , 11.734375, 11.75 , 11.765625, 11.78125 , 11.796875, 11.8125 , 11.828125, 11.84375 , 11.859375, 11.875 , 11.890625, 11.90625 , 11.921875, 11.9375 , 11.953125, 11.96875 , 11.984375, 12. , 12.015625, 12.03125 , 12.046875, 12.0625 , 12.078125, 12.09375 , 12.109375, 12.125 , 12.140625, 12.15625 , 12.171875, 12.1875 , 12.203125, 12.21875 , 12.234375, 12.25 , 12.265625, 12.28125 , 12.296875, 12.3125 , 12.328125, 12.34375 , 12.359375, 12.375 , 12.390625, 12.40625 , 12.421875, 12.4375 , 12.453125, 12.46875 , 12.484375, 12.5 , 12.515625, 12.53125 , 12.546875, 12.5625 , 12.578125, 12.59375 , 12.609375, 12.625 , 12.640625, 12.65625 , 12.671875, 12.6875 , 12.703125, 12.71875 , 12.734375, 12.75 , 12.765625, 12.78125 , 12.796875, 12.8125 , 12.828125, 12.84375 , 12.859375, 12.875 , 12.890625, 12.90625 , 12.921875, 12.9375 , 12.953125, 12.96875 , 12.984375, 13. , 13.015625, 13.03125 , 13.046875, 13.0625 , 13.078125, 13.09375 , 13.109375, 13.125 , 13.140625, 13.15625 , 13.171875, 13.1875 , 13.203125, 13.21875 , 13.234375, 13.25 , 13.265625, 13.28125 , 13.296875, 13.3125 , 13.328125, 13.34375 , 13.359375, 13.375 , 13.390625, 13.40625 , 13.421875, 13.4375 , 13.453125, 13.46875 , 13.484375, 13.5 ], dtype=float32)
array([[[ 0. , 0. , 0. , ..., 0. , 0. , 0. ], [ 0. , 0. , 0. , ..., 0. , 0. , 0. ], [ 0. , 0. , 0. , ..., 0. , 0. , 0. ], ..., [ 1.066904 , 1.0687737 , 1.0805457 , ..., 1.1298819 , 1.1477047 , 1.1428069 ], [ 1.0672998 , 1.0686485 , 1.0925952 , ..., 1.1684004 , 1.1650727 , 1.1727686 ], [ 1.0683863 , 1.0612656 , 1.0942254 , ..., 1.1936531 , 1.172017 , 1.194019 ]], [[ 0. , 0. , 0. , ..., 0. , 0. , 0. ], [ 0. , 0. , 0. , ..., 0. , 0. , 0. ], [ 0. , 0. , 0. , ..., 0. , 0. , 0. ], ... [ 0. , 0.07456194, 0.07466754, ..., -0.02417301, -0.02371762, -0.02332709], [ 0. , 0.07456277, 0.07466781, ..., -0.02390764, -0.02344503, -0.02304699], [ 0. , 0.07456206, 0.07466779, ..., -0.02381338, -0.02334795, -0.02294712]], [[ 0. , 0. , 0. , ..., 0. , 0. , 0. ], [ 0. , 0. , 0. , ..., 0. , 0. , 0. ], [ 0. , 0. , 0. , ..., 0. , 0. , 0. ], ..., [ 0. , 0.07447547, 0.07458015, ..., -0.02385198, -0.02340036, -0.02301486], [ 0. , 0.07447463, 0.07458017, ..., -0.02356755, -0.0231083 , -0.02271472], [ 0. , 0.07447527, 0.07458037, ..., -0.02347264, -0.02301037, -0.02261364]]], dtype=float32)
array([[[ 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, ..., 0.0000000e+00, 0.0000000e+00, 0.0000000e+00], [ 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, ..., 0.0000000e+00, 0.0000000e+00, 0.0000000e+00], [ 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, ..., 0.0000000e+00, 0.0000000e+00, 0.0000000e+00], ..., [ 3.9951832e-04, -7.7321245e-03, -7.6053739e-03, ..., -2.4251246e-03, -2.5644463e-02, -2.5891958e-04], [ 5.4418977e-04, -3.7125724e-03, -3.8085878e-03, ..., -2.8599426e-03, -1.2564845e-02, -5.4518931e-04], [ 4.8172090e-04, 0.0000000e+00, 0.0000000e+00, ..., 0.0000000e+00, 0.0000000e+00, 0.0000000e+00]], [[ 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, ..., 0.0000000e+00, 0.0000000e+00, 0.0000000e+00], [ 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, ..., 0.0000000e+00, 0.0000000e+00, 0.0000000e+00], [ 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, ..., 0.0000000e+00, 0.0000000e+00, 0.0000000e+00], ... [ 0.0000000e+00, -7.8184166e-05, -7.8424404e-05, ..., 3.0557884e-04, 3.0438974e-04, 3.0254378e-04], [ 0.0000000e+00, -3.9191214e-05, -3.9193859e-05, ..., 1.5502279e-04, 1.5448115e-04, 1.5360933e-04], [ 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, ..., 0.0000000e+00, 0.0000000e+00, 0.0000000e+00]], [[ 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, ..., 0.0000000e+00, 0.0000000e+00, 0.0000000e+00], [ 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, ..., 0.0000000e+00, 0.0000000e+00, 0.0000000e+00], [ 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, ..., 0.0000000e+00, 0.0000000e+00, 0.0000000e+00], ..., [ 0.0000000e+00, -7.8039542e-05, -7.8209589e-05, ..., 3.0068133e-04, 2.9551092e-04, 2.8918689e-04], [ 0.0000000e+00, -3.9014445e-05, -3.9118280e-05, ..., 1.5270065e-04, 1.5019168e-04, 1.4716687e-04], [ 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, ..., 0.0000000e+00, 0.0000000e+00, 0.0000000e+00]]], dtype=float32)
array([[[ 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, ..., 0.0000000e+00, 0.0000000e+00, 0.0000000e+00], [ 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, ..., 0.0000000e+00, 0.0000000e+00, 0.0000000e+00], [ 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, ..., 0.0000000e+00, 0.0000000e+00, 0.0000000e+00], ..., [-1.4962861e-04, -1.9036216e-04, -2.7533676e-04, ..., 1.3522417e-02, -3.2518465e-02, 4.5260694e-03], [ 6.9702818e-04, -8.2882281e-05, -2.3282131e-05, ..., 9.1788573e-03, -2.7126342e-02, -2.9180187e-03], [ 1.2331757e-04, -3.4389755e-05, 1.1264250e-04, ..., -2.6467920e-04, -2.3358040e-02, -9.0868073e-03]], [[ 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, ..., 0.0000000e+00, 0.0000000e+00, 0.0000000e+00], [ 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, ..., 0.0000000e+00, 0.0000000e+00, 0.0000000e+00], [ 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, ..., 0.0000000e+00, 0.0000000e+00, 0.0000000e+00], ... [ 0.0000000e+00, 5.7926598e-12, 7.0863211e-12, ..., 1.1954070e-03, 1.1923112e-03, 1.1883506e-03], [ 0.0000000e+00, 2.2091877e-11, -7.9896579e-14, ..., 1.0981479e-03, 1.0964391e-03, 1.0939026e-03], [ 0.0000000e+00, 1.9262338e-11, -1.7621459e-12, ..., 1.0637013e-03, 1.0622648e-03, 1.0599149e-03]], [[ 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, ..., 0.0000000e+00, 0.0000000e+00, 0.0000000e+00], [ 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, ..., 0.0000000e+00, 0.0000000e+00, 0.0000000e+00], [ 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, ..., 0.0000000e+00, 0.0000000e+00, 0.0000000e+00], ..., [ 0.0000000e+00, -2.2535415e-11, 1.0872882e-12, ..., 1.1640270e-03, 1.1587701e-03, 1.1523206e-03], [ 0.0000000e+00, 1.7668829e-12, 1.6995549e-11, ..., 1.0708580e-03, 1.0672706e-03, 1.0629308e-03], [ 0.0000000e+00, 8.2729275e-12, 2.1417968e-11, ..., 1.0375496e-03, 1.0341940e-03, 1.0301620e-03]]], dtype=float32)
array([[[[0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ..., 0.00000000e+00, 0.00000000e+00, 0.00000000e+00], [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ..., 0.00000000e+00, 0.00000000e+00, 0.00000000e+00], [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ..., 0.00000000e+00, 0.00000000e+00, 0.00000000e+00], ..., [0.00000000e+00, 3.14487725e-01, 3.14490378e-01, ..., 3.14453661e-01, 3.14447671e-01, 3.14450085e-01], [0.00000000e+00, 3.10884953e-01, 3.10894281e-01, ..., 3.10854971e-01, 3.10852438e-01, 3.10856491e-01], [0.00000000e+00, 3.07354271e-01, 3.07367623e-01, ..., 3.07331711e-01, 3.07331413e-01, 3.07335466e-01]], [[0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ..., 0.00000000e+00, 0.00000000e+00, 0.00000000e+00], [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ..., 0.00000000e+00, 0.00000000e+00, 0.00000000e+00], [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ..., 0.00000000e+00, 0.00000000e+00, 0.00000000e+00], ... 1.89034444e-17, 1.75907385e-17, 2.55318991e-17], [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ..., 1.30427134e-17, 3.49446586e-17, 6.31496745e-17], [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ..., 9.95678710e-18, 2.57851470e-17, 4.41494351e-17]], [[0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ..., 0.00000000e+00, 0.00000000e+00, 0.00000000e+00], [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ..., 0.00000000e+00, 0.00000000e+00, 0.00000000e+00], [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ..., 0.00000000e+00, 0.00000000e+00, 0.00000000e+00], ..., [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ..., 2.03368905e-17, 3.31782574e-17, 5.41856605e-17], [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ..., 5.04693961e-17, 7.96892236e-17, 1.04605062e-16], [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ..., 3.63619267e-17, 5.43082023e-17, 6.77059441e-17]]]], dtype=float32)
Now, lets select some values as time reference:
selected_times = [250, 500, 1000, 2000, 6000]
And plot total concentration field (notice that matplotlib can be used for adjustments):
xyplanes.phi.sel(t=selected_times).sum('n').plot(col='t', x='x')
plt.gca().invert_yaxis()
plt.show();
Now the velocity components:
for var in 'ux uy uz'.split():
xyplanes[var].sel(t=selected_times).plot(col='t', x='x', robust=True)
plt.gca().invert_yaxis()
plt.show();
We can extract a signal in some location:
for var in 'ux uy uz'.split():
xyplanes[var].sel(x=0, y=0.5, method='nearest').plot()
plt.show()
and we can go back to ds
and plot some variables for all cases at reference times:
for var in 'U Fr utau mixing'.split():
ds[var].sel(t=selected_times).plot(hue="t", x='x', col='case')
plt.show();