Tuesday, March 21, 2017

Limit of Continuum

Let us consider a class room as shown in the following image1.

The class room has a seating capacity of 48 students with 24 each in two columns. I wish to find average height of students in the class. Where do I start?

Let us take height of one random student sitting in the front row. If I say that the height of that random student is the average height of class, that would be an exaggeration, wouldn't it?

Well, then. Let me add heights of two random students sitting in front row and take their average. Would that be the same as class average? Better than one student for sure, but still it falls short to be called as class average, right?

But I do not want to consider height of 48 students and then take the average. So I am going to continue with adding one student at a time and find the average and see where it leads to.

Let  us find average of 3 students, 4, 5, ... and find sample averages. If we continue doing this, we will get a plot similar to what is shown in the following picture:

We can see that as the sample size increases, the sample averaged height of students move closer towards the actual average. If we take a closer look, we will find that there exist a sample size 'n' below which the sample average is not the indicator of actual average. The error is too large. In other words, the number of data points we consider below 'n' is statistically insignificant and hence we cannot come to a "statistical" conclusion.

However, if we consider a sample size of 'n' or above, the sample average tends to move closer to the total average. Now, it is possible for us to say that the data points we have considered to compute the average height is statistically significant.

There is an alternate way to look at this. If the number of data points from a sample is countable, it does not represent total average. The sample size should be uncountable to be a representative of total average.

Why is this concept so important?

In thermodynamics, we want to measure system properties such as pressure, temperature etc. Let us consider temperature. Temperature is a measure of average momentum exchanged between system molecules and molecules that are present in a thermometer bulb, under equilibrium condition. Thus, temperature is not defined if the number of molecules exchanging momentum is statistically insignificant. This can happen if we are trying to find temperature at a point in space whose dimensions are comparable with nano or molecular scales. One can only measure temperature at a point if number of molecules exchanging momentum is statistically significant or uncountable. This statistically significant level is called as limit of continuum.

Parameters that are measured at or above continuum level are called as continuum parameters or macroscopic parameters. Thermodynamic properties such as temperature, pressure, density etc are macroscopic parameters.

Take home message: A function is said to be continuous if the parameter that describes the function is defined above limit of continuum.
1Image courtesy: www.ampli.com

Monday, March 20, 2017

Reversibility of a thermodynamic process

If one wants to understand thermodynamic entropy, he/she should start from reversibility.

What is reversibility of a thermodynamic process? Let us start from a thermodynamic process and then move on to define reversibility.

A system is said to have undergone a thermodynamic process if it changes its state from initial state to final state. State of a system is referred by its coordinates under thermodynamic equilibrium condition. Typically, state of the system is identified by the state variables, aka, thermodynamic properties such as pressure, temperature, density, etc.

A process is said to be a reversible process if the system reverses its direction by changing from final (new initial) state to initial (new final) state. The beauty of a reversible process is it brings system  back to its original state tracing the same path.

Now what is the big deal about reversibility? It is very hard to achieve. In some cases, it is even impossible.

Are you wondering why should we learn reversibility then? Well, there is certainly a reason to it. In thermodynamics, our aim is to build engines that takes energy in available form (heat) and convert it to useful form (work). Thermodynamics first law gives us the assurance that this is indeed possible. However, first law falls short in providing the limit to this conversion which depends on quality of energy. But how can one quantify quality of energy?

It is quite a challenge to quantify quality of energy. Quality is a relative term. What I consider to be of high quality may not be the same for someone else. With this ambiguity, how can we address this issue scientifically? Understanding reversibility can through us some light on our discussion. Reversible process is difficult to achieve, but such a process can act as a reference against which actual processes can be compared with.

The following example may make the concept more clear. Suppose let us say I have a pen (system) and paper (surroundings) and I intend to write a letter (work). At the end of the writing process, I would have spent a certain amount of ink fluid in order to get the writing done. Now the pen has changed its state from its initial (full ink) state to final (partial ink) state. To bring back the system to its initial state again, I have two choices.
  • Extract the ink embedded on the paper and supply the same quantity to pen. This will bring back the pen and paper (system and its surroundings) to their original state making this process a totally reversible one.
  • Take an ink pot. Fill the pen with quantitatively same amount of ink which was spent as work. In this case, only the system comes back to its initial state, while surroundings went through a permanent change. Such a process is called as internally reversible process.

Quantitatively, there is no difference between the two choices. However, quality of ink from ink pot and that from a paper are different. Ink from ink pot can be used to do more work, while ink of same quantity from paper can never be recovered. The change in quality of energy is due to reversibility of the process. At best, one can strive to achieve a process that comes closer to a reversible process.

This brings us to the closure of this lecture.

Take home message: One way to quantify quality of energy is by comparing an actual process to its reversible equivalent.

Monday, December 9, 2013

Snow pores

I clicked this interesting picture of snow pores at CSU transit center today. Snow was accumulated from the recent snow storm which has kept even high temperatures in Fort Collins below 32 F (0 C) for the past few days. What could be the reason for the appearance of pores in this accumulated snow/ice?

Sunday, August 18, 2013

Display Gridded Gauged Rainfall data using Grads

Download GRIdded Binary (Grib) data from source. In my case, I am interested in hourly gauged rainfall from NCAR EOL, which is available in gridded binary format.

Step 2: In order to display grib data using grads, we need to create a control file (.ctl) and an gribmap index file (either .gmp or .idx). Control file can be created using grib2ctl perl script.

Create ctl file using grib2ctl perl script.
grib2ctl.pl file_name.grb >file_name.ctl. 
Make sure the grib2ctl.pl is executable and is in searchable location (I had copied it to /usr/local/bin).

Once the file_name.ctl file is created, create index file using gribmap (inbuilt with grads software). 
gribmap -i file_name.ctl -0 (if the gridded file is for one time step).
Now that file_name.ctl and file_name.idx file are created, we can display the variable using grads. For hourly gridded gauged rainfall data, the name of the variable is apcpsfc. You can get this information using wgrib
wgrib -V file_name.Grb
The following lines of code plots gridded gauged rainfall data (hourly):
Open a terminal and cd to the location where the .grb, .ctl and .idx files are saved.
Type grads in command prompt. This will start a new grads session. Choose landscape or portrait mode.
open file_name.ctl (grads will open the control file)
query file (list details of the file such as variable name, domain etc)
set lon -125 -67 (sets lon range)
set lat 25 49 (sets lat range)
d apcpsfc (displays contour map of gridded gauged rainfall data)
If you do not like the default line contour display, you can display using shaded contour.
clear (clear existing plots)
set gxout shaded (this will set contour type as shaded)
set csmooth on (if you want to have a smooth contour, set this option on)
d apcpsfc (displays shaded contour of gridded gauged rainfall data).
Finally, if you want to save the display image, type the following.
printim image_filename.jpg (saves image in jpg format. other options are png and gif).