Tesla valves: Comparison of the forward and backward flow
Channel: Nils Berglund
Date: 2023-05-11

A Tesla valve is a clever one-way fluid valve without moving parts, that was invented (and patented) by Nikola Tesla in 1920. The design used here features two conduits attached to the main pipe, and folded back on it. When used in the forward direction, the fluid can easily flow along the main pipe. When used in the backward direction, however, the back-folded conduits make the fluid interact with the flow in the main pipe, slowing it down or even stopping it altogether. 
In this simulation, there are two parallel set-ups of 4 Tesla valves in series, allowing to compare the forward and the backward flows more easily. The figures at the left show the average horizontal components of the velocity, for the upper and lower half. The set-up used here increases the chances that the fluid follows the blocking path in the backward direction, increasing the efficiency of the valves. 
The boundary conditions are imposed by multiplying the fields with a cut-off function, that smoothly interpolates between 0 and 1 when moving across the boundary of the valve, effectively introducing a boundary layer. In addition, there is a repulsive force orthogonal to the boundary, proportional to the gradient of the cut-off function. 
In color hue shows the speed (norm of velocity) of the fluid. The velocity field of the fluid is materialized by 1000 tracer particles, whose initial position is distributed randomly over the simulation region. There are periodic boundary conditions, which is why vortices can be seen wrap around the displayed rectangular region.

Render time: 1 hour 15 minutes
Color scheme: Inferno, by Nathaniel J. Smith and Stefan van der Walt
https://github.com/BIDS/colormap
 
Music: Sunset Strip by Audionautix is licensed under a Creative Commons Attribution 4.0 licence. https://creativecommons.org/licenses/by/4.0/
Artist: http://audionautix.com/

See also https://images.math.cnrs.fr/Des-ondes-dans-mon-billard-partie-I.html for more explanations (in French) on  a few previous simulations of wave equations. 

The simulation solves the 2D compressible Euler equation by discretization (finite differences).

C code: https://github.com/nilsberglund-orleans/YouTube-simulations
https://www.idpoisson.fr/berglund/software.html
Many thanks to Marco Mancini and Julian Kauth for helping me to accelerate my code!

#Tesla #Tesla_valve