Pierre Augier, A. Vishnu (KTH), C. Bonamy, A. Campagne, J. Sommeria, S. Viboud, C. Bonamy, N. Mordant (ERC Watu)...
$\newcommand{\kk}{\boldsymbol{k}} \newcommand{\eek}{\boldsymbol{e}_\boldsymbol{k}} \newcommand{\eeh}{\boldsymbol{e}_\boldsymbol{h}} \newcommand{\eez}{\boldsymbol{e}_\boldsymbol{z}} \newcommand{\cc}{\boldsymbol{c}} \newcommand{\uu}{\boldsymbol{u}} \newcommand{\vv}{\boldsymbol{v}} \newcommand{\bnabla}{\boldsymbol{\nabla}} \newcommand{\Dt}{\mbox{D}_t} \newcommand{\p}{\partial} \newcommand{\R}{\mathcal{R}} \newcommand{\eps}{\varepsilon} \newcommand{\mean}[1]{\langle #1 \rangle} \newcommand{\epsK}{\varepsilon_{\!\scriptscriptstyle K}} \newcommand{\epsA}{\varepsilon_{\!\scriptscriptstyle A}} \newcommand{\epsP}{\varepsilon_{\!\scriptscriptstyle P}} \newcommand{\epsm}{\varepsilon_{\!\scriptscriptstyle m}} \newcommand{\CKA}{C_{K\rightarrow A}} \newcommand{\D}{\mbox{D}}$
Fluids: Navier-Stokes equations
$\p_t \vv + \vv\cdot\bnabla\vv = - \bnabla p + \nu \bnabla^2 \vv,$
plus rotation, density stratification, etc.
(anisotropic) turbulence
Tools and methods:
A project to foster open-science and open-source in fluid mechanics
A thesis:
Pure-python code that can be reused in scripts or in specialized FluidDyn packages. Miscellaneous command-line utilities.
C++ and Python classes useful to perform Fast Fourier Transform (FFT) in sequential and in parallel.
Computational Fluid Dynamics (CFD) Python framework (mainly pseudo-spectral methods).
For laboratory experiments. Communication with various hardware devices such as motors, sensors, pumps.
Scalable image processing: calibrate cameras, preprocessing images, Particle Image Velocimetry (PIV) and processing of velocity fields.
Experiments in the Coriolis platform and Open Data.
Loading, plotting and processing of OpenFoam data.
Examples for
Standard method: Fortran codes
FluidDyn Python packages: fluidfft and fluidsim
Hierarchy of C++ classes to use different FFT libraries.
Cython wrappers of the C++ classes. Cython .pyx
and .pdx
files produced from template
files using the template library mako.
Python operators classes (2d and 3d) to write code independently of the library used for the computation of the FFT.
Pythran to speedup critical code. Performance $\simeq$ Fortran.
Commandline utilities (fluidfft-bench
and fluidfft-bench-analysis
).
Unittest !
Python framework to run sequential and parallel (MPI) Computational Fluid Dynamics (CFD) simulations and on-the-fly processing for a variety of problems (Navier-Stokes, Shallow Water, Föppl von Kármán equations, ...).
highly modular, object-oriented structure (solver, state, time stepping, output, ...),
specialized in pseudo-spectral methods (based on fluidfft),
very user friendly,
very efficient (much faster than Dedalus, faster than SpectralDNS).
Summer 2016 (a collaboration between KTH, Stockholm, Sweden and LEGI).
Summer 2017: focused on mixing without rotation
A community of hackers!
Python packages for
async, await and asyncio for asynchronous input/output (see asyncio in autolib's car)
Arduino, Micropython for microcontrollers, Raspberry Pi
Python friendly companies (Labjack for acquisition boards, ...)
Python packages for experiments (control instruments, ...): fluidlab, lantz, place
See also this presentation on Factory Automation with Python...
PIV: Particle Image Velocimetry
Simple functions to control the mirror and trigger the cameras via the T7 board (in fluidlab).
PIV processing with fluidimage
Many images (~ 20 To of raw data): embarrassingly parallel problem
Asynchronous computations
Efficient algorithms and tools for fast computation with Python (Pythran, Theano, Pycuda, ...)
Images preprocessing
2D PIV, scanning PIV, stereo PIV, BOS
Utilities to display and analyze the PIV fields
Remark: highly inspired by PivMat (F. Moisy) and UVmat (J. Sommeria), that we continue to use, in particular for calibration
Example of scripts to launch a PIV computation:
from fluidimage.topologies.piv import TopologyPIV
params = TopologyPIV.create_default_params()
params.series.path = '../../image_samples/Karman/Images'
params.series.ind_start = 1
params.piv0.shape_crop_im0 = 32
params.multipass.number = 2
params.multipass.use_tps = True
# params.saving.how has to be equal to 'complete' for idempotent jobs
# (on clusters)
params.saving.how = 'complete'
params.saving.postfix = 'piv_complete'
topology = TopologyPIV(params, logging_level='info')
topology.compute()
Remark: launching computations on cluster is highly simplified by using fluiddyn:
from fluiddyn.clusters.legi import Calcul7 as Cluster
cluster = Cluster()
cluster.submit_script(
'piv_complete.py', name_run='fluidimage',
nb_cores_per_node=8,
walltime='3:00:00',
omp_num_threads=1,
idempotent=True, delay_signal_walltime=300)
On another cluster, for example Froggy (Ciment, GRICAD), change the first line as:
from fluiddyn.clusters.ciment import Froggy
from fluidcoriolis.milestone17 import Experiment as Experiment17
iexp = 21
exp = Experiment17(iexp)
exp.name
'Exp21_2017-07-11_D0.5_N0.55_U0.12'
print(f'N = {exp.N} rad/s and Uc = {exp.Uc} m/s')
N = 0.55 rad/s and Uc = 0.12 m/s
print(f'Rc = {exp.Rc:.0f} and Fh = {exp.Fhc:.2f}')
Rc = 11425 and Fh = 0.44
print(f'{exp.nb_periods} periods of {exp.period} s')
3 periods of 125.0 s
print(f'{exp.nb_levels} levels for the scanning PIV')
5 levels for the scanning PIV
from fluidcoriolis.milestone import Experiment
exp = Experiment(73)
cam = 'PCO_top' # MILESTONE16
pack = exp.get_piv_pack(camera=cam)
piv_fields = pack.get_piv_array_toverT(i_toverT=80)
/home/pierre/16MILESTONE/Data_light/PCO_top/Exp73_2016-07-13_N0.8_L6.0_V0.16_piv3d/v_exp73_t080.h5
piv_fields = piv_fields.gaussian_filter(0.5).truncate(2)
piv = pack.get_piv2d(ind_time=10, level=1)
piv = piv.gaussian_filter(0.5).truncate(2)
piv.display()
_ = plt.xlim([-1.7, 0.5])
_ = plt.ylim([-1.3, 1.3])
We can do several things with Python
Even studying fluid dynamics
8 March: International Women Day... And for PySciDataGre ?