Giter VIP home page Giter VIP logo

image-based-cfd-using-deep-learning's Introduction

Image Based CFD Using Deep Learning

For a better view visit the GitHub Page
For any suggestion/query please mail me at: [email protected]

Author

Afzal Hussain

Preface

This January, during the starting of the 7th semester I completed Andrew Ng’s Deep Learning Specialization from Coursera. I was really fascinated by how I can use different deep learning algorithms so that it can be useful in mechanical engineering. Then suddenly an idea came into my mind, deep learning models can be used to predict fluid simulation and later I started doing research on this.

This blog is about the whole procedure that I have gone through, from generating fluid simulation to deep learning model everything is explained here.

Case Setup

For this research, I have used OpenFOAM, a C++ open source implementation for pre-processing, solving and post-processing CFD simulation. The reason behind choosing OpenFOAM because of its flexibility and automatization. Here supersonic flow over a forward-facing step is investigated. The problem description involves a flow of Mach 3 at an inlet to a rectangular geometry with a step near the inlet region that generates shock waves. The geometry is shown below:

Generating simulation

This is the most laborious task. As deep learning requires plenty of data, I needed about thousands of simulations of varying geometries so that it can predict simulation of unknown geometries. For this purpose, I changed the position of step from near the inlet region to the outlet i.e. 0.1 < x < 2.9, ranging it height 0.1 < y < 0.4. This is done by a python script where each step are described with comments. Making the dataset contains the following steps:

  1. Make 1500 random coordinates within some constraints.
  2. Remove previous simulation file (if it exists).
  3. Copy the OpenFOAM forwardStep directory.
  4. Remove blockMeshDict file from system directory.
  5. Execute gen_blockMeshDict.py to write blockMeshDict and cellInformation file. cellInformation consists cell number of three rectangle (x_cell * y_cell) (2D simulation).
  6. Move blockMeshDict file to system directory
  7. Move cellInformation file to home directory
  8. Now execute sim_cmd from terminal.
  9. It uses sonicFoam to run simulation.
  10. And foamToVTK to convert the simulation result into .vtk file.

After this almost 168GB simulation data has been generated. But all this data is not necessary for training, I extract only velocity at x & y direction, pressure, and temperature of each cell. dl_data_generation is used to do this tasks.

Convolutional LSTM

For long-range dependencies in time-series data, LSTM has been using for a longer period of time, that has proven stable and powerful. But typical LSTM implementation deals with 1-D series data only, as fluid simulation involves with spatial data, I need to use a variant of LSTM, proposed by X Shi et al., where state-to-state and input-to-state transitions are replaced by convolution operation. The key equations are shown below, where ‘∗’ denotes the convolution operator and ‘◦’ denotes the Hadamard product:

Deep Learning Model

As fluid simulation is time-depended I have used three TimeDistributed Conv2D followed by a TimeDistributed MaxPolling2D. After that ConvLSTM2D has been performed. This model is initially taking a lot of time to converge, so I have used ResNet concept here to improve training time. Using ResNet has significantly improved the model performance and accuracy. The whole model is shown below:

Results so far

The model is evaluated on geometries that are previously unknown to the model. The obtained results are realistic, competitive in accuracy; it successfully shows discontinuities in shock waves, emanating from ahead of the base of the step, and also captures the time-dependent development of the shock-waves. While this work has been performed on one problem specification, it illustrates the viability of data-driven approaches in computational fluid dynamics. Below a comparison between actual simulation and the predicted one by the model is shown for velocity, pressure and temperature at t = 1, 2 & 3 seconds.

Velocity

Pressure

Temperature

Conclusion

In the past few years, deep learning has exhibited unprecedented competency and efficiency in image classification, speech recognition, weather forecasting, self-driving cars and many other domains, due to the large availability of data. In this work, we propose an image-based end-to-end deep learning model where both the input and output are spatiotemporal sequences of images, having convolutional structures in both the input-to-state and state-to-state transitions. The proposed model is trained and evaluated on supersonic flow over a forward-facing step; the obtained results are realistic, competitive in accuracy while illustrating the viability of data-driven approaches in computational fluid dynamics.

Related Research

Data-Driven Turbulence Modeling
Turbulence Modeling Gateway
Maziar Raissi's Research
Data-driven Fluid Simulations using Regression Forests
Convolutional Neural Networks for Steady Flow Approximation
Application of Convolutional Neural Network to Predict Airfoil Lift Coefficient

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.