So, this talk is about how Bundler works. How does Bundler work? This is an interesting question. We'll talk about it for a while. So this talk is kind of a brief, hopefully brief, history of dependency management in Ruby and kind of a discussion of how libraries and shared code works. Both how it's worked in the past and how it works now because how it works now is kind of directly a result of how it used to work in the past and trying to fix problems that happened back then. So before we get started, let me introduce myself. My name is Andre Arco. I am indirect on pretty much all the internet things. That's my avatar. Maybe you have seen me on a web page somewhere. As my day job, I work at Cloud City Development, doing Ruby and Rails and web and Ember Consulting. We do web and mobile development and I mostly do architectural consulting and senior developer pairing and training. If that's something that your company's into, talk to me later. The other company that I founded is called Ruby Together and it's a nonprofit. It's kind of like NPM Incorporated but without the venture capital. Ruby Together is a trade association that takes money from companies and people who use Ruby and who use Bundler and Ruby Gems and all of the public infrastructure that everyone who uses Ruby uses and pays for developers to work on that stuff so that rubygems.org stays up. And so that people keep being able to have gems, which is pretty cool. As part of my work for Ruby Together, I work as lead of the Bundler team. I've been working on Bundler since before 1.0 came out and I've been team lead for the last four years. So, using Ruby code written by other developers. Nowadays, this is actually really easy. You add a line to your gem file, gem foo.  You start using it, that was actually it. Pretty cool, that's really easy. The thing that I've noticed talking to people who use Bundler and think that it's awesome is that it's not actually clear what just happened. Based on the text printed out by Bundler install, it seems like something probably got downloaded and something probably got installed. But it's not totally clear what got downloaded, it's not clear what got installed, it's not clear where any of that happened. And it's not clear what exactly happened there. Nobody's really sure, how does just putting a line in your gem file mean that you can start using somebody else's code? So, to explain that, we'll need a little bit of history. We're gonna go back in time and I'm gonna give you a little tour from the beginning of sharing code in Ruby up until now and hopefully by the end of it, you'll understand why things work the way they do now. So, I'm gonna start talking about Require which came with the very first version of Ruby ever in 1994 and then talk about SetupRB which came out in 2000 and then RubyGems which came out in 2003 and then Bundler which came out in 2009. And that's what we're still using today. So, Require, the Require method has been around since 1994 with the very, very first version of Ruby that actually came out. And or I guess I should say, I'm sure that Require has been around since at least 1997 because that's the oldest version of Ruby that we have in version control still. It was probably there before that though. But Require can be broken down into even smaller concepts. So, using code from a file is basically the same as just inserting that code and having Ruby run it like you had just written it in the file. So, it's actually possible to implement Require yourself with just a one line function. You say, hey, I have a file name and I want to require it. And you read the file into memory into a string and then you pass the string to eval and Ruby runs it and it's just like you typed that code yourself. And it got run. So, there's some problems with this. This is not how Require works in real life. I'm sure it's totally fine that this will run that same piece of code over and over and over if you require it over and over and over. You like having lots and lots of constants that keep getting redefined. I'm sure it's totally fine. So, working around that is actually also pretty straightforward. You can just keep track of what you've required in an array and not require something again if it's already been required. This, as you can see here, you set up an array. You check to see if the array already contains the file name that just got passed in and then if it hasn't already been required, do the same thing we were doing before, read the file in, pass it to eval. And then add it to the array so that you won't require it again later. In fact, this is exactly what Ruby does, albeit written in C and not in Ruby. There is a loaded features global variable, and it's an array. And it contains a list of all of the things that you've required in the past. So if you ever wanted to know, if you've required something yet, you can actually just check the loaded features array. So there's one more problem with this, which is that right now it only works if you pass it absolute paths. I'm sure you don't mind typing the full path from wherever you are to exactly where the file that you want to require is, I'm sure that's fine too. So the easiest way to allow requires that aren't absolute is to just treat all requires as if they're relative to the path where you started the Ruby program. And that's easy, but that doesn't help a lot if you want to require Ruby files from different places.  You can't, like, writing relative paths from wherever you started the Ruby program would be terrible. So instead, we can create an array that holds the list of paths that we want to load Ruby files from. In a burst of creativity, I'm just gonna call that variable the load path. And here's an implementation of a load path. If you put something in the load path array, you can then pass a relative path to any directory that's in the load path array and will look for the file. Hey, is there a file? So if you require foo, we'll say, hey, is there a file named foo inside any of the load path directories? And the first one that we find, searching the load path in order from first to last, will require that one. Coincidentally, this is exactly what Ruby does. There is a global variable named load path. And if you put a string that contains a path to a directory in it, Ruby, whenever you require something, will look in that directory to see if there's a file with that name. So you can totally use the load path to require files from somewhere else while you're working with them. And of course, the load path and loaded features can both be combined, but that code didn't fit on a single slide. So I'll leave that as an exercise to the listener. It's pretty straightforward, to be honest. So load paths are pretty cool. They allow us to load Ruby directories, even if they're spread across multiple places. At this point, we could even have, like automatically at the start of every script, we could add the directory that holds the standard library to the load path. And then all of the files that are part of the Ruby standard library, like net HTTP, all of the set, all of those cool things that come with Ruby could just be available for require automatically, and you wouldn't have to worry about putting them in the load path yourself. That is exactly what Ruby does. The standard library starts on the load path whenever you start Ruby. It's pretty great. So this was cool, and for several years, this was enough. People just added things to the load path a lot, or wrote scripts that added things to the load path before requiring things before their actual script happened. The thing that got super tedious about just having load paths is that if you want to get code from someone else, you have to find that code, download that code, put it in somewhere, remember where that somewhere is, put that somewhere in the load path, and then require it. It was pretty tedious. Sorry. So the next thing that happened was set up RB. So we're totally caught up to the state of the art in Ruby libraries around the year 2000. Everyone's still installing shared Ruby code by hand, CP, CP. And that wasn't so much fun. So a Japanese Ruby developer named Minoru Aoki wrote set up RB. And amazingly, even though this was created in the year 2000, set up RB is still around on the internet. The website for this developer is i.loveruby.net, which is pretty cool. And you can even download set up RB, although to be perfectly honest, it hasn't been updated since 2005, so I'm not sure it's super helpful to you. So, how did set up RB work? Well, you, at its core, set up RB kind of mimicked the classic Unix installation pattern of downloading a piece of software, decompressing it, and then running configure make make install. And so Ruby kind of copied, set up RB kind of copied that for Ruby and you would run set up RB set up, set up RB config, set up RB install. And what would happen is set up RB would copy all of the Ruby files. And there was a specific directory structure, kind of like a gem today where you would have library files and bin files that you could run as programs and support files. And set up RB would copy all of those files into a directory that was already in the load path called site Ruby. And that was like the Ruby files that you had installed that were specific to your computer. And so after set up RB using Ruby libraries was actually much easier than it had been. You could find a cool library on the internet, you could download that cool library.  But then hey, it was all installed, no more manual copying, no more like having to manage all these files. And everything was in the load path, you could just require it as soon as you ran set up RB, it was pretty cool. So after a little while some of the shortcomings of this scheme became apparent too, there's no versions for any of these libraries. And after you run set up RB, there's not even a way to tell what version you have unless you write it down or unless the library author was really nice and put the version into the code somehow, and there's no way to uninstall. Everything just gets thrown into the same directory. So you run set up RB for five different Ruby libraries, and now all of their files are just in one directory. Good luck figuring out which ones belong to which. Because if you delete the wrong one, too bad. And then upgrading, upgrading was super fun. If there was a new version of the library, which, good luck finding that out, right? You had to remember the website where you got it from in the first place. I hope you write all these down. I hope you've written down every website you've ever downloaded Ruby from. You have to go back to that website, and you have to remember which version you have, which, as I said before, there's nothing there unless you wrote it down. And then you have to download the tar ball with the new version, and decompress it, and CD into it, and run Ruby set up RB all. And hope that the new version didn't delete any files, because the old files are still there and you just went over the top of them. Yeah, so overall this was, this probably sounds a little tedious. It was really tedious. People frequently kind of had no idea what was actually happening with their libraries. And it was actually not uncommon for people to be like, this doesn't work, I'm just gonna fix it in my site with Ruby directory. Okay, everything's great. Right, yeah, super awesome. So at some point, some people were like, hey, this isn't actually that great. What if you could just gem install? That would be cool. And so in 2003, Ruby gems came to the rescue and kind of fixed all of the problems with setup RB that were known. You could check to see if a library existed by just running gem list. You could install a gem just by running gem install. You could uninstall a gem, super great. By running gem uninstall. And Ruby gems kept each of these libraries in different directories. So that you knew which libraries you had and you knew how to uninstall those libraries. And you knew how to install new versions of those libraries. And it was all with a single command. There was none of this like, find it on the internet somewhere, download it, unpack it, set up RB it. And Ruby gems had another super cool trick up its sleeve, which was versions. Ruby gems actually kept each version of each gem in a different place. You could install multiple versions of the same library and they could all be in your Ruby because they did not go into one giant folder. They all went into their own separate folders. So there was a folder for Rails 14, or Rails 4.1, Rails 4.2, Rails 5. This was pretty cool. So to make this actually work because required doesn't support versioning inherently, Ruby gems added a gem method that lets you say, hey, I know that I have or I don't really care whether it's installed or not. I need version 1.0 of rack and Ruby gems will check to make sure it's installed. And then put that directory, just the one with rack 1.0, into your load path. So then when you run require rack, you get rack 1.0, it was pretty cool. And so calling the gem method told Ruby gems that you wanted to manipulate the load path to load exactly the version that you knew that your code wanted to talk to, it was pretty useful. Ruby gems also has a way to support versioning even in commands that come with gems. So the rack gem comes with the rackup command. And if you have multiple versions of rack installed, the rackup command could run any of those versions. So Ruby gems defaults to the newest version that you have installed, hoping that the newest version is the right one. But if that's not the right one, Ruby gems actually checks the first argument to the command to see if there's something with underscores on either side of it. And it thinks that that will be the version number that you want. So in this example, we're running rackup from rack version 1.2.2. And only version 1.2.2, if you don't have version 1.2.2 installed, Ruby gems will be like, hey, sorry, I couldn't find that version. You need to install it first. Ruby gems was really, really successful. Ruby grew in popularity a lot, but Ruby gems made Ruby libraries and sharing code grow in popularity a lot. Present day, we have about 100,000 different gems and about a million different versions of those 100,000 gems. That is a lot of shared Ruby code, and that is super cool. So, and you probably knew this was coming. As cool as Ruby gems is, it still has some problems. If you have multiple applications that all use Ruby gems to load their dependencies, this can be problematic. It's really hard to coordinate across multiple applications, because the way Ruby gems works, every machine, or technically every individual version of Ruby. But each installation of Ruby itself just has a set of gems, right? Like you ran gem install, and now there's all these gems. And so if one developer runs gem install foo and starts using foo in their application, and then commits that code and checks it in, and the next person checks it out, and tries to run the application, it's gonna explode with like, I don't know what foo is, where is it, you need to fix that for me. And so it led to an era of basically pure manual dependency management. Starting a new job, hooray, no joke, this literally happened to me in 2008. New job, welcome to the team, here's your cool new laptop. We expect you to have the app running by next week. It actually took me, and I was totally working overtime on this. I think it only took me three and a half days. It was amazing. To figure out which gems to run gem install, I looked in the readme and there was a list, and I installed all of them. And then clearly there were some that some people had just kind of forgotten to put in the readme, and then it kind of worked. But then I wasn't able to get images working, and then some other developer was like, yeah, you have to install image magic. This was before homebrew. It was really, really terrifying. Yeah, so to try and kind of fix this problem of like, do we just put the gems in the readme? How do we even know if we have written everything in the readme? I don't know, try it. And of course you had to get a new machine to try it on because some person, after three years of using Ruby, you've just gem-installed everything and you have no idea what is important and what isn't important, and yeah, it's terrible. So people started working on tools to help this problem. Rails actually added this thing called config.gem, and this is like Rails 2.3 era, 2.2 era, where you would say, hey Rails, I need this gem, and you would put it inside your application rb file. And that was super helpful if you needed to like know for sure that this was the master list of all the gems that you needed in your application, but you could only access that list if Rails was already loaded. So if you upgrade Rails over here, it was pretty bad. So because RubyGems automatically uses the newest version of each gem, just having an older version installed didn't mean that it would be used. And if you like install some gem a month after the other person did, maybe there's a new version, you just get the new version automatically. This is also totally a real life experience that happened to me in 2009. Debug a production server that just throws exceptions sometimes for three days, the other production servers are fine. You can't reproduce this problem on a single developer laptop. Like what is even going on? This is so weird. After three days, I finally thought to look at the output from gem list for the entire production machine. And I was like, this production server has gem version 113. And every other production server and every developer laptop has gem version 114. And that was the problem. There was a bug and but that only that server had this problem. And then like I was saying about Rails versions, you could gem install Rails, be happy, make a new app, run your server. Everything's great. And then you switch to another application that already existed. Didn't get written to use that version of Rails. Got written to use some older version of Rails. And you're like, okay, let's go. Cuz you just didn't have the right version of Rails. And there was no way to like, if you put the Rails version in your config.gem line inside your application RB, then Rails would complain that you had the wrong version of Rails. But Rails had to have successfully started up to tell you that you had the wrong version of Rails. So it didn't actually help.  Depending on what exactly you did on the team. Some people on my team at the time spent like a quarter or a third of their time doing nothing but figuring out and fixing dependency management issues. And it was really, really, like I felt really bad for them. Sometimes it was me and I felt really bad for me. And then there's one more, even after you have done all of this by hand management, there's one more problem that RubyGems has that is another reason why Bunder was created. And that is activation errors.  And so RubyGems will load the newest version of those gems that can. And so sometimes you'll say, hey, I need this gem. And then this gem will need that gem. And then that gem will need this gem. And you'll get the newest version of that child gem. And then later you'll say, oh, and I also need this gem. And that gem won't work with that gem. So how common can this be really? Well, unfortunately, it was super common. Not like happens to you every day common, but like happens to you maybe two or three times a year. And when it happens, you basically tear all your hair out, delete your entire Ruby install, and reinstall Ruby and start installing gems again. Because figuring out exactly which combination of installed gems was causing this problem was just a total nightmare. So this is a real life activation error. I salvaged this from a presentation that I gave in 2010 about why Bunder exists. So this is a Rails app. And it's loading. And Rails, of course, depends on Action Pack. This is the Rails 2.3 era. Action Pack depends on Rack. Rack is a gem that helps Rails talk to web servers. And Thin, which is a web server, also depends on Rack. So Rack is how Rails talks to Thin, how Thin talks to Rails. But there's a problem. Thin is perfectly happy to use Rack 1.1, which makes some changes to how Rack works. Action Pack, on the other hand, is not happy to use Rack 1.1 and can only use Rack 1.0.  And then Thin gets to work trying to load up your Rails application. And your Rails application says, I can't actually use that Rack. Sorry, the end. So the conclusion here is that the reason that these activation errors would happen is that RubyGems does what we call runtime resolution, which is RubyGems figures out which versions of which gems it should load after RubyGems is already running. And you say, hey, I need a thing. And it's like, OK, I think this version works. And at some point, if later on you say, hey, I need a thing that doesn't work with things that you've already done, RubyGems just has to be like, well, can't fix that. And so the fix for this problem is to figure out all of the versions before you run your application. You have to know that the versions that you're going to use are all versions that can work together with one another. And so resolving things at install time, which is when you install all of the gems, know that you're installing versions that work together. So hang on a second. You're probably saying, how do we make sure that all of the versions that we're installing work together? Well, that's actually where Bunder comes in. Before Bunder, the process of figuring out which gems would work together was done entirely by hand. And it consisted of gem on install, gem install slightly older version. Does Rails start up yet? Gem on install, gem install slightly older version. Does Rails start up yet? And when the exception stopped, you knew you'd won. Unsurprisingly, computers are a little bit faster at this process than people. And computers are also really good and accurate at trying many, many, many, many, many options until one of them actually works. So this is what Bunder does. You, yeah, I know, Bunder figures out the entire list of every gem and every version of every gem that you need, but that also all work together with one another. This is called dependency graph resolution. And there's an entire academic literature about dependency graph resolution. And it's kind of a well-known, hard problem. It's part of the set of problems called NP-complete. And the totally fantastic thing, and I say this as a person who has to fix Bunder when it doesn't work, is that in theory, you can construct a set of gems and a gem file such that it is not possible to find a set of gems that work together until after the heat death of the universe. Most of the time, we don't have that long to wait. And so we use a lot of tricks and shortcuts and heuristics to try and figure out which gems to try first and hopefully actually finish before you've drunk that cup of coffee or whatever. So we have this pretty large built-up set of tricks over the years. And most gem files actually resolve in less than 10 seconds, which is pretty cool, considering that the upper bound on that is practically infinity. So after finding versions that work together, because this problem is really hard and we don't want to have to keep doing it over and over and over, Bunder writes down the exact versions of every gem that did all work together so that they can be reused by other people who are also interested in running your application. So that file is called the gemfile.lock. This is a little snippet of a gemfile.lock showing you which gems need to be installed, which versions of those gems need to be installed. And as a bonus, the lock file is what makes it possible to install the exact same version of every gem on every machine that's running this application. That means that when you develop on your laptop, you get whatever version of the gem was newest when you were developing, because you can bundle install and you've got the newest version by default or whatever.  It's pretty great. So fundamentally, the core of Bundler consists of two steps, bundle install and bundle exec. So the steps for bundle install are actually pretty simple. They're totally understandable in plain English that fits on a single slide, which is great. I edited this slide for maybe 10 minutes, deleting words. So the steps to bundle install are read the gem file, ask ruwegems.org for a list of all of the gems that we're going to need, find versions of those gems that are both allowed by the gem file, because you can sometimes say, I only want this version or I only want that version or I only want versions greater than that version kind of thing. And then once you've found versions that all work together because you checked, write all of those versions down in the lock, and then install every version until every gem that's in the lock is installed. And that's how bundle install works. Bundle install actually uses RubyGems under the covers to do the installation. And so every bundle is its own little RubyGems isolated install. Every application has its own RubyGems. Thanks to Bundler. And then the next step is bundle exec, which is how we use that application's dedicated little RubyGems instead of the one that just has whatever in it because you ran gem install last year. So the way bundle exec works is it reads the gem file and it reads the lock if the lock's there. It uses the lock gems if the lock file is there. And if the lock file isn't there, it finds versions that all work together just like install would, except bundle exec doesn't do any installing. It just says, oh, do I already have versions that all work together? They do cool. And then bundle exec deletes any gems that are already in the load path because sometimes that happens before bundle loads. And then it adds the exact gem at the exact version that you need to the load path so you can use it, which is pretty great. That's it. That's all bundle exec does. It's once your gems, all the gems that actually work together and their exact versions are in the load path, your application just goes on its way and it's happy. No activation errors. All your requires actually succeed. I hope everything's pretty great. So as I think I promised in the abstract for this talk, here's a bundle exec removing pro tip. I don't really like typing bundle exec. I find it really annoying, but bundle provides a way to not have to type bundle exec all the time and it is to create programs that map to the little copy, like the Ruby gem installation that belongs just to that application. You can use the bin stubs command, bundle bin stubs sum gem, and it will create in the bin directory a program for that gem that only runs the exact version that belongs to that application. So if you have RSpec in your Rails app, you can have bin RSpec that will only run the RSpec for your app. And in this way, you can have bin RSpec refer to RSpec three in this application and have bin RSpec refer to RSpec two in that application. No exec required. It's pretty great. Rails has actually started to do this very thing and Rails four ships with bin Rails and bin rake that are scoped like so when you run bin Rails, you get the exact Rails version for that application and not this application. And when you run bin rake, you get the exact version of rake for that application and not this application. Pretty cool. No more bundle exec. If everyone did this and you can check in these bin stubs, right? So you can take bin RSpec and you can put it and it will be mapped to just that application forever. So no one would ever have to bundle exec ever again if everyone did this. Pretty cool. So now we bundle install. All our gems show up. We have versions that are dedicated to each individual application. But as you probably sense the pattern going through history, that wasn't actually the end. There are still problems that show up after Bundler came out. The biggest problem that was left was that running bundle install just took a really long time. And if you lived really far away from the US, it took a really long time. I talked to some developers in South Africa when I went there to give a talk and they told me about how running bundle install means that they literally get up to start making themselves a cup of coffee that they can finish before bundle install finishes. So to try and speed things up, Bundler 1.1 created a completely new way to get information from RubyGems about gems and that sped things up by like around 50%, which was a pretty big win. We keep working on this. Bundler 1.9 just came out this month. There's a bunch more improvements that we're still working on. Bundler will keep getting better. If you're interested in following along with that, the Bundler website has news announcements at bundler.io and on Twitter we're also bundlerio. So having said all of this, if you use Bundler, I would totally love to have your help working on Bundler. It's an open source project. We're super, we have dedicated a lot of time to making it easy for people who don't know how to do open source to help with Bundler and to start working on Bundler and to kind of get into open source that way. It's a project on GitHub at Bundler Bundler. It's on Twitter. If you are interested but don't really know where to start, you can totally email the Bundler team at team at bundler.io and we'll get you set up. On the other hand, if you have a job that means you have money but not time, join Ruby Together and give us money and we'll work on Bundler and it'll be better. As Ruby Together grows, we're also gonna be tackling bigger community issues. We wanna add easy to use gem mirrors so that you don't have to go all the way to rubygems.org for your office or for your data center. We wanna add better public benchmarks. There's a project called Ruby Bench that's starting to do that and we'd really like to expand it. There's a bunch of other things that Ruby Together is working on that'll be totally cool. If you want Bundler or Ruby Together stickers, I have a giant pile so find me later. That's it.


What's up everybody? Jason here for jaskiesandcasebreaks.com our second master case of the brand new 2019 number deck ice hockey just sold out This is figure teams number two and again We're giving away $300 and break credit if you buy two or more teams in the break straight up And again the way it works is you buy two teams or more you get entered two teams Even was one entry four teams equals two entries six teams equals three entries, etc. No max entries top three names at the end of the randomizer will win $100 and break credit each and We'll see who qualified for qualifies for that break or for that Break credit at the end of the break. Yes, it was sold out straight up. No team fellas. No, nothing. So good luck That's all your ad to guess the senators Here you go, you're probably honestly, this is gonna take me an hour I've got it with their orders for like 15-20 minutes. Then I gotta do select So if I had to make a time frame probably not to like seven o'clock So in about like two hours This breaks gonna take me about an hour, you know, 20 30 minutes to go through orders So let's load out first so that'll take me like 20 minutes 20 30 minutes And then I think the mixer was the second break that sold out So I'm not sure on seven o'clock man to be honest Whatever a rise. How's it going buddy? Yeah, we'll do that make sure tonight. We'll do that select. We'll do the anti We'll do it all. Oh Look how they taped this one guys.  I can't even cut it. We got the cut over here If we're gonna put this in here and do it like this It's funny. That's where the one-on-one is. Oh bold Kind of hope I hit our ice premier patch autograph to town. That's whatever All right, yeah, like we did last time we'll go for For them That's from 1870. That's Anderson update to 199. Hunter Timmons to 149 And they packed to 299 Morgan Frost the fliles little shoebox for the hits jumbo rugs of Kale in the car Off to a good start here for the avalanche Wade hits there in the first box Davidson to 499 level three and to 1299 Wedding and we got ice buckets Adam Fox for the Rangers to 199 Rangers Winner Robert Adam Fox to 399 exquisite rookies Tyler Sagan We had our trial voting At a 249 Morgan Frost level 2 Rhett garden We got an autograph here of Garno no adoption islanders base rookie Little Rasmus Dallin Relic here of Carl Brunström Matt Wah Roy and Niko Sturms Our next box guys, you gotta make pack sacking over there make this quick go by a little quicker Make your holes in retro to 149 Well, we got an insert or sorry a inscription Boise graphs coming up Sabres And we got a night cow grandma a little description there grand help To one of the boxing main events already You have seen your box no for boxing I guess the Because of this thing or no, I guess we're scattered the fight today the main event and the trainer for the boxer tested positive so So that accounts the main event so I'm like dude, I don't know I can see like it would be unfair to be like I what if like What if like Patrick Mahomes tested positive right? Yeah, and then you're not gonna be able to play it. I play that so unfair Yeah, or even then you know It's like well look at the Texas University team, you know, you have like and football. They're doing They're not they don't play like NBA where they're just yeah Did you see the well they have more players are they have to be to be seed Follow player And then the other NBA player like They get like They lose all their eggs What up Zach? Yes, the basketball mixer sold out. So I Just seen the one that was funny was like it was a Picture from was a shot from the movie from NWA. Yeah when they're in the hotel and it was like Yes, after this guy didn't go through about like 20 orders or so and then select baseball They sold out first and then it'll be the mixer. We're talking about yesterday and boom. I went to like 90 cool Articles and everything how Suppose that's what I heard too Yeah $600,000 I know but they like told the wrong thing to pose the wrong side Right. I mean, I think they were talking about the RPA for just not found. Yeah Yeah Yeah, I thought there were more than 50, but I know whatever that was like two years ago Oh look at this I Which one's that one By the end of getting a license I'm never doing this again like I'm done and then all of a sudden causing the morning There you go guys nice ice buckets Cal McCart out of 99 74 out of 99 Teddy Bolzer See Jamal Adams wants to request trading the Eagles for one of the dance I'll do these ones like all the playoff teams He's been saying he's been wanting to go there because I guess it's from Texas Kirby Dodge. That's pretty nice Yeah, they're just gonna pay him much. He's so good and Amiko ratting and glacial grabs autograph. Look at that That's an update as well. I believe from 1819 More for the Colorado avalanche and Wade Little Miko Kirby dogs to 299 Yeah, this is just one inner definitely Colorado avalanche are definitely taking over this inner so far So 499 a brahman Oliver and we got no adopts with his landers exquisite rookie autographs David Duffy is that nurse and a couple cockles Why aren't these numbered? Relic here Well, no because these have all been numbered every single one of them. I've seen this is the only one I haven't seen It's numbered I pulled those like at least like ten of these in the last one and it's not numbered So I don't know a couple cockles Different maybe they only made so many of those But his is not numbered Maybe that's true The 499 level three for the bolts and Less It's in the cross is a number either Blue Jacket Relic and the 249 Ryan Pauling The 1299 Brady Keeper Maybe got a superb scripts coming up Oh It's under glass autograph makes a zoo key. Oh, that's pretty cool So they cut everybody else's jobs and stuff and then So need to show girls The 1299 support for 99 a brahman level three We got for the almost blue jackets relic a couple doc. Oh, see this one is a number Rangers All right, Robert that one and the autograph is Wall Street 2199 I didn't want me like I just the weight of my arms It's a 499. Oh, yeah, exactly. I thought you have one of them Ron's room. Yeah, thanks Suzuki Relic Yeah, I'm sure we'll finish off the highest round of teams tonight as well Lake was up retro to 149 for my Kings Michael del Cali retro or sorry ice premieres update was what I meant to say For the islanders and a short Terry update JC Carl Grunscham and I I know we have more ice as well. That's so no need to worry I'm sure we'll post up another pick your team or two. Nice. We got a jack Hughes ice premier retro to 149 43 at a 149 and That is going to the Devils and DJ We do actually wait We do actually have more SPA. We got a post up as well. I Think after this weekend with all this like, you know all this baseball releases I'm sure we'll post them up Maybe you'll tell me to post them up like Sunday night so we can try to fill it for Monday, but we do have more SPA as well That's another one that I've been trying to want to rip as well kind of want to rip besides ice Bastion Davidson Fox and a jack Hughes to 19 three out of 19 Gold that's pretty nice. Oh nice way You still have one of the case and a half over here. So we're halfway through the break Still not a 99 though Nikita Goosef But they're not guaranteed per case So I have to play by ear if we're gonna get one or not. Yeah Pierre-Luc d'Ivoire Trent Frederick both of us and we got Mike L. Gronlin It's already updated here. They have them in his predators uniform 1920 Barrett Hayton Retro to 149 Beck to 1299 249 Dante Vauro Ryan Pauling and a jack Hughes Autograph exquisite to 99 Very nice. It was all about Quinn Hughes in the first one. That's all about Jack so born to 49 Adam Fox Relic here of Matt Roy Mario Ferrero and a mark Messier autograph to 25 very nice Oilers edition John Stallone at four out of 25 Victor Olson Retro to 149 Pass to my 99 Yeah, this ice hockey is really beautiful This is a good job of this year To 499 Mac even Barzell Relic our next four guys last dinner ice buckets for the blue jackets Alexandra Wade with that one. We got Ladislaw to 499 out de Favreau because the Dina to 149 very nice and Sammy Nicole update The jet's going to Steve you got autograph of Blake LaSotte whether to turn red wings Steve does all right, excellent. We got for the Toronto able use Ilya Underglass Mike Mac Mike McCarthy 999 Or no out of 249 Kaden Kanibe Myers Lindgren, I am a stud tour one Let me have Werner. I could do it after my select selection. All right. I got a mark shortly the 15 Nice from your autographs I know Relic here for our blue jacket Adam Fox 109 for the Rangers All right guys last four boxes right here so after this guys I'm gonna quickly go through some orders And I believe select should be next and then follow that with With a mixer break, but I think after select I'm gonna take a quick like 15 minute lunch break Fuel up, and then we'll do that mixer after but I am a little bit ahead of schedule Since Nick did help pack stocks. That's good out of 99 ice cream your autographs 16 out of 99 Kail McCar Very nice. I'll do where I'm taro Relic here of Gustafson I Rasmus I 249 and Ryan Ellis ringside signings it's an update from last year And we got ice cream autographs Paul Brunswick two more boxes guys Giovanni no adoption Jumbler relative Cody glass Oh, we got an update Brock Vessar sub zero autograph very nice For the nukes going to Christopher BV6 and Coleman I Go ransom and I was from here's Rasmus Sandin you got taro and Yami boards laser graphs there for the Lightning going away All righty guys, and there you go that was the break I Have no idea when was that Danny? If one when did you buy into that if you bought into that? I Think we've been done that along. I haven't seen his break any Any multi-packing so long so it's already here in the video section You could take you could take a look for yourself. It should be there use that title And there you go guys that was the break a lot of really nice stuff hiding in here No out of 99 here as again, they're not per case, but Brock Vessar Cal McCartn Zedina retro Olson retro Mark Messia autographed Jack Hughes to 99 Baron Hayden retro Jack Hughes to 19 Jack Hughes retro Wallström Capococco Suzuki Crosby Capococco again Dobson I'm sure it has Danny we haven't had that on the website for a little bit So check out the videos click that link above you and look for it. It should be somewhere in there Me go ranting in ice buckets Kale McCartney 99 all of sin Adam Fox Connor Timmons really really nice stuff. Appreciate it guys. Now. Let's give away some break credit And again, let's see who is eligible for the break credit. So let's see And you got three So give you one inch away to use your last bomb older entry Brian. Oh, sorry Christopher you got two teams. So you got one entry They're definitely one DJ you got one I'm the one Kevin Michael at you with two you got one entry Michael you got one entry as well Mack McCarty have an entry as well Nick you have an entry as well with two Robert you have two Steve Steve Wong as well. So we'll put both of you guys in here and Wade one two three.  Good luck six into two eight times. Good luck six seven eight one two three four five six seven and eight Boom eight times six and a two Steve Nick and Michael Galucci. There you go. Hundred dollars and break credit each of you. I'll be sending that out to you as soon as possible jazby's casebreaks.com


Namaste and welcome back to the video course on Watershed Management. In module number 4, lecture number 18, today we will discuss subsurface and groundwater flows. So, some of the important topics which will be discussed today include subsurface flow, infiltration, aquifers, groundwater flow, groundwater flow modeling, numerical modeling and groundwater quality. So, some of the important keywords are subsurface flow, infiltration, aquifer, groundwater flow, groundwater flow modeling, numerical modeling, groundwater quality. So, as we discussed earlier in some of my earlier lectures, so as we discuss about the water source in a watershed. So, we are related to watershed management. So, we have to see the total availability of the water. So, as far as water is concerned, water can be either surface water or groundwater. So, in any of the watersheds, since groundwater is a major resource as water, so that we have to say utilize it properly, we have to plan it properly, we have to understand its behavior within the watershed and then also we have to, while we use the groundwater, we have to replenish the groundwater through the various schemes like rainwater harvesting or artificial recharge and other ways. So, within this contest today, we will discuss the important aspects of groundwater flow and its modeling within the perspective of watershed management. So, as we have already seen groundwater is say is a part of the subsurface flow. So, subsurface water is the all water beneath the air surface. So, we can see that whenever rainfall takes place, there is the infiltration takes place and then water will be percolated down and that movement, so all water beneath the air surface, we can call it as subsurface water. So, the water will be is recharged by infiltration either directly on the land surface or in the beds of streams, lakes and oceans. So, you can see in this figure, so when the rainfall takes place, the recharge is taking place with respect to the infiltration and then also say from the surface water sources, lake lakes then rivers and oceans also the water is infiltrated down to the subsurface and that becomes the subsurface water. And then as far as the subsurface water discharge is concerned, it is discharged through evaporation, transpiration and then from springs, seeps on land surface or beds of surface water bodies and then we can get this water through pumping wells, gravity drains etcetera. So, as far as subsurface water is concerned, there is say the water recharge taking place with respect to rainfall or with respect to the movement of water from the surface water sources like lakes, rivers, ponds or ocean that is the recharge taking place to the subsurface as subsurface water and a discharge is concerned with the water which we are taking through pumping wells or water coming out as springs or say the gravity drains which we give, so that way the discharge is taking place. So, as far as subsurface environment is concerned, you can see that some of the, so this depends the subsurface flow, the subsurface water movement depends upon the porous material. So, water moves within the pores of the soil, so you can see that if this is the soil media, so within the soil media lot of pores will be there. So, water will be moving through this say the pores and that water is coming as the subsurface water. So, most of the terrestrial hydrologic activities takes place within a few feet from the surface of the earth or within the root zone. You can see that whatever is happening is that say water is recharging and then say it is the immediately it is going through the soil and then it will be reaching the aquifer system or the water table, it can be say aquifer can be confined or unconfined nature. So, generally to be initially within the unconfined layers and then say most of these activities will be taking place within the root zone and then further this ground water may percolate down deep, so that deep percolation also can take place. So, then say as far as subsurface water is concerned say what we discussed now is say within the context of soil water. So, this soil water we can divide into 3 parts. So, say how the water is available within the subsurface or within the soil, so accordingly we can classify into 3 types. So, first one is the drainable water. So, that is the water that readily drains from soil under the influence of gravity and water occupying pores larger than the capital size. So, that way that will be drained out. So, that is say with respect to the recharge and then what is available say within the subsoil or the subsurface that kind of water is called a drainable water.  So, planned available water is the volume of water released from soil between a soil water pressure head of about minus 1 by 3 bar which is so called generally called field capacity and about minus 15 bars which is so called a wilting point. So, this water is a generally detained in storage by capital forces. So, you can see that when this water is infiltrating down, so we can generally classify the water available in subsurface or in the soil as fully saturated which is generally called as ground water. And then there will be a capillary fringe like this and then there will be unsaturated zone where the water will be available within the soil which is not fully saturated. So, that way then the water which is generally available to the plants I mean between the field capacity and the wilting point that is so called a planned available water. And third one is say the water still existing the soil that is so called unavailable water which we cannot drain or which we cannot which is not will not be available to the plants. So, that is so called a hygroscopic water. So, water held tightly in film around the individual soil particles. So, that is will not be available to the to the plants or even it will not be possible to drain. So, that way the water subsurface water we can classify into drainable water, planned available water and the unavailable water. So, as we discussed earlier say within the hydrologic processes then say with respect to the rainfall to run off various processes are there like infiltration, then evaporation, evapotranspiration, interception like that various processes will be there. So, what is available as water a subsurface water or ground water is coming from the infiltration of the water which is coming from the rainfall. So, this infiltration process is very important as far as ground water or subsurface water is concerned. So, the about the infiltration we have discussed already earlier. So, again say as subsurface water we will have a brief discussion further. So, infiltration is a process by which what on the ground surface and there is the soil as we already seen earlier. Then the infiltration capacity of soil determines how much water is infiltrated down and then how much is the time distribution of rainfall access for runoff from a storm. So, accordingly the infiltration capacity varies and say it is a very important to estimate the infiltration within the contest of surface runoff and then the availability of water as far as the subsurface water is also concerned. So, subsurface flow and storage of water within the watershed depends upon the infiltration. So, as we discussed in one of the earlier lecture the controlling factors say that control the infiltration are the soil type like size of particles, then degree of aggregation between particles, arrangements of particle and then what kind of vegetative cover is there, then surface crusting, then season of the year, then say what is the soil moisture level available within the soil or so called andesite moisture, then rainfall hyctograph, subsurface moisture conditions etcetera. So, we had a detailed discussion on infiltration in one of the earlier lectures. So, we will not be discussed further on infiltration. So, now we will further discuss about the ground water say within the contest of the subsurface water and a ground water flow. So, as we discussed just in the previous slides, so water is the water available within the soil we can classify into unsaturated and saturated. So, the flows within the soil can be unsaturated flow or saturated flow. As you can see here say the once the water is infiltrated down. So, here the we can classify unsaturated soil and saturated soil. So, unsaturated soil means the water moves primarily in small pores and through fillings located around and between solid particles as water content decreases, cross sectional area of the fillings decreases and flow paths become more limited. So, this results in hydraulic conductivity function that decreases rapidly with water content. So, this unsaturated flow or unsaturated soil is a very important as far as especially as far as the water availability to plants are concerned. And then saturated soil or saturated flow is related to the soil pores are considered full with water. So, it may not be completely full due to air entrapment within the soil, but say wherever we consider the hydraulic conductivity will be constant with respect to the head edge as far as saturated flow is concerned or saturated soil is concerned. So, here you can see that as shown in this figure. So, say once the water is infiltrating down this is the unsaturated flow region and here this is the so called water table then this is the groundwater or the saturated flow. So, that way now this so called unsaturated flow that depends upon how much is the infiltration, how the infiltration process take in place and then say how much is the what kind of soil is that accordingly the water availability within the unsaturated zone and water movement through the saturated flow condition takes place. So, as far as the soil water movement is concerned. So, this is the response to a gradient generally. So, depends upon how much is the pressure or how much is the gradient accordingly the soil water movement takes place. So, for example, if the soil is fully wet. So, wet soil to dry soil. So, generally low soil moisture tension to high soil moisture tension and high soil water potential to low soil potential when we consider wet soil to dry soil. And when we say that the soil is fully saturated or saturated condition means water is moving mainly in the macro pores. So, that all of the pores are filled with water. Then the unsaturated flow is concerned unsaturated conditions are concerned the macro pores are full of air micro pores filled with water and air. So, the moisture tension gradient creates the unsaturated flow. And then very similarly the saturated flow is concerned the it is we can also called saturated flow as gravitational flow. So, this occurs under saturated conditions when the force of gravity is greater than forces holding water in the soil. So, from capillary flow onwards the saturated flow starts. So, capillary flow occurs in unsaturated soil. So, here this is the unsaturated soil and just below there is a capillary fringes there and then below is the saturated flow. So, we can measure this the soil content the water content in the soil. So, the measurement of soil moisture various methodologies are available like gravimetric methods, then tensiometer, then electrical resistance method etcetera number of methodologies are available. So, using these techniques we can identify how much moisture content is there within the soil. So, anyway we will not be discussed further on these aspects. Now, we will go to the saturated flow conditions or the ground water flow. So, the ground water flow is say fully saturated flow condition. So, infiltrated water say some replenishes soil moisture deficiency if soil is not saturated and when the soil is fully saturated then we are having the shallow ground water system. So, as you can see within the hydrologic processes. So, you can see that with respect to rainfall the water is infiltrating down and then where the shallow ground water system is after the saturation we are having the shallow ground water system. So, then water then percolates down until it reaches the saturated zone called a aquifer or deep ground water system. So, here once it is say fully saturated and then water is further percolating down to the aquifer system. So, the upper water surface of saturated zone is called generally a water table. So, when we consider an unconfined aquifer we are having the say the unsaturated zone then the capillary fin zone and then the saturated zone. So, that saturated zone that say the surface is so called a water table. So, then say as we can see that say here say for example, this is the water table and this is the unsaturated zone and this further to the saturated flow condition. So, as we can see that as I mentioned earlier ground water is one of the important source of water for the humanity for say domestic and all types of uses. So, it is an important part of the hydrologic cycle. So, we cannot separate the ground water flow with respect to the runoff or the surface water. So, say after the available fresh water resources the major source is the ground water. So, an estimate says that the ground water constitute more than 80 times amount of fresh water in rivers and lakes combined. So, you can see so the importance of ground water. So, ground water is one of the most important say resource water resource available for humanity. So, only difficulty is that the deeply percolated water it is very difficult to pump out, but say in most of the places we can the whatever is especially shallow water or the somewhat deep zone water we can say pump it out and then use accordingly. So, ground water is one of the important source of water. So, as we discussed say once the water is percolating down we are have the water through the saturated zone once it is reaching the aquifer system or where the water is stored or water is moving through the soil. So, that formation is so called aquifer. So, accordingly now let us see the different types of classifications as far as the aquifers are consents. So, here in the slides the classification of aquifers are given. So, aquifer as I mentioned it is a formation that contains sufficient saturated permeable material to yield a significant quantity of water to wells or springs. So, this is the definition of aquifer. So, say for example, if a sand formation where significant amount of water water is holding within the soil and that can be drained say by using wells or it will coming through springs. So, that is so called a aquifer. And then say there are classification like a acute clout, acute clout is a saturated, but relatively impermeable material and it does not yield appreciable quantities of water. Say for example, clay formation. So, clay formation once it is saturated contains so much of water, but we cannot drain the water easily. So, it is relatively impermeable material. So, we cannot drain the water. So, that is that kind of formation is soil formation is called acute clout. And then aquifuge is a relatively impermeable formation it neither contains nor transmits water say for example, granite formation. So, that is so called aquifuge. And then acute clout, acute clout is saturated, but poorly permeable stratum. So, like sand clay mix or sandy clay. So, that is that kind of formation is called an acute clout. So, that way when we look the ground water as a source is available mainly from aquifer or acute clout. And then say other formations even the water is available we cannot get a substantial amount of water. So, then aquifers again further can be classified into confined or unconfined. So, you can see that say an unconfined aquifer means say water is say infiltrating down and this is the water table as shown in this figure and then there is an impermeable layer below. So, there is a water table or a free surface as you can see here in this figure. So, that kind of formation is called unconfined aquifer. And then confined aquifer means the formations or the aquifer between which is confined between two layers you can see that here this is one layer of impermeable layer and this is another layer of impermeable layer. So, the confined aquifer is this soil this material where a considerable amount of water is there which is also moves with respect to gradient. So, that formation is so called a confined aquifer. So, generally the aquifers can be classified into either confined aquifer or unconfined aquifer. So, that depends upon the hydrogeological conditions of the particular area. So, now let us further discuss what are the important characteristics as far as the aquifers are concerned. So, we have seen that the rainwater or the precipitate precipitate water is say infiltrating down and then that is further percolating down to the aquifer system. So, the water movement within the subsurface or within the soil depends upon various parameters like porosity, specific historic coefficient, hydraulic conductivity etc. So, let us see some of these important definitions as given in these slides. So, first one is porosity. So, those portions of soil not occupied by solids. So, that is say the meaning of porosity. So, generally the porosity is expressed as ratio volume of pores or industries to total volume. So, that is the porosity. So, you can see that in this soil medium say large number of pores you can see. So, porosity is the ratio volume of pores to pores or industries to total volume. Then further percolation, percolation means rate at which water moves downwards through the soil. So, once it the water is infiltrated down. So, what is the rate at which the water is moving? So, that is so called percolation. And then another important time is so called permeability. Permeability is an expression of movement of water in any direction. So, percolation is generally we mentioned as downwards movement, but permeability means it can be in lateral directions also. So, that is the so permeability and expression of movement of water in any direction. And then as far as the aquifer is concerned say the times like specific yield, specific yield especially we mentioned about form unconfined aquifers. So, it is a ratio of volume of water that after saturation can be drained by gravity. So, that is the definition of specific yield. And then storage coefficient or generally called it as storativity. So, storativity is the volume of water that an aquifer releases from or takes into storage per unit surface area of aquifer or per unit change in head normal to that surface. So, generally we mentioned the storage coefficient for confined aquifers or sometimes we mentioned for an unconfined aquifer also depending upon the way which is mentioned within specified equations. And then another important time is so called hydraulic conductivity. So, hydraulic conductivity which is generally mentioned as say the simply scale. So, this is a constant that serves as a measure of the permeability of the porous medium. So, how much water can move through the soil medium say from one location to another location. So, it is that care represent or hydraulic conductivity represent the measure of the permeability of the soil media or porous media. So, accordingly the movement takes place within the soil media and its unit is the velocity the unit of velocity like meter per day or meter per second like that. Then another time is called transmissivity of the aquifer media. So, transmissivity is the rate at which water is transmitted through a unit width of aquifer under unit hydraulic gradients. So, generally transmissivity is equal to hydraulic conductivity multiplied by B where B is the saturated thickness of aquifer. So, these are some of the important times which we have we will be using as far as the subsurface flow or ground water flow is concerned. We have seen what is subsurface water or ground water and what is aquifer and what are its important characteristics. So, now let us discuss what are the governing laws as far as the ground water flow or ground water movement is concerned. So, one important say governing law was proposed by Darcy in 19th century Darcy is a French engineer Darcy was a French engineer who conducted large number of experiments in 19th century and put forward certain laws called Darcy's law. So, Darcy defined how water moves through a saturated porous media with analogy of a cylinder fitted with inflow and outflow pipes Darcy showed that velocity was a function of difference in head H over a finite distance L. So, if we consider the say for example, if this is a soil media. So, between say one location to another location within the flow direction say what is the head difference and what is the distance between those two points accordingly he proposed the Darcy's law. So, Darcy's law is say velocity of flow v is equal to minus k dh by dl where v is so called Darcy's velocity or specific discharge and k is the hydraulic conductivity and this dh by dl is the hydraulic gradients. So, here in this equation minus sign indicates the flow of water is in the direction of decreasing head and once we find the Darcy's velocity we can find the actual velocity by dividing Darcy's velocity divided by the porosity. So, this Darcy's law is one of the most important law as far as ground water is concerned and based upon that only all the further theories on ground water flow movements and transport process were put forward later time. So, Darcy's law is very very important. So, generally the Darcy's law combined with mass balance or the conservation of mass we derive the governing equations as far as the ground water flow is concerned. So, that will be discussing later and as per this Darcy's law generally the flow should be in very low Reynolds number or laminar flow condition. So, Reynolds number which is the ratio of inertia force to viscous force generally this law is valid when Reynolds number is less than 1, but still it may be valid within the range of say even Reynolds number up to 10. So, now say this hydraulic conductivity which we have seen one of the most important parameter as far as the porous media is concerned. We can find the hydraulic conductivity by various experiments like pumping test within the aquifer or tracer test or say depending upon the soil media we can use certain formulas and then also based upon laboratory methods we can determine the hydraulic conductivity. So, now let us further discuss say how the ground water flow is moving within the porous media and then what way we can quantify or what way we can model this ground water flow movement. So, let us see in the coming slides. So, as I mentioned earlier also so as far as soil or the porous media is concerned it is very heterogeneous and then the its properties like the porosity or the hydraulic conductivity is varying drastically from one location to another location and from one direction to another direction. So, the soil media or the porous media is totally heterogeneous and anisotropic. So, anisotropic means the parameters are varying with respect to direction. Heterogeneous means the parameters are varying from one location to another location. So, due to this say generally it is very difficult to say get to the correct value of this hydraulic conductivity or porosity. So, generally we use some approximations depending upon say some pumping test or some of the field test and we determine some values and then we do through a calibration process. We identify the hydraulic conductivity and other parameters as far as the aquifer consumption. So, as I mentioned earlier also say as far as the soil is concerned say or the aquifer is concerned various types of soils forms the aquifer system like a alluvial deposits, limestone, volcanic rock, sandstone, igneous and metamorphic rocks. So, accordingly since all these varieties taking place and sometimes say one variety or most of time a mixture of these varieties. So, that when the porous media characteristics drastically changes from one location to another location. So, that is why we call the porous media is heterogeneous and then from say either vertical direction or lateral direction also these parameters are changing. So, that is why we call this the porous media as anisotropy. So, accordingly say when we discuss about the groundwater flow movement. So, due to the heterogeneity or due to the anisotropy the movement rate also in the groundwater movement rate also varies. So, that way when we discuss about the groundwater flow analysis. So, the process is very complex due to the complexity of the porous media and then various other parameters. So, most of the time when we are looking for groundwater conductivity or quality investigations say the we have to deal with very complex hydrogeological systems. So, you can see that as in as shown in this figure. So, there are number of layers of material different types of materials as far as porous media is concerned. So, that way it is very difficult process very complex to say study the groundwater flow movement or the groundwater quality analysis. So, that also clear from this figure also where a watershed is concerned the parameters are changing from one location to another location. We have the limitations as far as the field investigations are concerned. So, we cannot say generally field investigation means through bore holes or bore wells we have to get the data. So, that is also not so easy since we cannot have so many bore wells or bore holes say as far as a watershed is concerned. So, generally say the data available through few through some of the bore wells or bore holes we get the data and then we average as far as the various parameters are concerned. So, that way groundwater flow modeling the computer based modeling are the only solutions as far as the groundwater flow investigations or groundwater quantity investigations or quality investigations. So, now another issue the other than the groundwater quantity and the important issue is the quality of the available groundwater. So, when we discuss about the water resource plans within a watershed, watershed management plans say water resource is concerned. So, the available water should be the not only the quantity, but quality also should be good for various uses like the domestic uses or the agriculture uses. So, groundwater quality is a major issue. So, earlier times say with the there was a thinking that the groundwater is a good quality and we can directly utilize, but due to the industrial revolution or say overuse of fertilizers and other things for the agriculture. Now, last few decades it has been identified that groundwater is also very much amenable to pollution and many locations groundwater pollution have been identified. So, groundwater pollution has become a major problem in many countries. So, the reasons are indiscriminate disposal of industrial waste, extensive use of chemicals in agriculture like fertilizers and pesticides and a host of other human interventions are causing the groundwater pollution. So, effluents in water bodies after affecting soils. So, if say the untreated effluents or treated effluents to certain extent are putting into the in the river or lakes. So, this water will be percolating down to the groundwater system through down downwards gravitational movements, lateral dispersion and adductive migration. So, that way you can see that like in this figure. So, this groundwater pollution space and that it will be further moving and further the fractures, fissures, joints etcetera what are there in groundwater or the aquifer system provide additional preferred pathways for fast migration of pollutants. So, with increase in industrialization and increasing use and reliance on groundwater it is very important to assess the water quality and the steady the movement of contaminants in an aquifer system to predict the migration. So, it is not only the issue of groundwater quantity or the quantity of the water available as groundwater, but quality is very important. So, after identifying that many locations groundwater is polluted. So, we now we have to understand how the pollution is taking place and what extent the pollution has been taken place and then what kind of remedial activities can be done. So, that is nowadays a major questions. So, as far as groundwater contamination is concerned as I mentioned earlier some of the bottom sources are mentioned here. So, groundwater pollution can be from natural contamination like seawater intrusion or fluoride or arsenic contamination which is taking place in many locations and then the pollution or contamination can be agricultural contamination by the use of fertilizers pesticides etcetera. Then industrial contamination that means the flue and liquid waste or solid waste which is putting as landfill and that is further say the leachate is seeping down. So, that kind of industrial contamination and then underground storage tanks like in many countries the like petroleum products and other say liquid forms are kept in underground. So, there is always possibility of leakage from these tanks. So, that can be the underground storage tanks then land application and mining. So, what kind of say the fertilizer applications or what kind of solid waste are kept on the land. So, that will be percolating with respect to rainfall this pollutants will be percolating down and then another source is mining. So, you can see that many areas are different types of mines are there. So, mining is another important source of groundwater pollution and then say the septic tanks say most of the houses or many locations the septic tanks will be there and even if it is scientifically constructed there is possibility of leakages. So, that septic tanks can be another source of pollution then waste disposal in injection wells. So, many areas say the liquid waste or solid waste keep it in the soil media or very deep rocks. So, that can be a source of pollution and as I mentioned landfill is another source of pollution where if it is not properly or scientifically constructed landfill then leachate will be percolating down to the aquifer system. So, these are some of the important groundwater contamination sources. So, then as far as once the groundwater is contaminated or the pollutant is introduced to the subsurface or to the aquifer itself. So, there are number of processes taking place. So, that this plume will be or the contamination will be further spreading. So, the changes in chemical concentration or the contamination depends on four distinct processes like advective transports. So, here the dissolved chemicals are moving with the groundwater flow. So, you can see that already groundwater flow is there and then with that flow this contaminant plume is also taken within the flow. So, that is so called advective transports and then a second one is hydrodynamic dispersion. So, since the soil media is porous and then as far as the various way of movements within the soil the plume movement or the the contamination movements. So, hydrodynamic dispersion is another important process. So, this can include mechanical dispersion, hydraulic dispersion, molecular and ionic diffusion. And then another source another concern the groundwater pollution mechanism is fluid sources. So, water on one composition is introduced to and the mixed with a water different composition then that that is the groundwater contamination mechanism like what is happening sea water intrusion. And then reactions say some amount of a particular dissolved chemical species may be added or removed from groundwater as a result of chemical biological and physical reaction in the water or between the water and the solid aquifer materials. So, like that the groundwater contamination various mechanisms are there. So, when we study about the groundwater pollution we have to study this various mechanisms and then accordingly we we have to investigate how the contamination is further spreading. So, now say let us go to the groundwater flow or groundwater quality modeling. So, before that so let us further summarize what are the important work elements as far as groundwater investigation are concerned. So, here I have listed when we go for groundwater investigations we have to go systematically. So, the work elements are well elementary and selection of observation wells then preparation of groundwater level map for the particular watershed or particular area concerns. Then geophysical investigations to decipher the subsurface layers and their characteristics. Then identification of hydro geological features of interest which are likely to control groundwater flow and transports. Then understanding of aquifer geometry. Then detail and periodical water quality analysis. Then periodical monitoring of water levels in the observation wells. So, when we discuss about the the groundwater say say investigations within a watershed we have to go systematically. So, either water quantity investigations or quality investigations we have to study systematically as we are discussed in the work elements. So, various things we have to study systematically and then come up with the investigation report. So, now as I mentioned say we cannot have so much of field investigations to assess how much groundwater is available or how the groundwater quality varies. So, most of the time we have to depend upon mathematical models. So, now let us see some details about the mathematical models as far as groundwater is concerned. So, a model as I mentioned earlier is a representation of a system that means here the groundwater system. So, only effective way to test the effects of groundwater management strategy is through modeling. So, due to especially surface water is concerned we can say directly see what is happening, but groundwater is as you can see that only observation is possible through the wells or the boreholes. So, that way it is it is always better to go for mathematical modeling or mathematical modeling is only way out as far as groundwater investigations are concerned. So, mathematical model simulates groundwater flow and or solute feed and transport indirectly by means of a set of governing equations thought to represent the physical process that occur in the system. So, that is the mathematical model within the context of groundwater. Then the governing equations we can identify governing equations are generally derived from Darcy's law and water balance equation with Hedda's the mainly as the dependent variable. And then of course, we have to define the boundary conditions say if this is the key for system we have to identify what is the Hedda available here or the flux say for example, this is an imber medium water cannot percolate down further. So, that is an imber medium where the flux can be assumed as 0. So, the boundary condition can be in the direct boundary conditions or Dirichlet boundary conditions and then Neumann boundary conditions or in terms of flux. And then when we are going for transient analysis like within an aquifer system when we are pumping water there the Hedda will be continuously varying with respect to time. So, that is called transient analysis. So, there we have to start with some initial conditions what is at time t is equal to 0 how the Hedda is distributed or how the condemnation is spread throughout the aquifer. So, based upon that only we will be doing further the mathematical modeling. So, that way by using the Darcy's law or under the conservation of mass or water balance we can derive the groundwater flow equation. So, as shown in the slide the derivation of groundwater flow equation is we can do by considering a representative elementary volume ReV. So, delta x by delta y by delta z. So, if you consider the flux through the ReV representative elementary volume. So, what is coming out minus what is in is equal to change in storage and then this we can combine with the Darcy's law. So, that way we can derive the groundwater flow equation. So, the derivation of groundwater flow equation is based upon the mass balance and the Darcy's law. So, here this is the say representation as far as Darcy's law and then low mass balance with respect to this. So, finally, using both we get the divergence k gradient h is equal to assess del h by del t this equation we can obtain which is the governing groundwater flow equation. So, in a better mathematical form here I have written the groundwater flow equations generally in 3D form say for example, unconfined aquifer. So, del by del x of k x del h by del x plus del by del y k y del h by del y plus del by del z del h by del z is equal to assess in a del h by del t minus r where this r is the recharge of pumping. So, minus 4 recharge and plus 4 pumping. So, assess is the say specific yield or specific storage coefficients as given here and for confined aquifer we can represent the equation like this and in 2D the same equation can be mentioned like this. So, of course, depending upon like various recharge or pumping times or other sources coming to the aquifer system where this equation can some more times will be there or some changes will be there otherwise general equations are in this form. And then as far as groundwater quality is concerned we have to say study the transport process taking place as far as the aquifer is concerned. So, very similar way we can derive the groundwater transport equation by using the fixed slope. So, here the objective dispersive solute transport equation in groundwater we can write here I am not going through derivation here the equation is written here it is del by del x of d i z del c by del x minus del by del x i c v i plus w by n in the c dash is equal to del c by del t. So, where d is the hydrodynamic dispersion coefficient tensor c is a concentration solute in source or sink fluid n is the porosity dimensions and x i x j r Cartesian coordinates v i is a seepage velocity obtained by solving the groundwater flow equation and then v is obtained by using the Darcy's law and w is the volume of flux per unit volume and c Darcy is the solved concentration. This equation is also concerned different forms are available depending upon various kinds of transport processes, but a general form is written here. So, as I mentioned so, here once the groundwater flow equations are solved we get the head variation and then using the head variation by using the Darcy's law we can obtain the velocity in x y z direction and then from that velocity components we can utilize within the transport equation. And then also we have to specify the initial and boundary conditions as I mentioned initial condition for flow will be flow equation will be say if you know the head variation within the aquifer system that will be initial condition and boundary condition flow for flow equation will be either head prescribed or flux prescribed in terms of Dirichlet boundary condition and the Neumann boundary condition. And as far as the transport equations are concerned initial condition can be the variation of concentration at the starting on the time step and boundary condition can be in terms of the knowledge of concentration at particular boundaries or gradient of the concentration. So, this constitute so, once we define the boundary of the aquifer system and then we identify whether it is confined aquifer or unconfined aquifer and correspondingly we can take the equation for confined aquifer or unconfined aquifer and then we can use the transport equation. So, the modeling can be either in three dimensions or two dimensions or sometimes in one dimension and then say we can also use the Darcy's law with respect to calculate the velocity components. So, that constitute the mathematical model as far as the ground water flow is concerned. And then say the solutions of this mathematical models say we can go for say for simple problems like here some hypothetical or small type of problem where not complexities are there. Analytical solutions are possible say simple steady-stage ground water flow in homogeneous isotropic medium we can go for analytical solution. But as far as field problems are concerned analytical solutions are not at all available not at all possible. So, we have to go for only for numerical solutions. So, numerical solutions as I discussed in the previous lecture. So, various numerical techniques are used to transform this partial differential equations the second order partial differential equations. And the equations are transformed into algebraic form by using techniques like finite difference method, finite element methods, boundary element method or finite volume method etc. So, in the last lecture we discussed the methodologies like same finite element method finite difference methods. Also nowadays a method called analytical element method is also available for the solution of ground water flow and the transport equation. So, now say before discussing little bit further about the ground water the numerical techniques. So, ground water flow modeling is very important as I mentioned. So, this ground water flow modeling is a powerful tool for furthering our understanding of hydrogeological systems and ground water flow and transports. So, that is what we were discussing. So, the importance of ground water flow modeling include construct accurate representations of hydrogeological systems and understand the inter relationships between elements of systems and efficiently develop a sound mathematical representations as we have already seen in the previous slides. Then make reasonable assumptions and simplifications like whether two-dimensional modeling, three-dimensional modeling or one-dimensional modeling, transient modeling or steady state modeling. Then understand the limitations of the mathematical representations. So, we have derived these equations and then we are going for numerical modeling based upon number of assumptions. So, that are our limitations as far as the ground water flow modeling is concerned. Then understand the limitations of the interpretations of the results. So, since the data availability and its accuracy is very much varies with respect to ground water flow investigation. So, that way getting 100% accuracy in ground water flow modeling is impossible task. So, how much is how what kind of assumptions we put and then what kind of limitations are there? Accordingly, the model results will be the accuracy of the model results depends either for flow or transport is consents. So, now say for example, here before discussing the numerical technique like final defense or final tournament. So, here say for example, for simple flow say like we can even simply derive a analytical equation like say if we consider the Darcy's law say for flow movement from one location to another location if it is flow is homogeneous isotropic then we can simply derive equation like this. So, solutions we say for simple problems we can derive the the analytical solutions, but most of the field problems these kinds of analytical solutions will not be valued. So, this for this flow say isotropic homogeneous media we can say the schedule variation is actually linear variation which is obtained by this equation. So, that way we have to go for final defense method or final tournament method or other numerical tools. So, final defense method and final tournament method we discussed in the last lecture. So, further say as I mentioned in the earlier lecture final defense method gives the continuous variation of the function concerned by a set of values at points on a grid of intersecting lines as shown here. So, the gradient of the functions are then represented by the differences in the values of neighboring points and the final difference versions of the equations is formed. At points in the interior of the grid the equation is used to form the set of simultaneous equations giving the value of the function at a point in terms of value such nearby points. At the address of the grid the values of function is fixed or a special form of the final difference equation is used. So, as we discussed in the previous lecture. So, this final difference can be implicit or explicit we can have forward, backward or central final differences. So, according to the formulation which we are doing. So, we can have this various schemes and then we can transform the either the ground water flow equation or ground water transport equation using the final defense method. So, for example, in this slide say the final difference explicit scheme for the ground water flow equation is given. So, this is our ground water flow equation 2 dimension for say for example, for confined flow. So, in explicit scheme using the final difference schemes for a node ij. So, this is ij node for a specific time n using forward discretization time and central difference discretization space we can derive this system of equation. So, these details are available in test books like an induction to ground water modeling using final difference and final term method by Wang and Anderson and say Jacob Beer ground water flow Jacob Beer, Dynamics of porous media by Jacob Beer etcetera. So, this books gives all these details. So, due to lack of time for this this only ground water flow only one lecture is dedicated. So, that way not much time is there. So, that way I am not going to the details of this methodologies, but final difference in explicit scheme we can obtain like a stone in the slide. So, then final element method is another method as we have discussed in the previous slide previous lecture. So, the region of interest is divided in a much more flexible way the nodes at which the value of the function is found how to rely on a grid system or on a flexible mesh as you can see here. Then either like a triangular elements rectangular elements in two dimensions or correspondingly prism elements tetrahedron in three dimensions we can use. So, various schemes are there direct approach, variational principle or weighted threshold etc. So, that way also this given equations like the ground water flow equation or transport equation we can transform and then we can have the system of equation all right system of equations. And then we can apply the boundary initial conditions and boundary conditions and solve those system of equation either iteratively or direct methods to get first the the head variations. And then using the head variations we can get the velocity variation using the Darcy's law. And then if you want to say identify how the transport mechanism then we can solve the transport equation also very similar way using finite element method or finite difference method. So, before closing this lecture let us go through one case study. So, the case study here is the IDI Patanjiru. So, here an industry development area in Patanjiru near Hyderabad the area is in Madag district and the area is about 500 square kilometer. So, this is the the Ikea region and it is spread in three bundles more than 600 industries in this area dealing with the pharmaceutical Spain's and pigments etcetera were established in 1977 since 1977. And then say in 80s say there was no when it was the industries were established there was no say effluent treatment plants. So, these industries directly put this effluence to the nearby streams. So, that way this has become a major problem in this area ground water pollution has been a major problem. So, as a part of this ground water transport mechanism and ground water quality modeling here we have developed a model using visual mode flow. So, I briefly discuss about that. So, here in this area the ground water recharge varies from 100 to 110 mm per year for an annual rainfall of 800 mm. Terminativity values vary from 50 to 80 meter per day and a transmissivity varies from 140 to 1300 meter square per day and offset site data shows that top weather aquifer is having 10 to 15 meter thick underline by fractured layer. So, simulated model domain is above consist 55 rows 65 columns with a 250 meter approximately by 250 meter grid and two layers you can see here two layers and this is the grid which we have generated using the visual mode flow. So, the mode flow is based upon the finite difference scheme and this is the boundary. So, now these cells will be in active cells and only the cells within this boundary will be active cells. So, top layer of 10 to 25 meter thick alluvium of Nakavagu weather zone is granite and is underline by 10 to 20 meter fractured zone. Vertical section simulated in model is having the total thickness of 45 meter and water table in the area has an elevation difference of 75 meter. So, with the southern boundary near this location is about 570 meter above mean sea level and here it is about 495 meter. So, as far as analysis concerned main issue was here the transport modeling. So, that way we conducted a steady state analysis. So, this using the mode flow as I mentioned model flow is a finite difference based package developed by Macdonald and Harbu. So, the aquifer model simulation is carried out. So, model is calibrated between offset data and simulated results. So, water table configuration of November 2003 was adopted for this purpose. So, computer and offset water level for the steady state condition is shown here. So, this is the variation of the. So, once the model is run with model flow is run we obtain the head variation from here to here and that is this contour line shows and then also we can calculate how the velocity variation taking place. So, you can see that this RMR shows velocity variation within the aquifer system. So, using this mode flow good agreement is observed between computer and offset water levels for the aquifer system. And then we run another model called mass transport in three dimension that is also a finite difference based model by assuming dispersivity values 100 meter 1 meter and 0.01 based on field observation. A constant tedious concentration at different nodes of Nakavagu which is this here and varying from 4500 milligram per liter to 1500 milligram per liter has been used. So, the main pollution was on this source. So, this is the initial condemnation at 2003 and then we run the model to find out how the spending will take place in 2007 and further. So, 2003 measure data was available. So, based upon that we run the model to identify how the condemnation spending in 2007. So, this shows the variation. So, like this say by using the mathematical or numerical model like a mode flow or empty 3D we can assess the groundwater say flow condition of the quantity based modeling and the transport modeling how the condemnation spending is taking place. So, that way we can model using the groundwater flow model using finite difference, finite element method or other kinds of numerical techniques. So, for this today's lecture some of the important references are listed here. And then before closing the lecture some tutorial questions so how groundwater condition can be improved in a watershed discuss the importance of groundwater and water management plans discuss groundwater resources improvement by rainwater harvesting and artificial recharge. So, these questions can be answered based upon today's lecture and some of the previous lectures on rainwater harvesting and artificial recharge. Then some self evaluation questions why groundwater is very important in water management describe different types of soil water differentiate between unsaturated flows and saturated flows. What are the important work elements in groundwater investigations discuss groundwater quality issues. So, these all these related answers you can obtain from today's lecture. And then some assignment questions explain how to assess groundwater potential describe different types of aquifer classify aquifer according to characteristics. Discuss fundamental laws governing groundwater in a watershed how to model groundwater flow explain major modeling techniques for groundwater flow. So, these questions also can be answered by going through today's lecture. And finally, as an unsolved problem say study the groundwater potential of your watershed area collect data related to aquifer soil land use land cover etc. obtain hydro geological maps and topo sheets assess the groundwater potential based on available data. Get the data related to number of wells in the watershed and study the head variations within the wells. Discuss how you can improve the groundwater available between the area in terms of rainwater harvesting or artificial recharge. So, today what we discussed is the groundwater flow or subsurface flow conditions. So, we have seen various aspects of groundwater flow and groundwater flow modeling. So, we have say here only one lecture is given for groundwater flow. So, only the introductory aspects only we could discuss today. So, those who are interested in this you can refer to some of the test books and even in the Rappan list. Thank you very much.