Machine Learning for Fluid Dynamics: Models and Control

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome back time travelers from the future i'm steve brenton and i'm going to tell you about machine learning for fluid mechanics now i am calling you time travelers because time travels so very fast when you're talking about machine learning and between the time i make this video and the time you watch this video there may indeed be significant changes to the state of the art i actually gave a version of this lecture no more than three or four months ago and then found this amazing uh kind of rendering by petro civrelis of starry night using this kind of flow mapping visualization so lots of cool things i'm going to talk about in machine learning for fluid mechanics in this video i'm going to focus in particular on how we use machine learning to model and to control complex unsteady high dimensional flow fields so i'm pretty excited this is a topic very near and dear to my heart all right and we've already talked about before how kind of you can uh you can in broad brushstroke summarize machine learning as optimization based on data and in particular uh that optimization is often building models from data and you can use those models uh to predict to estimate and to control your fluid system and here's just a small uh a small illustration of one of some of the many applications of fluid uh flow in our daily lives in in significant industrial uh and societal uh systems transportation energy defense health this is a diagram from a review paper i wrote with barrett nowak a few years back and again just to remind you most of our fluid dynamics tasks here in blue can be written as these really hard optimization problems in pink and today i'm going to focus in particular on modeling control and closure problems how to pose them as optimization problems and then how we're currently using machine learning to start solving these problems and i'm going to point out at the outset there is so much good work on this there are hundreds of groups from around the world tirelessly working on implementing machine learning to solve increasingly hard problems in engineering fluid mechanics a lot of what i'm going to tell you about is from my group and the groups of my close colleagues and collaborators but i do want to kind of let you know that this is just a very very shallow topical treatment of this really rich and interesting interesting subject okay so let's jump in um and a lot of this is going to follow kind of some of this material outlined in this review paper uh with myself bert noack and petrus kumasakis from 2020 and we're going to talk about how to use optimization for modeling and control in fluids good all right so i've been kind of uh bringing this up over and over and over again this idea that patterns exist in the data and that's why we think we can model and predict and control these fluid systems and pattern extraction kind of the the theory of of you know pattern identification and extraction uh has a rich history and that's actually a lot of the machine learning uh the modern machine learning algorithms grew out of kind of pattern extraction theory okay so we're going to use these patterns in flow fields to model to predict and to control kind of the future evolution of these flow fields and i love this picture this is from a review paper by sam tyra and and co-authors in the aid journal where he shows this uh kind of correspondence between a very complex geophysical flow this is the flow over rishiri island in japan uh and although this is an extremely extremely complex flow i mean i don't know how large a kilometer is in this in this picture but i mean this is on earth scale right these are this is a mountain here but the flow patterns actually you know are very close to this very very simple toy problem flow problem that we've all been working with uh for decades okay and so these patterns allow us to simplify problems but where does this complexity come from in the first place so that's what i'm going to start with with this lecture okay and the complexity i like to think of this is the navier-stokes equation for an incompressible fluid and this is a non-dimensional form the complexity is really entering here in the reynolds number term this one over reynolds number so as your flow becomes either bigger or faster roughly speaking this reynolds number increases and the higher the reynolds number is the smaller the effect of viscosity or rather viscosity acts on smaller scales and you get more and more and more turbulent complex multi-scale behavior in your flow solution generally i'm painting with really broad brush strokes here but the reynolds number is kind of this parameter that modulates the complexity of your flow and this is a great diagram uh i grabbed from the feynman lectures volume two where you have these beautiful hand-drawn pictures of this flow past a cylinder as you increase the reynolds number you see this increasing flow complexity so you have this very simple kind of steady laminar solution here this is what like tiny tiny tiny microscopic organisms would look like their flow field and as you increase the reynolds number you start to see these wake structures this carbon vortex street then it becomes turbulent uh like the flow of richard island and then eventually it becomes turbulent and kind of reattaches so you get this incredible range of complexity just by varying this one parameter the reynolds number and it's interesting you can also look at the drag on each of these cylinders at each of these reynolds numbers so the y-axis here is drag drag coefficient the x-axis is the reynolds number and you see that you get this incredible range of drag values as you increase the reynolds number from very very low to very very high okay so if you drop a ball from the leaning tower of pisa it doesn't actually accelerate at a constant rate given by the the gravitational constant because you have all of these uh kind of various fluid forcing that's also uh impeding or fighting uh the downward acceleration of of that ball so really interesting um complexity enters through this reynolds number and you get this massive range of scales as you crank up that reynolds number okay good now oftentimes we don't care about resolving all of those many many scales in a fluid system oftentimes what we really care about are the big dominant energy containing structures coherent structures in the flow so you know if you think about that that picture of the the clouds pass richiri island maybe i only care about those big vertical structures and i don't care about all of the little turbulent structures on top okay and so this is a picture that anyone in fluids is is uh you know very familiar with the kolmogorov turbulent energy cascade and what we have here on a log log plot is the amount of energy in each of these spatial wave numbers from low spatial wave number big low frequency vortices all the way up to very very high spatial wave number teeny tiny little vortices and again flows are characterized by this multi-scale in space and time behavior so if i look at the flow around a submarine or a jumbo jet i'm going to have big flow structures that are on the length scale of the object itself and then i'm going to have medium and smaller and smaller eventually getting teeny tiny little flow structures maybe they're millimeter length scales and so you get this massive range of spatial scales maybe 10 orders of magnitude for some of the largest industrial flows at scale but again i don't necessarily care about every single degree of freedom in this fluid i might just care about the big coherent structures that i need to care about for lift and drag and noise and things like that okay actually noise is a really hard one that one's not not as easy lift and drag and so this is the basis of a huge effort in fluids called closure modeling and closure modeling basically tries to get low order models simple models that describe the big stuff the big energy containing stuff while still somehow accounting for at least the you know statistical effect or the average effect of the small scales okay and i'm again broad brush strokes here but that's more or less what we're trying to do in closure modeling and so mathematically the way i can write this and this is kind of just a toy system that i've i've written down for my own understanding of this is that maybe i care about the first few big energy containing structures in x1 and x2 these are variables that describe kind of those big structures and then maybe i have all of these higher order little teeny tiny vertices uh that are described by x3 x4 x5 and so on and so forth but this gives you a big coupled system of differential equations the navy or stokes equations is a big coupled system of differential equations if you discretize or you project onto modes or something like that and so it's really hard to untangle the effect of these small scales on the big scale and that's the goal of closure modeling so we can't resolve all scales we don't want to resolve all scales it's too expensive it takes super computers and we still can't resolve the most industrially relevant flows we care about today they're too slow for optimization and for control so we need low order models that aren't completely accurate but are good enough for some of our high level objectives of design and control okay and so the goal here is essentially to get a proxy for these high frequency structures here and how they act in the low frequency structures here given by this expression so we want some some representation of the high frequency structures in terms of the low frequency structures which we can then substitute back into this first equation which gives us this closure model so that uh kind of boxed equation is only in terms of the big low frequency dominant coherent structures and it approximates the effect of these high frequency structures here now this is one type of closure modeling uh there's many types of closure modeling there's large eddy simulation uh there's reynolds average navy or stokes there's unsteady reynolds average navier stokes uran's all kinds of uh of approaches to this closure modeling problem this is just kind of how i think about it in terms of differential equations and dynamical systems because that's how i think about things so we want this simplified equation okay and that's really really hard to get so can we start building this with machine learning with with a wealth of data can we start building these proxy models uh for how the high frequency stuff would depend on the low frequency stuff or uh kind of averaging the effect of the high frequency stuff in this low frequency equation can we start getting proxy models from machine learning because we have so much data from turbulence we have massive massive turbulent simulations there is the johns hopkins turbulence database stanford has a big turbulence database many researchers around the world are generating just server rooms full of hard drives full of flow simulation data of turbulent flows can we learn from that wealth of data to start figuring out these closure models okay there is a really really nice paper that summarizes some of these modern efforts uh turbulence modeling in the age of data by durasami yakiri yakurino and xiao and in this paper they outline some of the leading methods people are using to tackle this closure modeling problem with data and with machine learning so if you want to dig into this and make progress on this extremely important field of research you've got to read this paper this is this is the entry point and on the right i have some of my favorite papers um that are kind of research papers on on this closure modeling problem you have a lot that are dealing with reynolds averaged navy or stokes equations which is kind of a time averaged equation and then on the bottom you're starting to see people apply this to large eddy simulations okay and this is a tiny fraction of the the wealth of good work on on closure modeling and one of my absolute favorite models out there today is this uh this rand's closure model from uh ling kurzowski and templeton in a 2016 jfm paper and what i like about this this paper and i'm gonna i guess wax philosophical for a minute here whenever you want to apply machine learning to a problem in fluid mechanics or physical science or engineering i think there are kind of two approaches one is to just build a deep neural network throw in your data cross-validate and get some results and you know write a paper and the other approach i like much better this is what kind of ling at all are doing here which is to somehow guide the learning process with some partial physical knowledge to constrain your learning algorithm your machine learning algorithm in this case a neural network with partial knowledge of the physics and so what they were able to do is modify their deep learning structure to include uh this this kind of last tensor input layer which allows them to embed known invariants and symmetries in uh that should be in any closure model and this is i think a really important point is that they actually went back in the literature well before kind of the deep learning literature back to the 70s and essentially found this this early result where researchers wrote down the navier stokes equations and then made a bunch of statements of things that were absolutely true until they hit a mathematical wall and that at the time in the 70s that mathematical wall they just couldn't get around it they couldn't solve that problem with the tools of the era and what ling at all did was they took off where that excellent paper from the 70s left off and then they started using better mathematical tools like these constrained deep neural networks to start getting these representations and working further so i highly recommend you do this go back to the 60s go back to the 70s find these classical papers and figure out because they were so brilliant back then they didn't have the tools we have they couldn't just crank through a deep neural network they had to really think deeply about the physics of the problem and so if you can go through these papers and find where kind of they set up this problem and where they get stuck because of limited tools of the era you might be able to write a new classic uh like like ling at all did in this jfm paper okay i really really like this one i'm going to link to this paper and also to to kind of the papers that they were based on in the comments okay good so we've talked about how patterns exist you can use these to get low order models of kind of the dominant coherent structures without resolving all of the teeny tiny physics but that was still for very turbulent problems so now i'm going to talk about how do you actually get reduced order models if your system is relatively simple in the first place and so i'm going to work with this flow past the cylinder this reynolds number 100 flow this is kind of our starting point in a lot of these dynamical systems analyses and what baron noack and colleagues showed in 2003 was that if you measure the system in the right way if you if you pull out the right features from from this data these modes these three modes two principal components and something he calls the shift mode then you can essentially represent this complex system in a very simple three-dimensional coordinate system given by by these three modes and when you represent your system in those three coordinates you get a really beautiful and simple description of the flow physics in this case there is a slow manifold where the dynamics usually live and vortex shedding is given by this limit cycle up here at the top of that slow manifold and they were able to derive a very simple reduced order model set of equations for the dynamics in these coordinates this is a tour de force of dynamical systems modeling and data driven modeling of fluid systems from a while ago and now we're increasingly able to do some of this with machine learning so i think that's really exciting so instead of kind of writing down how the navy or stokes equation act in those coordinates to derive this model it's now possible to just collect measurement data and through collecting measurement data of those x y and z coordinates in time we're able to essentially build nonlinear models for how those derivatives behave how x dot y dot and z dot behave as a sparse linear combination of candidate terms that could be used to describe the dynamics okay so this is super simple you you take your system you trust no act that you should measure this in pod1 pod2 and the shift mode that gives you time series for x y and z and then you try to model x dot y dot and z dot as some sparse combination of terms like x or x squareds or x y's or y squareds a sparse combination of terms in a library and by doing this sparse regression we call this the sparse identification of nonlinear dynamics you get a model that has only the active terms that are needed to describe the data so it remains interpretable and generalizable which is what we want for machine learning models especially for engineering systems where you might need to generalize to new scenarios you haven't seen before or where you might need to communicate or explain the model and control decisions you're making okay so this is the cindy method and it can reconstruct this this behavior and essentially what you can see is this is actually those coordinates on the actual data this is the full simulation plotted in those three coordinates x y and z and this is what the cindy identified model looks like so it captures the slow manifold it captures kind of the separation of time scales and and everything in this model now after writing this original paper um shortly after john christophe lazzo contacted me and we started working together to make this method a lot better and so i want to tell you about some of what jc has done because again i think this is the absolute spirit of how we should be using machine learning for fluid systems or for engineering systems in general so what jc did and this made a huge impact in our ability to model these systems is he incorporated two key innovations to this modeling framework the first one is that he showed how you can enforce known physics or known constraints and so you know when we were modeling this we were doing it very naively we just collected the data built the library and did a regression to find which terms were active but we've known for a long time well first of all we know that these incompressible fluids conserve energy that's just part of the the physics but more than that we know how that manifests itself in the equations of motion we know that there is this skew symmetry in the equations of motion in the quadratic terms of the navy or stokes equation that kind of manifests itself as energy conservation and so jc showed that you could enforce this constraint in the cindy regression so that every model you get by construction was guaranteed to conserve energy and that's huge that means that out of this massive space of models where most of them are bad we've already limited ourselves to a very specific family of models that are energy conserving by construction that's huge the second innovation and i really really like this one too is including higher order non-linearities so the original cindy model for the the flow past a cylinder used quadratic terms because the navy or stokes equations has quadratic terms because baron's model has quadratic terms but if you allow yourself to have higher order terms third order fifth order seventh cubic quintic uh septic even nonic terms then what you get is a more accurate model at lower order and so essentially you're accounting for all of the energy that you're truncating in your pod expansion or in your principle components you truncate your principle component analysis at just the first two pca modes or pod modes and then the effect of all of those those modes that you truncated manifest themselves as these cubic quintic nanic terms and so that's really cool and that gives us much better models so that was a huge innovation that that jc brought into this and since then we've looked at uh several flow systems both the cylinder flow past a cavity jc's looked at a lot of other flows too and in these systems what we're seeing here this is just a comparison of how this model works um in this model here for flow past the cylinder and for the cavity flow the y axis is kind of a proxy for drag in this case and the white curve here is what your full high fidelity simulation the actual flow simulation has this kind of drag profile in white and in yellow and blue are the classic models the classic pod galerkin models that everyone's been using for for decades are these yellow and blue and they get the right kind of features but they have some pretty big errors but when you do this cubic constrained cindy algorithm you get much much better agreement with the actual trends in the data so we have less overshoot we have the right rise time and things like that and what's also really nice about this uh that jc has shown is because you get a sparse model a parsimonious or simple model you can manipulate the terms and actually simplify it into something that's very intuitive for a human and so this is the model he wrote down for flow past a cylinder and to date to my knowledge this is the most accurate most efficient and simplest model for flow faster cylinder in the literature this is a simple spring mass damper with a nonlinear damping term so this is basically saying that the cylinder flow acts like a van der pull oscillator really really cool and it's more accurate than actually taking the navy or stokes equations and projecting them onto pod modes so that's really cool and since then working with jc and with barrett noak we've been able to show that you can also develop these models without having access to the full flow field without having full flow measurements even if you just had lift and drag measurements in this case on these three cylinders you can still build very very accurate cindy models kind of in these lift and drag coordinates so this gives us some hope that we can actually use this for control in in the real world because we don't need access to the full measurements to have these models work so really cool i'm a huge fan of kind of sparse modeling in general but there's been a ton of success on this in in fluid mechanics now i'll point out that you can also use deep learning to get better coordinate representations we still built all of this on pod or principal components and with these deep auto encoders you can get enhanced coordinate embeddings or better coordinate systems that go beyond kind of those linear algebra techniques that we've been using for the last 50 years and so this is some great work by uh kathleen champion bethany lush nathan kutzen myself where essentially we take this autoencoder idea and combine it with those sparse cindy models in the middle layer so you might have some high dimensional flow data and the idea is you build an autoencoder to learn nonlinear coordinates in the middle where it's simple so maybe you go from a million degrees of freedom down to four or five variables you care about in this case three and then you simultaneously add this cindy loss function so that you get a sparse interpretable nonlinear model on those latent variables i think this is a really exciting idea for flow field analysis and for modeling really complex fluid flows so i encourage you to check this out there's also great work by bethany lush developing these auto autoencoders that instead of having sparse nonlinear models in the middle have actual linear models in the middle and this is closely related to coupon theory and kind of a non-linear dynamic mode decomposition and i'll point out that there are dozens of groups working on this this is probably uh less than half of the papers that are out on this topic now but really vibrant field trying to find these coordinate systems where your dynamics are simple okay especially important for fluid dynamics good so why do we care about modeling why do we spend so much effort building these models well oftentimes we want to control our system so this is just one of my favorite diagrams from a paper that barrett noak and i wrote a while ago on flow control and it just shows kind of the richness of applications of control theory and this is a recent paper by katarina beaker and sebastian pites which basically uses a deep learning model of the fluid flow as a surrogate that they can then use with a model predictive controller okay so the idea here is that you have a complex flow system and you're going to be controlling it to try to manipulate its behavior and what you'd like to do is run a forward simulation of the actual equations of motion of the navy or stokes equations you'd like to run this forecast forward to see if your control is doing the right thing in the future if it will be doing the right thing but this is far too expensive to run in real time especially many many trajectories for your control system so instead what they do is they build this surrogate model using a deep learning algorithm you could also use cindy or dmd or anything else to get this surrogate model and then you use that surrogate model which is much much faster and still pretty accurate and you can use it for control okay uh so they've applied this uh to the single cylinder and to the three-cylinder configuration where you get to rotate these cylinders and you're trying to control like the lift and drag on all of these cylinders so that's the configuration here they get to independently rotate these three cylinders and they're trying to track a reference lift for the light blue the yellow and the dark blue cylinders so these three different lift values and when you turn on this deep model predictive controller it starts off not tracking those and very rapidly the controller is able to to get pretty close to the reference lift now this required a lot of training data you had to take the system and push on the variables and push on the control inputs and measure what happened for a long time to build this deep learning model but once you have that expensive offline calculation forever in the future it's fast and efficient and accurate okay and i'll point out that this deep learning model is only using measurements of the lift and drag on these cylinders it's not measuring full flow field information maybe even just lift information and what's kind of cool is if you develop a controller based on a model like you run the simulation and you develop a controller your control your model is a model of kind of that cylinder in the uncontrolled scenario and when you turn on the control you're driving your system to a state that it very rarely sees this is not a normal flow state down here and so your model is actually less valid down here than it was when you turned on your controller and so what you can do is you can retrain your model predictive control surrogate model as you start to use it and you drive your system to a new flow state you can retrain that model and you actually get better and better and better performance this is much better performance it's more accurate and it's cheaper in terms of the control cost so i really like this paper i think this is pretty exciting there's also this great paper by erica kaiser that points out sheik does a comparison of using model predictive control based on dmd models sparse cindy models and neural network models and she shows that in general if you can represent your system with dmd or cindy you get better control performance but i think the real hero of this is that even for chaotic systems which shouldn't be described by a linear dmd model you get this very very good fast convergence of your control optimization you can learn this model on the fly with about 10 data points and then turn your controller on so it's extremely efficient to train these dmd models and to use them for model predictive control huge huge point here if you're doing flow control with model predictive control please start by using a dmd model or a cindy model and if those don't work definitely use a deep learning model but it's really always a good idea to start with a simple model that's easy to train fast with little amounts of data rather than a big beefy neural network model i'll also point out there's a huge and growing effort to use reinforcement learning in flow control problems this is very much bio-inspired so a lot of these papers are using reinforcement learning for fish swimming or for perching or for landing uavs this is one of my favorite papers by verma novati and kumasakis from pnas in 2018 where they use a deep reinforcement learning control algorithm to learn how to tail how one fish would learn to tail another fish kind of energy efficient um kind of boat tailing and this is a really hard problem actually um there's some you should go read this paper it's excellent it's a really hard problem the computations alone are incredibly impressive this is a full 3d simulation of two fish swimming with all of the you know resolved vorticity and because reinforcement learning requires a lot of training of different actions they had to run many of these simulations so this is a tour de force in um in in computation but also in learning for control so really great paper um reinforcement learning is becoming a big part of modern flow control with with machine learning okay so i i always want to point out at this point i think this is a nice segue that we really take a lot of inspiration from biology in these systems we are deeply inspired by the control performance of flying birds and bats and insects and swimming fish they are able to expertly manipulate and interact with a complex flow environment with relatively few measurements without the equations of motion you know this eagle can fly on an empty stomach on a full stomach in rain after having injuries it's really incredible insects are especially incredible because they don't have nearly the same sophistication of a nervous system as a bird yet these insects are also able to interact with very complex gust fields so they're able to you know track odor plumes in a turbulent plume they're able to respond very rapidly to gusts that would otherwise knock them off course they're able to figure out from strain sensitive neurons in their wings what control decisions to make ultra ultra fast and so we're just still learning so much from these systems and again this fits in very naturally to machine learning and modeling prediction control you don't have to model everything we don't care about all of the degrees of freedom of your fluid at least i don't think the moth or the eagle do they probably care about big dominant coherent structures that affect their daily lives okay so i want to end here and i just want to kind of tell you that this is still a really rapidly growing field so you know tons of opportunities for an entire career in machine learning for fluid dynamics for modeling predicting estimating and controlling these and progress made here will make a huge difference in technology societal impact industrial impact but we also have a lot to learn in machine learning from advancing advancing these methods on real physical systems uh where we know f equals m8 we know conservation laws so really exciting field thank you for tuning in
Info
Channel: Steve Brunton
Views: 26,236
Rating: 4.9744525 out of 5
Keywords:
Id: gb_C9LcjDSI
Channel Id: undefined
Length: 32min 28sec (1948 seconds)
Published: Fri Dec 04 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.