This is the repository containing the source codes for Unsteady Cylinder Wakes from Arbitrary Bodies with Differentiable Physics-Assisted Neural Network by Shuvayan Brahmachary
and Nils Thuerey
. The work has been accepted as a regular article in Physical Review E PRE
. The preprint is available on arXiv
.
Additional information: project page
This work delineates a hybrid predictive framework configured as a coarse-grained surrogate for reconstructing unsteady fluid flows around multiple cylinders of diverse configurations. The presence of cylinders of arbitrary nature causes abrupt changes in the local flow profile while globally exhibiting a wide spectrum of dynamical wakes fluctuating in either a periodic or chaotic manner. Consequently, the focal point of the present study is to establish predictive frameworks that accurately reconstruct the overall fluid velocity flowfield such that the local boundary layer profile, as well as the wake dynamics, are both preserved for long time horizons. The hybrid framework is realized using a base differentiable flow solver combined with a neural network, yielding a differentiable physics-assisted neural network (DPNN). The framework is trained using bodies with arbitrary shapes, and then it is tested and further assessed on out-of-distribution samples. Our results indicate that the neural network acts as a forcing function to correct the local boundary layer profile while also remarkably improving the dissipative nature of the flowfields. It is found that the DPNN framework clearly outperforms the supervised learning approach while respecting the reduced feature space dynamics. The model predictions for arbitrary bodies indicate that the Strouhal number distribution with respect to spacing ratio exhibits similar patterns with existing literature. In addition, our model predictions also enable us to discover similar wake categories for flow past arbitrary bodies. For the chaotic wakes, the present approach predicts the chaotic switch in gap flows up to the mid-time range.
Differentiable physics, unsteady cylinder wakes, arbitrary flows, spatio-temporal predictions
The entire dataset used for training and testing the DPNN based-model is available for download MediaTUM. Refer to respective readme.md files for instructions. The following image shows the 100 experiments that were generated at various spacing ratios using FoamExtend FoamExtend
.
The open source immersed boundary-based solver FoamExtend v4.0
was used to generate the high-resolution (768 x 512) flowfields for flow past arbitrarily shaped objects on a Cartesian mesh. Refer to this link
for installation instructions. Recommended open source postprocessing tool Paraview
. Recommended open source tool for meshing Gmsh
. Validation test cases performed using FoamExtend as well as related source codes and computational meshes will be uploaded not yet available
.
In house developed differentiable flow solver Phiflow [ΦFlow] is used as the base source solver. The machine learning framework TensorFlow is utilised as the python backend.
The following packages/libraries with version have been used:
PhiFlow 2.1.3
Tensorflow 2.3.0
Numpy 1.20.3
Scipy 1.9.3
CUDA 10.0
Installation begins with a simple command for Phiflow
!pip install phiflow==2.1.3
The python script trainDPNN.py
under the directory Training_script
executes the network training. The script takes the following as input arguments:
python script name
: This indicates the name of the python script file that is to be executed.epochs
: The number of training epochs.output directory
: Name of the output directory where the output files are to be stored.configs
: The number of experiments to be included in the trainingtotal_frames
The number of consecutive frames per experiment to be included in trainingremove_frames
: Number of frames that are to be removed. Used to remove the transient frames not included in training.lr
: initial learning rate for trainingdownsample
: How many times the high-resolution inputs velocity fields are to be downsampledmsteps
: number of unroll steps during trainingadplr
: option to use adaptive learning rate or fixed learning raterseed
: Value of the random number seedjitc
: option to use jit compilation or notgpu
: Value of the GPU for training
For further details, refer to the respective readme.md file.
The Cartesian employed in FoamExtend to generate the ground truth data can be easily loaded in Phiflow [ΦFlow] using the phi.domain
class. In Phiflow, we employ an equivalent Staggared grid to store the velocity components in the grid faces. The following parameters are relevant for the simulations:
kinematic viscosity, ν
: 0.01 Ns/m2characteristic length scale, H
: helght of the upstream cylindergrid spacing, Δ𝑥/𝐷 = Δy/𝐷
: 1/32 (high-resolution)time step size, Δt
: 0.1ssimulaiton time, T
: 300sstastically stable simulaiton time, T
: 150s - 300sspacing ratio, L/D
: 1.2 ≤ L/D ≤ 5.5
In phiflow, the following settings are employed to transpost the velocity fields:
advection:
MacCormack advection step for advecting the initial velocityprojection:
Chiron's method to obtain divergence free velocity fieldsbody wall boundary conditions
: no-slip mask.immersed body
:phi.Obstacle
classfreestream velocity
: constant Dirichlet velocity V = 1m/s
Typical example of the above are as follows:
V* = advect.mac_cormack(V0, ν, Δt)
V1, p1 = fluid.make_incompressible(V* obstacle, Solve('CG', 1e-5, 1e-5, 2500, x0=None))
The pretrained DPNN-based model can be tested against a representative testing sample. The jupyter notebook corresponding to this setup can be easily executed using this link:
Please cite the following:
Brahmachary, S., & Thuerey, N. (2024).
Unsteady cylinder wakes from arbitrary bodies with differentiable physics-assisted neural network.
Physical Review E, 109(5), 055304.
https://journals.aps.org/pre/abstract/10.1103/PhysRevE.109.055304