# Just-in-Time Fluid Flow Simulation on Mobile Devices Using OpenVisFlow and OpenLB
## 1 Introduction  
Computational fluid dynamics (CFD) has been a vital tool for understanding fluid behavior across various industries and academic domains. However, the practical application of CFD has been limited by the long computational time and complexity involved in building a simulation setup. In recent years, the integration of CFD into various software, including CAD, 3D computational graphic software like _Blender_ version 4.0.2 [1], and game engines like _Unity_ version 2023.2.10 [2] and _Unreal Engine_ version 5.3 [3], has become more prevalent due to its usefulness in observing fluid flow behavior. Various researchers have proposed innovative methods for applying CFD to different areas of interest. [PERSON] and [PERSON] [4] proposed using game engine technology to bridge the gap between architects and engineers in evaluating the effect of buildings on urban climate through CFD methods. [PERSON] [5] presented a rapid implementation of a fluid dynamics solver for game engines based on the physical equations of fluid flow, emphasizing stability and speed for _just-in-time_ performance. [PERSON] and [PERSON] [6] proposed the Fast Fluid Dynamics (FFD) method as an intermediate approach between nodal models and CFD, providing much richer flow information while being 50 times faster than CFD for conducting faster-than-just-in-time flow simulations for emergency management in buildings. [PERSON] et al. [7] introduced a mobile instructional particle image velocimetry (mI-PIV) tool for smartphones and tablets running Android that provides guided instruction to learners, enabling them to visualize and experiment with authentic flow fields in real time. [PERSON] et al. [8] explore the use of augmented reality (AR) technology in mobile devices for visualizing and interacting with CFD simulation results in the context of indoor thermal environment design. [PERSON] et al. [9] developed a GPU-accelerated, interactive simulation framework suitable for mobile devices, enabling the visualization of flow around particles. The Lattice Boltzmann Method (LBM), a versatile computational technique for simulating fluid flow, is integral to our approach. Renowned for its capability to handle intricate geometries, multiple phases, and mesoscale phenomena [10], the LBM operates on a lattice grid, utilizing probability distribution functions to model fluid behavior, and it is adaptable for parallel processing on diverse platforms. Recent advancements include the integration of multiple-relaxation-time schemes to enhance stability and efficiency, along with extensions for simulating thermal and multiphase flows [11; 12]. The LBM finds application in various scenarios, such as solving evaporating and boiling problems [13], observing particle behavior in particle-laden flows [14], simulating heat transfer [15], and more. Previously mentioned work [9] utilized a static domain with fixed inlets and outlets to create 2D simulations on tablets, which is limited to NVIDIA GPU-based devices. In this paper, we present a new application called _paint2 sim_ version 0.1, which extends the capabilities of _OpenVisFlow_ version 0.1 [16], a visualization library that introduced novel solutions to the challenges of a long computational time and complexity when targeting mobile devices. Leveraging the power of the LBM, _paint2 sim_ utilizes the open-source library _OpenCV_ version 4.8.1 [17] to enable on-the-fly, _just-in-time_ 2D simulations using the camera of a mobile device. Our approach is not limited to specific NVIDIA GPU-based mobile devices but is applicable to all Android devices. Furthermore, we incorporate AR capabilities through the scanning of physical objects. Moreover, in this paper, we compare the performance, demonstrating better results even while utilizing only one core. The aim of this approach is to enable users to generate a digital twin of a fluid domain using hand-drawn sketches, effectively converting their mobile devices into virtual laboratories for fluid dynamics.