원시데이터 수집 시스템
선정목록으로

An inverse analysis of fluid flow through granular media using differentiable lattice Boltzmann method

간접 관련 수소연료전지 · (5) 연료전지용 수분제어장치(가습기) (18) VENT(방수통기 부품)

기본 정보

저자
  1. Qiuyu Wang — Department of Civil, Architectural and Environmental Engineering, University of Texas at Austin, Austin, 78712-2100, USA
  2. Krishna Kumar — Department of Civil, Architectural and Environmental Engineering, University of Texas at Austin, Austin, 78712-2100, USA
DOI
10.1016/j.jrmge.2024.03.010
저널
Journal of Rock Mechanics and Geotechnical Engineering
발행년도
2024
발행기관
Elsevier BV
피인용수
3
라이선스
cc-by-nc-nd
논문 유형
–
언어
–
원문 페이지
https://doi.org/10.1016/j.jrmge.2024.03.010
토픽
Heat and Mass Transfer in Porous Media
OpenAlex ID
W4394859497

평가 내용

관련도
간접 관련
사업분야
수소연료전지 · (5) 연료전지용 수분제어장치(가습기)
부 분야
(18) VENT(방수통기 부품)
R&D 측면
분석·모델링
확신도
0.70
근거 용어
Lattice Boltzmann Method, permeability, fluid viscosity, porous media, inverse analysis
판단 근거
이 논문은 다공성 매질(porous media) 내의 유체 흐름을 역해석하는 수치 해석 방법론(LBM)을 다룹니다. 이는 코오롱인더스트리의 수소연료전지용 중공사막(5)이나 방수통기용 멤브레인(18)과 같은 다공성 막 소재의 투과성(permeability) 및 유체 거동을 모델링하고 분석하는 데 응용될 수 있습니다.
R&D 활용 포인트
연료전지용 중공사막이나 방수통기 멤브레인의 미세 기공 구조에 따른 유체(수증기, 공기)의 투과 성능을 예측하고, 최적의 기공 구조를 설계하기 위한 수치 해석 모델로 활용 가능합니다.
평가 입력
본문 60,532자 중 30,032자 발췌

초록

This study presents a method for the inverse analysis of fluid flow problems. The focus is put on accurately determining boundary conditions and characterizing the physical properties of granular media, such as permeability, and fluid components, like viscosity. The primary aim is to deduce either constant pressure head or pressure profiles, given the known velocity field at a steady-state flow through a conduit containing obstacles, including walls, spheres, and grains. The lattice Boltzmann method (LBM) combined with automatic differentiation (AD) (AD-LBM) is employed, with the help of the GPU-capable Taichi programming language. A lightweight tape is used to generate gradients for the entire LBM simulation, enabling end-to-end backpropagation. Our AD-LBM approach accurately estimates the boundary conditions for complex flow paths in porous media, leading to observed steady-state velocity fields and deriving macro-scale permeability and fluid viscosity. The method demonstrates significant advantages in terms of prediction accuracy and computational efficiency, making it a powerful tool for solving inverse fluid flow problems in various applications.

본문 60,532자

본문 펼치기
## An inverse analysis of fluid flow through granular media using differentiable lattice Boltzmann method Qiuyu Wang <sup>*</sup> _·_ Krishna Kumar Abstract In this study, we introduce an effective method for the inverse analysis of fluid flow problems, focusing on accurately determining boundary conditions and characterizing the physical properties of gran ular media, such as permeability, and fluid components, like viscosity. Our primary aim is to deduce either constant pressure head or pressure profiles, given the known velocity field at a steady-state flow through a conduit containing obstacles, including walls, spheres, and grains. We employ the lattice Boltzmann Method (LBM) combined with Automatic Differentiation (AD), facilitated by the GPU-capable Taichi programming language (AD-LBM). A lightweight tape is utilized to generate gradients for the entire LBM simulation, enabling end-to-end backpropagation. For complex flow paths in porous media, our AD-LBM approach accurately estimates the boundary conditions leading to observed steady-state velocity fields and consequently derives macro-scale permeability and fluid viscosity. Our method demonstrates significant ad vantages in terms of prediction accuracy and computational efficiency, offering a powerful tool for solving inverse fluid flow problems in various applications. 1 Introduction Accurate modeling of fluid flow through porous granular media is critical for diverse engineering applica tions, including hydrocarbon recovery optimization, grouts and filter design, and stability analysis against seepage. However, inverse prediction of the ideal boundary conditions or fluid properties to achieve a desired flow state remains challenging. Furthermore, this inverse problem is ill-posed and sensitive to measurement noise (Cheylan et al., 2019). Solving these inverse problems involves calculating functional gradients of the specified flow conditions (results) on a set of fluid state variables (inputs) and then minimizing the gradients to find optimal solutions (Plessix, 2006). However, traditional CFD tools are limited to forward Q. Wang, K. Kumar The University of Texas at Austin Civil, Architectural and Environmental Engineering Cockrell School of Engineering 301 E. Dean Keeton St. C2100, Austin, Texas 78712-2100, USA E-mail: wangqiuyu@utexas.edu 2 Qiuyu Wang <sup>*</sup>, Krishna Kumar differentiation and cannot efficiently calculate these reverse-mode gradients (Nørgaard et al., 2017). Spe cialized techniques like adjoint solvers, which require manually defining the gradient function of the forward problem or finite difference (FD) approximations, require extensive computations and memory for gradient estimation in time-dependent problems (Cheylan et al., 2019; Tekitek et al., 2006; Rokicki et al., 2016). FD gradient computation requires multiple runs and may suffer from numerical instabilities or experience van ishing gradients for small pertubations. Hence, there is a need for more specialized techniques to compute multi-parameter gradients for solving the optimization of fluid flow through granular media. Differentiable simulations combine automatic differentiation with gradient-based optimization to build a simulation framework that can compute derivatives relating output to its input (Battaglia et al., 2018; De B´ezenac et al., 2019). Treating simulation as a differentiable function facilitates parameter optimization and control. Moreover, unlike numerical approximations, automatic differentiation ensures accurate and efficient gradient computations. This combination of automatic differentiation with fluid simulation paves the way for integrating physical simulations with machine learning algorithms, opening up exciting avenues for research and applications in physics-informed machine learning and data-driven science. Differentiable simulation has significant implications for fluid flow through granular media, where it can provide a powerful tool for inverse problems and control tasks. For example, it can estimate the forces or boundary conditions that resulted in observed fluid flow or determine control inputs that would cause a fluid to move in a desired way. Despite the advancements, auto differentiation has limited applications in optimizing flow dynamics for shape and topology (Mohammadi and Pironneau, 2009; Rozvany and Lewi´nski, 2014). JAX-FLUIDS is another notable example of a fully differentiable high-order computational fluid dynamics code that leverages machine learning and differential programming to solve Navier-Stokes equations and simulate turbulence (Bezgin et al., 2023). This work presents a novel differentiable lattice Boltzmann model (LBM) for efficient inversion of fluid flows through granular media. Leveraging the automatic differentiation capabilities of the Taichi programming language, we develop an innovative framework to backpropagate through LBM simulations. We successfully demonstrate the determination of pressure boundary conditions from limited velocity data. Despite having access to only partial velocity fields, our approach can deduce full pressure profiles to within 10% average error. Furthermore, we showcase the ability to evaluate permeability and identify fluid viscosity matching observed flows within 4% error. Our differentiable LBM represents the first demonstrated method for optimizing complex granular media flows. This paradigm paves the way for integrating physical simulations with machine learning toward data-driven modeling of subsurface flow. While we focus on laminar steady-state cases, future efforts will aim to extend this approach to turbulent and transient flows. An inverse analysis of fluid flow through granular media using differentiable lattice Boltzmann method 3 2 Methodology 2.1 Lattice Boltzmann Method The fluid state at any point x =[x, y, z] <sup>_T_</sup> and time t is governed by the Navier-Stokes equations, which describe momentum and mass conservation for fluid flow. However, solving continuous partial differen tial equations numerically can be computationally demanding. The LBM offers an alternative mesoscopic approach based on kinetic theory models of fluids (Kr¨uger et al., 2017). In LBM, fluid dynamics emerge from collective behaviors of virtual particle distributions on a lattice. LBM solves a discretized version of the Boltzmann equation by locally streaming and colliding discrete par ticle populations. LBM can simulate macroscopic fluid flows efficiently while inherently including mesoscale interactions. The local nature of LBM is well-suited for coupling fluid dynamics with granular dynamics. (a) D2Q9 (b) Collision (c) Streaming Fig. 1: D2Q9 velocity sets. The square denoted by solid lines has an edge length dx. We use the D2Q9 scheme for 2D modeling and D3Q19 for 3D modeling. The number of discrete velocities is denoted by Q. Figure 1 shows the D2Q9 velocity sets as well as the collision and streaming stages in LBM simulation. As seen in Figure 1a, the lattice was created by dividing the fluid domain into an equally spaced grid in 9 or 19 directions, and each intersection of the grid was referred to as a lattice node. The particle distribution function, _fi_, was associated with each lattice node at each discrete direction, i, which represented the density of particles with velocity _ci_ at that node. _ρ_ = 19 _i_ =0 _fi,_ (1) Macroscopic quantities such as mass density, rho, or fluid velocity, _u_, which are usually of interest in fluid dynamics, could be calculated from the distribution functions using the lattice Boltzmann equation: _ρ_ _u_ = 19 _i_ =0 _fi_ _c_ _i,_ (2) 4 Qiuyu Wang <sup>*</sup>, Krishna Kumar Following the definition of the velocities, an evolution rule is applied to solve the Boltzmann equation at every time increment: _fi_ ( _x_ + _c_ _i∆t, t_ + _∆t_ ) = _fi_ ( _x_ _, t_ ) + Ω _col,_ (3) where _x_ is the position of the lattice node, _t_ is the current time and Ω _col_ is the Bhatnagar–Gross–Krook (BGK) collision operator (d’Humieres et al., 1986), corresponding to Figure 1b: Ω _col_ = <sup>_<u>fi −</u>_</sup> <sup>_<u>f</u>_</sup> _<u>i</u>_ <sup>_eq_</sup> _∆t,_ (4) _τ_ During collision, the collision operator depends on the relaxation time _τ_ which we use _τ_ = _∆t_ in our simulations. The equilibrium distribution function, _fi_ <sup>_eq_</sup>, in Eq. (4) is given by, <sup>_<u>·</u>_</sup> <sup>_<u>u</u>_</sup> ) _,_ (5) 2 _c_ <sup>2</sup> _s_ _i_ <sup>_eq_</sup> = _ωiρ_ (1 + <sup>_<u>u</u>_</sup> <sup>_<u>·</u>_</sup> <sup>_<u>c</u>_</sup> <sup>_<u>i</u>_</sup> + <sup><u>(</u></sup> <sup>_<u>u</u>_</sup> <sup>_<u>·</u>_</sup> <sup>_<u>c</u>_</sup> <sup>_<u>i</u>_</sup> <sup><u>)2</u></sup> <sup>_<u>·</u>_</sup> <sup>_<u>c</u>_</sup> <sup>_<u>i</u>_</sup> <sup><u>)2</u></sup> _−_ <sup>_<u>u</u>_</sup> <sup>_<u>·</u>_</sup> <sup>_<u>u</u>_</sup> 2 _c_ <sup>4</sup> _s_ 2 _c_ <sup>2</sup> _s_ _fi_ <sup>_eq_</sup> _c_ <sup>2</sup> _s_ where _ωi_ as the corresponding weights. After a collision, the updated distribution functions are streamed according on their velocities: each _fi_ is pushed one lattice node in the _i_ direction, as shown in Figure 1c. To simulate the fluid flow driven by a constant pressure difference between the inlet and outlet faces, we employ the anti-bounced back conditions at boundary (Ginzburg et al., 2008): _fi_ ( _xb, t_ + _∆t_ ) = _−fi_ ( _xb, t_ ) + 2 _ωiρw_ (1 + <sup><u>(</u></sup> <sup>_<u>u</u>_</sup> <sup>_<u>·</u>_</sup> <sup>_<u>c</u>_</sup> <sup>_<u>i</u>_</sup> <sup><u>)2</u></sup> <sup>_<u>·</u>_</sup> <sup>_<u>u</u>_</sup> ) _,_ (6) 2 _c_ <sup>2</sup> _s_ <sup>_<u>·</u>_</sup> <sup>_<u>c</u>_</sup> <sup>_<u>i</u>_</sup> <sup><u>)2</u></sup> _−_ <sup>_<u>u</u>_</sup> <sup>_<u>·</u>_</sup> <sup>_<u>u</u>_</sup> 2 _c_ <sup>4</sup> _s_ 2 _c_ <sup>2</sup> _s_ where _ρw_ is the constant fluid density of the boundary nodes ( _x_ = _xb_ ) leading to a constant fluid pressure. In LBM simulations, the parameters such as grid spacing (dx), timestep (dt), and relaxation time ( _τ_ ) are set to 1 in dimensionless lattice units. Establishing geometric and dynamic similarity between physical and lattice scales is a crucial step, which is achieved by matching dimensionless parameters like Reynolds number ( _Re_ ), Rayleigh number, Nusselt number, and Weber number, among others. Regardless of fluid velocity, geometric scale, or viscosity differences, flows with identical Reynolds numbers are deemed comparable. These dimensionless numbers allow the derivation of physical properties from LBM simulations, such as permeability, thermal conductivity, and formation factor. The accuracy of the numerical solutions for these physical properties from LBM simulations can be relied upon, even in cases of significant geometric complexity. This process applies to LBM simulations employing a BGK collision operator (Huang et al., 2015; Baakeem et al., 2021). 2.2 Differentiable Lattice Boltzmann Simulation For computing the gradients in simulations, there are four possible methods (Gunes Baydin et al., 2015; Margossian, 2019): (1) manual differentiation; (2) finite difference or other numerical approximations; (3) An inverse analysis of fluid flow through granular media using differentiable lattice Boltzmann method 5 (a) Forward mode (b) Reverse mode Fig. 2: Directed Acyclic Graph (DAG) of _f_ ( _x, y_ ) = _x_ <sup>2</sup> + _xy_ . symbolic differentiation; and (4) automatic differentiation (AD). Manual differentiation is time-consuming and impractical for complex with many parameters. Numerical differentiation involves computing the finite difference approximation of derivatives by incorporating a tiny increment to the original function. The finite difference approximation is inaccurate because of truncation and round-off errors (Jerrell, 1997; Burden et al., 2015). Symbolic differentiation calculates the derivative of a mathematical function using its symbolic representation, providing a precise solution without approximations. However, it can result in the problem of ”expression swell,” yielding complex and lengthy expressions (Corliss, 1988). Automatic differentiation (AD) combines the power of symbolic and numerical differentiation by breaking down numerical computations into simple differentiable operators, allowing for efficient and accurate computation of derivatives. Hence, AD is a powerful candidate for solving gradients to infer unknown parameters in fluid flow problems. 6 Qiuyu Wang <sup>*</sup>, Krishna Kumar We develop a fully differentiable 2D/3D LBM solver using the domain-specific Taichi programming language (Hu et al., 2019a). To tackle the differential operators inherent in the inverse simulation of Lattice Boltzmann equations (reverse-mode differentiation), we employ automatic differentiation, which delivers substantial improvements in computational efficiency compared to numerical differentiation meth ods (Gunes Baydin et al., 2015). AD cleverly circumvents the drawbacks of numerical and symbolic differen tiation by constructing a computational Directed Acyclic Graph (DAG), where nodes represent operations or variables, and edges signify the dependency between them. The flow of this graph captures the se quence of elemental functions and their derivative calculations, providing a precise mechanism for gradient calculation. Figure 2 shows an example of forward and reverse mode automatic differentiation using a Directed Acyclic Graph (DAG). Consider the function _f_ ( _x, y_ ) = _x_ <sup>2</sup> + _x×y_ . In the forward mode of AD, computations proceed from the input variables to the output function, following the topological ordering of the graph, as shown in Fig. 2a. For example, if _x_ = 1 and _y_ = 2, then _f_ ( _x, y_ ) = 1 <sup>2</sup> + 1 _×_ 2. In the reverse mode AD, often known as backpropagation in neural networks. Computations proceed in the opposite direction, from the output function back to the inputs, as illustrated in Fig. 2b. At each node, the gradient, represented by _∇_, is calculated with respect to the input variable. To compute the gradients with respect to the input, we perform a chain rule traversing every node from the output to the input node. Using the same example with _x_ = 1 and _y_ = 2, the gradients are _∇f_ ( _x, y_ ) = (4 _,_ 1). This mode is especially useful when the function has many inputs and few outputs. It computes the derivatives of a single output with respect to all inputs in a single pass. As the computational DAG is traversed, nodes are updated using the chain rule of differentiation, ensuring accurate and efficient gradient calculations. Hence, forward and reverse mode ADs provide a flexible, robust, and efficient framework for calculating derivatives in numerical simulations. Similar to a DAG-based AD in Fig. 2, we construct a computational DAG for the LBM simulation. Fig ure 3 shows the computational DAG representing a single D2Q9 LBM cell. Each stage of the LBM pro cess—”Initialization,” ”Collision,” ”Streaming,” ”Boundary Fixation,” ”Bounce Back,” and ”Redistribu tion”—is represented as a node in the DAG, and the directed connections between these nodes represent the computational flow. We represent the AD-LBM process as a high-level abstraction known as the Intermediate Representation (IR) graph. The IR graph operates within compilers as a transitional platform between the source and target machine codes, which the computer’s hardware executes. The Taichi programming language constructs this IR graph by monitoring the invoked kernels and displaying the computations of the forward kernels with respect to the inputs (Hu et al., 2019a). We traverse the forward IR graph in reverse order to generate reverse mode gradients and incorporate appropriate gradient computations for each active function (node) in the forward mode computational graph (Griewank and Walther, 2008). A lightweight tape gradient is employed An inverse analysis of fluid flow through granular media using differentiable lattice Boltzmann method 7 Fig. 3: Directed Acyclic Graph (DAG) Representation of lattice Boltzmann Method Simulation Stages with two time steps and 2×2×2 domain division. to log the forward kernel launches and replay the gradient kernels in reverse order for backpropagation (Hu et al., 2019b). Fig. 4: Flowchart of LBM simulation of fluid flow employing Taichi differentiable simulators. 8 Qiuyu Wang <sup>*</sup>, Krishna Kumar Finally, we combine the AD-LBM solver with a gradient-based optimization approach to build a dif ferentiable simulator. Figure 4 shows the workflow of a differentiable LBM simulation capable of solving inverse or design problems involving fluid flow. The LBM differentiable simulator consists of two stages: computing the gradients using automatic differentiation in the reverse mode and a gradient-based opti mizer. The differentiable LBM simulation has three stages: initialization, time iterations, and loss function computation. In each time step of the LBM solver, we use AD to compute the time and spatial derivatives for the objective field(s) based on the loss function and accumulate the gradients through the simulation. We use gradient-based optimizers, Stochastic Gradient Descent, and ADAM, to solve inverse problems. Consider the problem of identifying the pressure boundary conditions that cause a particular velocity field distribution in a granular media. In this inverse problem, we iteratively optimize the boundary pressure by minimizing the loss function on the known velocity distribution. The loss function is computed as the sum of the squared differences between the simulated velocity norm at each fluid node and the observed values at the target time step. The core kernel function for differentiable simulation to evaluate the loss based on the velocity prediction is shown below: 1 `@ti.kernel` 2 `def` `compute_loss ():` 3 `#` `Loop` `over` `the` `velocity` `field` 4 `for` `I` `in` `ti.grouped(v):` 5 `loss[None ]+=` `(v[I]. norm()- target_v[I]. norm ())**2` 6 `#` `"loss"` `is` `a` `scalar` `(0-D` `tensor)` `and` `indexed` `by` `[None ].` To calculate the boundary condition of the input pressure profile, we use the tape gradient in the LBM differential simulator ‘ti.ad.Tape()‘ on the kernel function to compute the gradient of the inlet pressure profile as inlet ~~p~~ ressure.grad[None](= _∂inlet∂losspressure_ <sup>).</sup> <sup>‘</sup> 1 `learning_rate` `=` `0.01` 2 `#` `Initial` `guess` `of` `unknown` `pressure` `at` `inlet` 3 `loss[None]` `=` `0.` 4 `inlet_pressure [None]` `=` `0.6` 5 `for` `iteration` `in` `range (100):` 6 `#` `Initialize` `simulation` 7 `init_field ()` 8 `#` `Run` `simulation` `for` `5000` `time` `steps` 9 `for` `step` `in` `range (5000):` 10 `with` `ti.ad.Tape(loss)` 11 `boundary_condition ()` An inverse analysis of fluid flow through granular media using differentiable lattice Boltzmann method 9 12 `collision ()` 13 `streaming ()` 14 `compute_loss ()` 15 `if` `loss[None]` `==` `0:` 16 `break` 17 `#` `Gradient` `descent` 18 `inlet_pressure [None]` `+=` `inlet_pressure .grad[None]` `*` 19 `learning_rate` The gradients are propagated and evaluated through all variables and operations in the LBM simulation. Our simulations involve 10 <sup>4</sup> 10 <sup>7</sup> cells to model fluid flow through the granular media. We track all global tensors allocated to store the entire simulation state, including loss and inlet pressure scalars and 2D/3D tensors (density, velocity, force, pressure, _etc._ ). Using ‘ti.root.lazy grad()’, the velocity field (‘v’), loss, inlet pressure, and other tensors involved in a derivative chain are automatically positioned in the adjoint fields in accordance with the layout of their primal fields 3 Result and Discussion 3.1 Inferring boundary conditions from flow characteristics _3.1.1_ _Single-parameter_ _inverse_ _of_ _boundary_ _conditions_ _Optimizing_ _boundary_ _conditions_ _for_ _pipe_ _flow_ We demonstrate the capability of differentiable LBM to infer boundary conditions from observed flow velocities. We first simulate 2D laminar flow in a pipe with a thin obstacle plate as a test case. The aim is to estimate the constant pressure inlet boundary condition that drives this flow, using the resulting steady-state velocity field as a single-parameter inverse problem. Figure 5a shows the steady-state velocity field of laminar flow in a 2D pipe (width 50 lu, length 300 lu) with a thin obstacle plate (width 1 lu, length 30 lu) at x = 80 lu. The flow is driven by a constant pressure difference of 0.05 mass units (mu)·length units (lu) <sup>_−_</sup> <sup>1</sup> ·time units (ts) <sup>_−_</sup> <sup>2</sup> between the inflow and outflow. We allow the velocity field 40,000 timesteps to reach steady state when the kinetic energy plateauing below 10 <sup>_−_</sup> <sup>4</sup> (lu)(ts) <sup>_−_</sup> <sup>1</sup> standard deviation. The number of time steps required for the LBM to reach steady state is dependent on the spatial discretization of the fluid domain. A larger number of fluid nodes in the computational grid leads to an increased number of time steps needed to converge to a stable solution. To estimate the inlet pressure boundary, we initialize with a lower pressure of 0.0025 (mu)·(lu) <sup>_−_</sup> <sup>1</sup> (ts) <sup>_−_</sup> <sup>2</sup> and compute the loss function between the simulated velocities and the target field. The target field is only observed at the outflow region (x _≥_ 275 lu) to simulate limited sensor data, as shown in Figure 5b. Accordingly, we define the loss function by computing the difference between LBM velocities _ux,y_ ( _p_ ) and 10 Qiuyu Wang <sup>*</sup>, Krishna Kumar (a) (b) Fig. 5: AD-LBM simulation of steady laminar flow through a 2D pipe (width 50 lu, length 300 lu) containing an obstruction plate (width 1 lu, length 30 lu) situated at _x_ = 80 lu: (a) velocity field driven by imposed inlet-outlet pressure difference of (mu)·(lu) <sup>_−_</sup> <sup>1</sup> (ts) <sup>_−_</sup> <sup>2</sup> ; (b) unknown variables (inflow pressure and velocity field at _x <_ 275 lu) and known variables (outflow pressure and target outlet velocities field at _x ≥_ 275 lu). target velocities _|u_ <sup>_target_</sup> _x,y_ <sup>)</sup> _|_ . It is defined as the summed squared errors over the lattice in this region of interest: _Ny_ _y_ �2 _,_ (7) ��� ��� _ux,ytarget_ _loss_ ( _p_ ) = _Nx_ _x_ _f_ ( _x, y_ ) _· |ux,y_ ( _p_ ) _| −_ with _Nx_ and _Ny_ being the number of LBM grids in x and y dimensions, _|ux,y_ ( _p_ ) _|_ is the norm of simulated velocity when the pressure p is applied at a specified boundary. _|u_ <sup>_target_</sup> _x,y_ _|_ is the norm of target velocity. The function _f_ ( _x, y_ ) defines the region of interest. For example, _f_ ( _x, y_ ) is set to 1 for x _≥_ 275 lu and 0 for x ¡ 275 lu to only compute loss at the outlet region based on observed target data. Using the gradients from AD, we iteratively update the inlet pressure to minimize this loss function and match the observed target velocities. Figure 6 shows the optimization of inlet pressure boundary conditions using AD-LBM for obstructed pipe flow. The inlet pressure is updated each iteration to minimize loss between simulated and target outlet velocity fields, converging to the true pressure difference of 0.05 (mu)·(lu) <sup>_−_</sup> <sup>1</sup> (ts) <sup>_−_</sup> <sup>2</sup> that generates the target flow. After 20 iterations using a learning rate of 0.05, the loss decreases to 10 <sup>_−_</sup> <sup>5</sup> (lu) <sup>2</sup> (ts) <sup>_−_</sup> <sup>2</sup> . It demonstrates that even when using a limited target velocity field observation near the outlet, the AD-LBM approach efficiently determines the target boundary condition of 0.0025 (mu)·(lu) <sup>_−_</sup> <sup>1</sup> (ts) <sup>_−_</sup> <sup>2</sup> . _Optimizing_ _boundary_ _conditions_ _for_ _for_ _fluid_ _flow_ _through_ _a_ _granular_ _media_ We now evaluate a more complex inverse problem of inferring the boundary condition for a laminar flow through a 2D granular packing using AD-LBM. When simulating a porous media flow in 2D, an important consideration is non An inverse analysis of fluid flow through granular media using differentiable lattice Boltzmann method 11 Fig. 6: Directed Acyclic Graph (DAG) Representation of lattice Boltzmann Method Simulation Stages with two time steps and 2×2×2 domain division. (a) t = 0 ts (b) t = 100 ts (c) t = 500 ts (d) t = 1000 ts (e) t = 2500 ts (f) t = 5000 ts Fig. 7: Evolution of velocity field in LBM simulation for a laminar flow driven by a constant inlet pressure of (mu)·(lu) <sup>_−_</sup> <sup>1</sup> (ts) <sup>_−_</sup> <sup>2</sup> through 2d granular packing. 12 Qiuyu Wang <sup>*</sup>, Krishna Kumar interconnected pore space when circular grains come in contact. In reality (3D), the pore spaces between the grains will allow fluid flow perpendicular to the reference plane. We solve the 2D artifact by adopting a hydrodynamic radius, a reduced radius of 0.9R only for the LBM computations (Soundararajan, 2015), where R is the actual radius of each grain. The hydrodynamic radius can be considered a 2D representation of the 3D permeability of the granular material. Figure 7 shows the evolution of the velocity field of a lami nar flow driven by a constant pressure difference through 2D granular packing with the grains set immobile. This approach of immobilizing the grains enables isolating the effects of fluid flow on the granular media and a more focused investigation of the fluid flow dynamics. The flow is fully developed when the velocity reaches the top of the granular media. As seen in Fig. 7, the fluid flow reaches equilibrium after 5000 time steps. (a) (b) Fig. 8: AD-LBM optimization of inlet pressure boundary conditions for laminar flow through 2d granular packing: (a) estimating unknown inlet pressure based on target outlet velocities (y _≥_ 180 lu); (b) differentiation paths using two different inlet pressures. We limit the target velocity field data to y _≥_ 180 lu at time step 5000 ts, which yields velocity at 2300 fluid nodes. Figure 8 shows the evolution of velocity loss utilizing AD-LBM simulation. As illustrated in Figure 8a, the inlet pressure boundary condition was unknown, while the target velocity field and the granular packing were known. We initialized simulations using two different inlet pressures - one higher at 0.693 (mu)·(lu) <sup>_−_</sup> <sup>1</sup> (ts) <sup>_−_</sup> <sup>2</sup> and one lower at 0.292 (mu)·(lu) <sup>_−_</sup> <sup>1</sup> (ts) <sup>_−_</sup> <sup>2</sup> than the real target value. For inferring constant inlet pressure, the loss function decreased to 10-6 (lu) <sup>2</sup> (ts) <sup>_−_</sup> <sup>2</sup> after 10 iterations, approaching the target pressure difference of 0.05 (mu)·(lu) <sup>_−_</sup> <sup>1</sup> (ts) <sup>_−_</sup> <sup>2</sup>, independent of initial guesses above or below the target as seen in Figure 8b. Therefore, the case studies of the obstructed pipe flow and flow through 2D granular An inverse analysis of fluid flow through granular media using differentiable lattice Boltzmann method 13 packing demonstrate the ability of the AD-LBM to converge to an optimal solution for single-parameter optimization problems. _3.1.2_ _Multi-parameter_ _inverse_ _of_ _boundary_ _conditions_ We now demonstrate a multi-parameter inversion using AD-LBM to identify a variable pressure boundary condition based on the target flow velocities at the top of a granular media. We apply a target pressure boundary as a cubic spline by varying the fluid densities at the inlet, as shown in Figure 9a. Our goal is to find the derivative of loss of the velocity profiles at the outlet with respect to the input pressure profile, given the observation of the target velocity field for y _>_ 180 lu. The ’inlet ~~p~~ ressure’ is no longer a constant but a 1D tensor of 200 elements, for x ranging from 0 lu to 199 lu and y = 0. (a) (b) (c) 14 Qiuyu Wang <sup>*</sup>, Krishna Kumar (d) Fig. 9: AD-LBM optimization of variable inlet pressure profile for 2D laminar flow through granular media based on outlet target velocity data (y _>_ 180 lu): (a) target pressure profile and induced velocity field; (b) inferred pressure profile and induced velocity field after 99 iterations; (c) comparison of the target velocity field (top) and inferred velocity field (bottom); and (d) loss and inferred pressure profiles for the first 100 iterations. Figure 9 illustrates AD-LBM optimization of a non-uniform inlet pressure profile based on limited target velocity data. Figure 9a-b shows the comparison of the target and inferred velocity field as well as the inlet pressure profile. Figure 9c compares the target velocity field (top) and the inferred velocity field after 99 iterations (bottom). Figure 9d shows the loss and inferred pressure profiles for the first 100 iterations. As an initial guess, we set the inlet pressure to be uniform at 0.32 (mu)·(lu) <sup>_−_</sup> <sup>1</sup> (ts) <sup>_−_</sup> <sup>2</sup> . We use a learning rate of 0.01 for optimization. The loss function requires 100 iterations to reduce from 4.62 (lu) <sup>2</sup> (ts) <sup>_−_</sup> <sup>2</sup> to 0.064 (lu) <sup>2</sup> (ts) <sup>_−_</sup> <sup>2</sup> . After 100 iterations, the inferred inlet pressure profile matches the target pressure profile reasonably well, giving a root-mean-squared-error (RMSE) of 0.0254 (mu)·(lu) <sup>_−_</sup> <sup>1</sup> (ts) <sup>_−_</sup> <sup>2</sup>, RMSE = ~~�~~ <u>1</u> _N_ <u>�</u> _Ni_ =1 <sup>(</sup> <sup>_P_</sup> <sup>target</sup> <sup>_,i −_</sup> <sup>_P_</sup> <sup>inferred</sup> <sup>_,i_</sup> <sup>)2</sup> <sup>where</sup> <sup>N</sup> <sup>=</sup> <sup>200</sup> <sup>is</sup> <sup>the</sup> <sup>number</sup> <sup>of</sup> <sup>nodes</sup> <sup>at</sup> <sup>the</sup> <sup>inlet,</sup> <sup>Ptarget,i</sup> and Pestimated, i are the target and inferred pressure at x = i and y = 0, respectively. Figure 9c-d also shows that the inferred velocity field matches the observed velocity field for the pressure profile with a velocity magnitude error of 0.064 (lu) <sup>2</sup> (ts) <sup>_−_</sup> <sup>2</sup> . Unlike the single-parameter cases, the loss function for the variable inlet pressure profile did not converge below 10 <sup>_−_</sup> <sup>5</sup> (lu) <sup>2</sup> (ts) <sup>_−_</sup> <sup>2</sup>, highlighting difficulties in matching non uniform boundaries. Nevertheless, the consistency in the velocity field suggests that AD-LBM has promising capabilities in solving inverse problems for non-trivial boundary conditions in realistic flow scenarios. We can improve the slower convergence using a better initial guess through a neural network in future studies. An inverse analysis of fluid flow through granular media using differentiable lattice Boltzmann method 15 3.2 Approximation of Permeability for Porous Media In addition to inferring boundary conditions, the AD-LBM provides an integrated way to estimate the permeability of porous media. Each data point along the differentiation path represents a fully developed steady-state laminar flow solution. This enables permeability to be derived by directly applying Darcy’s law to the AD-LBM simulations. We compared LBM-derived permeabilities against empirical solutions for 2D and 3D granular packings using the Carman-Kozeny (CK) equation, based on Poiseuille flow in a pipe: _kCK_ = _Φs_ <sup>2</sup> _ε_ <sup>3</sup> _Dp_ <sup>2</sup> _ΦCK_ (1 _−_ _ε_ ) <sup>2</sup> <sup>_,_</sup> (8) where _kCK_ is the permeability, _ε_ is the porosity, _Dp_ is the mean grain diameter, _ΦCK_ = 180 is the Kozeny shape factor (Yazdchi et al., 2011), and _Φs_ is the sphericity of the particles. _Φs_ equals 1 for purely spherical grains. For the 2D granular packing shown in Fig. 9, _Dp_ = 1 _._ 18 mm and _ε_ = 0 _._ 489. Substituting these values into Eq. (8) gives an analytical permeability of _kCK_ = 3 _._ 164 _×_ 10 <sup>_−_</sup> <sup>9</sup> m <sup>2</sup> . Note that the conversion from lattice units to physical units is <sup>_<u>L</u>_</sup> _L_ <sup><u>physical</u></sup> LBM = 10 <sup>_−_</sup> <sup>4</sup> m·(lu) <sup>_−_</sup> <sup>1</sup>, where _L_ physical is the physical length in meters, and _L_ LBM is the lattice length in lattice units. Converting the LBM-derived permeability to physical permeability requires defining consistent LBM units for mass (mu), time (ts), and density to match physical fluid properties. The fluid domain is initialized with a uniform density of 1 mu _·_ (lu) <sup>_−_</sup> <sup>3</sup>, corresponding to the density of water (1000 kg _·_ m <sup>_−_</sup> <sup>3</sup> ). The mean fluid density _ρ_ fluid represents the total fluid mass divided by the volume and depends on the pressure difference _∂P_ . A higher _∂P_ increases _ρ_ fluid. With _∂P_ = 0, the volume of 1 (lu) <sup>3</sup> has the mass _ρ_ fluid _×_ 1 (lu) <sup>3</sup> = 1 mu which equals 1000 kg _·_ m <sup>_−_</sup> <sup>3</sup> _×_ (10 <sup>_−_</sup> <sup>4</sup> m _·_ (lu) <sup>_−_</sup> <sup>1</sup> ) <sup>3</sup> = 10 <sup>_−_</sup> <sup>9</sup> kg. Thus, 1 mu = 10 <sup>_−_</sup> <sup>9</sup> kg for _∂P_ = 0. For a _∂P_ = 0 _._ 276 mu _·_ (lu) <sup>_−_</sup> <sup>1</sup> _·_ (ts) <sup>_−_</sup> <sup>2</sup>, _ρ_ fluid = 1 _._ 40 mu _·_ (lu) <sup>_−_</sup> <sup>3</sup> . This gives 1 _._ 40 mu _·_ (lu) <sup>_−_</sup> <sup>3</sup> _×_ 1 (lu) <sup>3</sup> = 10 <sup>_−_</sup> <sup>9</sup> kg, so 1 mu = 7 _._ 14 _×_ 10 <sup>_−_</sup> <sup>10</sup> kg. We use the correlation between the kinematic viscosity of a fluid to determine the time in the physical and lattice scales. The kinematic viscosity of water equals and _νphysical_ = 10 <sup>_−_</sup> <sup>6</sup> m <sup>2</sup> /s in physical units. In contrast, the kinematic viscosity of water in LBM is defined as _s_ <sup>2(</sup> <sup>_τ_</sup> <sup>_−_</sup> <sup>_<u>∆t</u>_</sup> 2 _νLBM_ = _cs_ <sup>2</sup> 2 <sup>)</sup> <sup>_,_</sup> (9) where _τ_ is the dimensionless relaxation time and _cs_ is the isothermal speed of sound, given as _cs_ = <sup><u>1</u></sup> 3 _∆t_ <sup><u>1</u></sup> 3 _<u>∆x∆t</u>_ for the velocity sets used. We use the BGK operator, hence, _τ_ = _∆t_ . Therefore, _ν_ LBM can be written as: _νLBM_ = <sup>_<u>∆x</u>_</sup> <sup>2</sup> (10) 6 _∆t_ <sup>_,_</sup> where _∆x_ and _∆t_ are set to unity for simplicity, giving _∆x_ = 1 lu and _∆t_ = 1 ts. By setting _ν_ LBM = _ν_ physical, 1 ts = 1 _._ 67 _×_ 10 <sup>_−_</sup> <sup>3</sup> s. Thus, the pressure difference of _∂P_ = 0 _._ 276 mu _·_ (lu) <sup>_−_</sup> <sup>1</sup> _·_ (ts) <sup>_−_</sup> <sup>2</sup> corresponds 16 Qiuyu Wang <sup>*</sup>, Krishna Kumar to a pressure gradient of <sup>_<u>∂P</u>_</sup> _∂x_ <sup>=</sup> <sup>1</sup> <sup>_._</sup> <sup>38</sup> <sup>_×_</sup> <sup>10</sup> <sup>_−_</sup> <sup>3 mu</sup> <sup>_·_</sup> <sup>(lu)</sup> <sup>_−_</sup> <sup>2</sup> <sup>_·_</sup> <sup>(ts)</sup> <sup>_−_</sup> <sup>2</sup> <sup>=</sup> <sup>35</sup> <sup>_._</sup> <sup>36 Pa</sup> <sup>_·_</sup> <sup>m</sup> <sup>_−_</sup> <sup>1.</sup> <sup>The</sup> <sup>mean</sup> <sup>fluid</sup> <sup>velocity</sup> _U_ = 3 _._ 88 _×_ 10 <sup>_−_</sup> <sup>3</sup> mu _·_ (ts) <sup>_−_</sup> <sup>1</sup> = 2 _._ 33 _×_ 10 <sup>_−_</sup> <sup>4</sup> m _·_ s <sup>_−_</sup> <sup>1</sup> . With the knowledge of channel width _D_ = 200 lu = 0 _._ 02 m, mean fluid velocity _U_, and fluid kinematic viscosity _ν_, we derive the dimensionless Reynolds number as: _Re_ = <sup>_<u>UD</u>_</sup> 2 _ν_ = <sup><u>3</u></sup> <sup>_<u>.</u>_</sup> <sup><u>88</u></sup> <sup>_<u>×</u>_</sup> <sup><u>10</u></sup> <sup>_−_</sup> <sup>3 mu/ts</sup> <sup>_<u>×</u>_</sup> <sup><u>200 lu</u></sup> (11) 2 _×_ 0 _._ 167 mu <sup>2</sup> _/_ ts = <sup><u>2</u></sup> <sup>_<u>.</u>_</sup> <sup><u>33</u></sup> <sup>_<u>×</u>_</sup> <sup><u>10</u></sup> <sup>_−_</sup> <sup>4 m/s</sup> <sup>_<u>×</u>_</sup> <sup><u>0</u></sup> <sup>_<u>.</u>_</sup> <sup><u>02 m</u></sup> = 2 _._ 33 _,_ 2 _×_ 10 <sup>_−_</sup> <sup>6</sup> m <sup>2</sup> _/_ s Since _Re_ is as low as 2.33, the flow simulated by LBM is laminar and comparable to the physical flow. We can calculate the permeability using Darcy’s law: _kLBM_ = <sup>_<u>ρfluid</u>_</sup> _<u>∂p</u>_ <sup>_<u>νU</u>_</sup> _∂x_ _,_ (12) Accordingly, the AD-LBM yields kLBM = 0.317 (mu) <sup>2</sup>, corresponding to the physical permeability _kphysical_ = 3 _._ 17 _×_ 10 <sup>_−_</sup> <sup>9</sup> m <sup>2</sup> . The permeability determined by LBM simulation is extremely close to the permeability predicted by the CK model ( _kCK_ = 3 _._ 164 _×_ 10 <sup>_−_</sup> <sup>9</sup> m <sup>2</sup> ). The permeability value calculated from LBM simulation is in dimensionless lattice unit, and it may be converted to physical unit using (Sukop et al., 2013): _kphysical_ = _kLBM_ ( <sup>_<u>Lphysical</u>_</sup> _LLBM_ ) <sup>2</sup> _,_ (13) By substituting <sup>_<u>L</u>_</sup> _L_ <sup>_<u>physical</u>_</sup> _LBM_ = 10 <sup>_−_</sup> <sup>4</sup> m/lu, we can easily derive the same value of _kphysical_ . Table 1: Unit conversion of variables for 2D laminar flow problem. Reference Variables in Physical-Scale and Lattice-Scale Reference Variables Physical-Scale Lattice-Scale Mass 7 _._ 14 _×_ 10 <sup>_−_</sup> <sup>10</sup> kg 1 mu Time 0.00167 s 1 ts Length 10 <sup>_−_</sup> <sup>4</sup> m 1 lu Converting properties between scales Properties Physical-Scale Lattice-Scale Reynolds number ( _Re_ ) 2.33 2.33 Mean fluid density ( _ρ_ fluid) 1000 kg _·_ m <sup>_−_</sup> <sup>3</sup> 1.40 (mu) _·_ (lu) <sup>_−_</sup> <sup>3</sup> Pressure gradient ( _∂P/∂x_ ) 35.36 Pa _·_ m <sup>_−_</sup> <sup>1</sup> 1 _._ 38 _×_ 10 <sup>_−_</sup> <sup>3</sup> (mu) _·_ (lu) <sup>_−_</sup> <sup>2</sup> _·_ (ts) <sup>_−_</sup> <sup>2</sup> Kinematic viscosity ( _ν_ ) 10 <sup>_−_</sup> <sup>6</sup> m <sup>2</sup> _·_ s <sup>_−_</sup> <sup>1</sup> 0.167 (lu) <sup>2</sup> _·_ (ts) <sup>_−_</sup> <sup>1</sup> Dynamic viscosity ( _µ_ ) 10 <sup>_−_</sup> <sup>3</sup> Pa _·_ s <sup>_−_</sup> <sup>1</sup> 0.234 (mu) _·_ (lu) <sup>_−_</sup> <sup>1</sup> _·_ (ts) <sup>_−_</sup> <sup>1</sup> Mean fluid velocity (U) 2 _._ 33 _×_ 10 <sup>_−_</sup> <sup>4</sup> m _·_ s <sup>_−_</sup> <sup>1</sup> 3 _._ 88 _×_ 10 <sup>_−_</sup> <sup>3</sup> (lu) _·_ (ts) <sup>_−_</sup> <sup>1</sup> Permeability (k) 3 _._ 47 _×_ 10 <sup>_−_</sup> <sup>9</sup> s <sup>2</sup> 3.47 (mu) <sup>2</sup> Hydraulic conductivity (K) 3.17 cm _·_ s <sup>_−_</sup> <sup>1</sup> 3 _._ 17 _×_ 10 <sup>8</sup> (mu) _·_ (ts) <sup>_−_</sup> <sup>1</sup> An inverse analysis of fluid flow through granular media using differentiable lattice Boltzmann method 17 We evaluate the permeability of the granular media by determining the pressure gradient variation at each iteration of AD-LBM. The target pressure gradient is 35 _._ 36 Pa _·_ m <sup>_−_</sup> <sup>1</sup>, and the pressure difference is 0 _._ 707 Pa. At each iteration, we calculate mean fluid density and update the mass units in both the physical scale and lattice scales, while the length and time units remain fixed. We then convert the mean flow velocity and pressure gradient from lattice units to physical units (see Table 1). Fig. 10 shows the relationship between the loss function and the pressure difference, as well as the mean flow velocity and pressure gradient for each iteration. The initial estimation of pressure difference is 0 _._ 087 Pa; after 20 iterations of differentiation, the loss reaches 10 <sup>_−_</sup> <sup>4</sup> (lu) <sup>2</sup> _·_ (ts) <sup>_−_</sup> <sup>2</sup> . According to Darcy’s law, the permeability can be derived as a product of the kinematic viscosity, porosity, and the proportionality constant between the mean fluid velocity and the applied constant pressure gradient. (a) (b) Fig. 10: AD-LBM analysis of laminar flow in 2D granular packaging: (a) differentiation path and (b) relationship between mean flow velocity and pressure gradient. 3.3 Inverse analysis in 3D granular media We extend the AD-LBM to 3D laminar flow through granular media for more realistic geometries. We demonstrate the capability of the 3D AD-LBM in evaluating pressure boundaries from limited flow velocities and estimating the permeability of 3D granular media of real Hamburg sand. We develop a digital twin of the 3D sample using the technique described in (Wang et al., 2022). We use phase segmentation on the 12-mm-diameter cylinder sample to produce a digital twin of the CT experiment using the LBM. Figure 11a shows the grain structure. We store the segmented data in Tag Image File Format (TIFF), which comprises 1200 photos of the cross-section every 0.01 mm along the sample height. Each slice represents a labeled volume, with each voxel labeled with an integer value (0 for pore space and 1 for solid grain). We then select the representative elementary volume (REV) from the cylinder specimen. The LB REV model 18 Qiuyu Wang <sup>*</sup>, Krishna Kumar represents the 6-mm-high central cubical sub-volume. The grains have a mean diameter of 0.68 mm and a porosity of 0.36 (Wang et al., 2022). We employ the D3Q19 scheme for velocity discretization, which is more computationally intensive despite being GPU-capable. We restrict its size to 200 lu (= 6 mm) in height and 100 lu (= 3 mm) in width and length. Thus, _<u>L</u>_ <u>real</u> _L_ LBM <sup>= 3</sup> <sup>_×_</sup> <sup>10</sup> <sup>_−_</sup> <sup>5</sup> <sup>_m · lu−_</sup> <sup>1.</sup> <sup>We</sup> <sup>apply</sup> <sup>a</sup> <sup>pressure</sup> <sup>gradient</sup> <sup>of</sup> <sup>2</sup> <sup>_._</sup> <sup>94</sup> <sup>_×_</sup> <sup>10</sup> <sup>_−_</sup> <sup>3</sup> <sup>mu</sup> <sup>_·_</sup> <sup>lu</sup> <sup>_−_</sup> <sup>1</sup> <sup>_·_</sup> ts <sup>_−_</sup> <sup>2</sup>, equivalent to 1 _._ 874kPa _· m_ <sup>_−_</sup> <sup>1</sup> in physical units, which creates a fully developed laminar flow with _Re_ = 3 _._ 85.” To estimate permeability using the CK model for the 3D granular packing, we determine the Kozeny factor _ΦCK_ based on the tortuosity: _ΦCK_ = _Φ_ ( _<u>Le</u>_ _L_ <sup>)2</sup> <sup>_,_</sup> (14) where _Φ_ accounts for particle shape effects ( _Φ_ = 90 for spherical particles). The tortuosity <sup>_<u>L</u>_</sup> _L_ <sup>_<u>e</u>_</sup> <sup>depends</sup> on the streamline length _Le_ relative to sample length L. Using ParaView on the stored VTK files, we extract streamlines traversing 200 lu pore space length along the REV sample. By integrating along each steady-state streamline as shown in Figure 11b, and averaging, we obtained a tortuosity of <sup>_<u>L</u>_</sup> _L_ <sup>_<u>e</u>_</sup> <sup>=</sup> <sup>1.441.</sup> With _Φ_ = 90, this gives a Kozeny factor of _ΦCK_ = 186.63. Substituting into the CK equation results in an estimated permeability of _kCK_ = 2 _._ 82 _×_ 10 <sup>_−_</sup> <sup>10</sup> m <sup>2</sup> for the 3D packing. For the 3D case, the loss function comparing simulated and target velocities is: _Nz_ _z_ _Ny_ _y_ <u>1</u> _loss_ ( _p_ ) = _Nfluid_ _Nx_ _x_ �2 _,_ (15) ��� _|ux,y_ ( _p_ ) _| −_ ��� _ux,ytarget_ where _Nfluid_ is the number of fluid nodes. We use normalization of loss to improve convergence for the larger domain size. The 3D LBM model includes 761,855 fluid nodes ( _Nfluid_ = 761,855) compared to _Nfluid_ = 19,200 in 2D. Though normalization does not impact the optimized pressure, it provides better-scaled gradients for the iteration updates. Fig. 11a illustrates the progressive permeation of the laminar flow through the 3D Hamburg sand’s pore spaces over 20 _,_ 000 LBM timesteps, due to the applied pressure gradient. The flow achieves an average outlet velocity of 0 _._ 4 lu _·_ (ts) <sup>_−_</sup> <sup>1</sup> . The loss function decreased to 10 <sup>_−_</sup> <sup>6</sup> (lu) <sup>2</sup> _·_ (ts) <sup>_−_</sup> <sup>2</sup> after 20 iterations, yielding an estimated permeability of 0 _._ 285 mu <sup>2</sup> or 2 _._ 56 _×_ 10 <sup>_−_</sup> <sup>10</sup> m <sup>2</sup>, within 4% of the CK analytical estimate of 2 _._ 82 _×_ 10 <sup>_−_</sup> <sup>10</sup> m <sup>2</sup> . Overall, these 3D results further demonstrate the capability of AD-LBM in inferring boundaries for realistic intricate geometries. Moreover, the GPU-accelerated differentiable fluid simulator demonstrates significant speedups over multi-threaded CPU lattice Boltzmann methods. In benchmark tests with 5 _,_ 000 kernel invocations for 761 _,_ 855 nodes, the total CPU execution time was 234 _._ 4 seconds using 56 threads. This was dominated by three main kernels - streaming (41 _._ 6%), collision (26 _._ 0%) and boundary conditions (25 _._ 1%). By leveraging a Quadro RTX 5000 GPU and CUDA parallelization, the total runtime was slashed to 46 _._ 9 seconds, a An inverse analysis of fluid flow through granular media using differentiable lattice Boltzmann method 19 (a) (b) (c) (d) Fig. 11: AD-LBM simulation of laminar flow through the Hamburg sand: (a) development of the flow through the 3D granular media; (b) steady-state streamline; (c) path of differentiation trajectory of loss function; and (d) mean flow velocity versus pressure gradient. 5 _×_ speedup over CPU. The highly parallelized streaming kernel accounted for 52 _._ 9% of GPU execution time. Other top GPU kernels were boundary conditions (29 _._ 5%) and collision (12 _._ 1%). This prominent 5 _×_ simulation speedup highlights the benefits of massively parallel architectures for computational fluid dynamics. Our GPU-based differentiable simulator enables faster iteration on larger, more complex fluid systems previously hindered by computational cost. 3.4 Material property determination In this section, we evaluate the fluid rheological properties, such as its viscosity, based on the flow charac teristics and known boundary conditions. We will employ the AD-LBM with the Multiple Relaxation Time (MRT) operator to consider turbulent flows (Lallemand and Luo, 2000). In LBM-MRT, the advection is mapped onto the momentum space by a linear transformation, and the flux is finished within the velocity 20 Qiuyu Wang <sup>*</sup>, Krishna Kumar space (Du et al., 2006). The MRT collision operator, different from the BGK operator, is: _Ωcol_ = _M_ <sup>_−_</sup> <sup>1</sup> _S_ ( _Mf_ _−_ _m_ <sup>_eq_</sup> ) _,_ (16) The collision process is conducted in the momentum space, and the equilibrium moment is calculated by _m_ <sup>_eq_</sup> = _Mf_ <sup>_eq_</sup> . Alternatively, one can also construct equilibrium moments more precisely and efficiently from the known moments and u using a general polynomial representation for D2Q9 model: _m_ <sup>_eq_</sup> _i_ = _ρ_ _l,m_ <sup>_m_</sup> _y_ <sup>_,_</sup> (17) _ai,l,mmu_ <sup>_l_</sup> _x_ <sup>_l_</sup> _x_ <sup>_um_</sup> _y_ where _i_ = 0 _,_ 1 _,_ 2 _, ...,_ 8 denotes the discrete direction. The exact form of the equilibrium moments, referring to the coefficients _ai,l,m_, are constructed via Gram-Schmidt orthogonalisation procedure (Lallemand and Luo, 2000). Explicitly, the transformation matrix can be written as:   0 1 _−_ 1 1 _−_ 1 0 0 0 0 0 0 0 0 0 1 1 1 1 _,_  1 1 1 1 1 1 1 1 1 _−_ 4 _−_ 1 _−_ 1 _−_ 1 _−_ 1 2 2 2 2 4 _−_ 2 _−_ 2 _−_ 2 _−_ 2 1 1 1 1 0 1 0 _−_ 1 0 1 _−_ 1 _−_ 1 1 0 _−_ 2 0 2 0 1 _−_ 1 _−_ 1 1  (18) 0 0 1 0 _−_ 1 1 1 _−_ 1 _−_ 1 0 0 _−_ 2 0 2 1 1 _−_ 1 _−_ 1 The collision diagonal matrix _S_ is a diagonal of relaxation rates. The nine eigen values of _S_ are all between 0 and 2 so as to maintain linear stability. The LGBK model is a special case in which the nine relaxation times are all equal and the collision matrix _S_ = _τ_ <u>1</u> <sup>_I_</sup> <sup>,</sup> <sup>where</sup> <sup>_I_</sup> <sup>is</sup> <sup>the</sup> <sup>identity</sup> <sup>matrix.</sup> <sup>The</sup> <sup>values</sup> <sup>of</sup> <sup>the</sup> elements in the collision matrix are: _s_ 8 = _s_ 9 = _τ_ <sup><u>1</u></sup> <sup>and</sup> <sup>_s_</sup> <sup>1</sup> <sup>=</sup> <sup>_s_</sup> <sup>4</sup> <sup>=</sup> <sup>_s_</sup> <sup>6</sup> <sup>=</sup> <sup>1</sup> <sup>_._</sup> <sup>0</sup> <sup>and</sup> <sup>the</sup> <sup>others</sup> <sup>vary</sup> <sup>between</sup> <sup>1.0</sup> and 2.0 for linear stability. Raissi et al. (2019) investigated a realistic incompressible fluid flow scenario governed by the Navier Stokes equations. They utilized a physics-informed neural network to identify parameters equivalent to the kinematic viscosity present in the Navier-Stokes equations. Using automatic differentiation, we will evaluate the fluid viscosity similar to Raissi’s work. We set a non-dimensional free stream velocity of _u∞_ = 0 _._ 2 lu _·_ (ts) <sup>_−_</sup> <sup>1</sup>, a zero-pressure outflow condition on the right boundary situated 25-cylinder diameters ( _D_ = 10 lu ) downstream from the cylinder, and periodicity for both the top and bottom boundaries. We estimate the true kinematic viscosity _ν_ LBM as 0 _._ 02 (lu) <sup>2</sup> _·_ (ts) <sup>_−_</sup> <sup>1</sup>, based on the lattice spacing ( _∆x_ ) and the time step ( _∆t_ ), considering _u∞_ = 1, _D_ = 1, and _ν_ real = 0 _._ 01. An inverse analysis of fluid flow through granular media using differentiable lattice Boltzmann method 21 (a) (b) Fig. 12: Incompressible flow and dynamic vortex shedding past a circular cylinder at _Re_ = 100 using: a) LBM simulation using MRT collision operator; (b) Navier-Stokes equations (Raissi et al., 2019). The region of interest is the rectangle located downstream from the cylinder. Fig. 12 shows the incompressible flow and dynamic vortex shedding around a circular cylinder at _Re_ = 100. The fluid domain has a width of 400 lu and a height of 160 lu, consistent with the dimensions of 40 and 16 in Raissi et al. (2019). We observe the same periodic steady-state behavior marked by an asymmetrical vortex shedding pattern in the cylinder wake, known as the K´arm´an vortex street (Von K´arm´an, 2004). The region of interest is the rectangle located downstream of the cylinder. Our goal is to inversely deduce the kinematic viscosity (with a target value of 0.02 lu <sup>2</sup> /ts) based on the steady-state velocity distribution in the region of interest. Fig. 12 shows the incompressible flow and dynamic vortex shedding around a circular cylinder at Re = 100. The fluid domain has a width of 400 lu and a height of 160 lu, in consistency with the dimensions of 40 and 16 in Raissi et al. (2019). We observe the same periodic dynamic behavior marked by an asymmetrical 22 Qiuyu Wang <sup>*</sup>, Krishna Kumar vortex shedding pattern around the cylinder, known as the K´arm´an vortex street (Von K´arm´an, 2004). The region of interest is the rectangle located downstream of the cylinder. Our goal is to inversely deduce the kinematic viscosity (with a target value of 0.02 (lu) <sup>2</sup> _·_ (ts) <sup>_−_</sup> <sup>1</sup> ) based on the observed periodic velocity distribution in the region of interest (the rectangle located downstream from the cylinder). Fig. 13: Path of trajectory differentiation for incompressible flow past a circular cylinder at _Re_ = 100 using AD-LBM simulation LBM simulation using MRT collision operator. We use a learning rate of 0 _._ 01 to update the ADAM algorithm for identifying the viscosity by minimizing the flow velocity difference between the target and simulated fields in the target window using AD. Fig. 13 shows the trajectory of the loss function with viscosity for the AD-LBM simulation of the K´arm´an vortex street simulation. We successfully identified the viscosity as 0 _._ 022 (lu) <sup>2</sup> _·_ (ts) <sup>_−_</sup> <sup>1</sup> after 50 iterations. The loss function initially increased as the viscosity decreased from the initial guess of 0 _._ 06 (lu) <sup>2</sup> _·_ (ts) <sup>_−_</sup> <sup>1</sup> per iteration. However, once the iterative viscosity dropped below 0 _._ 024 (lu) <sup>2</sup> _·_ (ts) <sup>_−_</sup> <sup>1</sup>, the loss function sharply decreased from 12, indicating the optimized viscosity was being approached. The differentiation path exhib ited slight oscillation when converging to the optimized viscosity value. This oscillatory behavior is common in gradient-descent methods and can be attributed to overshooting the minimum due to the discretization of the iterative steps. Although a 10% error remains, the optimized viscosity of 0 _._ 022 (lu) <sup>2</sup> _·_ (ts) <sup>_−_</sup> <sup>1</sup> can be used as an improved initial guess for subsequent inverse analysis if higher precision is required. The oscillation amplitude could potentially be reduced through smaller step sizes or momentum techniques to smooth the gradient descent trajectory. An inverse analysis of fluid flow through granular media using differentiable lattice Boltzmann method 23 3.5 Limitations and future research Although AD-LBM successfully solves inverse fluid flow problems through granular media, the convergence depends on the initial guess and the gradient at each iteration. As inverse problems are ill-conditioned, developing a good initial guess is critical to achieve successful convergence. A neural network-based initial guess could be coupled directly with AD-LBM to improve optimization and convergence. Further studies could explore using AD-LBM coupled with a differentiable Discrete Element Method in designing and optimizing granular media considering grain movements. 4 Summary This study presents a highly efficient and accurate approach for solving inverse and optimization problems using automatic differentiation. We successfully infer the fluid and granular media’s boundary conditions and rheological properties (fluid viscosity or granular permeability) by solving the inverse problems. Im plementing the lattice Boltzmann method using automatic differentiation (AD-LBM), we compute the gradients of the results (such as velocities) with respect to the input properties, enabling us to solve inverse and optimization problems involving fluid flow through a granular media. We demonstrate our proposed approach by accurately estimating the pressure profiles in 2D and 3D granular media based on limited tar get velocities. Additionally, our method identifies fluid viscosity by matching the periodic vorticity in the region of interest. We improve the performance of AD-LBM by implementing GPU-capable differentiable simulators. The AD-LBM method demonstrates considerable advantages in solving inverse and optimiza tion problems involving complex fluid flow in granular media. Further work could incorporate the effects of grain movement into the simulation model, enabling optimization of flow involving dynamic fluid-grain interactions. References Baakeem SS, Bawazeer SA, Mohamad AA. 2021. A novel approach of unit conversion in the lattice boltz mann method. Applied Sciences 11(14):6386 Battaglia PW, Hamrick JB, Bapst V, Sanchez-Gonzalez A, Zambaldi V, Malinowski M, Tacchetti A, Raposo D, Santoro A, Faulkner R, et al.. 2018. Relational inductive biases, deep learning, and graph networks. arXiv preprint arXiv:180601261 Bezgin DA, Buhendwa AB, Adams NA. 2023. Jax-fluids: A fully-differentiable high-order computational fluid dynamics solver for compressible two-phase flows. Computer Physics Communications 282:108527 Burden RL, Faires JD, Burden AM. 2015. Numerical analysis. Cengage learning 24 Qiuyu Wang <sup>*</sup>, Krishna Kumar Cheylan I, Fritz G, Ricot D, Sagaut P. 2019. Shape optimization using the adjoint lattice boltzmann method for aerodynamic applications. AIAA journal 57(7):2758–2773 Corliss GF. 1988. Applications of differentiation arithmetic. In: Reliability in computing, Elsevier, pp 127– 148 De B´ezenac E, Pajot A, Gallinari P. 2019. Deep learning for physical processes: Incorporating prior scientific knowledge. Journal of Statistical Mechanics: Theory and Experiment 2019(12):124009 d’Humieres D, Lallemand P, Frisch U. 1986. Lattice gas models for 3d hydrodynamics. EPL (Europhysics Letters) 2(4):291, DOI 10.1209/0295-5075/2/4/006 Du R, Shi B, Chen X. 2006. Multi-relaxation-time lattice boltzmann model for incompressible flow. Physics Letters A 359(6):564–572 Ginzburg I, Verhaeghe F, d’Humieres D. 2008. Two-relaxation-time lattice boltzmann scheme: About parametrization, velocity, pressure and mixed boundary conditions. Communications in computational physics 3(2):427–478 Griewank A, Walther A. 2008. Evaluating derivatives: principles and techniques of algorithmic differentia tion. SIAM Gunes Baydin A, Pearlmutter BA, Andreyevich Radul A, Siskind JM. 2015. Automatic differentiation in machine learning: a survey. arXiv e-prints pp arXiv–1502 Hu Y, Anderson L, Li TM, Sun Q, Carr N, Ragan-Kelley J, Durand F. 2019.a Difftaichi: Differentiable programming for physical simulation. arXiv preprint arXiv:191000935 Hu Y, Li TM, Anderson L, Ragan-Kelley J, Durand F. 2019.b Taichi: a language for high-performance computation on spatially sparse data structures. ACM Transactions on Graphics (TOG) 38(6):1–16 Huang H, Sukop M, Lu X. 2015. Multiphase lattice Boltzmann methods: Theory and application. John Wiley & Sons Jerrell ME. 1997. Automatic differentiation and interval arithmetic for estimation of disequilibrium models. Computational Economics 10:295–316 Kr¨uger T, Kusumaatmaja H, Kuzmin A, Shardt O, Silva G, Viggen EM. 2017. The lattice boltzmann method. Springer International Publishing 10(978-3):4–15, DOI 10.1007/978-3-319-44649-3 Lallemand P, Luo LS. 2000. Theory of the lattice boltzmann method: Dispersion, dissipation, isotropy, galilean invariance, and stability. Physical review E 61(6):6546 Margossian CC. 2019. A review of automatic differentiation and its efficient implementation. Wiley inter disciplinary reviews: data mining and knowledge discovery 9(4):e1305 Mohammadi B, Pironneau O. 2009. Applied shape optimization for fluids. OUP Oxford Nørgaard SA, Sagebaum M, Gauger NR, Lazarov BS. 2017. Applications of automatic differentiation in topology optimization. Structural and Multidisciplinary Optimization 56:1135–1146 An inverse analysis of fluid flow through granular media using differentiable lattice Boltzmann method 25 Plessix RE. 2006. A review of the adjoint-state method for computing the gradient of a functional with geophysical applications. Geophysical Journal International 167(2):495–503 Raissi M, Perdikaris P, Karniadakis GE. 2019. Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations. Journal of Computational physics 378:686–707 Rokicki J, et al.. 2016. Adjoint lattice boltzmann for topology optimization on multi-gpu architecture. Computers & Mathematics with Applications 71(3):833–848 Rozvany GI, Lewi´nski T. 2014. Topology optimization in structural and continuum mechanics. Springer Soundararajan KK. 2015. Multi-scale multiphase modelling of granular flows. PhD thesis, University of Cambridge Sukop MC, Huang H, Alvarez PF, Variano EA, Cunningham KJ. 2013. Evaluation of permeability and non-darcy flow in vuggy macroporous limestone aquifer samples with lattice boltzmann methods. Water Resources Research 49(1):216–230 Tekitek MM, Bouzidi M, Dubois F, Lallemand P. 2006. Adjoint lattice boltzmann equation for parameter identification. Computers & fluids 35(8-9):805–813 Von K´arm´an T. 2004. Aerodynamics: selected topics in the light of their historical development. Courier Corporation Wang Q, Milatz M, Hosseini R, Kumar K. 2022. Multiphase lattice boltzmann modeling of cyclic wa ter retention behavior in unsaturated sand based on x-ray computed tomography. arXiv preprint arXiv:220911393 Yazdchi K, Srivastava S, Luding S. 2011. Microstructural effects on the permeability of periodic fibrous porous media. International Journal of Multiphase Flow 37(8):956–966

섹션 본문 78문단 · 41,245자

(제목 없음)

1In this study, we introduce an effective method for the inverse analysis of fluid flow problems, focusing on accurately determining boundary conditions and characterizing the physical properties of granular media, such as permeability, and fluid components, like viscosity.Our primary aim is to deduce either constant pressure head or pressure profiles, given the known velocity field at a steady-state flow through a conduit containing obstacles, including walls, spheres, and grains.We employ the lattice Boltzmann Method (LBM) combined with Automatic Differentiation (AD), facilitated by the GPU-capable Taichi programming language (AD-LBM).A lightweight tape is utilized to generate gradients for the entire LBM simulation, enabling end-to-end backpropagation.For complex flow paths in porous media, our AD-LBM approach accurately estimates the boundary conditions leading to observed steady-state velocity fields and consequently derives macro-scale permeability and fluid viscosity.Our method demonstrates significant advantages in terms of prediction accuracy and computational efficiency, offering a powerful tool for solving inverse fluid flow problems in various applications.

Introduction

2Accurate modeling of fluid flow through porous granular media is critical for diverse engineering applications, including hydrocarbon recovery optimization, grouts and filter design, and stability analysis against seepage.However, inverse prediction of the ideal boundary conditions or fluid properties to achieve a desired flow state remains challenging.Furthermore, this inverse problem is ill-posed and sensitive to measurement noise (Cheylan et al., 2019).Solving these inverse problems involves calculating functional gradients of the specified flow conditions (results) on a set of fluid state variables (inputs) and then minimizing the gradients to find optimal solutions (Plessix, 2006).However, traditional CFD tools are limited to forward differentiation and cannot efficiently calculate these reverse-mode gradients (Nørgaard et al., 2017).Specialized techniques like adjoint solvers, which require manually defining the gradient function of the forward problem or finite difference (FD) approximations, require extensive computations and memory for gradient estimation in time-dependent problems (Cheylan et al., 2019;Tekitek et al., 2006;Rokicki et al., 2016).FD gradient computation requires multiple runs and may suffer from numerical instabilities or experience vanishing gradients for small pertubations.Hence, there is a need for more specialized techniques to compute multi-parameter gradients for solving the optimization of fluid flow through granular media.

3Differentiable simulations combine automatic differentiation with gradient-based optimization to build a simulation framework that can compute derivatives relating output to its input (Battaglia et al., 2018;De Bézenac et al., 2019).Treating simulation as a differentiable function facilitates parameter optimization and control.Moreover, unlike numerical approximations, automatic differentiation ensures accurate and efficient gradient computations.This combination of automatic differentiation with fluid simulation paves the way for integrating physical simulations with machine learning algorithms, opening up exciting avenues for research and applications in physics-informed machine learning and data-driven science.

4Differentiable simulation has significant implications for fluid flow through granular media, where it can provide a powerful tool for inverse problems and control tasks.For example, it can estimate the forces or boundary conditions that resulted in observed fluid flow or determine control inputs that would cause a fluid to move in a desired way.Despite the advancements, auto differentiation has limited applications in optimizing flow dynamics for shape and topology (Mohammadi and Pironneau, 2009;Rozvany and Lewiński, 2014).JAX-FLUIDS is another notable example of a fully differentiable high-order computational fluid dynamics code that leverages machine learning and differential programming to solve Navier-Stokes equations and simulate turbulence (Bezgin et al., 2023).This work presents a novel differentiable lattice Boltzmann model (LBM) for efficient inversion of fluid flows through granular media.Leveraging the automatic differentiation capabilities of the Taichi programming language, we develop an innovative framework to backpropagate through LBM simulations.

5We successfully demonstrate the determination of pressure boundary conditions from limited velocity data.

6Despite having access to only partial velocity fields, our approach can deduce full pressure profiles to within 10% average error.Furthermore, we showcase the ability to evaluate permeability and identify fluid viscosity matching observed flows within 4% error.Our differentiable LBM represents the first demonstrated method for optimizing complex granular media flows.This paradigm paves the way for integrating physical simulations with machine learning toward data-driven modeling of subsurface flow.While we focus on laminar steady-state cases, future efforts will aim to extend this approach to turbulent and transient flows.

Lattice Boltzmann Method

7The fluid state at any point x =[x, y, z] T and time t is governed by the Navier-Stokes equations, which describe momentum and mass conservation for fluid flow.However, solving continuous partial differential equations numerically can be computationally demanding.The LBM offers an alternative mesoscopic approach based on kinetic theory models of fluids (Krüger et al., 2017).

8In LBM, fluid dynamics emerge from collective behaviors of virtual particle distributions on a lattice.We use the D2Q9 scheme for 2D modeling and D3Q19 for 3D modeling.The number of discrete velocities is denoted by Q. Figure 1 shows the D2Q9 velocity sets as well as the collision and streaming stages in LBM simulation.As seen in Figure 1a, the lattice was created by dividing the fluid domain into an equally spaced grid in 9 or 19 directions, and each intersection of the grid was referred to as a lattice node.The particle distribution function, f i , was associated with each lattice node at each discrete direction, i, which represented the density of particles with velocity c i at that node.

9Macroscopic quantities such as mass density, rho, or fluid velocity, u, which are usually of interest in fluid dynamics, could be calculated from the distribution functions using the lattice Boltzmann equation:

10Following the definition of the velocities, an evolution rule is applied to solve the Boltzmann equation at every time increment:

11where x is the position of the lattice node, t is the current time and Ω col is the Bhatnagar-Gross-Krook (BGK) collision operator (d' Humieres et al., 1986), corresponding to Figure 1b:

12During collision, the collision operator depends on the relaxation time τ which we use τ = ∆t in our simulations.The equilibrium distribution function, f eq i , in Eq. ( 4) is given by,

13where ω i as the corresponding weights.After a collision, the updated distribution functions are streamed according on their velocities: each f i is pushed one lattice node in the i direction, as shown in Figure 1c.

14To simulate the fluid flow driven by a constant pressure difference between the inlet and outlet faces, we employ the anti-bounced back conditions at boundary (Ginzburg et al., 2008):

15where ρ w is the constant fluid density of the boundary nodes (x = x b ) leading to a constant fluid pressure.

16In LBM simulations, the parameters such as grid spacing (dx), timestep (dt), and relaxation time (τ ) are set to 1 in dimensionless lattice units.Establishing geometric and dynamic similarity between physical and lattice scales is a crucial step, which is achieved by matching dimensionless parameters like Reynolds number (R e ), Rayleigh number, Nusselt number, and Weber number, among others.Regardless of fluid velocity, geometric scale, or viscosity differences, flows with identical Reynolds numbers are deemed comparable.These dimensionless numbers allow the derivation of physical properties from LBM simulations, such as permeability, thermal conductivity, and formation factor.The accuracy of the numerical solutions for these physical properties from LBM simulations can be relied upon, even in cases of significant geometric complexity.This process applies to LBM simulations employing a BGK collision operator (Huang et al., 2015;Baakeem et al., 2021).

Differentiable Lattice Boltzmann Simulation

17For computing the gradients in simulations, there are four possible methods (Gunes Baydin et al., 2015;Margossian, 2019): (1) manual differentiation; (2) finite difference or other numerical approximations;

18(3) symbolic differentiation; and (4) automatic differentiation (AD).Manual differentiation is time-consuming and impractical for complex with many parameters.Numerical differentiation involves computing the finite difference approximation of derivatives by incorporating a tiny increment to the original function.The finite difference approximation is inaccurate because of truncation and round-off errors (Jerrell, 1997;Burden et al., 2015).Symbolic differentiation calculates the derivative of a mathematical function using its symbolic representation, providing a precise solution without approximations.However, it can result in the problem of "expression swell," yielding complex and lengthy expressions (Corliss, 1988).Automatic differentiation (AD) combines the power of symbolic and numerical differentiation by breaking down numerical computations into simple differentiable operators, allowing for efficient and accurate computation of derivatives.Hence, AD is a powerful candidate for solving gradients to infer unknown parameters in fluid flow problems.

19We develop a fully differentiable 2D/3D LBM solver using the domain-specific Taichi programming language (Hu et al., 2019a).To tackle the differential operators inherent in the inverse simulation of Lattice Boltzmann equations (reverse-mode differentiation), we employ automatic differentiation, which delivers substantial improvements in computational efficiency compared to numerical differentiation methods (Gunes Baydin et al., 2015).AD cleverly circumvents the drawbacks of numerical and symbolic differentiation by constructing a computational Directed Acyclic Graph (DAG), where nodes represent operations or variables, and edges signify the dependency between them.The flow of this graph captures the sequence of elemental functions and their derivative calculations, providing a precise mechanism for gradient calculation.

20Figure 2 shows an example of forward and reverse mode automatic differentiation using a Directed Acyclic Graph (DAG).Consider the function f (x, y) = x 2 +x×y.In the forward mode of AD, computations proceed from the input variables to the output function, following the topological ordering of the graph, as shown in Fig. 2a.For example, if x = 1 and y = 2, then f (x, y) = 1 2 + 1 × 2. In the reverse mode AD, often known as backpropagation in neural networks.Computations proceed in the opposite direction, from the output function back to the inputs, as illustrated in Fig. 2b.At each node, the gradient, represented by ∇, is calculated with respect to the input variable.To compute the gradients with respect to the input, we perform a chain rule traversing every node from the output to the input node.Using the same example with x = 1 and y = 2, the gradients are ∇f (x, y) = (4, 1).This mode is especially useful when the function has many inputs and few outputs.It computes the derivatives of a single output with respect to all inputs in a single pass.As the computational DAG is traversed, nodes are updated using the chain rule of differentiation, ensuring accurate and efficient gradient calculations.Hence, forward and reverse mode ADs provide a flexible, robust, and efficient framework for calculating derivatives in numerical simulations.

21Similar to a DAG-based AD in Fig. 2, we construct a computational DAG for the LBM simulation.Fig-

22ure 3 shows the computational DAG representing a single D2Q9 LBM cell.Each stage of the LBM process-"Initialization," "Collision," "Streaming," "Boundary Fixation," "Bounce Back," and "Redistribution"-is represented as a node in the DAG, and the directed connections between these nodes represent the computational flow.

23We represent the AD-LBM process as a high-level abstraction known as the Intermediate Representation (IR) graph.The IR graph operates within compilers as a transitional platform between the source and target machine codes, which the computer's hardware executes.The Taichi programming language constructs this IR graph by monitoring the invoked kernels and displaying the computations of the forward kernels with respect to the inputs (Hu et al., 2019a).We traverse the forward IR graph in reverse order to generate reverse mode gradients and incorporate appropriate gradient computations for each active function (node) in the forward mode computational graph (Griewank and Walther, 2008).A lightweight tape gradient is employed to log the forward kernel launches and replay the gradient kernels in reverse order for backpropagation (Hu et al., 2019b).Finally, we combine the AD-LBM solver with a gradient-based optimization approach to build a differentiable simulator.Figure 4 shows the workflow of a differentiable LBM simulation capable of solving inverse or design problems involving fluid flow.The LBM differentiable simulator consists of two stages: computing the gradients using automatic differentiation in the reverse mode and a gradient-based optimizer.The differentiable LBM simulation has three stages: initialization, time iterations, and loss function computation.In each time step of the LBM solver, we use AD to compute the time and spatial derivatives for the objective field(s) based on the loss function and accumulate the gradients through the simulation.

24We use gradient-based optimizers, Stochastic Gradient Descent, and ADAM, to solve inverse problems.

25Consider the problem of identifying the pressure boundary conditions that cause a particular velocity field distribution in a granular media.In this inverse problem, we iteratively optimize the boundary pressure by Figure 5a shows the steady-state velocity field of laminar flow in a 2D pipe (width 50 lu, length 300 lu) with a thin obstacle plate (width 1 lu, length 30 lu) at x = 80 lu.The flow is driven by a constant pressure difference of 0.05 mass units (mu)•length units (lu) −1 •time units (ts) −2 between the inflow and outflow.

26We allow the velocity field 40,000 timesteps to reach steady state when the kinetic energy plateauing below 10 −4 (lu)(ts) −1 standard deviation.The number of time steps required for the LBM to reach steady state is dependent on the spatial discretization of the fluid domain.A larger number of fluid nodes in the computational grid leads to an increased number of time steps needed to converge to a stable solution.

27To estimate the inlet pressure boundary, we initialize with a lower pressure of 0.0025 (mu)•(lu) −1 (ts) −2 and compute the loss function between the simulated velocities and the target field.The target field is only observed at the outflow region (x ≥ 275 lu) to simulate limited sensor data, as shown in Figure 5b.

28Accordingly, we define the loss function by computing the difference between LBM velocities u x,y (p) and Using the gradients from AD, we iteratively update the inlet pressure to minimize this loss function and match the observed target velocities.Figure 6 shows the optimization of inlet pressure boundary conditions using AD-LBM for obstructed pipe flow.The inlet pressure is updated each iteration to minimize loss between simulated and target outlet velocity fields, converging to the true pressure difference of 0.05 (mu)•(lu) −1 (ts) −2 that generates the target flow.After 20 iterations using a learning rate of 0.05, the loss decreases to 10 −5 (lu) 2 (ts) −2 .It demonstrates that even when using a limited target velocity field observation near the outlet, the AD-LBM approach efficiently determines the target boundary condition of 0.0025 (mu)•(lu) −1 (ts) −2 .

29Optimizing boundary conditions for for fluid flow through a granular media We now evaluate a more complex inverse problem of inferring the boundary condition for a laminar flow through a 2D granular packing using AD-LBM.When simulating a porous media flow in 2D, an important consideration is non- interconnected pore space when circular grains come in contact.In reality (3D), the pore spaces between the grains will allow fluid flow perpendicular to the reference plane.We solve the 2D artifact by adopting a hydrodynamic radius, a reduced radius of 0.9R only for the LBM computations (Soundararajan, 2015),

30where R is the actual radius of each grain.The hydrodynamic radius can be considered a 2D representation of the 3D permeability of the granular material.We limit the target velocity field data to y ≥ 180 lu at time step 5000 ts, which yields velocity at 2300 fluid nodes.Figure 8 shows the evolution of velocity loss utilizing AD-LBM simulation.As illustrated in Figure 8a, the inlet pressure boundary condition was unknown, while the target velocity field and the granular packing were known.We initialized simulations using two different inlet pressures -one higher at 0.693 (mu)•(lu) −1 (ts) −2 and one lower at 0.292 (mu)•(lu) −1 (ts) −2 than the real target value.For inferring constant inlet pressure, the loss function decreased to 10-6 (lu) 2 (ts) −2 after 10 iterations, approaching the target pressure difference of 0.05 (mu)•(lu) −1 (ts) −2 , independent of initial guesses above or below the target as seen in Figure 8b.Therefore, the case studies of the obstructed pipe flow and flow through 2D granular packing demonstrate the ability of the AD-LBM to converge to an optimal solution for single-parameter optimization problems.

Multi-parameter inverse of boundary conditions

31We now demonstrate a multi-parameter inversion using AD-LBM to identify a variable pressure boundary condition based on the target flow velocities at the top of a granular media.We apply a target pressure boundary as a cubic spline by varying the fluid densities at the inlet, as shown in Figure 9a.Our goal is to find the derivative of loss of the velocity profiles at the outlet with respect to the input pressure profile,

32given the observation of the target velocity field for y > 180 lu.The 'inlet pressure' is no longer a constant but a 1D tensor of 200 elements, for x ranging from 0 lu to 199 lu and y = 0. Figure 9 illustrates AD-LBM optimization of a non-uniform inlet pressure profile based on limited target velocity data.Figure 9a-b shows the comparison of the target and inferred velocity field as well as the inlet pressure profile.Figure 9c compares the target velocity field (top) and the inferred velocity field after 99 iterations (bottom).Figure 9d shows the loss and inferred pressure profiles for the first 100 iterations.As an initial guess, we set the inlet pressure to be uniform at 0.32 (mu)•(lu) −1 (ts) −2 .We use a learning rate of 0.01 for optimization.The loss function requires 100 iterations to reduce from 4.62 (lu) 2 (ts) −2 to 0.064 (lu) 2 (ts) −2 .After 100 iterations, the inferred inlet pressure profile matches the target pressure profile reasonably well, giving a root-mean-squared-error (RMSE) of 0.0254 (mu)•(lu

33where N = 200 is the number of nodes at the inlet, Ptarget,i and Pestimated, i are the target and inferred pressure at x = i and y = 0, respectively.Figure 9c-d also shows that the inferred velocity field matches the observed velocity field for the pressure profile with a velocity magnitude error of 0.064 (lu) 2 (ts) −2 .Unlike the single-parameter cases, the loss function for the variable inlet pressure profile did not converge below 10 −5 (lu) 2 (ts) −2 , highlighting difficulties in matching nonuniform boundaries.Nevertheless, the consistency in the velocity field suggests that AD-LBM has promising capabilities in solving inverse problems for non-trivial boundary conditions in realistic flow scenarios.We can improve the slower convergence using a better initial guess through a neural network in future studies.

Approximation of Permeability for Porous Media

34In addition to inferring boundary conditions, the AD-LBM provides an integrated way to estimate the permeability of porous media.Each data point along the differentiation path represents a fully developed steady-state laminar flow solution.This enables permeability to be derived by directly applying Darcy's law to the AD-LBM simulations.We compared LBM-derived permeabilities against empirical solutions for 2D and 3D granular packings using the Carman-Kozeny (CK) equation, based on Poiseuille flow in a pipe:

35where k CK is the permeability, ε is the porosity, D p is the mean grain diameter, Φ CK = 180 is the Kozeny shape factor (Yazdchi et al., 2011), and Φ s is the sphericity of the particles.Φ s equals 1 for purely spherical grains.For the 2D granular packing shown in Fig. 9, D p = 1.18 mm and ε = 0.489.Substituting these values into Eq.( 8) gives an analytical permeability of k CK = 3.164 × 10 −9 m 2 .Note that the conversion from lattice units to physical units is

36, where L physical is the physical length in meters, and L LBM is the lattice length in lattice units.We use the correlation between the kinematic viscosity of a fluid to determine the time in the physical and lattice scales.The kinematic viscosity of water equals and ν physical = 10 −6 m 2 /s in physical units.In contrast, the kinematic viscosity of water in LBM is defined as

37where τ is the dimensionless relaxation time and c s is the isothermal speed of sound, given as c s = 1 3 ∆x ∆t

38for the velocity sets used.We use the BGK operator, hence, τ = ∆t.Therefore, ν LBM can be written as: Since R e is as low as 2.33, the flow simulated by LBM is laminar and comparable to the physical flow.

39We can calculate the permeability using Darcy's law:

40Accordingly, the AD-LBM yields kLBM = 0.317 (mu) 2 , corresponding to the physical permeability k physical = 3.17 × 10 −9 m 2 .The permeability determined by LBM simulation is extremely close to the permeability predicted by the CK model (k CK = 3.164 × 10 −9 m 2 ).The permeability value calculated from LBM simulation is in dimensionless lattice unit, and it may be converted to physical unit using (Sukop et al., 2013):

41By substituting

42L LBM = 10 −4 m/lu, we can easily derive the same value of k physical .

433.47 × 10 −9 s 2 3.47 (mu) 2 Hydraulic conductivity (K) 3.17 cm • s −1 3.17 × 10 8 (mu)

44We evaluate the permeability of the granular media by determining the pressure gradient variation at each iteration of AD-LBM.The target pressure gradient is 35.36 Pa • m −1 , and the pressure difference is 0.707 Pa.At each iteration, we calculate mean fluid density and update the mass units in both the physical scale and lattice scales, while the length and time units remain fixed.We then convert the mean flow velocity and pressure gradient from lattice units to physical units (see Table 1).Fig. 10 shows the relationship between the loss function and the pressure difference, as well as the mean flow velocity and pressure gradient for each iteration.The initial estimation of pressure difference is 0.087 Pa; after 20 iterations of differentiation, the loss reaches 10 −4 (lu) 2 •(ts) −2 .According to Darcy's law, the permeability can be derived as a product of the kinematic viscosity, porosity, and the proportionality constant between the mean fluid velocity and the applied constant pressure gradient.

Inverse analysis in 3D granular media

45We extend the AD-LBM to 3D laminar flow through granular media for more realistic geometries.We demonstrate the capability of the 3D AD-LBM in evaluating pressure boundaries from limited flow velocities and estimating the permeability of 3D granular media of real Hamburg sand.We develop a digital twin of the 3D sample using the technique described in (Wang et al., 2022).We use phase segmentation on the 12-mm-diameter cylinder sample to produce a digital twin of the CT experiment using the LBM. Figure 11a shows the grain structure.We store the segmented data in Tag Image File Format (TIFF), which comprises 1200 photos of the cross-section every 0.01 mm along the sample height.Each slice represents a labeled volume, with each voxel labeled with an integer value (0 for pore space and 1 for solid grain).We then select the representative elementary volume (REV) from the cylinder specimen.The LB REV model represents the 6-mm-high central cubical sub-volume.The grains have a mean diameter of 0.68 mm and a porosity of 0.36 (Wang et al., 2022).

46We employ the D3Q19 scheme for velocity discretization, which is more computationally intensive despite being GPU-capable.We restrict its size to 200 lu (= 6 mm) in height and 100 lu (= 3 mm) in width and length.Thus, L real L LBM = 3 × 10 −5 m • lu −1 .We apply a pressure gradient of 2.94 × 10 −3 mu • lu −1 • ts −2 , equivalent to 1.874kPa • m −1 in physical units, which creates a fully developed laminar flow with R e = 3.85."

47To estimate permeability using the CK model for the 3D granular packing, we determine the Kozeny factor Φ CK based on the tortuosity:

48where Φ accounts for particle shape effects (Φ = 90 for spherical particles).The tortuosity L e L depends on the streamline length L e relative to sample length L. Using ParaView on the stored VTK files, we extract streamlines traversing 200 lu pore space length along the REV sample.By integrating along each steady-state streamline as shown in Figure 11b, and averaging, we obtained a tortuosity of L e L = 1.441.With Φ = 90, this gives a Kozeny factor of Φ CK = 186.63.Substituting into the CK equation results in an estimated permeability of k CK = 2.82 × 10 −10 m 2 for the 3D packing.

49For the 3D case, the loss function comparing simulated and target velocities is: Moreover, the GPU-accelerated differentiable fluid simulator demonstrates significant speedups over multi-threaded CPU lattice Boltzmann methods.In benchmark tests with 5, 000 kernel invocations for 761, 855 nodes, the total CPU execution time was 234.4 seconds using 56 threads.This was dominated by three main kernels -streaming (41.6%), collision (26.0%) and boundary conditions (25.1%).By leveraging a Quadro RTX 5000 GPU and CUDA parallelization, the total runtime was slashed to 46.9 seconds, a 5× speedup over CPU.The highly parallelized streaming kernel accounted for 52.9% of GPU execution time.Other top GPU kernels were boundary conditions (29.5%) and collision (12.1%).This prominent 5× simulation speedup highlights the benefits of massively parallel architectures for computational fluid dynamics.Our GPU-based differentiable simulator enables faster iteration on larger, more complex fluid systems previously hindered by computational cost.

Material property determination

50In this section, we evaluate the fluid rheological properties, such as its viscosity, based on the flow characteristics and known boundary conditions.We will employ the AD-LBM with the Multiple Relaxation Time (MRT) operator to consider turbulent flows (Lallemand and Luo, 2000).In LBM-MRT, the advection is mapped onto the momentum space by a linear transformation, and the flux is finished within the velocity space (Du et al., 2006).The MRT collision operator, different from the BGK operator, is:

51The collision process is conducted in the momentum space, and the equilibrium moment is calculated by m eq = M f eq .Alternatively, one can also construct equilibrium moments more precisely and efficiently from the known moments and u using a general polynomial representation for D2Q9 model:

52where i = 0, 1, 2, ..., 8 denotes the discrete direction.The exact form of the equilibrium moments, referring to the coefficients a i,l,m , are constructed via Gram-Schmidt orthogonalisation procedure (Lallemand and Luo, 2000).Explicitly, the transformation matrix can be written as:

53The collision diagonal matrix S is a diagonal of relaxation rates.The nine eigen values of S are all between 0 and 2 so as to maintain linear stability.The LGBK model is a special case in which the nine relaxation times are all equal and the collision matrix S = 1 τ I, where I is the identity matrix.The values of the elements in the collision matrix are: s 8 = s 9 = 1 τ and s 1 = s 4 = s 6 = 1.0 and the others vary between 1.0 and 2.0 for linear stability.(Raissi et al., 2019).The region of interest is the rectangle located downstream from the cylinder.Fig. 12 shows the incompressible flow and dynamic vortex shedding around a circular cylinder at R e = 100.The fluid domain has a width of 400 lu and a height of 160 lu, consistent with the dimensions of 40 and 16 in Raissi et al. (2019).We observe the same periodic steady-state behavior marked by an asymmetrical vortex shedding pattern in the cylinder wake, known as the Kármán vortex street (Von Kármán, 2004).

54The region of interest is the rectangle located downstream of the cylinder.Our goal is to inversely deduce the kinematic viscosity (with a target value of 0.02 lu 2 /ts) based on the steady-state velocity distribution in the region of interest.Fig. 12 shows the incompressible flow and dynamic vortex shedding around a circular cylinder at Re = 100.The fluid domain has a width of 400 lu and a height of 160 lu, in consistency with the dimensions of 40 and 16 in Raissi et al. (2019).We observe the same periodic dynamic behavior marked by an asymmetrical vortex shedding pattern around the cylinder, known as the Kármán vortex street (Von Kármán, 2004).

55The region of interest is the rectangle located downstream of the cylinder.Our goal is to inversely deduce the kinematic viscosity (with a target value of 0.02 (lu) 2 •(ts) −1 ) based on the observed periodic velocity distribution in the region of interest (the rectangle located downstream from the cylinder).We use a learning rate of 0.01 to update the ADAM algorithm for identifying the viscosity by minimizing the flow velocity difference between the target and simulated fields in the target window using AD.Fig. 13 shows the trajectory of the loss function with viscosity for the AD-LBM simulation of the Kármán vortex street simulation.We successfully identified the viscosity as 0.022 (lu) 2 • (ts) −1 after 50 iterations.The loss function initially increased as the viscosity decreased from the initial guess of 0.06 (lu) 2 • (ts) −1 per iteration.However, once the iterative viscosity dropped below 0.024 (lu) 2 • (ts) −1 , the loss function sharply decreased from 12, indicating the optimized viscosity was being approached.The differentiation path exhibited slight oscillation when converging to the optimized viscosity value.This oscillatory behavior is common in gradient-descent methods and can be attributed to overshooting the minimum due to the discretization of the iterative steps.Although a 10% error remains, the optimized viscosity of 0.022 (lu) 2 • (ts) −1 can be used as an improved initial guess for subsequent inverse analysis if higher precision is required.The oscillation amplitude could potentially be reduced through smaller step sizes or momentum techniques to smooth the gradient descent trajectory.

Limitations and future research

56Although AD-LBM successfully solves inverse fluid flow problems through granular media, the convergence depends on the initial guess and the gradient at each iteration.As inverse problems are ill-conditioned, developing a good initial guess is critical to achieve successful convergence.A neural network-based initial guess could be coupled directly with AD-LBM to improve optimization and convergence.Further studies could explore using AD-LBM coupled with a differentiable Discrete Element Method in designing and optimizing granular media considering grain movements.

Summary

57This study presents a highly efficient and accurate approach for solving inverse and optimization problems using automatic differentiation.We successfully infer the fluid and granular media's boundary conditions and rheological properties (fluid viscosity or granular permeability) by solving the inverse problems.Implementing the lattice Boltzmann method using automatic differentiation (AD-LBM), we compute the gradients of the results (such as velocities) with respect to the input properties, enabling us to solve inverse and optimization problems involving fluid flow through a granular media.We demonstrate our proposed approach by accurately estimating the pressure profiles in 2D and 3D granular media based on limited target velocities.Additionally, our method identifies fluid viscosity by matching the periodic vorticity in the region of interest.We improve the performance of AD-LBM by implementing GPU-capable differentiable simulators.The AD-LBM method demonstrates considerable advantages in solving inverse and optimization problems involving complex fluid flow in granular media.Further work could incorporate the effects of grain movement into the simulation model, enabling optimization of flow involving dynamic fluid-grain interactions.

58LBM solves a discretized version of the Boltzmann equation by locally streaming and colliding discrete particle populations.LBM can simulate macroscopic fluid flows efficiently while inherently including mesoscale interactions.The local nature of LBM is well-suited for coupling fluid dynamics with granular dynamics.

Fig. 1 :

59Fig. 1: D2Q9 velocity sets.The square denoted by solid lines has an edge length dx.

Fig. 2 :

60Fig. 2: Directed Acyclic Graph (DAG) of f (x, y) = x 2 + xy.

Fig. 3 :

61Fig. 3: Directed Acyclic Graph (DAG) Representation of lattice Boltzmann Method Simulation Stages with two time steps and 2×2×2 domain division.

Fig. 4 :

62Fig. 4: Flowchart of LBM simulation of fluid flow employing Taichi differentiable simulators.

63minimizing the loss function on the known velocity distribution.The loss function is computed as the sum of the squared differences between the simulated velocity norm at each fluid node and the observed values at the target time step.The core kernel function for differentiable simulation to evaluate the loss based on the velocity prediction is shown below: @ti .kernel def compute_loss (): # Loop over the velocity field for I in ti .grouped ( v ): loss [ None ]+= ( v [ I ].norm () -target_v [ I ].norm ())**2 # " loss " is a scalar (0 -D tensor ) and indexed by [ None ].To calculate the boundary condition of the input pressure profile, we use the tape gradient in the LBM differential simulator 'ti.ad.Tape()' on the kernel function to compute the gradient of the inlet pressure profile as inlet pressure.grad[None](=∂loss ∂inlet pressure ).' for 5000 time steps for step in range (5000): with ti .ad .Tape ( loss ) ] += inlet_pressure .grad [ None ] * learning_rateThe gradients are propagated and evaluated through all variables and operations in the LBM simulation.Our simulations involve 10 4 10 7 cells to model fluid flow through the granular media.We track all global tensors allocated to store the entire simulation state, including loss and inlet pressure scalars and 2D/3D tensors (density, velocity, force, pressure, etc.).Using 'ti.root.lazygrad()', the velocity field ('v'), loss, inlet pressure, and other tensors involved in a derivative chain are automatically positioned in the adjoint fields in accordance with the layout of their primal fields 3 Result and Discussion3.1 Inferring boundary conditions from flow characteristics3.1.1Single-parameter inverse of boundary conditionsOptimizing boundary conditions for pipe flow We demonstrate the capability of differentiable LBM to infer boundary conditions from observed flow velocities.We first simulate 2D laminar flow in a pipe with a thin obstacle plate as a test case.The aim is to estimate the constant pressure inlet boundary condition that drives this flow, using the resulting steady-state velocity field as a single-parameter inverse problem.

64Fig. 5: AD-LBM simulation of steady laminar flow through a 2D pipe (width 50 lu, length 300 lu) containing an obstruction plate (width 1 lu, length 30 lu) situated at x = 80 lu: (a) velocity field driven by imposed inlet-outlet pressure difference of (mu)•(lu) −1 (ts) −2 ; (b) unknown variables (inflow pressure and velocity field at x < 275 lu) and known variables (outflow pressure and target outlet velocities field at x ≥ 275 lu).

65with N x and N y being the number of LBM grids in x and y dimensions, |u x,y (p)| is the norm of simulated velocity when the pressure p is applied at a specified boundary.|u target x,y | is the norm of target velocity.The function f (x, y) defines the region of interest.For example, f (x, y) is set to 1 for x ≥ 275 lu and 0 for x ¡ 275 lu to only compute loss at the outlet region based on observed target data.

Fig. 6 :

66Fig. 6: Directed Acyclic Graph (DAG) Representation of lattice Boltzmann Method Simulation Stages with two time steps and 2×2×2 domain division.

Fig. 7 :

67Fig. 7: Evolution of velocity field in LBM simulation for a laminar flow driven by a constant inlet pressure of (mu)•(lu) −1 (ts) −2 through 2d granular packing.

Fig. 8 :

68Fig. 8: AD-LBM optimization of inlet pressure boundary conditions for laminar flow through 2d granular packing: (a) estimating unknown inlet pressure based on target outlet velocities (y ≥ 180 lu); (b) differentiation paths using two different inlet pressures.

Fig. 9 :

69Fig. 9: AD-LBM optimization of variable inlet pressure profile for 2D laminar flow through granular media based on outlet target velocity data (y > 180 lu): (a) target pressure profile and induced velocity field; (b) inferred pressure profile and induced velocity field after 99 iterations; (c) comparison of the target velocity field (top) and inferred velocity field (bottom); and (d) loss and inferred pressure profiles for the first 100 iterations.

70Converting the LBM-derived permeability to physical permeability requires defining consistent LBM units for mass (mu), time (ts), and density to match physical fluid properties.The fluid domain is initialized with a uniform density of 1 mu•(lu) −3 , corresponding to the density of water (1000 kg•m −3 ).The mean fluid density ρ fluid represents the total fluid mass divided by the volume and depends on the pressure difference ∂P .A higher ∂P increases ρ fluid .With ∂P = 0, the volume of 1 (lu) 3 has the mass ρ fluid × 1 (lu) 3 = 1 mu which equals 1000 kg • m −3 × (10 −4 m • (lu) −1 ) 3 = 10 −9 kg.Thus, 1 mu = 10 −9 kg for ∂P = 0.For a ∂P = 0.276 mu • (lu) −1 • (ts) −2 , ρ fluid = 1.40 mu • (lu) −3 .This gives 1.40 mu • (lu) −3 × 1 (lu) 3 = 10 −9 kg, so 1 mu = 7.14 × 10 −10 kg.

7110) where ∆x and ∆t are set to unity for simplicity, giving ∆x = 1 lu and ∆t = 1 ts.By setting ν LBM = ν physical , 1 ts = 1.67 × 10 −3 s.Thus, the pressure difference of ∂P = 0.276 mu • (lu) −1 • (ts) −2 corresponds to a pressure gradient of ∂P ∂x = 1.38 × 10 −3 mu • (lu) −2 • (ts) −2 = 35.36Pa • m −1 .The mean fluid velocity U = 3.88×10 −3 mu•(ts) −1 = 2.33×10 −4 m•s −1 .With the knowledge of channel width D = 200 lu = 0.02 m, mean fluid velocity U , and fluid kinematic viscosity ν, we derive the dimensionless Reynolds number as:

Fig. 10 :

72Fig. 10: AD-LBM analysis of laminar flow in 2D granular packaging: (a) differentiation path and (b) relationship between mean flow velocity and pressure gradient.

73Fig.11aillustrates the progressive permeation of the laminar flow through the 3D Hamburg sand's pore spaces over 20, 000 LBM timesteps, due to the applied pressure gradient.The flow achieves an average outlet velocity of 0.4 lu • (ts) −1 .The loss function decreased to 10 −6 (lu) 2 • (ts) −2 after 20 iterations, yielding an estimated permeability of 0.285 mu 2 or 2.56 × 10 −10 m 2 , within 4% of the CK analytical estimate of 2.82 × 10 −10 m 2 .Overall, these 3D results further demonstrate the capability of AD-LBM in inferring boundaries for realistic intricate geometries.

Fig. 11 :

74Fig. 11: AD-LBM simulation of laminar flow through the Hamburg sand: (a) development of the flow through the 3D granular media; (b) steady-state streamline; (c) path of differentiation trajectory of loss function; and (d) mean flow velocity versus pressure gradient.

75Raissi et al. (2019) investigated a realistic incompressible fluid flow scenario governed by the Navier-Stokes equations.They utilized a physics-informed neural network to identify parameters equivalent to the kinematic viscosity present in the Navier-Stokes equations.Using automatic differentiation, we will evaluate the fluid viscosity similar to Raissi's work.We set a non-dimensional free stream velocity of u ∞ = 0.2 lu • (ts) −1 , a zero-pressure outflow condition on the right boundary situated 25-cylinder diameters ( D = 10 lu ) downstream from the cylinder, and periodicity for both the top and bottom boundaries.We estimate the true kinematic viscosity ν LBM as 0.02 (lu) 2 • (ts) −1 , based on the lattice spacing ( ∆x ) and the time step ( ∆t ), considering u ∞ = 1, D = 1, and ν real = 0.01.

Fig. 12 :

76Fig. 12: Incompressible flow and dynamic vortex shedding past a circular cylinder at R e = 100 using: a) LBM simulation using MRT collision operator; (b) Navier-Stokes equations(Raissi et al., 2019).The region of interest is the rectangle located downstream from the cylinder.

Fig. 13 :

77Fig. 13: Path of trajectory differentiation for incompressible flow past a circular cylinder at R e = 100 using AD-LBM simulation LBM simulation using MRT collision operator.

Table 1 :

78Unit conversion of variables for 2D laminar flow problem.

참고문헌 29건

  1. Aerodynamics: Selected Topics in the Light of Their Historical Development 2004
  2. (제목 없음) Computational Economics · Springer Science+Business Media · 1997 10.1023/a:1008633613243
  3. Applied Shape Optimization for Fluids 2009 10.1093/acprof:oso/9780199546909.001.0001
  4. Evaluating Derivatives: Principles and Techniques of Algorithmic Differentiation 1987
  5. Multi-relaxation-time lattice Boltzmann model for incompressible flow Physics Letters A · Elsevier BV · 2006 10.1016/j.physleta.2006.07.074
  6. A Model for Collision Processes in Gases. I. Small Amplitude Processes in Charged and Neutral One-Component Systems Physical Review · American Institute of Physics · 1954 10.1103/physrev.94.511
  7. Theory of the lattice Boltzmann method: Dispersion, dissipation, isotropy, Galilean invariance, and stability Physical review. E, Statistical physics, plasmas, fluids, and related interdisciplinary topics · American Physical Society · 2000 10.1103/physreve.61.6546
  8. A review of the adjoint-state method for computing the gradient of a functional with geophysical applications Geophysical Journal International · Oxford University Press · 2006 10.1111/j.1365-246x.2006.02978.x
  9. Evaluation of permeability and non‐Darcy flow in vuggy macroporous limestone aquifer samples with lattice Boltzmann methods Water Resources Research · Wiley · 2012 10.1029/2011wr011788
  10. Adjoint lattice Boltzmann equation for parameter identification Computers & Fluids · Elsevier BV · 2005 10.1016/j.compfluid.2005.07.015
  11. Multi-scale multiphase modelling of granular flows 2015 10.17863/cam.14130
  12. Two-relaxation-time Lattice Boltzmann scheme: About parametrization, velocity, pressure and mixed boundary conditions HAL (Le Centre pour la Communication Scientifique Directe) · Centre National de la Recherche Scientifique · 2008
  13. Applications of automatic differentiation in topology optimization Structural and Multidisciplinary Optimization · Springer Science+Business Media · 2017 10.1007/s00158-017-1708-2
  14. The Lattice Boltzmann Method: Principles and Practice 2017 10.1007/978-3-319-44649-3
  15. Microstructural effects on the permeability of periodic fibrous porous media International Journal of Multiphase Flow · Elsevier BV · 2011 10.1016/j.ijmultiphaseflow.2011.05.003
  16. Topology optimization of thermal fluid flows with an adjoint Lattice Boltzmann Method Journal of Computational Physics · Elsevier BV · 2018 10.1016/j.jcp.2018.03.040
  17. Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations Journal of Computational Physics · Elsevier BV · 2018 10.1016/j.jcp.2018.10.045
  18. Shape Optimization Using the Adjoint Lattice Boltzmann Method for Aerodynamic Applications AIAA Journal · American Institute of Aeronautics and Astronautics · 2019 10.2514/1.j057955
  19. Adjoint Lattice Boltzmann for topology optimization on multi-GPU architecture Computers & Mathematics with Applications · Elsevier BV · 2016 10.1016/j.camwa.2015.12.043
  20. Taichi ACM Transactions on Graphics · Association for Computing Machinery · 2019 10.1145/3355089.3356506
  21. Deep Learning for Physical Processes: Incorporating Prior Scientific\n Knowledge arXiv (Cornell University) · Cornell University · 2017 10.48550/arxiv.1711.07970
  22. DEM modelling of mini-triaxial test based on one-to-one mapping of sand particles Géotechnique · ICE Publishing · 2020 10.1680/jgeot.19.p.212
  23. Reliability in Computing Elsevier eBooks · Elsevier BV · 1988 10.1016/c2013-0-11195-6
  24. JAX-Fluids: A fully-differentiable high-order computational fluid dynamics solver for compressible two-phase flows Computer Physics Communications · Elsevier BV · 2022 10.1016/j.cpc.2022.108527
  25. Effects of morphological gene decay and mutation on the micro–macro mechanical behaviours of granular soils Géotechnique · ICE Publishing · 2022 10.1680/jgeot.21.00180
  26. Revisiting the empirical particle‐fluid coupling model used in DEM‐CFD by high‐resolution DEM‐LBM‐IMB simulations: A 2D perspective International Journal for Numerical and Analytical Methods in Geomechanics · Wiley · 2023 10.1002/nag.3496
  27. Multiphase lattice Boltzmann modeling of cyclic water retention behavior in unsaturated sand based on X-ray computed tomography Canadian Geotechnical Journal · NRC Research Press · 2023 10.1139/cgj-2022-0489
  28. A particle-resolved heat-particle-fluid coupling model by DEM-IMB-LBM Journal of Rock Mechanics and Geotechnical Engineering · Elsevier BV · 2023 10.1016/j.jrmge.2023.02.030
  29. Topology Optimization in Structural and Continuum Mechanics Courses and lectures · Springer Vienna · 2013 10.1007/978-3-7091-1643-2