 So we are discussing this ph diagrams discussing u as h told you come along an isotherm at a particular pressure you have this equation mu a is equal to mu beta this is phase equilibrium but we have also seen this is the same as g a is equal to g beta for pure substances the chemical potential is simply the free energy Gibbs free energy per mole so this can be written as we have said that phase equilibrium t a is equal to t beta is equal to p p a is equal to p beta is equal to p pressures are the same because you have mechanical equilibrium and thermal equilibrium and so this gives you chemical equilibrium. So thermo one dynamic equilibrium has three components thermal mechanical and chemical equilibrium so you have s a dt so you have your clashes clip around equation that tells you that dp by dt is equal to ?s by ?b in this implies that ?h is equal to t ?s so this is your clashes clip around equation you are quite familiar with but the idea is that the pressure becomes related to the temperature by this equation at some if you take a substance in lower the pressure at some temperature below the critical temperature this is t is equal to tc so below tc you take any isotherm if you keep lowering the pressure and move along the isotherm you reach a pressure at which two phases form then here if you decrease the pressure further you have the gas phase here vapor phase so we have in this region of course we have all the isentropic lines this is s is equal to constant this is v is equal to constant and so on you can read any of the values it takes two coordinates to fix the position of a state for example here any h and p will fix the position then you can do it in terms of any two variables if you fix the temperature and the pressure this point is fixed if you fix the temperature and enthalpy this point is again fixed so any two variables will specify the state of the system inside this region this is say liquid plus vapor typically I given you the chart for methane plotted from experimental data here also you need two variables because you have one variable temperature which will determine the pressure and therefore all the values at saturation similarly at the vapor end but in between how much of vapor and how much of liquid is present is specified by an extensive variable in the variable here it is usually denoted by x is equal to fraction of vapor so two variables are required to specify the state of the system any two will do now if you want to calculate work for example you want to know what is the maximum work typically for example you compress a fluid you compress it as I said adiabatically simply because compression is usually done by it can be done by a rotary device or a reciprocating device and the compression time is very small it is so small that the amount of heat transferred to the fluid is negligible if you take a rotary device for example typically it rotates at 1000 rpm or 1200 rpm for convenience that means per second you have 20 rotations so in 20 times a second it gets compressed so 120th of a second how much heat can be transferred to the fluid so effectively it is adiabatic if it is adiabatic you know that the entire work done is simply the enthalpy change so if you take an s is equal to constant line adiabatic reversible case then if you are compressing from some pressure to some other pressure from this point let us say do not need to be on the saturation line does not matter I seem to have drawn it here so this point is a I take vapor at this pressure and compress it from a to b the amount of minimum work that I have to do is the enthalpy along the isentropic line so this will represent for example the minimum work per unit mass of per mole depending on what the plot is so essentially calculating minimum work simply means on this chart identifying position a and position b the initial state and the final state if it is isothermal you will go along an isotherm and calculate ?g if it is adiabatic if it is a closed system then you will calculate ?u and if it is finally a closed isothermal system you will calculate ?a let me do an example yeah this is adiabatic case device that people carry on the back for underwater operations has a huge tank as it has a small tank and a huge tank two tanks then you have a valve here you have a expansion device this is put into this okay I have tank one and tank two this contains at t is equal to zero this contains initially compressed air at say p0 bar you know what the units on this chart are the old units are all they have made it SI units pass mega Pascal's does not matter some pressure this is initially evacuated what you do is at t is equal to 0 you allow you open a valve allow this air to expand here into this you could let it out in the open if the pressure is sufficiently low but for example for deep sea activity if you are 10 meters below sea level you are talking 10 bar already the pressure there so if this is filled to 10 bar the gas would not leave at all if you open the valve so you have to have another container secondly there are environmental considerations whether the gas that you put in if it is air it is okay if you are taking some other gas for operations you do not want to let it out into the sea so what you do is pass it through an expansion engine this engine will rotate this will give you work shaft work so as the gas expands from one tank to the other it turns a shaft which will do work for you you may do minor repairs you may simply be you may take the hull of a ship and break up the crust that are found at some places and so on whatever whatever the repair job that you are doing you need an engine to help you produce work and this is a typical device this is carried on the back so you can calculate how much you can first of all the weight of the device that a person can carry the size of the device and all that so there are some limitations in terms of how much a person can carry on his back and but the question of thermodynamic interest is if it works under sea water for example this is at temperature T which is fixed both are at temperature T it is isothermal operation effectively because the temperature of the water outside will determine the temperature of the whole process so under isothermal operation what is the total work that is done so there are two ways of calculating it and this is the trouble about thermodynamics one way turns out to be trivial the other way turns out to be somewhat complex but the answers are the same they have to be the same in any case so for example if I want to calculate the work I can calculate I can take the engine alone I can do it as an open system where I define contents of the engine that is my system so I have gas coming in gas going out and I can ask what is the work done we derived an expression for the work done if you remember this expression had ?ws was less than or equal to because in isothermal operation it was g out minus of g out tm out minus g in dm in thing minus you had this du NTds of which at steady state we said du NTds are 0 but apart from steady state if you have a system like this where the total amount of gas flowing through the system over a finite period of time of interest I mean do not make that time too short the total mass flowing through is much larger than the hold up in the system then this du represents change in internal energy of the contents of this device and this contents is not at steady state because this pressure is falling this pressure is rising so the pressure will change so the contents will change but the mass inside is negligibly small therefore the internal energy is negligibly small the change in internal energy is even smaller therefore we throw these two terms out in this case not because of steady state but under conditions of negligible hold up if you try to analyze the system for a microsecond or something you will get wrong answers because then this assumption is not valid but you are normally worried about finite periods of time during which the amount of gas passing through the system is much larger than the negligible I mean negligible compared to the mass passing through the system during the period of interest so if I have gas passing through this and under negligible hold ups then dm out is equal to dm in because the mass inside is negligible so you simply get delta ws by dm is equal to delta g if you are trying to calculate the maximum amount of work you are talking about p1 is equal to p0 initially p2 equal to 0 or near 0 p1 final this is initial final should be equal to p2 final till the pressures are different there will be work that you can extract in this case I am talking about isothermal operation which is why I got this result delta g so if I want to calculate ws simply integral of delta ws over the entire thing is equal to integral of minus delta g times dm from the initial conditions to the final condition on this diagram what is plotted are constant specific volume lines so instead of the M there mass is simply equal to volume by the specific volume in the volume of the you in this case for example the you can take the mass here you can integrate over this condition here and the mass here will be simply the total volume of cylinder 2 divided by the specific volume in cylinder 2 okay this is actually the hard way I will do this calculation little I will do this in a minute but the easier way is to take a closed system fact as a thumb rule as far as possible define a closed system which will still give you the answers that you need in this case it is tank 1 plus contents of engine plus tank 2 I take all of them together or contents of tank 1 plus engine plus tank 2 contents is outside this is a closed system no mass change in the system if it is a closed system you know that delta w is less than or equal to minus delta a under isothermal conditions so all I need to know is a final w is simply equal to a final minus a initial with a minus sign and this is also easy to write down because this is mf remember in the final state the pressure is the same in both so I can take the total mass mf into a f it is a homogeneous it will be a minus sign here because I take the minus inside plus m initial in tank 1 times a initial in tank 1 plus m initial in tank 2 a initial in tank when I derive a result for closed systems the system does not have to be homogeneous it can consist of several homogeneous parts you have to add all the thermodynamic properties so ai is actually a in this tank plus a in this tank the engine mass negligible I mean the mass the contents of the engine are negligible in this particular case I have taken initial mass as 0 here so I can strike this out negligible mass initially I vacuate this cylinder so I have simply m f a f plus in this case these two are equal m is simply mf is equal to mi in 1 tank 1 is equal to v of tank 1 by v initial in tank 1 so I must give you the size of the two cylinders capital V is the total volume of tank 1 v 1 capital V 2 will be the volume of tank 2 the calculate vi I know the temperature and I know the pressure initially p0 so we will take some numbers here for example if you take let us take some numbers from here for example I will take example I am taking methane only because I have a chart on methane nobody will be foolish enough to run this with methane I mean the best way to do run such an engine is with air so if air leaks you do not have to worry about destroying the ecology in the fish and all that stuff but I just for example let me take some reasonable temperatures so let me take 10 mpa let me say I filled up to 10 mpa I can take a temperature I do not think I have a choice here this is seawater so we will take something like 20 degrees C 20 degrees C would be about 273 let me take 300 degrees k for convenience that line is here so you can read the 300 degree k line here so 300 degrees k and 10 what I need is simply a at these conditions this is the initial condition so what is a equal to a is h you need to get several variables because it is h-pv-ts right I have h p v t and s all these are available on the chart so t is known you have to read s on the table in the so you just take the intersection of 300 degree k line which is an isotherm you can see that line there it comes down and meets the 10 mpa line at something like 550 enthalpy roughly my eyes are far worse than yours so you can read some numbers out will you tell me the numbers this is about 550 for example in whatever units this is kilo joules per kilogram the pressure of course is 10 can you tell me what v is at that point you just identify the intersection point and then read everything from the graph this is great fun somebody else draws graph for you and you just read numbers from it so the whole calculation is trivial what is your v the v lines I pointed out to you that v is the slope of the v lines you remember we got the slope of the v and s lines actually these are marked here so the s lines of a steeper slope the flatter lines on the right hand side are the v lines the line that passes through this about 10 these lines are lines of his mark density is it okay the change this is not specific volume actually density is given and this chart has changed since the last edition so this is actually 1 by that so this is about 1 by 10 meter cube per kg I am reading numbers approximately you read them more carefully normally the PV product is negligible compared to H so H minus PV H and you can be equated for most purposes and then you have TS S you can read here what is the value of s that you get here 17 is it this one 71770 sorry oh it is much higher yeah right okay then what about the entropy is it 9 15 20 it is higher I say 30 50 and 70 it is almost 70 no it is not sorry I take it back I am allowed to make mistakes you are not one of my problems is that it is about 10 yeah you are right about 10 9 okay and this is of course 300 so that is your initial value and you have to know the volume as well I mean the mass the mass is simply the total volume what do you think you can carry on your back what kind of volumes can you carry 1 meter cube will be too big let us say point this the larger one will be about point 1 meter cube this is about point 0 1 meter cube just giving you some numbers this will be strapped on your back so the m will be point 0 1 which is meter cube divided by or multiplied by the density in this case he is giving you a density actually those are constant volume lines is the same as constant density lines they have marked the density on it so 01 into the density is we just saw 1 by 70 no 70 kg per meter cube so you will multiply m into a this is a initial this is m initial so you have got this figure to get the final state you have to realize that the total volume is given it is an isothermal operation so the mass is the same so to get the mf is the same is also equal to mf is equal to mf so the final density rho f or 1 by vf final density is simply mf which is this divided by v1 plus v2 so it is point 11 its 11th of the initial density so you had already 70 by 11 so you have to find the 70 by 11 curve here and that is that is one fixed point then you are moving along the isotherm so along the 300 degree line you locate the second coordinate is simply the volume so 70 by 11 is what about 6 so you see the volume line at 6 somewhere about 6.6 it intersects the 300 degree line some enthalpy which is about 650 so you have to locate that point the enthalpy at that point again you are calculating af is equal to hf-p f vf-tsf this hf is about you can read it more carefully 650 and the reason these numbers decrease as you go to the as you move left for example as you move from vapor to liquid is because the zero point of energy is considered when two molecules are infinitely apart so as they move closer attractive forces between the molecules work is done the if you push the one molecule towards the other work is actually done by the system itself on you on the second molecule the first molecule is attracted by the second molecule is attracted by the first molecule so the energy will actually decrease so it will always go less your you take the ideal gas infinitely separated molecule as the zero of the energy so this is hf this you can read pf we have already seen what this is this is 11 by 70 you can read pf on that intersection again you know what it comes to get something like one pf is approximately one then T is known T is again 300 and finally SF SF is about 10.5 or something yeah 10.5 you go to lower pressures this higher entropy because it is greater movement of the molecules more freedom for the molecules so you calculate this af then multiply by mf which is the same you get a number which will tell you the maximum work you can get out of the system what you want is actually shaft work what you get there is w right how would you find the shaft work this will give you shaft work directly the open system analysis will give you shaft work directly but on the other hand that is so much easier to do the calculations for to get shaft work all you do is go back to the definition ws is w total work done shaft work is minus total work minus the flow work flow work done by the system is here in the outside minus I will simply say flow work I will have to do the flow work calculation because flow work calculation depends on the outlet conditions in the outlet conditions keep changing so I have to integrate from initial state to the final state normally if it was an ideal gas for example PV would be RT regardless of the state here the pressure and the volume change but PV is RT so in an isothermal operation the work here will be the same as the work in so for an ideal gas there will be no difference at all flow work will be negative will be 0 ws will be equal to w in many cases flow work is negligible so ws will be approximately w but we can calculate that exactly I will do this other calculation then it will become clear as to what we are talking about is that calculation clear while it looks a bit messy when you first see it you can see that once you have a chart you are empowered so essentially you have the chart then you can do any calculation if people somebody has done the chart for you then all you do is locate these things in a mysterious way if you are impressing a layman you can always do this you know move your fingers and locate a point in say point A point B and then calculate the differences and so on but the calculation itself is trivial and you can get out of thermodynamics only the maximum work that you can get from the system in actual practice will get less because of various fractional losses and irreversibility but then you can design your system better and better and you can say if it gets to within 99% of the thermodynamic result you say stop improving the system it does not help you now let me do the second calculation although it is quite illustrative and finally you will be able to match the two what I want to do is to calculate ?g into dm this is the integral I want to calculate this mass could be any of them because the mass leaving one is the same as the mass entering two so I can start with either one let me start with this m dm is equal to dm in tank two because in tank two mass is increasing you are looking at the flow through the system it is also equal to minus of dm one could use either one ?g is the difference in free energy between tank one and tank two so this is integral dg is equal to integral minus s tt plus V dp now this is just the thermodynamic property per mole therefore it is like the close system equations this is zero because it is isothermal operation so all I have to do is to calculate integral V dp this is from inlet to outlet so this is from p outlet is p two inlet is p one ?g is g out minus g in g out is the same as g in tank two g in is the same as g in tank one at this stage you have to do a numerical calculation because in the chart you will have to start with p one to p two at any given mass so when the mass is equal to m two which will go from zero all the way to the final total mass that was initially in the system at every mass you have to calculate that is you assume m two from zero make small increments at every point you have to know V from p one to p two that is you go along the isothermal line from p one to p two let me do this calculation for an ideal gas so that it is explicitly clear so at this stage I am going to assume ideal gas actually you can do this for an ideal gas you can do this analytically because this is simply RT ln p two by p one I am going to integrate this over m two so I have to relate the pressures to the mass this is the same as RT ln p two is row RT because it is ideal gas this is equal to RT ln the density is simply mass in tank two by volume of tank two this is volume of tank one by mass in tank one mass in tank one as m minus m two I am not doing it for methane I am doing it for the ideal gas right now for methane you have to do the same thing but you have to do it numerically by going along the isothermal or I can give you an equation of state give you something like van der Waals equation of state describe methane then you will do the integration using V from the van der Waals equation now I have to do this integral over dm dm is dm two so I will simply get ?g since I want to get ws is equal to minus integral of ?g dm two I get RT ln v one by v two which is a constant times m two not m two the total integral is m two equal to zero to total mass in the m final integral of this form m two equal to zero to m fine this is logarithm of v one by v two plus logarithm of the second term so I have split it into two parts log of v one by v two this is a geometric factor this is a constant therefore I just integrate it over the entire mass so I get the total mass flowing through the system which is equal to the total mass in tank two at the end of the process is simply mf minus RT ln this you know how to integrate just log x dx in log of a minus x dx in the same case for an ideal gas for ?a this would have been simply equal to again I have to integrate the same thing da I have got a final minus a initial that is all the same calculation I have to do which gives me mf I can pull out mf times integral da from initial condition p0 to pf and at constant temperature da is da is actually minus stt minus pdv so this is simply minus or plus integral mf times pdv from p is equal to pf to p is equal to p0 every switch the two for the minus sign switch the limits so this again is RT by v so you get mf or ?a is equal to mf into RT ln v initial at RT ln v by v final is equal to mf into RT ln because the mass is the same I can multiply by the mass any v initial into m initial would give me simply v1 and v final into m final will give me v1 plus v2 I want you to compare this which gives you actually w in this which gives you ws complete this integration and you find that the two expressions are identical because flow work in an isothermal ideal gas system is net flow work is 0 flow in is equal to flow out if you want to do a proper a professional analysis for industry or something they have to get the database many of them have access to database in these cases as far as this course is concerned you can use trapezoidal rule for all integrations if you are doing vdp numerical integration you simply is take v2 plus v1 by 2 no under the condition in those conditions and just integrate using a trapezoidal rule that will do then for accuracy you can go to any level of accuracy later you can stop there.