I will set up a lab time each week in addition to class. Next week, I will do
this on Tuesday afternoon from 2 to 3. I will add another time if necessary.
Let me know what time would work for you if Tu 2-3 does not.
One of the goals of this course is to give you more experience and confidence
in learning how to check your own work. This is an extremely valuable skill
for your future career.
Programming is harder for some than for others. Programming is an acquired
skill, and you will all gain profiency. Programming requires knowing how to
check your code as you go. Below are some general and specific suggestions
for checking your program and finding errors.
A generally good programming practice is to write functions for commonly used
calculations. An advantage of functions is that they are portable. Saturation
mixing ratio. q_vs(T,P), would be a good candidate. The standard atmosphere
temperature profile, T_std(z), is another. The pressure at the top of a
layer, p_top(p_bot, T_avg,dz) would be another. CAPE for a layer is another.
Remember that a function can call another function. And in matlab, a function
can return (calculate) the values of more than one variable.
Some suggested ways to check HW 2 results:
1. Compare the temperature at several levels as listed in your printed output
(not on the matlab skew T plot, which is not very accurate) with the
corresponding parcel values obtained from a skew T diagram such as the one
you were given last semester, or the one linked to the class web page.
2. The US Standard Atmosphere is plotted on your laminated skew T, as a
function of pressure, so you can use that for comparison to your results.
Essentially the same problem as this one is given in Holton, 4th ed., Matlab
exercise M2.1. The problem describes how to use the hypsometric equation to
determine the pressure at each level. The method is exactly the one I
described in lecture.
3. You can make a rough estimate of the CAPE from the area between the parcel
and environment on the skew T plot. The area for a temperature difference
of dT over the layer between p1 and p2 is R * dT * log(p1/p2). On the
laminated skew T, the CAPE for the area between T = 0 and 5 C and p = 800 and
750 mb (easy to locate because of the shading) is 192 J/kg, or about 200
J/kg. You can use this as a reference to estimate the CAPE.
4. To convert from environmental temperature (Te) to environmental potential
temperature (the), use the function theta(T,p). It is used already in
parcel.m as follows:
th = theta ( T, p ); % theta(T,p) is a function