1: \begin{abstract}
2: Accurate and efficient prediction of multi-scale flows remains a formidable challenge.
3: Constructing theoretical models and numerical methods often involves the design and optimization of parameters.
4: While gradient descent methods have been mainly manifested to shine in the wave of deep learning, composable automatic differentiation can advance scientific computing where the application of classical adjoint methods alone is infeasible or cumbersome.
5: Differentiable programming provides a novel paradigm that unifies data structures and control flows and facilitates gradient-based optimization of parameters in a computer program.
6: This paper addresses the notion and implementation of the first solution algorithm for multi-scale flow physics across continuum and rarefied regimes based on differentiable programming.
7: The fully differentiable simulator provides a unified framework for the convergence of computational fluid dynamics and machine learning, i.e., scientific machine learning.
8: Specifically, parameterized mechanical-neural flow models and numerical methods can be constructed for forward physical processes, while the parameters can be trained on the fly with the help of the gradients that are taken through the backward passes of the whole simulation program, a.k.a., end-to-end optimization.
9: As a result, versatile data-driven modeling and simulation can be achieved for physics discovery, surrogate modeling, and simulation acceleration.
10: The fundamentals and implementation of the solution algorithm are demonstrated in detail.
11: Numerical experiments, including forward and inverse problems for hydrodynamic and kinetic equations, are presented to demonstrate the performance of the numerical method.
12: The open-source codes to reproduce the numerical results are available under the MIT license\footnote{\url{https://github.com/vavrines/KitAD.jl}}.
13: \end{abstract}
14: