Okay, so my name's Andy Keith and I'm here to talk about using Ruby to generate faster Ruby code using partial evaluation and sorry that the title is such a mouthful. So what I want to talk about is really two things but sort of broken into four parts. So I want to talk a little bit about partial evaluation and in general and what we're doing with partial evaluation of Ruby. And then about the tools that we created in order to do these transformations and what progress we've made and where we're going with it. Before I get started I did want to say who I am. So I'm a third year PhD student at Indiana University. I was not always an academic. I actually spent eight years working as a web developer in New York. Most of that time was coding Java and when I started learning Ruby I was very, very happy with the flexibility of the language and the metaprogramming that it provided. And when I got to college I also learned that I really like compiler technology which is what sort of got me started on this process. So first just to talk about partial evaluation a little bit. So partial evaluation is sort of an old compiler optimization idea and basically the idea comes from the fact that in a lot of cases when we write programs we know things about the programs statically. That is we know things about the program before they start to execute.  You know what all of those are and so you can determine those before runtime ever begins. So what we want to do is we want to take those static parts and evaluate them before we ever run the program. So this is what partial evaluation is basically, this is the basic idea behind it. And it also manifests itself in a couple of simpler optimizations namely constant propagation and constant folding which are both very, very common things to do particularly in static languages and specialization. So specialization some people would say partial evaluation is a type of specialization and some people would say that specialization is something that you do as part of partial evaluation but we don't really care what the distinction is. It just doesn't matter that much for us. So what is constant propagation? Well constant propagation is pretty simple. We have three variables defined here X, Y and Z and X and Y are both getting assigned to constants. So our operation here of adding these, the values in these two we know what those values are going to be so we can go ahead and propagate those into those positions. Very simple. And the great thing about doing this kind of stuff is we may be able to eliminate the definitions of X and Y from the program entirely which means less code to be run at runtime. We can also do constant folding and constant folding is basically just taking the two, taking the operation and taking the arguments to that operation and executing it at compile time. So here we're sort of ignoring the fact that a plus could actually be a method call that does something random and we're going to treat it as though we know what plus is. And we can of course combine these two techniques so we get, take our original expression and we do our constant propagation and then we do our constant folding and maybe we can eliminate X and Y entirely and maybe if there is a reference to Z we can replace that we can get rid of that as well. So specialization is something that's a little bit more complicated. So we might think of a simple method definition and we have here an optional value that's already been specified for Y and it may occur that in a lot of places in our program we actually only ever pass one argument and that means that we know that for those particular cases the value of Y is always going to be specified as five and so we can actually pre-compute this Y times six to make a specialized version of the method where we replace that with an already completed calculation. And so this is sort of the basic idea behind what partial evaluation is or at least what we're calling partial evaluation. So of course there's also, we now need to think about the sort of Ruby twist on partial evaluation. This is all great in static languages. Are you also including inlining? We're not including inlining. Traditionally inlining is not usually partial evaluation though it is something that I would like to do eventually for this code but it's not something that I've looked at immediately. So the Ruby twist on partial evaluation is that we can actually use the interpreter to do the evaluation. This is great because in a lot of static languages I actually have to make my compiler know what the operations that can be performed in language are and I have to make it sort of encode it in an evaluator in my compiler which is not necessarily an obvious thing to do. And so because we already have the interpreter, we don't need to implement it. It's already done. We never have to worry about trying to match Ruby semantics because we've got the evaluator and it will do the Ruby semantics for us. It is Ruby. It gives us the ability to introspect the results so we can look at what we got out of it, we can know its type, we can know what can be done with it, what methods are defined on all those types of things. It also provides for us a set of tracing facilities and so we can even put hooks on our code to say we want to know when a new method is being defined, we want to know when an object being extended and we can actually look at all those pieces. And we can use distributed Ruby in order to separate the program that's doing the partial evaluation from the program that is being partially evaluated. And this is particularly important because we don't want our definitions to conflict with each other if we're running all in one big evaluation session. So you could imagine actually trying to partially evaluate your partial evaluator and that might go very poorly if it was all in the same environment. But it's not all simple stuff. So we still need to figure out what do we know statically versus what is only known at runtime. And so it makes a big difference to try and figure that out automatically is not a non-trivial task. We need to ensure that the meaning of the program is preserved because of course we could write a very fast compiler that made all programs return zero, but that wouldn't be a very useful compiler. And so we need to determine what is and what is not safe. And this has to do with looking at side effects, what functional programmers would call side effects and has to do with making sure that the input and output that we get out of the program is going to be the same for both the original program and for our partially evaluated program. In Ruby of course expressions depend on the context. Because we can change definitions as we go along it's very important that we make sure that as the definitions change we're tracking what those are so that when we do the partial evaluation we're getting them in the correct environment. And we also need to know what the receiver class is in order to even resolve a method. So I can't know what a method is if I don't know what a method call is going to, which method is going to be called.  So just to look at why context matters. So this is just three times two, very simple, right? We all know that this is just six. But what if I evaluate it in a slightly different context? So I cheated a little when I changed multiply to be plus. Well now it evaluates to five. And so the partial evaluator can't just take three times two and say well I know it's always going to be six. Likewise I could actually redefine times to always return some constant value. Here no matter what I do it's always going to return 100.  And so even though the expression has changed the partial evaluator should be able to give us those values properly following the data flow of the program. But what if I have something like this? Now I've used method chaining in order to redefine, multiply so that it puts out a copy of the two things that it's multiplying out to standard out. And I might do this to a log file. You can imagine programs where we want to have logging of what's going on. We need to preserve these in order to make sure that the program is still doing the same thing that the program was supposed to do in the first place. And so here we have the output as well as the value that we get. And so determining the receiver is another challenge for us. If we have this simple method F that just takes an argument and then calls G on that argument, we need to know what G is in order to know whether or not we can partially evaluate calls to this method. That means that we need to determine every possible value of X that can flow into here. Which means that we need to find all the call sites for F before we can make a decision about whether or not this thing is safe. And of course we may find that G actually resolves to a number of different methods and we will need to make sure that all of them are safe in order to say that F is safe. Or we'll need to do some sort of call site specific optimization where we say at this call site this is safe and at this call site it's not. So to determine safety, right now we've restricted ourselves to full program analysis. And part of the reason why we stick to full program analysis is that the meaning of libraries can change. If we think about writing a factorial function that uses multiply, then the value that comes out of it when we give it five should be 120 if we have a standard multiply. And so I could go ahead and say, well, factorial five is 120. But if someone includes a library before that, before that call that redefines my multiply, now the value of that factorial changes. And so I really need to have the whole program. There are some ways to get around this. We can define a set of assumptions that are made in the library. And then if those assumptions are violated, you can go and either re-partially evaluate or just use the original version of the code. But we haven't gotten into that yet. We need to ensure that our effectful operations are preserved. So this is our reads and writes, anything that is going to change memory, where that memory may impact the run time of the program. So that happens a lot in the languages, of course. We change the value of an instance variable of an object. And the method call result changes based on that change. And so we need to make sure that anything that's going to be done at run time that's going to have those types of effects we preserve in the resulting program. And this means that we need to ensure that static values are available at run time. Regardless of whether they're in the local variable, if they're in some instance variable, some class variable, some constant, we need to make sure that those are available at run time. So our approach to this has been to use data flow based analysis, which is very common for this type of problem in writing compiler tools. And basically what it means is that we go through the abstract syntax tree from the start to the end. There are other methods of data flow based analysis that use a control flow graph. We are actually just sticking with the abstract syntax tree. And so the basic thing that we need is an environment that tracks the values or types of the static variables as they pass through the program. And we need that information so that we can determine what methods are being called, determine what is, and is not known statically in those types of things. But because this is Ruby and we can change definitions and do things like that, we need to actually track the definitions as well. And we can actually make definitions down different paths of the program. So you can think about an if statement where on one path of the if statement I define a function f and give it one meaning and if I can't determine statically which one of those two is going to be used. I can't know anything about f because it could be either one at runtime. And so those types of things we also need to keep track of in our super environment. And this idea of coming together at the end of branches or coming together in loops is what is known as a meet operation. So we need to make sure that the meet operation works not just on values and types, but also on the environment overall. We also need some sort of method safety analysis. So we need some way to make sure that no IO methods ever get called. Well, actually we need to cheat a little or we want to cheat a little because we want to make sure that we can do something with load and require. Because most Ruby programs are going to use load and require and we can't just ignore that and assume that everyone will gladly write massive, massive amounts of Ruby code in one gigantic file. We also can't do anything with methods that we don't know about statically, of course. So this gets back to having two different definitions for the same method and not being able to determine which one of them is going to be used. And we need to track argument safety through our calls. So we may have a couple of arguments that have, say, an array of them. And because we pass those arguments in, and maybe we find a method that we can't actually call because it does some sort of IO, we may not be able to use those arguments anymore either because they may have been modified and we may not know what they are anymore statically. And so we need to have some way to say, yes, this thing you can leave alone and you can pass through.  I want to be able to keep it because I know that it shouldn't be doing anything that's going to side effect that value. But at the same time, if I have some other method, which I either don't know what the method is, or I know that that method calls methods on the arguments, then I have to make sure that those get killed from my environment. Yeah, so yes, puts is, yeah, that was a cheat example because yes, you're right, it does call 2S. And so that information is something that we need to make sure that we track as well. It needs to analyze the 2S on the value in order to make sure that it knows what it is. Yeah, you're absolutely right. So there are a couple of different ways we can do this method analysis. We can actually do a fully static analysis of methods. And this is great because we only have to do it once per method. But it's not so great because it's not so precise. Because it means that we have to decide everything we know about a method based on just looking at the contents of that method and not knowing about where its call sites are, what its arguments are, or anything related to that. So instead, we could do a call site specific analysis, which basically says that each call point we could then redo this analysis. And with the known arguments, and that would allow us to be much more precise. Unfortunately, this is also much more time consuming. And while partial evaluation is something that we're going to execute before we start the run time. And so maybe we don't care too much about the compile speed. We all know that that's not true, or anyone who has set and waited for a large C code base to compile knows that we do care about compile time and we want it to be fast. So, sorry, go ahead. Sorry. So we can instead use something like a hybrid approach. And this gives us a lot more ability to sort of tweak what we're getting at. And the way we do this is by gathering up all the call site arguments. This gives us something that's in between on speed and precision. So we might decide that we're going to gather up all the arguments and we're going to analyze this function once anyway. And a lot of times we're actually going to get some benefit out of that. Because in a lot of cases our methods are called with roughly the same types or at least the same super classes of things. But we might also decide that we have a couple of different classes and we want to separate that method up into a couple of different sort of F and F prime where we have one set of calls that uses a similar set of arguments and another set of call that uses a different set of arguments and so we want to split those up. So it gives us a little bit of heuristic there that we can tweak. So, that's basically our approach to partial evaluation, what we're looking at to do inside Ruby. So we're also using Ruby to do the work. We weren't originally using Ruby to do the work, but I sort of encouraged my advisor that this was a good idea, so we're doing it now. So we do source to source translation, which means that we start with Ruby code and we end with Ruby code. This does limit us in what we can do because we might discover things about types that would be useful in accelerating things. But because we can't communicate those types through Ruby, they by necessity get lost. We're using Ripper right now to parse the Ruby code into an abstract syntax tree. We're not keeping Ripper's representation since it's event based and we want to have something a little bit more flexible. We have our own abstract syntax tree. We also wrote an internal DSL called RubyWrite that we use for doing term rewriting on our abstract syntax trees. And basically we use this for all of our analysis and for our transformation of abstract syntax trees. And the virtue of it being an internal DSL is it means that it gives us all of Ruby, which allows us to use libraries like the RGL library, which is great for doing graph related things, which is also a common thing to do inside compilers. And finally we wrote a little unparsing library called Shadow Boxing, which is also part of the RubyWrite stuff. So for the parsing, I have just a very thin wrapper around Ripper. In fact, I use Ripper's events to generate RubyWrite nodes. And I just use the Ripper event names for the node names. Yay, metaprogramming. And the thing that I like about this is that, bother, that doesn't show up. Well, it uses the same parse.y as Ruby19. And I like that because of course it means that it keeps up with the changes in the parser. Unfortunately, there have been some changes in the parser that have broke Ripper, which has been a little bit of a cause of consternation. But I think most of those are fixed now. So for analysis and transformation, we use our own tool, the RubyWrite module. And we use those as a set of RubyWrite nodes. So the RubyWrite nodes are basically an annotated abstract syntax tree node. And so the idea is that there's the head of the node and it's children. But we also want to store some annotations such as the source code that that node came from, the source file, the line number, column number, and things like that. Which is useful inside of a compiler, of course, because we might want to report where an error occurred. And then we define a couple of methods. The rewrite method, which is sort of our top level method, which basically takes a normal Ruby method and wraps using an environment. And we need the environment in there because we want to use match to decompose our patterns and we want to use build to recompose our patterns. And so match takes a pattern and that pattern can have variable slots in it. And those variables then get put into the environment with whatever tree node was in that location. And then build can look those back up in order to reconstruct abstract syntax tree nodes. And then we also have a little bit easier tool to use, which gives us a way to simply do a pattern rewriting where we take a pattern, it does the deconstruction for us, and we give it a block of code, basically, to execute, to rebuild. And then we also define a few tree traversals. Tree traversals are also something that's very common inside compilers. We define a number of them bottom up, top down, all, one, others. So let's take a look at an example. So we want to take this code, which is basically using these modifiers, Ruby modifiers, where we modify the statement with an if. And we want to turn those into just basic if statements, partially because later in the code, we don't want to have to duplicate our, in the, later in the analyzer, we don't want to duplicate our code to do the same things over and over again. And we would need to do that if we preserve all of these different node types. So when we parse this, it's going to look something like this. This is actually the literal syntax for our RubyWrite nodes. We've latched on top of symbols in order to give us our nodes. And so you can see that inside of our nodes, we also have some strings. These should actually all y and 0 and 1 actually should all be quoted, but they're a little difficult to see. And this actually should give us what we need to look at in order to transform them into this. Which is basically an if statement in the first case where we have a test and we put our consequence is the original statement that was being modified. And in the second case, we really don't want to preserve unless either. So we want to turn this into an if with an empty consequent, an empty then statement. And then put in else the results of the statement that would have been called. And finally, when we unparse it, we'll get back something like this. So a more standard if and a little bit weird looking if that has no then. We could have also done if not and change this into the other location, but this lets us get rid of not as well. So we can do this by pulling in our library. We define a class. We don't do anything special. We just have a module that we have added on top of it for doing our rewrites. Right now we sort of define a standard method of main. There's actually no need to do this any longer. This was a legacy from our old code. But RubyWrite provides us a run statement that allows that pass to run and it looks for main automatically. So in a lot of our code, we've continued to do this. So here I just want to do a bottom up pass through to unsweeten this code. Because I just want to look at all the nodes and I want to transform the ones that have that particular shape into a normal if statement. And so I'll have it called simplify on each of the nodes. And so simplify can write the same way. I should just use a new method here. And inside the simplify, I can then use match to deconstruct my clauses. And you can see here where colon t, colon c, and that's it, I guess, are being used in order to be variable slots. And I can plug them in in my build and it rebuilds those variable slots. And since I'm doing this bottom up, I don't have to do any extra traversal. It's all taken care of forming by the tree traversal. And if it doesn't match one of these two cases, I just want to return the original value back. But I can also write it as a re-writer, and there's an advantage actually to writing it as a re-writer. So you can imagine that you might have a much larger unsweetener, or a much more complex analyzer, both of which I have. And it would be nice not to have to go through the process of saying, if, else if, else if, else if, else if, for the 100 or some node types that there are in Ruby. So instead we have these re-writers. And these re-writers let us write these little functions. They also have a performance benefit for us, because rather than doing an if else, if else, if else, if else style match, we actually use a data structure called a tree, t, r, i, e, in order to determine which one of these calls should actually be executed. And we only execute the one that should be. So finally we want to un-parse this. Now we've got it transformed. We want to use shadow boxing to un-parse it. It's a pretty printing library. It's part of the RubyWrite. It basically has very, very simple matching for RubyWrite nodes. And it prints using the idea of horizontal and vertical boxes. And the basic idea, while this doesn't sound like it's very flexible, it turns out it's actually quite less the ability to list a whole bunch of items that are going to be printed out horizontally. And we put spacing information in there. And vertical boxes give us a way to indent and list things on separate lines. And so we can create a pretty simple un-parcer, just like this, by starting, pulling in our boxing library, starting our un-parcing, and then generating our un-parcer basically as a set of rules, and then using it to un-parse. And it's a little bit strange here we have this 2s at the very end. Part of the reason for that is that un-parcing a node actually generates, instead of generating the string directly, it actually generates another tree, which is the set of horizontal and vertical boxes, in case you wanted to manipulate that. So we can think of a very simple rule here for our var reference. We're just going to take the var reference. It has one item in it, which is the variable. And we're just going to print the variable back, and that's really all there is to it. But we may need to do something a little bit more complicated. We may want to actually break it down our if, and print the if pieces out. So here, T, C, and A represent the test, consequent and alternative of our if statement. And the V is our vertical boxes, and here we've got indentation of 2, because I like indentation of 2, and horizontal spacing of 1, so that we get if, space, our test, space, then. And this code is all done recursively, so if these things are not strings themselves, they will continue to be executed through the un-parcer until they get to being strings. And so we get the benefit of having these rules be independent of each other, and still getting the whole thing built up as one big final piece of source code. So finally, I'd like to talk a little bit about our progress. So this is still a work in progress. The partial evaluator is definitely still a work in progress. Right now, our current approach is using the simple static method analysis, more in order to get something up and running that we can test and start to see, sort of, get some idea of where, how much we're getting just from the simple static method analysis, but we would like to go further. And right now we're ignoring some more complicated cases. So for instance, right now we are not going inside methods to do partial evaluation. We can partially evaluate a whole method call, but we can't partially evaluate pieces of things inside of it. And we also aren't dealing with lambas and closures in general. Not because they're impossible to deal with, but because they're a little bit more complicated than we want to, again, get something up and running. And so, yeah, I mentioned that we're not partially evaluating internals with methods. The internals of methods actually have somewhat the same problem in libraries, which is to say that if the definition of methods that they call changes during the course of the program, then they are partially evaluated values. Even if we know something statically about the method, it may be different in one place in the program from another. And so in order to make sure that we don't cause something bad to happen, we need to either split those, that method call around that, or we need to only partially evaluate those methods, which this doesn't occur for. Which of course in a lot of programs is most of them, I mean, this is sort of, it's a very defensive method of doing all this stuff. We've been looking at making sure that we preserve the semantics of Ruby no matter what above and beyond our optimization, so. And we're also not doing any dead code elimination right now. One of the things that happens when you start to partially evaluate things is you end up creating, having a lot of useless assignments potentially, as well as code that contributes a value that never gets used. And this basically happens because as you can imagine as we start to propagate constants, propagate literals, we may end up no longer needing to make the original assignment of those literals because they may not manifest themselves throughout the code and there may never be a reference to that variable any longer. And so some of the benefit to be gotten out of partial evaluation is having a clean up step afterwards. And right now, we can't really do it at the same time because the partial evaluation needs to do a forward data flow analysis where it starts at the beginning of the program, not knowing anything and works its way to the bottom of the program. And dead code elimination needs to do exactly the opposite. It needs to start at the bottom of the program and work its way up through the data flow to determine what is live at any given point. I guess I already talked about needing to clean up. So our next steps are to put in a more sophisticated data flow analysis. So we really would like to be able to do something more like the hybrid approach. We also would like to do a control flow based graph to do our data flow analysis instead of using just the abstract syntax tree. And part of the advantage to using something like a control flow graph, which is essentially, you can think of the nodes on the graph as being the code, little blocks of code and the edges between the nodes of the graph are the actual control flow in the graph. Right now with the abstract syntax tree, we have some control flow that's implicit in the code. Things like yield, return, break, next. Anything that causes there to be a jump in where code is being executed is not explicit in the abstract syntax tree, it's just implicit there. And so right now we have a somewhat clumsy mechanism for dealing with that to make sure that we get the correct behavior out of it. But a control flow graph gives us a much more elegant way to handle that because we just add edge where we have these and we can actually make those pieces of control flow explicit. And it also makes more obvious where we need to do our meet points for our environments. We'd also like to do much more precise method analysis. We'd like to look more at the hybrid method, maybe even the call site analysis. The call site analysis can get kind of expensive because you can imagine that, well, you have to make sure that things like recursion and things like that are going to be caught. And of course, one of our goals for this tool was to be able to run this tool on our tool. And so if we're going to be able to do that, we make heavy use of recursion and things like that in the tool because when you're dealing with trees, it's a natural way of handling that. So we want to make sure that we can get that. We'd also like to partially evaluate methods. So we'd like to be able to go in and do some partial evaluation of methods when we know that that method is safe to partially evaluate it. And we'd also like to specialize methods. In a lot of the partial evaluation literature, especially for static programs, you will find these great and complicated ways of specializing methods. In a lot of cases, they've concerned themselves with specialization, but not with finding the opportunities for specialization. So they actually rely on the programmer to specify where those things are possible and where they're going to preserve the semantics of the program. We would prefer not to do that. But if it means that we are able to get some more out of it or we have programmers that are interested in trying to do some of those types of things, then we might actually want to expose this to programmers through some sort of DSL. So either some sort of fake annotation above the code or some sort of call during definition time that would tell us, you can specialize this because these particular values are going to be constant in a lot of cases. So maybe create three versions of this particular method and put them in the correct places in the code rather than just having the one. So finally, for more information, I maintain a blog at fee.cs.indiana.edu. Fee is actually a little play off of SSA transformations for those people who are compiler people. You can also get to our source code, which is available through HTTPS on the same server. And there is a way to get to it without a login or using a guest and no password. I cannot remember off the top of my head what that username is, but I'm going to post it on my blog after I ask my advisor. You can also get to our partial evaluator. So right now our partial evaluator is not doing too much. So it's possible to get it to do simple constant propagation. The method analysis stuff is not quite in there. One of the additional problems with the method analysis is actually that there's a lot of Ruby code that's actually written in C. And analyzing that C code and trying to treat it with Ruby semantics is also a bit non-trivial because there are things that you want to treat as being side affecting and things that you don't. So in the C code, you might have references to global variables and things like that that would normally be considered side effects. But because of the Ruby semantics that they're defining, those variables are actually constant through the program. And it's difficult to determine that without a C analyzer essentially to do something similar to what we're trying to do in Ruby. And finally, you can email me or you can Twitter me. And just to have one more slide of more and more information, we could use your help. And in particular, getting an opportunity to look at more realistic programs is something that's very helpful. So the benchmarks are great. They give us a starting point that Ruby Benchmark Suite is a great place to start. But in a lot of cases, benchmark programs are meant for testing implementations. They're not so much meant for testing these types of optimizations. And the problem that you run into with them is that in a lot of cases, you end up with code that either completely partially evaluates away because it returns a simple value and there are no side effects. And so you end up replacing every instance of factorial with the actual value of the factorial, which is sort of a not very useful example. Or you get the opposite problem where they've been optimized to the point where there's not much left for the partial evaluation to do. And in real programs, there is more opportunity for this. And I also just wanted to thank my advisor and my research group. My advisor is Arun Shaohan. And my research group includes Chunyu Shea and Pushkar, Ratnaalakar, who are both actually working on MATLAB. So thanks for coming and people have questions. Will it be a real-life health complication of the template optimizations? Yeah. Very slow, primarily because of Calvars on CRL4, which can be partial and evaluative of the template simulation time. Can you repeat the question, please? Sorry, so what he was saying is that templates in Rails can be particularly slow because of evaluating some of the helpers. And this partial evaluation would be something that would be very helpful in that. So I'm going to try applying this to Rails templates, which is a life-scale project and non-trivial thing to do. So yes, I mean, so when I started working on this project, the goal right now is, for a lot of Ruby stuff, is to get things working in Rails, right? Particularly when I first started working on this, Rails was sort of the killer app that was bringing people into the Ruby community at the time. There are some challenges there. There are always challenges when C code is involved with this stuff, because the minute we start to pull C code into this, especially outside of the Ruby library, where we can start to define some of the pieces, whenever we start to pull C code into this, we need to have some way of knowing what the characteristics of the methods that are defined and exposed inside Ruby are going to do in order to make sure that we are able to do this partial evaluation. But I am very interested in doing this kind of stuff with the Rails stuff and doing it with templates and things like that, with something that I had also been thinking about a while back. But we aren't there yet, but hopefully, in the not too distant future, we will be. Other questions? Let me actually follow up with that point. We just said, if you are going to apply this work and also, thank you so much for your work, if you are going to apply it to Rails templates in particular, there was a previous effort by Stephen, Stephen Cage or Case AES, and I think it's called Template Optimizer or something. Okay. I had some experience using it a couple of years ago, and I think that what he found, and unfortunately I can't remember the specific use case, what we found was basically that although there are these kind of simple breakdown cases of, oh, I'm going to take this route and look up, and I'm going to turn it into a string with block post ID for the ID and string interpolation.  So it was very difficult. So anyway, I just want to give you a pointer to that. So if you start to stumble into that, maybe you can learn from his difficulties. Yeah, no, that's definitely a good point. So just in case that wasn't heard and to get it on the record, there has been previous attempts to do a Template Optimizer and in a lot of cases, a lot of the sort of useful cases it proved not to work very well because of so many, there being so many options and helpers and things like that, it made it very difficult to do the analysis. A couple other questions. How far from a minimum viable application where you can, for example, not optimize the whole application just like few parts of it where the coder itself can say, hey, just work this part out as if you're doing like same side workings and optimize just like few parts of the code that are not that difficult and don't have closure. Right, right. So the question is sort of exactly our way, I guess, to restate it. To minimal useful thing. So right now we don't have the method analyzer completely finished and so the method analyzer being finished is the first part that's actually going to as my advisor keeps joking with me be able to handle 2 plus 2. So right now we're doing constant propagation and we are only handling things that have a literal expression. Part of the reason why we're only handling things that have literal expressions fortunately this is pretty wide in Ruby actually but part of the reason why we're only handling literal expressions is because we don't have a good way to take something that has been defined and let it go through some manipulation and then sort of rematerialize it in source code because we have to go back to source code. But the method analyzer stuff is something that I'm hoping to finish up actually in the next couple of weeks and so it will be to the point where you can have it do simple things. The other side of this whole problem is that in Ruby we need to get at the characteristics of the base library and one of the ideas the basic idea for this right now and this is not a scalable idea this isn't sort of the end idea but I actually did go through and try and do analysis of this stuff and found that it was very difficult of the C code to sort of get at the base Ruby library stuff so right now the approach that we're going to take is defining the characteristics of the basic Ruby library using a static method definition basically so rather than saying okay you're going to look at the Ruby implementation of plus or you're going to look at the C implementation of plus we're actually saying you know what plus it takes one argument it never gets changed by a call to plus and this is always safe to call and then if through the process of the program the programmer redefines plus that former definition will just get thrown away or it will get preserved if someone does something like a method chaining so when you method chain it will remember that and then it will throw away the value for plus but it will remember a ridge plus or whatever so hopefully in the next couple of weeks basically the answer to that anything else? What type of speed up do you see in like static languages that you can do this in? That's a good question it's actually not one that I have an answer for so partial evaluation has been something that was talked about like 20 years ago in static languages and then again like 10 years ago in static languages it sort of goes through cycles I haven't actually looked at anything recently I don't think this is a very common thing to do for a lot of static languages partially because in order to get all of it to work a lot of the previous implementations have actually said well we're going to require the programmer to specify what can be partially evaluated what can't be partially evaluated and the moment you start to put those types of requirements on it you immediately put yourself in some sort of niche where you're not going to be generally available for everyone so off the top of my head I don't know it is also a technique that's been used a lot in functional programming and I actually don't I also don't really have a good feel for exactly how much it gets used there but there they are trying to do it in a more automated fashion and it also gets used for logic programming and I believe in prolog it does actually get used in several of the implementations including the WAM anything else? alright, thank you very much


We will get started with tutorial, problem number 39. What does problem number 39 tell? Problem number 39 tells I have an aluminum plate heated to a uniform temperature of 227 degree Celsius and is allowed to cool while being vertically suspended. This is natural So, I think natural convection problem it is we have solved problem number 39. So, I do not think we should be solving again. So, even that 40 is also natural convection. So, we have solved forced convection all that we are saying is we have to compute the Rayleigh number and compute that I think this is a plug in problem there is nothing difficult in that. So, what we shall solve now is we shall take up 41 a furnace with an aperture of 20 mm diameter a furnace of 20 mm diameter and an emissive power of 3.72 into 10 to the power of 5 watts per meter square is used to calibrate a heat flux gauge having a sensitive area of 1.6 into 10 to the power of minus meter square area is 1.6 into 10 to the power of minus 5 meter square at what distance measured along a normal from the aperture should the gauge be positioned to receive irradiation of 1000 watts per meter square irradiation is 1000 watts per meter square. The question asked is what should be the distance between the gauge and the aperture of the furnace. So, now you have taken it. So, G equal to this is R G equal to Q F D Q F D that is furnace to gauge upon A D is equal to I E intensity D is the diameter for gauge the aperture correct I E A F I E A F area of the aperture into cos theta F into omega D F that is the solid angle D F omega D F upon A D. So, this is equal to what is intensity I E A F area of the aperture into cos theta F into omega D F that is the solid angle D F omega D F upon A D. So, this is equal to what is intensity I E what is intensity here this is we can be this is coming out from a furnace. So, we can consider this as a like a black body. So, I E equal to E B by pi E B by pi into we will substitute everything A F I E equal to E B by pi we got G equal to G equal to that is 1000 equal to G equal to 1000 equal to G equal to 1000 equal to E B by pi is 3.72 E B is what E B is what is the irradiation given E B by pi 3.72 times 10 to the power of 5. How did I get that 150 it is given to us. Yeah emissive power has been given to us that is 3.72 into 10 to the power of 5 divided by pi divided by pi into A F what is A F that is pi by 4 into 20 into 10 to the power of minus 3 whole square that is A F that corresponds to we will write A F equal to pi A F equal to pi into 20 into 10 to the power of minus 3 whole square by 4 that is that area turns out to be 1.6 into 10 to the power of minus 5 into cos into cos theta 0 cos theta F it is normal. So, 0 into A D cos theta D upon L square remember whenever I said there are two areas they should be normal to the irradiation. So, now here normal again A D is given to be what is the area given for A D that is pi by 4 D square that is coming out to be correct only 1.6 times 10 to the power 5 this is pi by 4 D square that is one area this is given as the other area see we have. Yeah right right. So, into does not matter which we are putting into divided by R square divided by R square that is it. So, if I get I will get R equal to point.  So, A D is what area of the aperture correct that is fine. So, we get L equal to 0.193 meters 0.193 meters okay. So, if the gauge is tilted if the gauge is tilted of normal by 20 degrees what will be its irradiation. So, it will be 1000 into cos 20 G at 20 degrees G at 20 degrees would be G G G at 20 degrees is 1000 into cos 20. So, that turns out to be 940 watts per meter square. So, a glass plate let us take problem number 42 that is a glass plate 30 centimeter square is used to view radiation from a furnace that is the glass plate is 30 centimeter square 30 centimeter square glass plate that is 30 into 30 into 30 centimeter square okay. The transmissivity of the glass is 0.5 from 0.2 to 3.5 micrometer that is lambda 1 equal to 0.2 micrometer and lambda 2 equal to lambda 2 equal to 3.5 micrometer. That means rest all in rest all other wavelength the transmissivity is 0 that is what we need to assume okay. So, all that we are saying is there is a transmissivity of the glass only within a wavelength of 0.2 to 3.5 micrometer anything less than 0.2 micrometer it is having transmissivity is 0 anything above 3.5 micrometers it is having 0. Now, the emissivity of the glass yeah. So, next sentence the emissivity of the glass may be assumed to be 0.3 up to 3.5 micrometers and 0.9 above that. So, if you plot that emissivity versus lambda 0.3 up to 0.3 3.5 micrometer and now at 3.5 micrometer there is a sudden jump and that will take to 0.9 and there from there on till infinity it is going to be infinity means it is not infinity that is until thermal radiation is contributed we will have an emissivity of 0.9 and the transmissivity of the glass is 0 except in the range of 0.2 to 3.5 micrometers I stated that already assuming that the furnace is a black body at 2000 degree Celsius the black body that is this glass plate is see in a furnace typically we put a glass. So, that we can see what is happening inside a furnace. So, that is what we are trying to do the energy balance for this glass assuming that the furnace is a black body and sitting at 2000 degree Celsius what is the energy absorbed by the glass and how much energy is transmitted through the glass outside that is the question which is asked. So, we have studied fraction of energy transmitted yesterday so if we take that concept we if you remember we can go to the table lambda 1 t table is there that is lambda we have listed the fraction as a function of lambda t is it so let us first calculate lambda 1 t and lambda 2 t and then we will go to that table so what is lambda 1 t lambda 1 is lambda 1 t that is 0.2 micrometer 0.2 into t is 2273 why did I get where did I get this 2273 from 2000 plus 273 remember in radiation always we have to keep temperature in Kelvin 2273 I get 454.6 micrometer Kelvin similarly lambda 2 t I get 3.5 into 2273 7955.5 micrometer Kelvin. So, now let us go to the table and see the radiation so for lambda 1 t 454.6 that means it is somewhere between 400 and 600 that is 0.  So, we will get f 0 lambda 2 as 0.85 this is the value this is the value 0.856288 f 0 lambda 2 is 0.85443. So, f of 0 lambda is equal to we will not do that I will not let us not write that let us just sigma t to the power of 4 the total incident radiation if we compute we are what are we supposed to find we are supposed to find the calculate calculate the energy absorbed in the gas and the energy transmitted. So, we are supposed to find the energy transmitted now let us find what is the energy absorbed what is the energy absorbed. If this is the glass plate g is coming from furnace and what is getting transmitted what is it being falling sigma t to the power of 4 is falling that is because it is black 0.3 square is the area. So, transmitted radiation is equal to this is sigma t to the power of 4 and area is 0.3 into 0.3. So, total incident radiation equal to first of all let us find out total incident radiation equal to total incident radiation equal to sigma t to the power of 4 total incident radiation equal to sigma t to the power of 4 into area into f of actually it is lambda 1 to lambda 2, but what is this f lambda 1 to lambda 2 equal to f of 0 to lambda 2 minus f of 0 to lambda 1. So, let us substitute all this I get yeah. So, sigma is 5.67 into 10 to the power of minus 8 2273 to the power of 4 0.85443 into 0.3 square I get 11,673 to the power of 4. So, this is the incident radiation that is coming from the furnace, but how much is getting transmitted if we see the graph of the transmissivity see it is getting transmitted only between 0.2 to 3.5 that is why we also calculated what is the incident radiation within that bandwidth that is 0.2 micrometer to 3.5 micrometer. So, what will we get total radiation transmitted what is the transmissivity within this bandwidth we have 0.5 how much is falling we have the G. So, 0.5 into G is the G transmitted G transmitted how do we show the transparency no 1 minute I just want to say why we did what we did here just 1 minute you might understand why we did this why we took from 0.2 to 3.5 is because we could have taken from 0 to infinity, but the thing is even if you have energy incident over all wavelengths the energy that is useful for this case is only what is coming between 0.2 to 3.5 micrometer. So, there itself we have used this fraction nothing else is going to go through that otherwise it might be falling on to it, but nothing is going to go through it. So, total radiation transmitted equal to 0.5 into 116381.7 which turns out to be 58190.85. Now, would I just like to add one thing here in this problem see actually we have this tau which is a constant in this range. So, we just took it as 0.5 if in this range also tau had some variation then we would have had to go through an integration to get the actual value of tau we will not do it for this problem there are couple of other problems where we will have to do an integrated value for tau or epsilon or alpha whatever and the procedure will be similar. So, we are leaving the other portion for yourself to work out that is the energy absorbed in the gas you please work out yourself because they have to do same thing. So, energy absorbed in the glass you will be working out yourself because we have emissivity of the gas given. So, from which you will have to work out the energy absorbed. So, let us move on glass gas ok. So, now I think if we have any questions here and there we will take. Sir my question is that sir in case of suppose you are we are considering a flame yesterday you told that suppose you are considering a blue flame it is having an emissivity of 0.2 to 0.3 something 0.2 emissivity it must be having some absorptivity term or transmissivity term along with that now how is the flame going to absorb something. Now my question is how is the flame going to absorb something. So, flame is something which is does not have any mass it is just a radiation. So, how is that absorbing any other radiation or it is absorbing a radiation or it is transmitting anything. See one of the question is yesterday we broached up that there is a flame because one of the questions was how does the blue flame how does the blue flame affect the heat transfer on my pan. So, what did we say if I have a blue flame where did this blue flame come from the question the there is no mass in the flame is the not right thing there is mass there is mass what is this mass consisting of it is what is coming inside. First is methane let me take simple in a LPG of course there will be butane and propane also I am just taking methane gas or a hydrocarbon. Let me put it very safe way answering is hydrocarbon you have an hydrocarbon and you are taking oxygen plus nitrogen that is air oxygen and nitrogen other extraneous things I am excluding. So, if you take this what is that which is there in the flame if the complete combustion takes place.  So, do not say that there is nothing inside the flame there is mass that is this carbon dioxide nitrogen and water vapor. Now that we are talking about emissivity absorptivity of these components carbon dioxide nitrogen and water vapor what we are saying is that because it is complete combustion it is blue flame number 1, number 2 it is emissivity not 0.2 it is almost 0.03 if the complete combustion is taking place it is almost 0.02 to 0.03. So, if it is 0.03 what does that mean what does that mean emissivity equal to absorptivity absorptivity is also equal to 0.03 assuming that there is no reflectivity which is true for the flame there is no reflectivity what is the transmissivity 1 minus 0.03 that is 0.97 0.97 that means what everything is getting transmitted through it it is a non participating gas that is why I said there is no radiation from the flame to the human body or to the plate whatever heat transfer is taking place between the blue flame and the plate is completely or majorly dominated by convective heat transfer convective heat transfer the mode of the heat transfer between the blue flame and the plate what I am putting on my gas stove is convective heat transfer majorly. If we need pick may be 3 to 5 percent it would be radiation because that radiation contribution is because of this small emissivity and of course there are lot of chemical reactions and all are there there will be a thermo chemical heat release also what is called as TCHR let us not get into all of that majorly the heat transfer is convection. So, please do not say that there is no mass in my flame there is mass what is that mass that is consisting of carbon dioxide nitrogen and water is this an assumption no this is experimentally measured value this is experimentally measured value we ourselves have measured this actually. So, we put a thermocouple and put a thermal camera the way I explained in the morning and we have measured the emissivity of the LPG flame. So, it is coming around 0.03 even lesser than that sir in another one I have another question. So, in temperature measurement by using thermometer you said that we have to consider the temperature of the wall it will affect the thermometer reading sorry temperature reading in a thermometer. So, suppose in case of a fluid which is having a very high temperature do you want to take the radiation effect of the fluid will it affect the temperature measurement by using thermometer. The question asked is in the radiation error in the radiation deviation what did we say yeah what did we say T fluid is equal to T thermocouple plus sigma epsilon thermocouple into T thermocouple minus T wall to the power 4 T thermocouple to the power of 4 T wall to the power of 4 upon H. But now what you are saying is that if there is a fluid and that fluid is moving and let us say water but water is not participating no water is not participating and even if you take air for example that is not participating as long as there is if we take participating medium it becomes complicated it is much difficult than what we have told. If it is non-participating then I do not think there is any problem in calculations of this. Did I answer your question. Suppose it is having a very high temperature fluid suppose a 700 degree or 800 Kelvin fluid is used will it affect now it will be also having mass which is emitting radiation no. See the question is if the fluid which is flowing is also sitting at high temperature will it affect why that is what it is not a function of temperature it is a function of participation. So, this in fact this T fluid here could be 700 800 how does it matter. Yeah here in the problem what we took itself it was it was quite high temperature actually. So, fluid temperature is not the issue the issue is whether my fluid is participating or not that is all the issue is. Instead of water if in the same place there is mixture of air I mean so instead of air if it is air plus some steam then it is a different problem it will be difficult. So, then it is air at that high temperature it is not going to be participating even if there is some amount of water vapor it will start to become participating that is what will matter that temperature might be the same for the two fluids, but the nature of the interaction is different that is what is more. So, what is the interaction we are looking at even if I have a participating medium what will happen. So, what will happen my thermocouple whatever temperature is there it cannot it cannot the fluid cannot transmit or radiate the heat to the wall that is being stunted by the medium which is there. So, in fact the participation the radiation from the fluid to the wall sorry from the fluid to the wall of course there is no radiation, but from the thermocouple to the wall is minimized in fact it is good no my radiation error is going to come down actually is that ok. How do we identify the participation is it depend upon viscosity or something like a degree of participation how do we identify a medium is participating or not. How do we identify. Does it depend upon the emissivity of the medium or something like that. The question is how do we how does one make out whether a medium is participating or non participating I think let us wait till tomorrow morning I am I have planned that I will be giving that participating mediums transmissivity emissivity and the of course again as you said whether they are participating or not will be dependent on emissivity and absorptivity. If their emissivity and absorptivity are equal to 0 then transmissivity is 1. We say that in the morning itself we said if I have a gas whose absorptivity is almost equal to 0 that is which is the case of optically thin medium then its transmissivity is equal to 1. As long as any medium has having a transmissivity of 1 everything which will come through it will pass through it. So any medium which is having transmissivity equal to 1 is a non participating medium ok. So if I have to imagine in terms of emissivity absorptivity reflectivity transmissivity is if it is a gas there is no reflectivity so it is only transmissivity it should be having 100 percent transmissivity. If you have 100 percent transmissivity then my medium is non participating ok ok. We will come out from this college now. In natural connection experiment if the geometry is changed from rectangular block to cylindrical block so we will be considering all entire surfaces for the calculating nozzle number no. So what will be the difference? In the natural connection experiment if I take a cylinder instead of a flat plate can I go ahead and do the natural connection in fact it will be good I think that is a good idea actually. So instead of taking a flat plate one can even take a cylinder but only thing is that yeah we can take a cylinder and do the experiment there is no problem you can go ahead and do this may be making a cylinder block is much easier than making a flat plate one can try this this is a very good idea really good idea we can go ahead and that way actually you have given idea that any shape we can do as long as I can get that shape in ice and with ice getting any shape is easy because template is in our hands. So question is related to absorptivity yeah very much. So in your slide there is a tree source temperature 300 Kelvin and the sun temperature around 5000 Kelvin and absorptivity related to the source temperature in that case at a lower temperature source have a high absorptivity while it is cold. The question is that in that slide with a house roof sun is at 5800 Kelvin absorptivity is 0.3 a tree is at 300 Kelvin absorptivity for that is 0.6 or something. So is it that for the roof material absorptivity decreases with let us increase in temperature no this is not that absorptivity decreases with what is it no temperature yeah absorptivity is this question actually we had in our class also okay I am just trying to open please bear with me see the point here is the absorptivity is a function of source temperature. So ha your question is this source is sitting at one temperature another source is sitting at temperature is that because of that the absorptivity is less no I cannot make a conclusion like that I cannot make a conclusion that absorptivity of the roof decreases with the increase in temperature no no no so because the each source is different is the source of each one is different it is a function of absorptivity is a function of source material and source temperature and source material properties like whether it is rough or smooth and things like that okay actually if these are the separate sources then absorptivity is 0.9 high value for the separate source as a sun its absorptivity is 0.6 that temperature is high that that time absorptivity is less compared to 300 Kelvin source that is my question yeah yeah the question we have understood your question is tree temperature is 300 Kelvin that is why my absorptivity is 0.9 and sun's temperature is 5780 Kelvin my absorptivity is 0.6 so absorptivity decreases with the increase of temperature no that is what we are saying we have got your question the conclusion is wrong just because this is an example which just shows that the absorptivity of the building material is a function of the is a function of which source it is coming from I am not told that this temperature is less that is why it is less see sun is going to energy coming from the sun is going to have this spectrum the last one 5800 for that 5800 Kelvin spectrum which is there absorptivity of this roof material is 0.3 now tree is not going to emit at this spectrum no it is going to be at a different temperature its characteristic of emission is going to be different so it will have a spectrum which is different for that spectrum the absorptivity is 0.9 now if that incidentally the temperatures are like that there that is one is less than the other one so do not look at temperature in isolation look at the source it is a different source all together two different sources at same temperature absorptivity of from that let us say I have source 1 which is a 500 I mean 500 Kelvin another source 2 at 500 Kelvin absorptivity of that roof for source 1 will be different from absorptivity at source 2 it is not related to temperature alone by chance it may come out to be the same that is that is incidental it is not necessarily a function of temperature alone it is a nature of the emission or nature of irradiation coming out from that surface to the surface. So, we will take up I hope you have pointed both today when is it problem 46 it is a slightly involved problem a small work piece is placed in a large oven having isothermal walls at T F equal to 1000 Kelvin this is F we are calling because furnace furnace so subscript F is for that with an emissivity of 0.5 that is furnace wall is having emissivity of 0.5 the work piece experiences convection with moving air at 600 Kelvin T infinity is 600 Kelvin and convective heat transfer coefficient is 60 watts per meter square Kelvin the surface of the work piece has a spectrally selective coating where whose spectral emissivity varies as epsilon lambda equal to 0.2 for lambda 1 equal to 0 to 5 micrometers and from 5 micrometers to infinity we have 0.8 we have 0.8 these are the inputs what is the question as perform an energy balance on the work piece and determine the steady state temperature T S let us try to solve this problem it is little lengthy we prepared and it is a little bit involved you might have questions please wait till the end I have drawn a furnace or the oven here this rectangle it is at temperature T F having emissivity 0.5 this is that work piece it is much smaller than the enclosure. So, I have arbitrarily drawn it as a circle does not mean anything it could be any arbitrary shape I am taking a control volume around this one. So, I have to do energy balance some energy is coming in some energy is going out. So, what is the mode of energy which is coming in very carefully we have to write this. So, e dot in minus e dot out equal to 0 because there is no e dot g and e dot s t term. So, what is e dot in e dot in should be the irradiation irradiation means it should be coming from the furnace wall. So, e dot in equal to epsilon e dot in equal to epsilon F sigma T F to the power of 4 why I am telling this only this much means what is this epsilon F sigma T F to the power of 4 what is this epsilon F sigma T F to the power of 4 emissive power of what of the furnace emissive power of the furnace is that equal to what my body has taken that is the irradiation how much my body has taken is dependent on what yes absorptivity that is this has to be multiplied by the absorptivity of my body very important this is where this is where we will go wrong alpha not of furnace, but of source my source is emitting epsilon F sigma T F to the power of 4 that is alpha of the body not work piece my work piece can take only as much as my absorptivity allows it to take it cannot take more than that. So, this is e dot in now let us write e dot out e dot out can be of two modes one is convection another one is radiation H into T S minus T infinity plus epsilon S e B at T S that is sigma T S to the power of 4. So, this is equation 1. So, these two are equated. So, I will get alpha S epsilon F sigma T F to the power 4 minus sigma S sorry epsilon S sigma T S to the power 4 minus H T S minus T infinity equal to 0. So, this is my governing equation in this quantity is for the work piece this quantity is for the work piece this is for the work piece we have to find this quantity it occurs here as we see it is a non-linear equation first of all. Now, alpha S also is not given to us directly sigma S also is obviously not given to us directly. So, we have to get these two somehow to get temperature that is what we are going to do. So, first let us find out alpha S alpha S alpha equal to we know we have written already the relation alpha equal to in the numerator 0 to infinity alpha lambda g lambda d lambda upon integral g lambda d lambda 0 to infinity. But alpha lambda equal to epsilon lambda 0 to infinity. So, alpha equal to epsilon equal to 0 to infinity in the numerator 0 to infinity epsilon lambda g lambda can be visualized as e b lambda at this is you see it is irradiating from the furnace. So, furnace we can take it as a blackboard. So, e b lambda T F upon e b of T F. Yeah sorry I made a wrong statement we are not taking furnace as a black body I am multiplying that with epsilon lambda it cannot be black body otherwise if it is I am a black body then its emissivity will be equal to 1 it is not there. So, I am multiplying epsilon lambda into e b lambda T F. So, now I have to take fraction what is the fraction which it allows we will have to see the you will have to see what we have plotted just now professor has plotted. Just one second what will what will the confusion be in fact when I write this each time I get confused see this alpha and epsilon are for the work piece. This epsilon I mean this e b is the furnace emissive power that is obvious what we have assumed is that this distribution spectral emissivity distribution for the work piece is the same as spectral absorptivity absorptivity work piece. So, Kirchoff's law is valid this way epsilon lambda equal to alpha lambda epsilon is not equal to alpha epsilon lambda equal to alpha lambda for the work piece that is what that and bear in mind this thing is this is going to be dealt with at 1000 Kelvin because energy is coming in at 1000 Kelvin. So, this is this is the as professor said this is where most of us will get confused ok. So, now what is lambda 1 and lambda 2 lambda 1 T F is equal to 5 5 times lambda 2 lambda 3 T 5 into 1000. So, you get 5000 micrometer Kelvin and lambda 2 into T F is 5000 lambda T you get 0.6337 0.6337. So, for this I will get F 0 lambda 2 lambda 1 as 0.6337 that is enough actually that is enough. So, epsilon equal to therefore, epsilon of what epsilon of the work piece at what temperature based on T F T F equal to equal to alpha is equal to 0.2 into 0.6337. Where did this 0.2 come from? 0.2 has come from this distribution here this is 0.2 into 0 to 5 micrometer that is that fraction that fraction that is 0.2 into 0.6337 plus 0.8 into 1 minus 0.6. Because the emissivity is 0.8 for all other wave lengths greater than 5 micrometer up to infinity. So, this turns out to be there itself you write as of 0.419 0.419 see that is what professor has emphasized this alpha s is based on T F. Now, using this alpha where will I use this in my previous equation? This governing equation this one has we solved. So, I got alpha s 0.419, but I do not know epsilon s and the most common mistake that we which most of us would have made even we would have made probably is that we would have taken alpha s equal to epsilon s that is wrong. Why is it wrong? Because this alpha was computed based on furnace temperature which is 1000 Kelvin. This is married to T subscript s because that is based on the temperature of the work piece. So, I do not know T s nor do I know epsilon. Let us write the equation in terms of epsilon s and T s.  By the way this was our end same question final exam final exam end semester examination So, this is known 0.5 given to us very nicely this we have calculated 0.419 sigma we know this is 1000 Kelvin. So, left hand side we know. So, this quantity we know h is 60 this is also known T infinity is known sigma infinity 600. So, I have epsilon s and T s as unknown what do I do how do I solve this. So, I know by intuition by observation that T infinity is going to be 600 given T f is 1000 given. So, it has to be between these two. So, logically the first thing I can take is assume T s to be equal to 800 Kelvin. So, for 800 Kelvin I have my epsilon distribution given already this one 0.2, 0.8 this 5 micrometer this was already drawn earlier that one is there. So, knowing temperature T s I will find lambda T s assume get a value get a fraction associated with this one and then evaluate epsilon using epsilon 1 into f of 0 lambda 1 T s plus epsilon 2 into 1 minus f 0 to lambda 1 T s. So, this fraction I will get based on the assume temperature 800 Kelvin. So, for 800 Kelvin I will go to that table get this fraction I have the distribution I will get a new epsilon s calculated value of epsilon s substitute this epsilon s and T s on this equation right hand side left hand side is a number which I know right hand side I will substitute. Obviously, it is not going to match. So, then I will go to a next value if the right hand side is more that means energy out is coming out to be more. So, I should make a judgment based on that. So, I should take a lower value of or I will substitute this epsilon and get T s and take that T s to compute again new epsilon I will go on doing this until my convergence is reached left hand side equal to right hand side. So, after doing that we get an epsilon of 0.5. So, after substituting 2 3 times trial and error you get epsilon equal to 0.57 and T s equal to 680 Kelvin note please note what was the alpha s 419 at furnace temperature of 1000 Kelvin our epsilon s is different why because my furnace temperature is at 1000 but my surface is at 680 Kelvin. So, see although Kirchhoff's law is there always epsilon is not equal to alpha please remember that we always abuse Kirchhoff's law on this note. So, we have to say the temperatures have to be the same source is not going to be at the same temperature as my body if source is at the same temperature of the body the problem is gone there is no radiation. So, this is this is some even we are laughing but even probably by if you are student we would have made a mistake. We would have made a mistake when so that is what that is another thing there is there is no question which is trivial in this world as long as I understand that. So, I think we should as teachers we should make a conscious effort to not to use these words I would I at least make a conscious effort not to use these words trivial and obvious actually I have developed a habit to hate these words why because these words put off the audience actually they think that this is this is too trivial and I am asking something very trivial nothing is trivial until I understand. So, I think if we get into that comfort zone that is if the teacher and the student gets into that comfort zone that I can ask this teacher any nonsensical thing and I can get an meaningful answer that is the ambience I need to create in the class that is why in fact if you if you have watched me I have gone to every center and pastored you for question why because we need to inculcate our students also to ask questions not put the questions under the carpet and go home. So, this is this is what we need to understand we will take quickly one or two questions if they are there anywhere the question is what is the influence of distance between the thermal camera and my object on the measurement of temperature. Now see basic question how is my thermal camera working it is capturing the thermal radiation it has to transmit through with the air. So, how does that matter where do where do I keep my camera it is as long as my in fact in all of this air is non-participating that is not an assumption that is indeed true. So, because air is non-participating medium that is why my camera is able to capture if air were to be non what to be participating my camera will be seeing something less it cannot see complete heat flux the radiative heat flux which is incident on it. So, it is the answer is the thermal camera is independent of the distance between the source and the thermal camera, but if you take very far away distance what will happen your number of pixels are fixed you know I said typically 320 by 240 pixels. So, if you go far away your resolution of the object what you are seeing is going to get decreased that is all because you are going to see your full object in may be few pixels if you go closer your complete 320 by 240 pixels you would have used that is all. Will the absorptivity depend only on the source temperature? Will absorptivity depend only on the source temperature will it not depend on the receivers temperature. Oh yeah will the absorptivity dependent only on the source temperature, but not the source sink temperature that is the receivers temperature. Yes, it is not dependent on the receiver's temperature, it is dependent only on the source temperature. But energy transfer, heat transfer interaction, net heat flow rate will will change depending on the source temperature. That is that is the energy value. But alpha will not change. Yes. What about receiver's properties? Receiver's properties. That is what we are saying. No, it is not dependent on the receiver's properties. It is dependent on the source only. See this is the general perception. This is what we have been telling again and again. Absorptivity is not dependent on the receiver's properties or temperature or its surface roughness. The absorptivity of any material is dependent only on the incident that is the source temperature. Sir, another question is on, while defining solid angle, we took the sphere. But while defining emissivity or radiocity or irradiation, we took only hemisphere only. What could be the reason? What you were there yesterday morning? Because we went through this, I will repeat for the sake of being repetitive. See in our normally radiation is going in all, will go in all directions. So, you will get a sphere. But in heat transfer applications that we are dealing with, we are dealing with interaction from one surface to another. So, if this energy is coming on from a from a source like a tube light, you are looking at what is coming down to us. So, we are looking at only the bottom part or the top part if things are going from here to upper part of the room. So, if I have a source of light in this room, I am looking primarily from the it is as if I am covering the bottom part by a cardboard and just looking at the top part so that I get a hemisphere. If there is let us say, if both the sides of the plate are emitting something, let us say. So, I will have two hemispheres, this hemisphere and again this hemisphere. See even in natural convection, we said that one side is insulated, we are taking only the other side. But we have solved problems where a plate is suspended and we have coolly multiplied everything by a factor of 2, exactly this. Once we know one half, the other half can always be built upon. What are the different methods to measure the heat transfer coefficients? Of course, you told using the lumped capacity. Apart from that, is there any other methods to find the heat transfer coefficient practically? Actually it is a very big, the question asked is what are the methods to measure the heat transfer coefficient? There are plenty of methods to measure the heat transfer coefficient. One of the methods is what we told yesterday that is the lumped capacitance. So, but it is in case of internal pipe, let us say if you want to measure the internal pipe, what should I do? I should take a pipe and wind a wire, wind wire that is wire should be as close as possible, there should not be any gap. So, why I am winding the wire, this is the nichrome wire which is having a thin insulation around it, so that I can maintain constant heat flux boundary condition. That is I will supply voltage into current upon pi into d into l, that is d is the diameter of the pipe and l is the length of the pipe. So, I get the heat flux. Now, if I measure, if I put thermocouples on the plate sorry on the pipe at various locations, so I get wall temperature, but how do I get the bulk temperature? For the bulk temperature, we said that bulk temperature is going to for constant heat flux boundary condition, temperature versus x, professor has taught us that the surface temperature and the bulk temperature are going to be parallel to each other. I can measure only the bulk temperature at the inlet and bulk temperature at the exit. So, in between the two I will assume linear. So, wherever I have measured the wall temperature, I will use this linear relationship and get the bulk temperature. So, that is how I have the bulk temperature at every location and wall temperature I have measured at every location possibly where I can put the thermocouple. Now, q double dash equal to h into T wall minus T bulk. So, h equal to q double dash upon pi. So, on T wall minus T bulk, this is assuming fully developed flow. If it is not fully developed flow, bulk fluid temperature is difficult to, now bulk fluid temperature will still be linear. Only the delta T will be linear. Yeah, even in developing flow I can measure this, there is no problem, because even if it is developing flow, it will be like this, this would not be there, but the bulk fluid temperature is going to vary linearly that cannot change. So, this is how one can measure the heat transfer coefficient. If I want to get the local, what should I do? I should not use this pipe as a copper pipe. I should use SS pipe and that too thin pipe I should do. I should use, why? Because there is no lateral conduction within my pipe. It is only going to what is that is outer wall temperature. I am measuring two things that is I am measuring outer wall temperature, but actually I need inner wall temperature. If I have thin the conduction within this is going to be minimal and I am going to get the same temperature, same temperature. So, the conductivity has to be as low as possible so that my lateral conduction is avoided and thickness has to be so small, because the inner surface temperature should be equal to the outer surface temperature. That is the differentiation. I have told you only one method. Actually there are several methods. So, please put this question on the model. I will put it across. I will answer, but I think I will tell you one more method just for the heck of it. Let us take, because I will tell with reference to thermal camera. So, now let us say I have a flat plate. As I said in the morning, I have taken a flat plate. Let me take a natural convection situation why every time force it. I have told for external flows. So, now I am going to tell for natural convection. Let me take a thin metal foil. As I said in the morning I have explained why thin 0.05 mm thickness which is the paper thickness if I take that and give direct DC power supply. In the morning I have explained you why DC power supply. If I give DC power supply, because if it is a thin metal foil resistance equal to rho L by A cross sectional area is less. So, resistance is we want to increase, but still if I take a nichrome foil or a stainless steel foil resistance will be very less. So, current will be very high. Voltage will be very less. It is a safe way of doing experiment. If you and I touch that foil nothing will happen. So, if I give the DC power supply for this. Now, what will happen? It will measure the I am giving constant heat flux boundary condition. Now, I will get the wall temperature everywhere using the thermal camera provided I have painted this with lamp black let us say because emissivity is known. So, in from the thermal camera I get temperature temperature at every pixel at every pixel you are going to get heat flux equal to h into T wall minus T infinity ambient I know wall temperature at every pixel I have measured and q double dash is nothing, but voltage into current divided by the area of my plate that will give my heat transfer coefficient. In all of this in all of these methods what is very important is to characterize the losses like in ice experiment there was radiation losses here also I have to deduct the radiative. There is radiative heat transfer also while there is natural convection from this plate I have to deduct that from my voltage into current that is sigma into epsilon into T s to the power of 4 minus T infinity to the power of 4 at every pixel I have to deduct. If I do that I will be getting the natural heat transfer coefficient these are not that it is a comprehensive we have covered everything there are tens of methods of measurement laser interferometry is there. There are lots of methods there are lots of methods, but everyone uses constant heat flux with a heater wire and a thermocouple because it is very easy to do in the lamp and you do not need much money to do that. I have one question, why lamp black when this is going to be more? No, why lamp black the question asked is why lamp black the answer is if I have lamp black the emissivity of that lamp black is known which is the input which I have to give to thermal camera then only I will get the temperature. So, I think yeah there are some questions Sir, we have some confusion regarding the value of alpha for the black body is it depend on temperature for the black body also? Yeah, it depends on the temperature for the black body also, but for the source temperature for black body see, am I what the what is the question I am asking let us go to the spectral what is that in this it is that So, let us see this what is this this is the emissive power emissive power of a black body what is the absorptivity of a black body once you say it is a black body what is the emissive what is the absorptivity of black body it is 1 and that is all it is. Now, if we say is it dependant on temperature no it is not dependant on temperature because it is a black body once it is a black body absorptivity is 1, but emissive power is continuing be going to a function of temperature that is what we have plotted as Planck's distribution. Is that ok? May be you may be. I do not know may be this is not your question. May be this is not your question. You have you are having some other question but you are not phrasing it properly. Yeah. Is that your question? Ok. Second question is regarding to the thermal penetration depth for radiation. Like how it is depending on the radiation that. Ok. Thermal penetration the question asked is what is the thermal penetration depth. So, what we have been saying is that this is for participating medium. What we are saying is that absorptivity equal to 1 minus of e to the power of minus k beta l actually that is that is the thing or usually this k beta is given as minus tau s l that is what they say. This is what is called as tau l together is called as optical thickness. So, if my tau s l is very less what will happen if tau s l is very less is let us take it as 0. If it is 0 this becomes 1. 1. e to the power of 0 is 1. e to the power of minus 0. 1. No no 1 upon e to the power of 0. 0 is 1. 1 by 1. 1 by 1. So, that is right that is right 1 minus 1 is 0 absorptivity is 0 absorptivity is 0 means what transmissivity is 1 that means this is non participating that means it is not affecting my non participating medium, but now on the other hand let me take tau s l very large how large I do not have to take very large. If I take that as 5 as I said in the morning optically thick e to the power of minus 5 you will get 0.99 you will get 0.99 something you will get tau alpha equal to 0.99. What does this mean what is transmissivity? Transmissivity is almost 0.01 that means it is highly participating it is highly participating medium. So, how much it is participating it depends on the thickness or the length or the distance between the one plate to the another plate is that ok. So, for each measurement for each participating medium these tau s have to be measured in fact these tau s are measured in terms of transmissivities and they are done through FTIR spectrometer Fourier transform infrared spectrometer. If you still want to know more about FTIR spectrometer put this on the model where you will answer it and each FTIR spectrometer will cost around 1.5 crores. Sir my question is what is the absorptivity of ice? Ok what is the emissivity we what is the absorptivity of the ice is the question what is the emissivity of the ice I took yesterday for my natural convection experiment you have to answer me emissivity of ice we took it as 1. So, we said that ice acts as a black body. So, emissivity is 1 means absorptivity is also equal to 1 come on here I am saying ice is black body once I say absorptivity why it is black body where is the question of temperature coming in the picture come on here I am saying black body again you are asking me the same question. So, ice is a black body. So, there is no question of functionality of temperature moment you are characterizing something like a black body then you have to forget temperature that is it that is it absorptivity and emissivity of a black body are not functions of temperature that is all. I understand what you are saying suppose emissivity of a body is 0.5 till some wavelength and then 1 after that it is not then ok. And here in chat we see lot of questions balance experiments for paucity of time we could not take those questions because tutorial also we have to solve two three problems. Tomorrow we will try to fill in these experiments sometime we will keep that in the back of our mind may be immediately after heat exchangers we will do that for today we are closing the session and we will meet you tomorrow morning at 9 o clock bye bye.


Everybody you have horse Jake and Jeff here. We got 23 flawless collegiate football hobby 2 bucks case number 8 random teams All teams that on this one y'all good luck. Look everybody Five and three eight times I'm already here F3 to screen share And I always double check before I start randomized. I got the right amount Also, you want to look here and that's about entries. You want that to match up obviously what 32 names and 32 Or how they would everything 30 30. Yeah, just got a matchup One two three four five six seven and eight Read D down to Alan C and eight times on the teams one two three four five six seven and eight Ravens down to Panthers. We have to get like little clips of like Sam pulling ice cream out of the microwave or something like that You will do it You know, here's an idea Hagan does pints or buy one get one at Publix right now Read D with the Ravens Thomas O. Lyons Daniel our Broncos Eric P. Bill's DLC Vikings Braden K. Raiders Jason L. Cowboys Michael S. Eagles Matt and Patriots Wayne P. Steelers Daniel S. Rams Tom B. Texans Daniel S. Dolphins DLC Seahawks George M. Bears Light M jets Braden K. Titans Braden a with the Commanders Victor are Packers Jason M. Chargers George M. Cardinals Brandon M. Bucks Nicholas C. Jags JD Bengals Nicholas F. Giants Jason L. Falcons Daniel our Browns George M. Chief Simon M. Colts Victor our Saints Daniel S. Niners Alan C. Panthers Grabbed it all since I set that up save Then right here the view on your online store just opens it grab the link Okay, guys, we got to get one-on-one going Gotta get one-on-one filling up here. Is that 11 to go one in one I didn't copy the whole thing nice Oh, you for sure made it this week Robert Usually it's the end of daytime because Kyle and uh, yeah Kyle and She is work daytime. Okay quick reminder Collegiate uniforms. There's not gonna be any NFL logos on this. So The players active the card will go to their current team if the player is a free agent or retired It'll go to the longest tenured team by seasons the tiebreaker for seasons is games played And then if there's someone that's still in college is random to everybody. So if you hit like a Caleb Williams You were his archmanning Arson this he is right Remember he's in and By the way, if we hit one of if we hit one of those players that's still in college and it's everybody Sunday funny from all dude tomorrow in the evening stream starts 545 Eastern Shipple Ohio State Patch CJ Stroud Justin Fields Jackson Smith and Jake but a 25 That is awesome. Yep Texans bears Seahawks You'd have to have two of the three otherwise a random at the end here Seahawks is Dale Texans is Tom and Mostly for bears Georgia with bears. All right, random at the end on that one those three teams Panthers rookie dual jersey card to 20 is Bryce young next up for the Seahawks rookie logo auto to 25 Zack Sharpen a There's the fugitive K. Sean butate a 25 RPA for the Patriots Beauty you bet on himself though. Come on. That's a nice one starts watching it Sure Travis at the end jr. 11 of 20 Jaguars Jags at the end Patriots horizontal RPA to 10 Christian Gonzalez. That's nice three colors Ducks three colored ducks right there. All right, Jameer Gibbs Nine of ten horizontal RPA lions Thomas oh with the lions We'll get that mag for you Thomas. That's cool. Congrats Thomas Here sapphire number two of 20 Aiden Hutchinson for the Lions Jerry Rice sapphire 16 of 20 for the 49ers Guarantee there RPA Colts Anthony Richardson two of 20 Yeah Colts Right in front of the Colts fans. Let's go, baby I'm Simon Congrats Simon three color gator patch there Do you that's cool? In Florida too Great card, yeah, let's be a seminal. You're like everybody Alrighty Dalton decayed number to 20 dual patch go into the door into the bills Next up is two of ten on the patch will McDonald the fourth for the Jets Jets will McDonald on the PlayStation fiesta bowl patch. Nice. I thought there was a playstation Shambute at a 15 rookie auto for the Patriots Yeah, Sam manipulated the polls heavily He he conveniently got to choose when they ended 12 out of 20 patch auto Damian Pierce Texans on the star swatch SIG Yes, I started doing nursery rhymes. We said we'll make Donald out of Okay, Jake say Jake. We'll just do it. Yeah. Yeah. Max Duggan Jersey auto two of 25 for the For the Chargers They go Irish Jersey auto Michael Mayer number to ten let's go irons raiders nice hit heck. Yeah, dude.  Do you shout out to who hit that card? Raiders Raiden I said, dude Very nice mayor there and check this out. We've got Doug Flutey Eight of ten. That's an older flawless card and it's game used. That's cool Yeah, that's so sick. This goes to the Chargers Doug Flutey eight of ten game use Jersey auto Congrats, dude goes Chargers. Thank you played four seasons in a couple places more games with the charge in the other team though I'm curious. Who was it? Yeah, San Diego by games played Four years in England four years San Diego four more games play with San Diego. However diamond guarantee here Herbie 10 of 20 jersey number Sapphire gem for the Chargers Chargers Herbie Bijan Robinson ruby gem rookie auto 12 of 20 fretlanta Sick Bijan nice in the last hit Yeah, this one is super cool Troy Palamalu five of 25 dual patch auto Game worn Game worn Palamalu go to the Steelers That is so sick the the Flutey the Palamalu in the same box with the Bijan very nice really good case Yeah, that's sick. You do have one random to do Texans Bear Seahawks triple relic to 25 Stroud fields Smith and Jigba five times Whoever's up top gets it one two three four and five Texans Texans get the card Y'all that does it for the break moving on to the 30 box mixer


currently you know I'm working on making a Star Wars fan film and I'm using Blender and I'm using Unreal Engine and I'm noticing a huge difference between what I'm getting out of each one. The Unreal Engine stuff looks great obviously I'm using some metahumans for that and you know some of the other assets look really really nice I don't know how to use it very well so I stumbled through it and I tried to just get enough into the camera so that it kind of comes off as a you know the scene that I'm trying to to do with the film. Blender I know a little bit better I've been using it for you know a year or so and I kind of know my way around that I can do some of the atmospheric things that I like to do and and I kind of you know have a basic skill set but I'm trying to use EV for this project and I don't know that it it I don't know it just doesn't really look all that great cycles looks okay but it takes forever to render so I'm really torn you know I really kind of wanted to use metahumans for the up close facial stuff and Blender for the rest of it but I'm really kind of thinking maybe I should just you know push Blender to the side for a little while and just really focus on Unreal Engine maybe and you know do this entire project in Unreal Engine so that I can you know fully learn it. I'm interested to see if anybody has any you know comments about this leave them below if you have any experience with using the two of these obviously you know Unreal Engine is more of a game engine and it's better for you know certain cinematic things things are going to look more like a video game or you know and you're kind of set up to build a game out of it if you wanted to and since I'm a programmer already you know it's not a huge jump a huge jump for me to get into that world of the C++ or the blueprints or whatever you know I've never really used the Python programming side on the Blender and I'm really sure how that would benefit me as far as the things I like to do with it which is basically filmmaking type stuff you know world-building type things that I don't really do a lot of motion graphics although I'm beginning to think that Blender is a better tool for me for motion graphics type stuff as opposed to filmmaking and I should just you know use Unreal Engine for most of my filmmaking stuff so anyway I'm just interested to see what other people think about this you know I'm not really pleased with some of the results I'm getting out of this stuff it looks you know kind of janky to me and I really want this you know second effort at this to be a little bit better you know so we'll see where that goes but please let me know if you have any comments one way at the other if you're strong for Blender if you're strong for Unreal or using both together for filmmaking you know anything like that I would love to hear from the community so let me know thanks for watching


Hi, I'm Jun Lanfeng from Beijing from China Mobile, first happy new year, I'm so pleased to start 2021 with the launch of Anakate, it's a merge from OpenFB and CNTT which are two great projects on the LFN for so many years, so for sure today is a milestone, so congratulations to the team, to the LFN team, to the leaders and developers who have worked so hard to bring the projects, the two projects together to become Anakate, thank you all for your work and congratulations and not only I think we have a such a great name for the project, we also set a very clear mission for Anakate, the mission is to deliver standardized reference framework specifications and common architecture for CNLF, cloud-based network functions and virtual network functions and I believe this mission will give the developers and to give the community a better sense of concentration, so as always LFN focuses on deployment, it's the same for Anakate, so let's work together on the mission to deliver solid work to truly help the industry to move fast, to accelerate the digital transformation, so now we are in a new era of 5G, a new era of data, a new era of intelligence, speed matters, the whole industry has done so much work, but some of our work are fragmented, we all have different probably unique ideas for our own solution, our own product services, so but I believe they're a layer which is common across the industry, let's make that layer solid and put the work under Anakate, I believe if we can deliver what the mission requires us to deliver, we'll sure will help the industry, help the members of LFN to move faster, so I'll be with you, let's work together


Hit your heart, Institute of Photography.