Welcome to NPTEL Rural Water Resource Management course week three lecture three. So we have been seeing the key hydrological parameters for rural water resource management and maybe looking at groundwater, which is as I said in my introduction lectures, one of the most important resource non-monsoon irrigation for rural water. There is a lot of demand for groundwater. It is by itself a course, but the idea behind the lectures now is to introduce you to the concept of groundwater and those who are interested can go on further to understand more advanced topics from the books that are given in the course syllabus. So some fundamentals, water that is not taken up by plants and animals and soil moves down due to gravity into the soil profile and after some more movement due to gravity and percolation it goes into the groundwater storage. So that movement of water into the groundwater storage is called groundwater recharge. It is very important for rural water management as I was saying because during your non-monsoon irrigation season where there is no rainfall for watering the crops, then most of the water is taken from groundwater. There are dams, large dams that can cater to water, but not all areas have dam connections. However, groundwater is almost present everywhere. It just depends on where you are in India and how deep the groundwater is. So as long as you have borewell lava and a pump and good electric city supply or diesel pumps you can access the water. Is it sustainable? That's a different question, but access is still available. It's supposed majority of the ruby season crop, the non-monsoon crop as I was mentioning and it is also supplying water for domestic use in urban cities and rural settings etc. One of the most complex hydrological parameter to estimate and model. So unlike the other parameters which is either happening on the surface where you can visually see it, then you can recalibrate your models, you can adjust your assumptions. Groundwater is a component that is deeper under the ground and it is not visible. Only one or two wells you can see, but between wells you can see a difference in water levels. So if you go to a rural village you always have complaints from farmers saying I put a borewell here, I access groundwater, but my neighbor who just put it right next to my well, there's no water. And same depth, same depth, everything is same, soil is same, they prefer geology is same, but one farmer is getting water while the other is not. So that is the complexity of groundwater by the way it is set up. So it is one of the most complex hydrological parameters. I would say it is the most because the others happen on the ground, for example, evapotranspiration. You can look at the plant, if the plant dies you can assume there's no water loss, and if the plant is fully grown you can know how much at full growth stage the plant grows, but you cannot visualize the movement of groundwater and recharge and discharge. So it is the last step in the hydrological cycle before the water gets into the oceans and lakes. So let's look at it here. The last step which I mean is the deepest step. So you have precipitation converting into snowmelt, runoff in the rivers and then storage. So these are earlier new stages. Then some part of the water gets into the system as soil moisture and that water is taken up by plants. So whatever is not remaining, from this exercise, so like plants have taken the water, animals have taken the water, the remaining water goes down because of gravity and that groundwater is either stored as deep aquifer water or it moves back into the system into the ocean. So it eventually meets the oceans and gives it as a discharge into the ocean. So it is one of the last steps in completing your hydrological cycle. You start from the oceans, go to the atmosphere, come down as precipitation, runoff, go into the groundwater and then come back to the oceans. And under that, there's nothing, which means under the groundwater, there's no movement of water because it is hard rock or impermeable surface. So beyond that, water doesn't move, very, very negligible water, which you can easily say it's negligible. Let's get into the theory of groundwater storage. So soil rocks and sediments in the solid minerals and grains. So this is the solid part of your soil. As you have soil formation, there are some courses on this. The soil is a weathering process and on the top of the soil, you have purely soil and more aggregate materials, but when you move down, down, down where groundwater occurs, on the top it's soil moisture, down it is groundwater. When you come to the groundwater stage, you see bigger size of soil or rock particles. And in between them, same like soil, you have white space. Here, air is very less. So most of the time it is water. So in the groundwater aquifer, you will find almost all the pore spaces are with water. So the minerals and grains have pore spaces and that is fully occupied by water, which constitutes your groundwater table. So you can see how different materials are. A, B, C, D all have some particle in it and then a lot of spaces. So depending on the spaces, water occupies it and water is very flexible. It can go through any space, it can manage manure, any shape. So it is very lucid and it can actually be flexibility into any shape. So you can see how it can go into a fracture, which is connected and all it needs is a connection from one pore to the other pore. So all these pores are connected very slightly. The water fills here, after it fills down, it goes moved down to the other pore. So it depends on the pore space. If you do not have a pore space, for example here, there's no water, only in the pore space where you have space, water gets it and then stores it. In the hydrological cycle again, to understand where we are, we have precipitation and whatever water is not taken up by plants after infiltration, moves down further downward in the soil profile as percolation. And that percolated water hits a level where it is called the ground water taping level.  So here you have all the water is being reallocated into all the pore spaces that it can find. And it is the last stage because below that there is no movement of water. So water moves, goes into the ground water table, there's no further downward movement, but the water has to come back to a surface discharge. It could be the ocean, it could be the ray on stream, river, etc. There are some instances where water is kept in a pocket, which means water gets in but doesn't get out of the system. So those pockets are touched aquifers, we'll look at some examples. And that water is very, very hard to take out because we don't know where it is, it is just a hit and a miss. It happens because how the earth has been formed. So important parameters for assessing ground water, we know how water gets in. Now let's look at what are the driving parameters and how can you assess ground water? First one is base flow. Discharge curve that we looked in the surface runoff, discharge curves. You could understand what component of water in the stream or the river is given by base flow. And as we know, base flow is given by groundwater discharge. So by knowing base flow, you can know whether groundwater gradient, groundwater flow. Principles of groundwater flow are given by Darcy's law and in that the very important parameter is groundwater head or the elevation of the groundwater level. So that is the groundwater table like here. So this from the ground zero, the top is your groundwater level and that drives your groundwater movement based on Darcy's or Richardson's law. Basically what it is is any water would flow from high potential to low potential from a higher level to lower level. Imagine you have water in a tank. To get water to the tank, you use a pump because water cannot go from lower potential to higher potential. So you spend energy to put it up. But when you leave water to stay there, what it would do, it would eventually want to come down. So water naturally flows from high potential to low potential. So this is the engineered setting. Let's look at a normal setting. So water is happening in rainfall in a mountain region, which is high potential, water is stored there as ice. Once it melts, it doesn't want to stay there. It wants to come to the low potential, which is your reverse lakes. So which is the lowest potential, it would come to the ocean. So that is where if your groundwater table is here and this one, the groundwater table is here, so it would flow from your left to right in this diagram. That is why you have the arrows here because the groundwater table here is at a higher potential compared to the groundwater table here, which is at a lower potential. You could see the elevation height, which is given by Ed and Darcy's law. The other thing is porosity. How much core space is available in your material and that determines the groundwater storage. So once you have groundwater storage, then the water starts to move. So the process is groundwater is going through a system by first precipitation. Precipitation occurs, it goes into your soil, then it gets stored in your core spaces, the porosity. Once it gets stored fully, then it starts to move. So then it establishes the groundwater table and an aquifer concept, thereby you have movement. Please understand that this is not fully water, you still have solid particles, soil or rock particles here. Only thing is it is all connected, so you can visualize it as a flowing river under the ground. So here it is like flowing, but flowing means it is connected through the pore spaces. So one pore to the next pore, it just flows through. Specifically it is another concept, which is very important. It is the drainable porosity. How much water can be extracted from your aquifer is a function of your specific yield. The hydraulic conductivity is the ease by which water can move from one point to the other point. These are explained in the Darcy's law, but please understand that there is a property which allows the water to move through the system. What will it be a function of? If we look at the concept of groundwater, it is stored water in the pores, which means there is still solid material and it is interconnected. So all this is a property of the soil. So the hydraulic conductivity or the ease by which water can move, conduct between a pore and another next pore is given by hydraulic conductivity is a property of the soil. Groundwater recharge is a very important aspect to understand groundwater assessment. Groundwater recharge can happen naturally by infiltration, percolation, etc. But sometimes it is not enough. It is very, very slow. And the farmer wants the wells to recharge for the next irrigation. So what do they do? We have augmented an artificial recharge. So the well, which was initially done for domestic use to bring and forecast them slowly began to be used for irrigation. And then the number of wells multiplied. So all this is having a tremendous impact on the groundwater sustainability because groundwater is a very slow process. It has to go through the soil, the rocks, the pore, etc. But then you easily extract it using a pump. So to increase the groundwater level, people would do augmented, which means additional structures or artificial structures to recharge. Then the concept of aquifer. So here, this is your aquifer. Okay, aquifer is the level at which water has been connected and water flows through the aquifer. Okay, so this part would be your aquifer. If you have a no permeable layer, which means a big rock or something which is separate the top and the bottom, then you can have an aquifer on the top also because there's no flow on the bottom and water can flow. And inside underneath here, there's another flow which happens. So we have two aquifers, like a layered cake. Okay, you have a cake and then some cream and then a cake. Look at the cream as a non penetrable layer, means water cannot go through. So water will flow through the cake, then no flow and then another. So we have two aquifers. Let's start with the different types of groundwater. So there are multiple different types of groundwater aquifers and all aquifers can be explained in this cross section. So what we have here is precipitation, which is the recharge for all of the groundwater resources. And first precipitation occurs into a land and then it starts to move down. While it moves down, it faces impermeable surfaces at different levels. So here we have the bedrock, which is impervious, which means water cannot move through. So water would move in a lateral way. So from vertical, it goes horizontal. Similarly, the top surface, which is your land surface where infiltration happens, water moves down and then slowly it sees another impervious layer, which is not as highly impenetrable like your bedrock because bedrock is the deepest you have while this one is not as strong in penetration. So you have water coming in and it hits your impervious layer. Then what happens? Water starts to pond up. While water starts to pond up, your soil gets on the soil or the solid particles, the pore space gets water. So number two, what you see here is called the zone of saturation, which means the water is full. Remember the soil moisture we discussed, same here, your zone of saturation is a fully watered with full of water aquifer. So this becomes your water table aquifer. What about the water which is moving in the soil and coming down? That becomes your zone of aeration. So you have a water aquifer which is formed and right on top of it, you have a zone of aeration which can still take water and become saturated. So those are the two types you have zone of aeration and zone of saturation in one aquifer unit. Then you have your confined aquifer. So this is an unconfined aquifer which means on the top you don't have an impervious layer. You can still infiltrate water and you can still convert the zone of aeration into zone of saturation. Whereas this layer between two impervious layers, so impervious layer one and the bedrock, the layer of soil or weather drop which has water is a confined unit. It is confined between two impermeable layers. You get the point. So water can flow, get in, but it cannot go up or down because it is confined within that unit and these are much deeper aquifers. In other terms, this is called a deep aquifer whereas the top one which has still potential to recharge is called a shallow aquifer. In hydraulic terms we call it zone of aeration and zone of saturation. And then different wells can be put to access the water. So in a zone of aeration and a zone of saturation you can have shallow wells where you can drill down and take the water. Whereas you can take a water from your confined unit with deep bore wells and the deep bore wells can have a screen here to just take this water or two screens on the top and the bottom to take the shallow aquifer and the deep aquifer. If you're a farmer you would like to have all the water coming into the well, not just one water. But if this is polluted then you would screen the well and only open the screen here so that the deep aquifer is giving you water. So the shallow groundwater is the water which we have used in our wells. So when you see a pulley system in a well those are shallow aquifers, shallow groundwater where water gets recharged annually and it can be used for domestic and irrigation purposes. Whereas the deep groundwater has taken a long time to recharge because it is not as ready as infiltration, percolation, then groundwater. It is recharging somewhere else and then coming here. See here this water can be vertically recharged but for this water it has to come from a very very far distance. So the deep groundwater is a water much much older than the shallow groundwater. And then on top of this you have a locked groundwater which purged water table which means in your soil sometimes you have a confining unit like a bowl or a small shape where water can get in but it cannot get out. Okay so which means downward movement cannot happen but water can get on the top. So that water is called a purged groundwater and that is a locked groundwater where it cannot move laterally but once it gets filled it just gets saturated. So this is where I was saying a farmer can put a well here and in just 30 meters he can get water. Another farmer which his house is here which is very close to the other, he'll build in 30 meters he won't get water. He'll still have to go down. So this understanding is not available for farmers. They cannot understand it how come you put a well there you get water but just 10 feet away I'm not getting water. It's because of the complexity inside the ground. We do not know where this impervious layer will form. There's no idea how it forms. Okay I'm saying you cannot model where it forms. So you'll have to be careful in understanding these externalities in groundwater. So these are the three different types of groundwater as after water moves in. You have your shallow groundwater then you have your deep groundwater and locked groundwater. So all these are based on your hydrogeology the rock material that is present in India and this has been given by the central groundwater board or the map and there is not much change between years because the rock is a rock right. You don't change the parent material that easily. It can weather as soil. So groundwater moves through the soil and then moves through the hydrogeology but the geology still stays. Okay so what you see here is the different types of aquifers based on the geology of India and you could see that this part where you have unconsolidated formations or more unconfined aquifers alluvial aquifers you can find a lot of water. So the yield is pretty high. You see high yield in liters per second and in the deep blue color. Okay so all the basins or all the areas with a big river network you could see a good groundwater availability in terms of yield. And here on the coastal regions also because all these central flowing rivers would come and deposit here. So all the sediments would give you a good aquifer alluvial or sediment aquifers. Then we have the consolidated or semi-consolidated areas which is most of central India where you have deep aquifers. Most of it is deep aquifers because the formations do not happen every day. Here every day you have sedimentation. So you have an aquifer which is being built up whereas here it's not that frequent. Okay so these are the unconsolidated aquifers on the rivers. Then you have in central India more consolidated or semi-consolidated. Some rivers are flowing. So you have consolidated and semi-consolidated aquifers wherein the yield is much much lesser compared to your unconsolidated formations. Then you have hilly areas almost very negligible water because water doesn't penetrate in your hill is just a rock. Mountains are rock. So where is the pore space for the water to be stored? It's very less compared to a soil where the soil has air and pore space. Your rock doesn't have that much so when you pour water on a rock it just falls down. So that is where you have less yield in groundwater. So now you understand that for groundwater you need to understand your precipitation. You need to understand the soil and the type of soil which gives you the details of porosity, hydraulic conductivity etc. Then the geology to understand the deep aquifers and if it is a hilly region and rock there's not much water that we store. So if you look at mountains and stuff you might get good rainfall but you need to capture the rainfall for agricultural domestic use because groundwater potential is very very good and even drilling into a mountain area is very hard because it's so rock. So it is very hard to even get your drill down. How do you determine groundwater recharge? It is because of its complexity mostly it is made by your groundwater budgets. So if you know the groundwater resources are determined by your precipitation and runoff you can calculate your infiltration. So let's look at some of the groundwater estimation committees 1997 report which is still used now because it's just a formula. You have infiltration which is the water that gets into the soil and that is the water which goes to percolation and your groundwater recharge. So infiltration is kind of the first step in your groundwater recharge. So you could see it as it can be very simple as precipitation minus runoff. So precipitation is the water coming in and runoff is the water that goes off the system. So the difference gives you the volume which actually infiltrates. Then you have your evaporation then you can add on your evapotransmission which means you can make your equation more complex by throwing in more and more variables.  So all this can be done at different scales regional or sub-regional scales and you could also look at different methods suited to your land. So for example in your land if there's no agriculture or if there's no transpiration happening or no water bodies then most of it is going to be precipitation and runoff. So after runoff if you can capture the water and understand how much runoff is there and if you can capture the rainfall understand how much rainfall is there the subtraction will give you your infiltration, more or less. So these are the different methods and based on this there are a lot of models that estimate groundwater. There are satellites right now but we would not get into that because it is not at a rural scale the satellites for groundwater. So I'm not including that in this picture. Someone might ask me tomorrow sir we do have groundwater recharge based estimations from Grace satellite which is a NASA US satellite but I do that for a state level or country level not for a village level right because at village it is such a small and the resolution is not good. So how do you estimate groundwater recharge is by looking at your wells understanding the hydraulic conductivity, understanding the properties of the soil you can estimate that calculate your recharge by these kind of methods. It is very expensive to do everywhere monitoring by groundwater. So groundwater board the central groundwater board which you see here is the authority in India to have these monitoring wells and regularly gives you data once in every three months at least. So quarterly you get data and across India they have around 15,000 wells to monitor and give you the data. So I think every year they do add more wells and it is a very, very time consuming and costly affair to get the groundwater data. So you don't see too many estimations. So somewhere you need to model it, somewhere you need to estimate it based on your precipitation and runoff and somewhere you would estimate it based on your characteristics of the geology like we saw here the geology. If I know the geology I could estimate how much porous space is there on the porous space and the rainfall I could estimate. For example if the Ganges was not flowing there's no water there then you have porous space but you will not have water. So based on your runoff, based on your precipitation and your soil and geology characteristics you can estimate groundwater recharge and groundwater storage. Driving home message is please understand there are multiple groundwater wells or groundwater storage and what a farmer uses might be shallow aquifer initially but as the water level goes down so for example if the water consumption is high the water level will keep falling and after this water is totally used then this well becomes abandoned he or she would drill another well much, much deeper and get water and that could be a deep groundwater aquifer. So driving message here in ZIP sustainable if you just keep on drilling deep and deep. So all of you will notice that even in urban centers you start with a well depth and then suddenly after some years there's no water you drill deep then you drill deep and because you know that as you go deeper and deeper there will be some water based on this diagram but once you hit bedrock there's no water so it is not sustainable to keep drilling. Sustainable way is to increase your recharge, increase the groundwater flow so that you can store more water and reduce your consumption. If you know that you cannot grow your crop why are you going to use the groundwater right? So you might use it in three fourths of the time for example if your crop needs 10 irrigation schedules your groundwater can give water for 3 but what about the remaining 7 and if you don't have water for the 7 your crop is lost. So the idea is to understand how much groundwater you have before using it and depending on that you use a crop or an area of crop for watering. So please understand these three different types the locked groundwater can be misleading because you'll find water you'll be happy but it is such a small component and your shallow groundwater would eventually lead to a deep groundwater access. So this is the problem in India currently. We will get into the river issues when we go into the groundwater lectures in the future. I'd like to stop here. Thank you.


Here we are zooming into the sculptor dwarf galaxy, an elliptical spheroidal galaxy orbiting the Milky Way. In 2017, Gaia and Hubble provided datasets separated by 12 years that were used to measure the exact three-dimensional motion of a small number of sculptor's stars. The main goal was to examine the distribution of dark matter in a galaxy without a central bar like our own. The current theory has it that dark matter is cold and only interacts with itself and visible matter via gravitational forces. Statistical simulations indicate that matter with these properties would clump up into galaxies with the dark matter density being highest in the center. This peak density at the center is referred to as a dark matter cusp, but spheroidal galaxies like this one don't have core dense center bars, so the central question became does this galaxy have a dark matter cusp even though it has no visible core? If the answer is no, as expected by many, then we go back to the drawing board for figuring out dark matter. 126 stars were found in common in the two Hubble appointings and the Gaia dataset. Using star distance, the researchers identified 91 of these that were actually inside sculptor. Using only those stars with the most accurate motion readings brought the number down to 15 stars. Over the 12 years, they would have traveled on average only six-tenths of a light year in sculptor's own reference frame. The results show that the stars in sculptor move preferentially on elongated radial orbits. This indicates that the density of dark matter increases towards the center instead of flattening out. These findings are in agreement with the established dark matter model, but the dataset is very small and more research is needed before a definite answer to our question can be reached.


What's up everyone? It's your girl Kenzie here from Layton Sports Cards and I'm ripping a personal for Ronald C We've got a 2022 tops finest baseball hobby. All right, Ronald. Ronald. Good luck. Here we go Luca black finite one of one rookie Chrome There's a 1.5 million dollar bounty on it right now. All right, Eddie. I would sell it I mean granted.  All right, we got a wander rookie Refractors Salvador Perez and pulling back here Mackenzie Gore a trade turner Not a rookie For the Cubs a red Wilson Contreras that is five of five Nice off-color match there We will take a red. There you go, Ronald. Nice Thanks for the follow Daniel all these conturers a Tyler McGill on the rookie refractor auto Mets Marsh and Bruhan rookie black man Devers rookie refractor Nicola Dolo Joey Vado and Freddie Freeman Bryan Hayes Ivan Rodriguez. We've got Green Lava Ronald Acuna Jr. 78 of 99 Miranda and Cabrera Alan Suzuki cornerstone George Springer Stott and Toss George Springer CJ Abrams, Vladdie refractor Molina Second half here for another auto Eric Cole Chris Bryant. We've got rookie aqua refractor that is 76 of 199 O'Neill cruise It's a nice box. It's a nice color and Shane Boz. We've got to 50 aura aura of excellence and Adrienne Beltray Nice one. They are beautiful looking autograph on that 47 of 59 insert auto there Patsy's and Devers Cornerstone's McGee refractor brace harper. You have a boba shut on the aqua to 89 89 of 199 So we're packing only at three cards in it. I'm sure this next one probably is. Yeah, the remaining Molins aura of excellence Aussie Smith finest rookies of Shane Boz for the race Kim Smith and Elliott Ramos a lot back here Yeah, Jim, it's a nice car and penny a rookie base Jonathan India refractor Aronato and Juan Soto Alrighty Ronald that will do it for your box nice color there as well as that nice Beltray auto That'll do it. Congrats and we'll get them right out to you


Welcome back. I hope you had an excellent break. Our next talk is a special topic, imagine code, creating code. It's always a really fun topic. So welcome, Kirill Borisov. Hi, Kirill. Thank you. Hi. So I am a little bit nervous. It's my first talk on a major conference and totally in English. So fingers crossed, it will go not as awful as it could. But still. Don't worry, don't worry. So where are you streaming from? I'm streaming straight from the Netherlands. It's quite rainy here. And weather could be nicer, but still I like it here. Okay, great. So you're really talking about automatically generating code? Yes. It's my passion because I like everything code related. And I try to create things that try to read and modify code in the spare time. So once I started doing that, I inevitably crashed right into a code generation. So let's get started. So let's get started. Thank you. Okay. So greetings. I'm Kirill Borisov, and I have more than 15 years of program experience under my belt. 10 of them are actually tightly mixed with Python. I'm creator of PyBattery code reformator and black connect PyCharm plugin. And as I've said, I'm in love with everything code. I like writing code, reading code, modifying code, fixing code, whatever. So about this talk, what will you know from it? We will talk about how code is written. We will cover a little bit of parsing. So how it is translated into some machine level representation. We will introduce Hypothesme, an excellent tool to do random Python code generation and we'll dive a little bit deeper into how it actually works. How is it possible? So let's get started from a basic code. What is it really? Code is, as you know, our bread and butter. We get paid to write code, to fix code of other people, to make it execute, to make it execute faster, etc. And code is usually written by hand by regular people. We have an idea, we translate it into paper and then we translate it into the file in the computer and then it magically gets to execute. But as we people are formal, we also need not only to read it, but also check it. And we can't really trust other people to check it because, as I've said, we are fallible. We're just mid-sex, we have emotions, we have fatigue, etc. So the whole cottage industry, or so-called linters, appeared. It's a set of tools, many of them that you know, and it actually does things like checking your code for complexity and other things. Before we get into them, let's remember how code is actually translated into a machine level representation. So here it is, maybe not the simplest possible program, but the simplest to understand and dear to everyone's heart, print hello world. But yes, it's a Python code, but how is it actually processed? First, it's broken down into so-called tokens. As you can see in this string print is a token of a type name. The left parenthesis and the right parenthesis and also semicolon are so-called op. And the hello world itself is a string. As you can see, we already have some understanding about what actually goes into this string and how this code is structured. But it's too low-level to actually do anything useful for our understanding. So then we apply the grammar. Grammar describes how the source code of a language is actually translated into high-level structures that can be used to process it into something that machine will understand. So here it is, an excerpt of Python free grammar that describes the top-level structures, so-called file input statement, simple statement and small statement. As you can see in this context free grammar, we go down. So we have a statement. It can be either simple statement or compiled statement. We go to the simple statement. It can be small statement, spirited by semicolons from other statement, one or more of them. And it usually ended with a new line. And the small statement in this turn can be one over whole set of other types of statements like expression, print, del, and things like that. So if you combine the stream of tokens with a grammar, you'll get something like this. It's basically a low-level structure that determines how the code is grouped. So as you can see, we have a file input that consists of end marker and simple statement. Simple statement is actually consists of power and the trailer and the new line. And all of them can be made directly onto the token stream. After that, the machine actually does some transformations and creates so-called abstract syntax tree. That is actually the high-level structure that interprets the workspace to translate your code into the byte code that gets executed by the interpreter. And this is a level at which most of the code checking, formatting, and modifying tool work at. Let's get back to the linters and auto-formatures. So as it has been mentioned, they read your code. And what they do is check your code style, they check your code for security issues, for the complex issues, et cetera. Some can actually modify it and introduce new constructions into it. Many of you know PEP 8, PyFlakes, Black. Those are just the most well-known examples of these kind of tools. There are many, many more, and maybe some of you actually written some of them. But the question that gets to everyone who actually wrote at least one of those tools, how do I actually check them? So how to check the checkers? The usual way to go is to use handcrafted examples. So you try to imagine which kind of code will actually trigger the checks that I'm interested with and which kind will actually do not trigger them. So you try to imagine as many permutations of these code examples as you can. When you write them down, when you say, hey, those should trigger the checks, those should not. And everything is OK, yes. And for the most part, it's really OK. But in this, you are limited by your imagination, and code can be an expressive tool like no other. So imagine that someone writes code in a totally different way than you are used to. Someone writes all their code in one string, or someone uses eight spaces instead of tabs, although it does seem a little bit crazy. And maybe, just maybe, your tool will break if you encounter code like that. The real world can really surprise you, and I know that from experience, sadly. So what can we do about that? Well, we can try to step outside of our head and try to imagine how I can get the most random code possible. So what you can do is just take a random set of characters as an input, and filter them by the criteria that it actually compiles, and it will work. Sure, but as anyone who read about infant monkey theory knows, it can take a really long time, like a lifetime of our universe, even if our computer was the size of the universe. I don't say that it can't reach the compiler, for example, in your lifetime, or maybe even in a year, but still much too much for your regular CI build. So it is highly practical in terms of time, and sadly, it cannot really be used for our purposes. So what should we do? Well, here comes the tool called procedural generation. As Wikipedia tells us, it's a method of creating data algorithmically. So we have some kind of algorithm which we can apply to the process of generating random data. So it's not completely random, it has some kind of structure inside it. And structure is the king. So what we need here is actually rules on how to arrange things inside the random code we generate. We need some kind of patterns for generating things that are correct and valid for this specific programming language. So for example, identifier should also all start with a letter. It doesn't mind which letter, but a letter still, etc. And it needs to cover the whole of the language. It wouldn't do if we cover only a specific subset of the language. If we are trying to go for broke and test something completely random, something that we'll never think of on our own, well, we'll need to try harder. And that sounds like a grammar, isn't it? Yes, it's actually something that will help us. A grammar. A grammar is a structural representation of the things that can be in the language, how they can be arranged, how they should look, if we are to be considered valid by the language itself. So we should really just go and use it. The grammar itself, as you have seen, can be represented as a tree. The rules, so-called non-terminals, will be a node of the tree. And the text, the actual text that will go into resource code, so-called terminals, will be a leaf on the tree. So what we'll need to do is just do a random walk through the tree, just go from the top of the tree down to the terminals, and just concatenate everything that we'll get from these leaves in order. And with a high probability, you will actually get code that will compile. To help us with that, we'll have a tool called hypothesis. Many of you also probably used it already to generate tests or to generate data sets for your tests. Using so-called property-based testing, it generates a wide range of input data. For example, if you have a function that accepts two arguments, integers A and B, you will try to call them with 0, 100 million, minus 1, et cetera, et cetera. It will not test the whole possible range of the values, and it's very important. But if we'll try to test for the whole possible range of values for a given data type, we may never end because the integers, they have a finite number of them, at least in computer representation. But imagine if we'll need to test all the possible strings of characters that we can generate. Yeah, quite a long time, isn't it? So based on a quick check paper, what it does, it tries to generate examples and then tries to generate interesting examples. So it tries to move for the whole possible space of values that can be used, and try the ones that will pass as approved by our tests, and then it will try to do so-called shrinking. Basically, if it finds a string of 1,000 million characters that breaks your test, it will try to make it 1 million characters, 10,000 characters, 1,000 characters, et cetera, just because it's much easier to represent and then reproduce. To do that, it uses so-called hill climbing search, which is outside of the scope of this chalk. Basically, it's a method to actually navigate with many-dimensional space of possible values. So just an example, we'll use something from the hypothesis documentation. It's a test that checks that we actually can create a file with all the possible branch names for some kind of repository. So we have a valid branch names function that uses the thing called strategy that is supported by hypothesis to actually generate random text. We specify the restrictions on that random set of characters. It should consist only of the letters, alphabetical letters. It should have minimum size 1 and maximum size 112. Also, they should all be lowercase, or we can also taste the specific case of master branch. And then the hypothesis will take our test function, test checkout new branch, and we'll try to generate branch names and give it one by one. Possibly some of them will pass. Maybe some of them will break the invariant and actually break the test as well. And that is actually what I do. But on itself, hypothesis cannot really generate the random source code using its simple strategies like text mentioned here. To help us with generating source code for a specific language, we need to use more advanced thing in the hypothesis called large strategy. Large strategy actually uses a large parser. It's a parsing toolkit for Python that you fit in the context free grammar and it generates the code to actually parse the source code described by this grammar into some kind of a representation. So large strategy basically takes grammar, in our case, Python free grammar. It generates its representation in the machine readable format, basically a tree. And then what large strategy does, it basically walks the tree as on each level, it selects a subset of the nodes on this level and walks into them and does that recursively until it reaches the terminals. And the terminals, the actual thing that will be generated and including our source code will be represented as a regex. And it will try to take a regex and generate a string that will actually be matched by that regex and then it will be considered as an acceptable terminal. But not all languages can be generated like that on the WIM because Python is very quirky. As you know, for example, aside from many different languages, it uses invitation to mark blocks of code instead of the pairs of parenthesis. Or for example, identifiers must be UTF-8 encodable. Otherwise, the compiler, the interpreter will not recognize them as valid. And there's a lot of AST post-processing. So the code that is described by the Python 3 grammar is not necessarily the code that will be recognized as valid by the Python interpreter itself because it will do a lot of post-processing on what is actually generated. Or for example, we have a new PAG parser in Python 3.10 that will actually do interesting things, which is again, at the scope of this talk, but we can talk for hours about it. If you're interested, you can read a series of posts by reader Juan Rosso, in which he walks you through writing as simply as possible a PAG parser for Python itself. So to help us with this, there is a tool called Hypothesmit. So it is inspired by the Seasmit. The Seasmit is actually a tool that has been used by the researchers to test the C compilers for bugs. It generates valid and random C programs. And why not do that for Python for the creator of this tool? And what it does, it exposes the strategy that can be used with the hypothesis. So it builds on the large strategy. And that strategy has a number of post-processing mechanisms that smooth over all the quirks in the Python code that we can generate. So for example, it post-processes the generated code in terms of idents, generating the correct ones. It also tries to compile each example by the Python compiler and then throws away the ones that actually do not compile although they are valid from the grammar standpoint. And it also has an experimental support for per node generation. So instead of generating any possible program that can include any possible subset of all the productions in the Python grammar, you can ask it to generate the if expressions in all the possible forms or imports, et cetera. It is a little bit experimental in my opinion at this point and it uses libcst, but it has a big potential in my opinion. So how does it actually look in practice? So let's look at this source code. This source code uses hypothesis to generate our source code. But first, we are setting a special set of options for the generation or random examples by hypothesis because generating source code examples can be very slow. Not slow like lifetime of a universe, but slow as 5-10 minutes. And by default, hypothesis will say that no, this test takes too long, I will just fail it. So we tell them that no, there is no deadline, take as long as you can and do not look at the high number of discarded examples because as we've said, quite a lot of the examples that will be generated will not actually be compilable. But the actual meat of the matter you can see in the next test, it's a generated source parameter that passed to the test and it's generated from hypothesis.fromGrammar. We are also telling it to generate a maximum of 1,000 examples just for the sake of a demonstration. And instead of checking this code for anything, we'll just try to print it out to see what is actually being generated by hypothesis. So in the beginning, it will be something quite simple. So in July, perfectly valid Python source code to new lines. Okay, I can write that new line and new line. Okay. If a... Oh my God. If a... Oh my God. But where are spaces here? Where are like no spaces here? Is it really a valid Python code? Actually it turns out yes. I for myself will not in any way consider any Python programmer a person who will write without any white spaces because it's actually hostile to other people. But for purposes of testing, this is exactly what we need because as I've said before, we need something what we people will not consider to be possible or even needed. And if you give it some time, it will graduate two more complex examples like this. Yes, again, perfectly valid Python source code. It does look a little bit strange, but it will compile and it will actually trigger some bugs possibly in your code because did you ever imagine that there can be no white spaces in your code as well or that non-local variable names can be a set of unicode characters, not only eski ones, etc., etc. And if you give it some time, it will generate something completely unreadable. But still, it's a valid Python source code and it's still valid for purposes of testing. Maybe exactly this will encourage some bug in your parser code or maybe your tool will choke on this and you will know that, hey, something went wrong. I need at least to see if it's actually applicable to the regular code written by humans or not. To help with a better example generation, HypotoSmith also used a target search feature of a hypothesis. So we use metrics to find better examples to guide the search for random data in the space of all possible examples. The targets as used by HypotoSmith is a number of bytecode instructions, total number of AST nodes in the resulting source code tree and the number of unique AST node types. So for example if we have a program generated that has like 1,000 print instructions, then possibly we need to do something to make it more varied in terms of what constructions go into the generated code. So by using these targets, HypotoSmith will move through this space and generate a longer and more complicated code which is a nice feature to have. So you will say, are there any actual bugs found by HypotoSmith? Yes. And as you can see from this list and this is not a complete list, bugs that it found can actually be traced to the Python interpreter itself for example, Python-first-sec-fold which actually stopped the release of Python 3.9-alpha-1 and Sec-fold as you may well is very, very serious matter because basically it breaks everything. There was also tokenize, untokenize around 3 bugs, so for some reason if given a specific example of code if you give it to tokenize and give the resulting string of tokens to untokenize, it will not generate the same text that was passed to the tokenize which is again not what was expected of the code itself. There's also issues in the mobile known packets like lib223, black, libcst and I do think that if you try it on your code, on your tool you may find a bug as well. For example I came to know about HypotoSmith when its creator actually came to one of my projects and said, hey your tool does not process this specific piece of code correctly and I'm like, where did you get this? Nobody writes code like that. And then I discovered HypotoSmith and yes, it encountered a serious bug in my tool and I had to fix it because while you may say this example was far-fetched, the one that was generated and looks mostly like gibberish it still could have impacted more unusually written code by actual human being. So as I said there are some caveats to this approach. Most generated code is gibberish as you've seen for yourself and it can only serve as a smoke test. Smoke test is a term that comes from electrical engineering. It's basically when you've assembled some kind of a device and you plug it to a power source and if everything is assembled correctly everything happens except for maybe it's not working as you expected but if you, for example made some errors and there's a short circuit, you will see smoke coming out of some parts of your circuit and that indicates that something went wrong and you should really look closely to what you have done and here it serves the same purpose. So it will crash your code, possibly in place you never expected it to and that will serve as an impetus to actually look into what is going on and does it actually trigger a real world bug and do you need to fix it or not. If you haven't done that, possibly it could have a snake under the hood and trigger something bad happening in the real world. There's actually no support for AST post processing as well as I mentioned many overcode examples that otherwise can be considered valid from a grammar standpoint will be thrown away because we do not have a specific understanding of how to generate code that will trigger those post processing rules but it is an area for improvement and possibly one day this tool or some hour will actually look into that problem and learn how to do that and it will improve the consistency of the generating process considerably. Also, it can be quite slow mostly because it will spend some time searching for examples that actually compileable due to a previous point and many of them will be thrown away and it can take quite a lot of time especially since if you try to compile any type of code that you it will take resources needed to parse this, to process this, transform this and in the end to determine that it's actually compilable. So if you are really interested in this and I may understand if you're not but for those who are you can read a little bit more to understand how it actually works and how it can be applied further. First I would highly recommend two papers finding understanding bugs in c-compilers that describes the c-smith and how it actually works. Next is a quick check. It's basically a property-based testing tool that's described in this paper in Haskell yes I know Haskell but still it gives all the necessary base of information for you to understand how this random example generation is actually guided and how it works and how it can be applied to your program. And all this very famous book compilers, principles, techniques and tools by Ahoseti and Ulman that is considered to be the textbook on the parsing techniques on how to write your own parser for any language that comes into your mind. It's a little bit heftier like one thousand something two hundred pages, but still it's a very gripping read and I cannot recommend it enough. And also if you're really just interested in how to apply random testing to your code then you can also look into the articles that describe the hypothesis and specifically a good starting point is the high hypothesis works on its website. To better understand what you can do to improve the efficiency of a code generation how it can be applied to your specific test situation. So, any questions? Thank you very much Kirill, for your first talk at a big conference it was very good so there is one question we don't really have too much time but I still ask this question Will hypothesis and other tools mentioned here work in Python 3.1 any pack? That's a very good question so technically they would because we're using the Python grammar that is not attached to a specific parsing method used by the Python interpreter as I've said it actually triggered some bugs in the pack parser already so we can say that it works and I think that maybe some purpose will come further if we dive into the creation of code examples that trigger the code transformation and specific pack parser features later but at this moment it uses on the grammar to generate code samples so you are good. Okay, so unfortunately we are out of time but if there are more questions I'm sure you can check the chat so sure Thanks again Thank you for having me and maybe see you at the physical conference next year I think it's crossed Okay so our next talk has a very


the previous lecture we were discussing about the lubrication theory and we eventually derived the governing equations for the leading order velocity component along x along with the boundary conditions. So before proceeding further I will try to summarize what we have discussed so far so that you can recapitulate and then we will move forward. So if you look into the view graph which is there then basically you have a narrow passage where the length scale along y is much smaller than the length scale along x. So the epsilon which is the length scale along y by the length scale along x is considered to be much much less than 1. So we have used various non-dimensional parameters I will go through these slides pretty quickly because this is just to sum up not to give you any new concept and we have obtained the velocity scale along y in terms of the velocity scale along x using the continuity equation. Then important notes for non-dimensionalization we have used the characteristic values of the variables to non-dimensionalize the pertinent variables. This is a very important step this ensures that all non-dimensional variables and their derivatives have order of magnitude of 1 that is variables are of the order of 1. This means that the contribution of a variable or its derivative in a given equation solely depends on its coefficients because the derivative is of the order of 1. This process thus enables us to neglect certain terms in the corresponding equations based on only the coefficients. The concept is of utmost importance in fluid mechanics as a number of methods employed in the subject comes straight from this concept. For the sake of completeness we will assume that the body forces fx and fy act along x and y directions. These forces might be gravity, magnetic field, electromagnetic effect whatever and the characteristic scales are fcx and fcy. So I will not go through all the details of the governing equations because these have already been worked out. So the analysis of the x momentum equation gives a choice of the pressure scale with scales with 1 by epsilon square. Then we can rearrange the x momentum equation and the various terms are shown here and similarly we can do analogous stuff for the y momentum equation and then we can use an asymptotic expansion. So this asymptotic expansion we can do provided that all variables of different orders must be of the order of 1 which is ensured by non-dimensionalization. We cannot guarantee these always to be satisfied because I mean why we cannot guarantee these always to be satisfied we are unsure about certain scales. We have selected u as the dimensional u by uc but we do not know what is uc. So how can we ensure that u by uc is of the order of 1 that is our hope. So if that hope does not work then it may so happen that the individual dimensionless parameters are not of the order of unity and then this method will not work. So choice of the scale is something which is very important. However if the suitable characteristic values can be found then non-dimensionalizing with the characteristic values almost always make sure that of the order of criteria is satisfied. So with the asymptotic expansion whatever we could not write on the board here you can see on the slide with all the different terms with expanded in terms of epsilon, epsilon square you get big expression but by looking into the equation you itself you can understand that which terms will be important. So you can have the asymptotic expansion along x leading to this equation and one of the important considerations is that in the process of equating powers of epsilon we have assumed that epsilon square Reynolds number tends to 0 as epsilon tends to 0 and that is true if Reynolds number is small otherwise you cannot ensure that. Similarly the y momentum equation and the continuity equation we have not yet used the continuity equation. So these equations which we have obtained of the order of epsilon to the power 0 are also known as the leading order equations in asymptotic analysis terminologies. So these are certain terminologies in mathematics and the reason is self-explanatory because these are the leading order representatives of the leading order effects in the physical system. The particular form this is some note on the asymptotic analysis the particular form of the asymptotic analysis that we have applied here is called as regular perturbation. There are different types of perturbations which are possible this is called as regular perturbation. It is regular because a uniform expansion like the ones in the previous equation equation number 14 is this kind of expansion. This kind of expansion is valid throughout the domain. It cannot be ensured I will give you some example where it cannot be ensured that this kind of expansion is applicable throughout the domain. So some further discussions on the asymptotic analysis this is for those of you who are mathematically minded but it I mean even if we skip this discussion that will not I mean hamper much of our discussion so far as what we are discussing right now but just for the sake of your interest regular perturbation is probably the easiest kind of perturbation. Apart from regular perturbation there exist many other forms of asymptotic analysis some of which are singular perturbation domain perturbation method of multiple scales the WKBJ theory method of dominant balance these are several perturbation methods. I will talk about the singular perturbation a little bit because singular perturbation is something which is also very important in fluid mechanics. So the reason I mean I will talk about the physics where the singular perturbation is required.  Let us say that you have a high Reynolds number flow so you have a thin boundary layer and the remaining fluid is behaving like a inviscid flow. Now the viscous effects are important in this region which is very thin as compared to the total dimension of the problem. Question is can we neglect this region altogether? If we neglect this region altogether the problem is that we neglect the viscous effects altogether and mathematically we bring down a second order PDE to a first order PDE because when viscous effects are not considered the Navier stokes becomes the first order PDE second order effect is not there. So this particular region has to be considered but the problem is this region is small. So if this region is considered the resolution of this region may be lost until and unless you blow up or zoom up this region and apply a different asymptotic expansion in this region. So applying a particular asymptotic expansion for this region and applying a different asymptotic expansion for the remaining bulk is something which is of the order of the day for a case where a thin boundary layer exist because you have to resolve the boundary layer. So that kind of perturbation where you treat this differently is called as a singular perturbation and the whole idea is that like physically try to understand that this is a small region. So to make it prominent you try to apply a transformation so that this small region is magnified as if you have a magnifying glass. By putting a magnifying glass you have magnified or stretched the boundary layer region and have applied a transformation to achieve that stretching this is called as stretching transformation okay. So this is something this singular perturbation theory is commonly used to analyze the boundary layer type of flows. So singular perturbation is also important. So let us look into the summary. So perhaps you have already encountered singular perturbation in your fluid mechanics course. The other widely used name of singular perturbation boundary layer theory theory will perhaps sound more familiar to you but I mean singular perturbation is a general mathematical treatment and boundary layer theory is a special case of application of that. A perturbation series usually involves expansions in terms of small valued parameters which is epsilon is the present problem. A general perturbation series has the form you can see that y is equal to summation of fk epsilon into ykx where fk's are known as gauge functions. Here the gauge functions are epsilon, epsilon square, epsilon cube like that. So you can see the lubrication equations summarized I mean in the special case that I was working on the board eventually I neglected the body forces but if you keep the body forces this is what the equations will look like. And then the transformation we attach our reference frame to the bottom wall as shown in the schematic. It moves along the x axis with a particular velocity. Whatever I mentioned as u star in the board that is given as utilde in this particular slide. So this is u star. So the dimensional boundary conditions at y is equal to 0 u is equal to minus u star. The boundary condition at y equal to h again u equal to 0. The u boundary condition is good enough to calculate u0 but that is not good enough to solve the pressure distribution because you have to link it through v. So you require a boundary condition for v and that boundary condition is v is nothing but del h del t right. The rate of change of the height with respect to time is v. So this is like the this is the kinematics of the problem that is deciding. So it is just a kinematic parameter. These kinds of boundary conditions are also called as kinematic boundary conditions. So in the non-dimensional form the same equations in the non-dimensional form. Now the choice of scale very important. If the x motion of the upper plate is dominant so you have to see that what is the physics. As I told you that the choice of the scale depends on the physics of the problem. So if the x motion of the upper plate is dominating then the velocity scale is nothing but the velocity of the top plate. If the y motion of the upper plate is dominating then the dominant velocity scale along y is your v tilde and the dominant scale along x is that divided by epsilon because vc by uc is epsilon. If the x body force is dominant then we equate the coefficient of the x body force as equal to 1 right. This is of the order of 1. So that gives a choice of uc. Similarly if the y body force is dominant then we equate the coefficient of the y dimensionless y body force equal to 1 that will give you a choice for uc. So whichever is dominant that you have to decide from the physics of the problem. See mathematics cannot decide each and everything. You have to give your physical judgment to figure out that what is dominant and what is not. Accordingly you have to select the suitable scale and why the selection of suitable velocity scale is important. Again I am repeating it is important because that will ensure that all the derivative terms or all the velocity individual u0, u1, u2 all these terms these are constrained to be of the order of 1 and these are possible in the dimensionless form only if you have non-dimensionalized with a suitable scale okay. So we will do one further simplification. We will assume that there are no body forces with this we shall proceed toward the solution of the problems. So these are the final equations. We have derived these equations but just to summarize and general steps for the solution. I will go through the general step later on because let us work out the steps and then you will yourself appreciate that what is the general steps so that we can write it in the form of an algorithm. So that for any problem using lubrication theory you can use the same algorithm. So with that let us come to the board and try to solve the equation. So let us write the x momentum equation the leading order. So x momentum equation right this was the equation. So let us integrate it del u0 del y. So this is the first step in the algorithm you integrate the x momentum equation to get u0. So del u0 del y what is that u0 is equal to this is function of x again. How will you get c1 and c2 you apply the boundary conditions at y is equal to 0 u is equal to minus u star right u0 is equal to minus u star. So minus u star is equal to c2. Boundary condition number 2 at y is equal to h, h remember is a function of x and t u0 is equal to so 0 is equal to dp0 dx into h square by 2 plus c1 h c2 you can write as minus u star. That means c1 is equal to u star by h minus dp0 dx into h square by 2 h by 2 right h by 2. So what is your u0 let us write it here u0 is equal to 1 by 2 dp0 dx into y square minus yh plus u star y by h minus 1 right. So just check I mean this is always a nice thing to do when you solve a problem after you solve the differential equation you check at least that the boundary condition is satisfied by the solution. So at y is equal to 0 u0 is equal to minus u star and at y equal to h both the terms are 0. So u0 equal to 0. So now how do you get v0 you have to relate this with the continuity equation. So continuity equation is del u0 del x plus del v0 del y equal to 0 in the leading order. So del u0 del x because h is the function of both x and t in general so I have written the partial derivative this is the first term right. Then minus u star by h square y del h when you differentiate this with respect to x you have to remember that p0 is a function of x and h is a function of x okay. So this is equal to minus del v0 del y continuity equation. So v0 is equal to you have to integrate this with respect to y minus half this is y cube by 3 minus y square by 2h plus dp0 dx minus y square by 2 del x. We have taken a minus sign outside then plus u star by h square y square by 2 del h del x plus some c3x what is the boundary condition at y is equal to 0 v0 is equal to 0 right. This is no penetration boundary condition so that means all the terms have y coefficient that means c3x equal to 0. Now our objective is to get the pressure distribution. So to get the pressure distribution we can use one condition which we have not yet utilized that is the kinematic boundary condition at y equal to h. So at y is equal to h v is equal to del h del t v0 basically. So del h del t is equal to minus half d2p0 dx2 y equal to h h cube by 3 minus h cube by 2 so minus h cube by 6 dp0 dx h square by 2 del h del x plus u star by 2 del h del x right. So we can simplify this and write so this term will become plus this term will also become plus. So we can write this as del del x of p0 into del p0 del x into h cube by 12. See when we consider when we write this the first term is this one. Second term you see del p0 del x into del del x of h cube by 12 that is 3h square by 12 into del h del x that is h square by 4 into del h del x. So these 2 terms are covered by this plus u star by 2. Now that because we have taken common so I mean this is more general mix okay. This equation is known as Reynolds equation in lubrication theory. So this gives a pressure distribution. If you now integrate this equation for a given scenario then that will give the distribution of pressure and when you integrate the pressure over a surface that will give you the total force which is of engineering interest. So now let us go through the general steps of the solution and we can now appreciate that how the general steps of the solution are have been applied. So you see the y momentum equation shows that pressure is not a function of y. So this means we can integrate the x momentum equation with respect to y to obtain the solution for u0. Enforce the boundary conditions for u to evaluate the full solution. Integrate the continuity equation to calculate v. Since continuity equation is a first order equation we need only one of the two available boundary conditions for the v to completely specify v and use the remaining boundary condition for v to deduce an equation for pressure. Now you can understand it much better because I thought that instead of telling the algorithm first let me work it out first and then you can generalize it for any scenario. So let us so this is the step up to which equation number 32 in the slide. This is the step up to which we have come. So this is called as Reynolds equation. Now we will work out two problems to demonstrate the use of the Reynolds equation. And all the problems are worked out in details in the slide. So I will only discuss about the concept and not necessarily go through all the integration differentiation and all which is mostly a trivial matter. But we will discuss more on the concepts of the problem. Before discussing on the problem we will summarize some of the important observations which we made in the previous lecture. First observation the scaling of pressure is one of the most important part of lubrication theory. We have noted that the pressure scales as 1 by epsilon square therefore the force on any one of the plates also scales as 1 by epsilon square. The viscous stress on the other hand scales as 1 by epsilon. Hence the force due to viscous stresses on the plates is also of the order of 1 by epsilon. I have already discussed but just to summarize because these are very very important conceptually. Therefore the viscous stresses are simply asymptotically smaller as compared to pressure. Thus when we calculate the force on the walls the contribution from the pressure dominates. In fact in the leading order of epsilon it is the only contribution that we will take. So when we calculate the force do not ask me that why are we not considering the viscous stress because the reason we have already clarified. So that is why pressure finding the pressure distribution is one of the big things in lubrication theory because that will give the force on the boundaries. Since the pressure scales as 1 by epsilon square it is usually very high therefore the forces resulting from it are also of very high magnitude. If the pressure is positive so I will show you examples to show that the pressure itself can come out as negative from the mathematical calculations and then one of the problems will work out like that and then what is the consequence. If the pressure is positive that means what? So you have two plates if the pressure is positive so let us try to draw this in the board and try to understand. So pressure is positive. This means positive pressure normal force onto the plate inward normal force to be precise. So it will require a huge amount of force to squeeze the two plates together because there is a force that is trying to separate the two plates. On the other hand if the pressure is negative if the pressure is acting like this then it will require then what will be the tendency of this plate. The tendency of this plate will be to come down relative to the bottom plate and there will be a high amount of force necessary to pull the two plates apart. So the fluid is acting like an adhesive. This is how you can engineer fluids to make work like adhesives. So in microfluidic technology or in nanotechnology these kinds of things are very commonly used. So if you can generate a negative pressure then you can make this fluid acting like an adhesive. Now let us get back to the slides. So the first problem a very classical problem in mechanical engineering a slider block problem. So the description of the problem is given in the slide but I will read it out for clarity so that you can understand the definition of the problem. We will work out a few steps but I will not work out the integration differentiation part but we will cover out the concepts. So consider the schematic shown in the figure. The bottom wall is fixed while the top surface moves in the x direction with a velocity u okay. So the top surface has no y component of velocity and only x component of velocity which is capital U. So what is an appropriate choice of velocity scale in this case? uc is capital U because the motion of the top plate is dictating the physics of the problem in this case. Had the top plate not been moving there I mean the physics of the problem would not have been described in this way. So the motion of the top plate is dictating the physics of the problem. The top block or surface is also known as the slider block. These are certain engineering terminologies but it is important to know about these engineering terminologies. The height of the space between the 2 blocks varies linearly. So h as a function of x linearly varies from a to b. So you can write h as a function of x. The length of the block is l in the horizontal direction. The axis system has also been depicted with like x and y axis as shown in the figure. We wish to find out how much force is required to pull the block forward using the lubrication theory. This problem is classically known as the slider block problem. This is a very classical problem. So let us get into the solution. So let us discuss a little bit. See every problem has certain aspects. One aspect is mathematics doing integration and differentiation. That is important because without that you cannot solve the problem. But there are other aspects which are physical aspects and let us try to understand some of the physical aspects some of which we have already discussed. We have to find the force exerted by the fluid on the top block as it is being pulled. The force required will be equal and opposite to that. So this is basically Newton's third law type of thing. So basically we have to find out the force distribution on the top plate. Force exerted by fluid on the plate. We have already discussed that the dominant contribution in the force comes from pressure in lubrication problems. Until and unless you have additional body force that comes into the picture. But here we have not considered any other body force. Of course if we are to apply lubrication approximation. See the statement of the problem does not give you a guarantee that lubrication theory can be applied. This is where many people make mistakes. That is given a problem because you have learned lubrication theory you tend to apply lubrication theory for anything and everything. But where is the guarantee that A and B are dimensions much smaller than L. Until and unless A and B are much smaller than L then you do not have the small parameter epsilon dictated by the ratio of either A by L or B by L whatever you take. Number one. Number two is the variation from A to B also has to be a slow variation. Otherwise if A is small you cannot ensure that B is also small. If there is a slow variation from A to B then if A is small B is also small. So these are certain things certain assumptions which need to be justified from the physical dimensions that you are considering. Choice of scales. The choices of the scales are quite obvious here. The obvious choice for uc is equal to capital U. The obvious choice for length scale in x direction is capital L. The obvious choice for length scale in y direction it could be either A or B. I mean whatever you choose because it is a slow variation it does not matter and because it is a slow variation B by A is of the order of 1. And here the V which is del h del t with that is equal to 0 because there is no y movement of the top plate. And the dimensionless u at the boundary that is u by uc that is equal to u by u that is equal to 1 because your uc is itself capital U. Now one interesting thing which we have not shown but you can show it easily that the dimensional form of the Reynolds equation and dimensionless form of the Reynolds equation look exactly the same. So if you revert back the dimensional terms from the dimensionless terms they will look exactly the same. So now let us solve the problem. So we will see the key steps here. The Reynolds equation now takes this form the left hand side that is del h del t is equal to 0. So now you separate variables. So h cube by 12 del p0 del x plus h by 2 the del del x of that equal to 0 that means if you integrate that h cube by 12 del p0 del x plus half h is equal to c1 or h cube dp0 dx is equal to so del p0 del x you can write dp0 dx for the reason we have already explained that p0 is not a function of y. So is equal to c1 minus 6h. Now you can integrate this to get p0 as a function of x once you substitute h as a function of x. So how do you get h as a function of x? Let us quickly go to the board and see. So this is a this is b let us say this is h at x this is l. So if this angle is theta you can write tan theta is equal to h minus a by x is equal to b minus a by l right. One from the small triangle another from the large triangle. So h is equal to b minus a into x by l plus a. So a plus b by a minus 1 into x by l. So this x is x dash actually the dimensional x b and a are physical dimension. So then if you sorry this is 1 h by a equal to I have written 2 steps together dividing by a. So this is dimensionless h if you are considering h0 equal to a dimensionless h is equal to 1 plus let us say b by a is equal to r. So 1 plus r minus 1 into dimensional x x dash by l.  So this gives h as a function of x. So let us get back to the slides. Now so h as a function of x. So p as a function of p0 as a function of x. So you have these are the coefficients. So in place of h you can write 1 plus r bar x do the integration. This integration is simple enough I do not want to spend time on this. So once you integrate this you will get p0 as a function of x with 2 boundary with 2 constants c1 and c2. How will you get c1 and c2? The boundary conditions at x equal to 0 and x equal to l x dash equal to 0 and x dash equal to l. So the boundary conditions for the pressure at x equal to 0 is atmospheric pressure equal to 0 gauge pressure and at x equal to 1 also atmospheric pressure which is 0 gauge pressure okay. So that will give you the 2 constants c1 and c2. So eventually you will get this pressure as a function of x dimensionless. As we see that the Reynolds equation has indeed given us the pressure distribution in the channel. All it remains now is to calculate the force along the x direction originating from the pressure on the top plate okay. So force you can see that the force we have kept the contribution of pressure and the kept the contribution of the viscous stress okay. But we have to keep in mind that the viscous stress is one order less than the contribution of pressure. So how do you calculate the force due to pressure? Let us come to the board. So this is the plate, this is the x direction so at a given x. So we use that at a given small l we take a strip of length dl. If this angle is theta then dl is dx by cos theta right. So what is the normal force on this p into dl into the width? Let us say width is equal to 1. So p into dx by cos theta the force in the axial direction is the x component of that. So that into sin theta right plus or minus I am not bothering about so much depends on whether you are finding out force on the fluid or force on the plate and that is there. So this is tan theta and tan theta is you know b-a by l. So you can express it in terms of r capital R. So with this mechanism so basically you have to calculate integral p dx with an adjustment parameter which is r-1. So you look into this slide that is what it gives equation 42. The force required to pull the blocks is of equivalent magnitude and opposite sign to this evaluated force the answer for the force is this. This I leave on you as a homework. So you calculate the force which is coming from the previous expression do all the integration and this is the final answer to the problem. I mean this is just integration work it has I mean does not involve a lot of fluid mechanics. So this is a graphical representation of p and dp dx as a function of x for capital R equal to 2 as an example. Example 2 which is the last example that we consider in this chapter adhesive problem. Consider the schematic shown in the figure the bottom wall is fixed while the top surface is being pulled in the vertical direction at a fixed velocity. Now there is a vertical motion of the top plate. We have not yet mentioned that whether the vertical motion is in the positive y direction or negative y direction. So both are possible then I will discuss about both possibilities. So the description of the problem is pretty straight forward. Now the upper plate is having a vertical motion instead of a horizontal motion. So now what is the appropriate choice of the velocity scale appropriate choice of the vc is the velocity of the upper plate and therefore the appropriate choice of uc is that divided by epsilon okay. So here the vertical motion of the top plate is governing the choice of the scale. So now you look into the Reynolds equation as I mentioned the dimensional and dimensionless versions are the same for the Reynolds equation. So I mean here we let us deal with the dimensional version. So we have used all that dash and here u dash u tilde which is u star is equal to 0 and h dash is equal to a function of time. The top plate is moving with respect to the bottom plate as a function of time. So del h dash del t dash is equal to v dash. So that has given rise to this form of the Reynolds equation. Assuming h is equal to h0 at t equal to 0 we can write h as a function of t right. dh dt is equal to the velocity of the top plate. If you integrate that as a function of time with at t equal to 0 h is equal to h0 you will get h equal to h0 plus v tilde into t right. So that h you can substitute in this equation and integrate this twice. See that integration of that twice will not it is so straight forward because this is a function of time this is not a function of x. So you just integrate it just del square p del x square just twice for that this term in the right hand side will appear to be like a constant because it is not a function of x. So we can integrate it twice and use the atmospheric pressure boundary condition to obtain the c1 and c2 and you will get the pressure distribution like this. And the force now I mean the plate is not inclined so simply integral p dx so that if you calculate this is the final expression for the force okay. Now you can use the force required as the same magnitude as that of this but with opposite sign. Now look at the magnitude of the force if v tilde is positive if v tilde is positive then as time progresses the numerator becomes at the denominator becomes larger and larger like because h0 plus v tilde into t as if v tilde is positive then as t increases the denominator also increases. So that means the height as a function of time will increase more and more and the force will decrease like that. So at a very large height you will require basically no force to separate but is it within the purview of lubrication theory? The answer is no because when h becomes larger and large at infinite time it can become comparable and even may be larger than the axial length scale l. So then lubrication theory will break down you cannot use the lubrication theory. The other interesting part is when v tilde is negative then h with time will decrease right the gap between the 2 plates will decrease that is the top plate is coming down towards the bottom plate. So then the force will be asymptotically increasing and as h tends to 0 the force will like tend to infinity. So it is extremely difficult to like bring the 2 plates to such a situation when the gap between the 2 plates is tending to 0 that is the physics that we get from the solution. So since v tilde is positive the force exerted is negative as shown in equation 54 and hence the force required to pull the plates apart is positive. So we observe that this indeed scales as 1 by epsilon square if you look into the expression you will see. The magnitude of the force required decreases as the plates are pulled further apart since the denominator grows with time but after the critical time the magnitude will grow so much that the assumptions of the lubrication theory will break down. Now if the v tilde had been negative then the force required would be negative not only that it will grow with magnitude as time progresses because the height will become smaller and smaller and height is coming in the denominator. After a sufficient amount of time this will actually blow up to become infinity and that time is h0 by v tilde then the denominator will become 0. Physically this means that as we squeeze the plates more and more higher and higher amount of force is required to keep up squeezing. So very difficult to really squeeze the 2 plates. So with these 2 examples I will try to conclude with the discussion on the lubrication theory. Now I mean there are many more issues and if you want to look into the various issues the mathematical as well as the physical issues you can look into these books. Typically I would like to give a pointer to the reference number 1 which is a text book Advanced Transport Phenomena authored by Professor Gary Lille and very nice book published by the Cambridge University Press and I mean if you want more advanced material on lubrication theory you can look into that text as well as the other references which are given in this slide. So we stop here today. Thank you very much and we will start with a different topic in the next lecture.