Interactive 3D fluid simulation: steering the simulation in progress using Lattice Boltzmann Method
Mengchen Wang, Nicolas Ferey, Patrick Bourdot, Frederic Magoules
IInteractive 3D fluid simulation: steering the simulationin progress using Lattice Boltzmann Method
Mengchen Wang ∗† Nicolas Férey † Patrick Bourdot † Frédéric Magoulès ∗ Abstract.
This paper describes a work in progress about software and hardware archi-tecture to steer and control an ongoing fluid simulation in a context of a serious gameapplication. We propose to use the Lattice Boltzmann Method as the simulation approachconsidering that it can provide fully parallel algorithms to reach interactive time and becauseit’s easier to change parameters while the simulation is in progress remaining physically rel-evant than more classical simulation approaches. We describe which parameters we canmodify and how we solve technical issues of interactive steering and we finally show anapplication of our interactive fluid simulation approach of water dam phenomena.
Keywords.
Lattice Boltzmann Methods; Interactive Fluid Simulation; Serious Game
Steering a fluid simulation in progress requires to combine simulation, interaction and visu-alization tools. Usually these tools are sequentially used analysing simulation results at theend of computation using visualization tools without interaction features, except navigationaround the fluid or only changing rendering properties or visualization modalities. In thispaper we will discuss how we can interact and steer the fluid simulation in progress basedon Lattice Boltzmann Method.
In the last two decades, the Lattice Boltzmann Method has become very popular[14] becauseit can provide fully parallel algorithms especially those adapted to many cores architecturesuch as GPU.We choose the Lattice Boltzmann Method (LBM) for the simulation part of our systemfor the following reasons. On the one hand we need a high performance computation methodto reach interactive time, i.e. providing several timestep per second to see the impact oninteraction of user during a simulation in progress. On the other hand, the final goal of ourresearch is to develop a serious game targeting multi-phase fluid simulations and LBM isespecially adapted in this context. Morover LBM are also less sensitive to parameters changeduring simulation allowing to steer the simulation during computation, as it is explainedbelow.The model of LBM used is the Bhatnagar–Gross–Krook collision model (BGK) [4] withsingle-relaxation-time: f i ( x + c i ∆ t, t + ∆ t ) − f i ( x, t ) = − τ ( f i ( x, t ) − f (0) i ( x, t )) (1) ∗ CentraleSupélec, Université Paris-Saclay, 3 rue Joliot Curie, 91190 Gif-sur-Yvette, France ([email protected]) † VENISE Team, LIMSI-CNRS, Université Paris-Sud, Université Paris-Saclay, Orsay, France (fi[email protected])
Preprint September 17, 2019 a r X i v : . [ c s . G R ] D ec n this equation f (0) i is the equilibrium distribution function at x,t and τ is the time relax-ation parameter[10]. Boundary conditions and initial conditions are crucial in CFD simulations. To implementboundary conditions in LBM, we need to translate given information from macroscopic vari-ables to particle distribution function[8]. Since all the data are saved in particle distributionfunction, we can change boundary conditions at any time of the simulation. Technically,we can change all the boundary conditions by changing particle distribution function. Forexample, we can change the wall and modify the fluid in contact with the wall. We can alsogive a velocity of the wall and make the fluid in contact has the same velocity with the wall.This kind of solid objects are treated with stick boundary conditions, with the bounce-backon the links (BBL) [6].
Simulations and visualization/interaction are usually used separately. Both the simulationand interaction are time-consuming jobs for computers, reducing performance on both sides.This may cause latency that have to be avoid for qualitative interactive environment, andbecause latency causes cybersickness in the case of immersive context of serious game. [9].To get a better performance, we chose to design a network API to implement a distributedarchitecture approach. One machine runs the simulation, and another machine runs thevisualization and interaction. Since we have two machines and we want them to workinteractively, we need them to efficiently communicate and exchange huge data with lowlatency. The simulation should be able to receive command from users at any time.This API is based on TCP protocol, and coded in C++. To make this API cross-platform, basic functions such as connection/send have been coded both for Windows andLinux as the TCP protocol has some differences in different platforms. These functionsare completely coded in a encapsulating way. Then we design the API functions, there areno difference between platforms. We can compile this API to dynamic link library(DLL)for other languages like C
With LBM, it is possible to change the parameters as we need during the simulation. Wecan change the walls by simply setting the corresponding cells as fluid or wall. Then we onlyneed to reinitialize the cells in contact with the new wall. To modify the inlet or outlet, wecan simply change the parameters on the cells at the place of inlet/outlet. This makes itpossible to only transfer very little data between two machines. Only modified cells data inthe 3D scene will be sent to the simulation, and user have a visual feedback of the editedboundary conditions or cells content inside the 3D environment.2igure 1: Example of using communication API to launch a simulation and transmit volumeof fraction(VOF) Figure 2: Process of setting initial conditionsFig.2 shows a proposition of how to deal with the initial condition. In Unity, the propertyof each cell is showed to the user with colors or textures. These data can be saved in anarray flags which stands for wall, water, etc. Then the array will be sent to the simulationand initialize the initial conditions with the array of flags.
In case of 3D fluid data, there are a large number of different techniques for flow visualization.The choice depends on the circumstance: the purpose of the visualization, the result of thesimulations or experiments and the objectives of the analysis.Flow visualization is a subfield of scientific visualization especially dedicated to renderflow. It has a wide application, like weather forecast, aerodynamics, airplay design, etc.This means it is widely used in different aspects. So, the users may have different purposeand there are many flow visualization resolutions.3low data is normally a set of positions, velocity vector, pression... There is a lotof flow visualization techniques aiming to present the whole flow data or partially in acomprehensible way, described for example in the classification of Post, Frits H., et al. [11].
One chosen approach is direct flow visualization. This technique aims to present the data inan explicit way as the data are. There are also many kinds of Direct FlowVis, such as DirectFlowVis 2D or 3D including Color coding, Arrow plots and Hybrid direct FlowVis. DirectFlowVis on slices or boundaries including Color coding and Arrow plots. An example ofDirect flow visualization is using this technique to visualize the particles of micro fluid[12].We used these techniques to visualize pressure, velocity and interface like water surface.This category maybe the most important in our case as it shows to users in a direct wayhow the fluid evolve.
Geometric Flow Visualization is also an approach of flow visualization. This technique usessome geometric objects to present the potential information in the data. The shape ofthe objects is related to the information. Geometric Flow includes Contouring, Isosurfaces,Streamlets, Streamlines, Streaklines, timelines, and pathlines. We can use for examplestreamlines to trace the fluid movement. These techniques offer more information thandirect flow visualization techniques.
Texture-based visualization is another approach of the flow visualization. This techniqueprovides dense spatial resolution images to the users. This technique presents the data tothe users by rendering the data with some texture. Texture-based FlowVis including Spotnoise, Line integral convolution, Oriented Line Integral Convolution. Cross advection anderror diffusion [1] are two examples of texture-based techniques to visualize uncertainty intime-dependent flow.
Apart these standard flow visualization techniques, a very specific flow rendering. For exam-ple, when it concerns the vortex structures of a flow, such structure is not directly accessiblein the result of a CFD simulation, while vortex has a great importance for both theoreticaland practical research. [5] proposed a simple and efficient vortex core region detection algo-rithm based on ideas derived from combinatorial topology. We can for example extract thecenters of vortex in the fluid, or other specific features that the user needs.Amount all these visualization techniques, we must choose some more accessible tech-niques. In a interactive scenario, users do not have much time to analyze data, so the showedresults must be very easy to understand.
In this section I will focus on how to interact with objects in 3D scene. The most commontasks are object selection and manipulation. The simplest way to select an object in a 3Denvironment using 3D mouse input is to use ray casting technique. This technique casts aray perpendicular to the pixel on the screen and compute the intersection between this rayand the nearest object considered as the selected 3D object.In fluid simulations, except selecting the solid object in the environment, fluid is the 3Dfield discretely stored on cells or points grid. If we want to choose a part of fluid in a 3D4igure 3: Comparison between direct(up) and geometric(down) flow visualizationenvironment, we have to use efficient picking paradigm to select cells or points that have tobe edited.Manipulating objects is another task we can perform in a 3D scene, for example movinga whole wall in the CFD simulation instead of set it cell by cell. One way to achieve thisis to use manipulators[13] to move the whole along x, y, z axis. Manipulators are definedas visible graphic representations displayed on the objects such as arrows, to allow user tochoose the direction of move of a wall object composed of several cells or point.Pointing and picking can also be improved by advanced 3D pointing techniques. Elmqvistand Fekete[3] developed an adaptation called semantic 3D pointing. This adaptation makespointing more accurate by shrinking empty space and expanding target sizes in motor space.This technique may be very useful for our case, as the fluid field mesh is very fine. If wewant to select a certain part of the simulation field, this technique increase the precision.
For our interactive fluid simulation approach, we designed and implement a distributedhardware and software architecture. One machine is dedicated to simulation, and the otherone runs a 3d scene including rendering and interaction features based on Unity 3D. On thecontrary to work of Florian De Vuyst et al. [2] in which simulation and rendering processwas done on the same GPU, we choose to design a generic network API to enable dataexchange between simulation and rendering software component, in order to easily extendsany existing simulation and visualisation tools with interactive simulation features.5igure 4: Design of the dam during the simulation in progressUsing this approach, users can interact with a simulation in progress in interactive time,modify the simulation conditions and parameters without stopping the simulation, or restartthe simulation from the beginning with new parameters or boundary condition.We choose
Palabos
Paraview , Unity makes user to quickly and easily develop customrendering and interaction techniques needed to steer a simulation in progress.
We made a benchmark to test the performance with the simulation of a 3D water dam. Weonly render and interact with a 2D cutting plane of 3D simulation inside
Unity 3D , and usercan set and move the shape of the 3D dam as shown in the Fig.4.This simulation of the water goes cross the dam includes 206080 cells, and for everysecond a simple laptop can run around 20 iterations.Reaching interactive time performance inside Unity 3D is important to avoid cybersick-ness [7], and the mean refresh rate obtained with direct flow rendering of the 70K trianglesmesh is about 60Hz, using a thread especially dedicated to network communication features.6able 1: Simulation with
Palabos
Simulation field × × (86400) cellsCPU for simulation i5-4200M 3.1GHzCalculation speed 10 iterations per secondResult data type Double(water interface mesh)Result output rate 1HzData transmitted ∼ We designed a system which allows users to interact with a fluid simulation in progresstargeting an application of serious game for pedagogical purposes. Our approach allowsuser to observe results of the simulation in progress in interactive time, and to directlyobserve the impact of modifying boundary condition or fluid parameters without restart thesimulation. We designed an API for the network communication between the simulationand the interaction, allowing to be suitable to any simulation or visualisation tools.We discussed about visualization and interaction techniques to manipulate and edit ob-jects in the 3D scene. The next step for us is to design and implement scenario in the contextof serious game, addressing more complex phenomena with the goal to optimize some globalparameters of the fluid, or to reach an given objective to the player, by modifying in inter-active time the parameter and conditions of the simulations.
References [1] R. P. Botchen, D. Weiskopf, and T. Ertl. Texture-based visualization of uncertainty inflow fields. In
Visualization, 2005. VIS 05. IEEE , pages 647–654. IEEE, 2005.[2] F. De Vuyst, C. Labourdette, and C. Rey. Gpu-accelerated real-time visualization andinteraction for coupled fluid dynamics.
Proceedings CFM 2013 , 2013.[3] N. Elmqvist and J.-D. Fekete. Semantic pointing for object picking in complex 3denvironments. In
Proceedings of graphics interface 2008 , pages 243–250. CanadianInformation Processing Society, 2008.[4] X. He and L.-S. Luo. Theory of the lattice boltzmann method: From the boltzmannequation to the lattice boltzmann equation.
Physical Review E , 56(6):6811, 1997.[5] M. Jiang, R. Machiraju, and D. S. Thompson. A novel approach to vortex core regiondetection. In
VisSym , pages 217–225, 2002.[6] A. J. Ladd. Numerical simulations of particulate suspensions via a discretized boltz-mann equation. part 1. theoretical foundation.
Journal of fluid mechanics , 271:285–309,1994.[7] J. J. LaViola Jr. A discussion of cybersickness in virtual environments.
ACM SigchiBulletin , 32(1):47–56, 2000.[8] D. R. Noble, S. Chen, J. G. Georgiadis, and R. O. Buckius. A consistent hydrodynamicboundary condition for the lattice boltzmann method.
Physics of Fluids , 7(1):203–209,1995. 79] R. Pausch, T. Crea, and M. Conway. A literature survey for virtual environments:Military flight simulator visual systems and simulator sickness.
Presence: Teleoperators& Virtual Environments , 1(3):344–363, 1992.[10] D. A. Perumal and A. Dass. Simulation of flow in two-sided lid-driven square cavitiesby the lattice boltzmann method.
Advances in fluid mechanics VII , 45:54, 2008.[11] F. H. Post, B. Vrolijk, H. Hauser, R. S. Laramee, and H. Doleisch. Feature extractionand visualization of flow fields.
Eurographics 2002 State-of-the-Art Reports , 1:69–100,2002.[12] M. T. Roberts, A. Mohraz, K. T. Christensen, and J. A. Lewis. Direct flow visualizationof colloidal gels in microfluidic channels.
Langmuir , 23(17):8726–8731, 2007.[13] P. S. Strauss, P. Issacs, and J. Shrag. The design and implementation of direct manip-ulation in 3d.
SIGGRAPH Course Notes , 12(2), 2002.[14] J. Yeomans. Mesoscale simulations: Lattice boltzmann and particle algorithms.