Python Lab – Moist Convection

Resources

When you are finished with this lab’s work, your program will be able to do the following:

  1. Allow you to select a parcel from an arbitrary level in the sounding (as before) and this time capture not only the temperature but also the water vapor mixing ratio at that level. Also allow you to modify the parcel’s starting temperature by an amount DeltaT.
  2. Plot a red dot for both the initial temperature and dew point at the pressure level where the parcel was selected.
  3. Allow the parcel to move vertically as before with the specified initial velocity, but this time using the virtual temperature of the parcel and the environment to determine acceleration rather than just the temperatures. Also check for saturation and, when saturation occurs, remove the excess vapor and add heat to the parcel so that it follows a moist adiabatic above its LCL.

Here are the detailed steps for achieving the above:

  1. Modify the Sounding.get_leveldata() method to return not only the environmental temperature but also the environmental mixing ratio (calculated from the dewpoint and pressure utilizing the wsat() function).   Return the two values as a tuple; i.e.,

return(T, w)

  1. Modify the TK = mysounding.get_leveldat((pinit) to receive the tuple TK, w instead; i.e.,

TK, w = mysounding.get_leveldat(pinit)

  1. Modify Parcel().__init__() method to also initialize the parcel with an optional mixing ratio self.w (default mixingratio = 0.0). Also add an attribute self.history_DPC that records the parcel’s dew point in degrees C.
  1. Modify the instantiation of myparcel to use mixingratio=w as the starting mixing ratio, where w is from the mysounding.get_leveldat(pint) call (see steps 1 and 2).
  1. Modify Parcel().plot() to also plot a red dot at the initial pressure and dew point. You will need to use the wsat_inv() function to convert the parcel’s mixing ratio to dew point.
  1. Within the existing Parcel().convect() method, use w from the environment and w from the parcel to compute virtual temperatures for each (TVparcel, TVenv). Then modify the accel term to use those instead of ordinary temperature. Also use TVenv instead of Tenv to compute DeltaP.
  1. Add lines to the Parcel class to record the dew point (Celsius) in self.history_DPC. You will have to use the wsat_inv() function. Also, modify Parcel().plot_tempvpres() to plot self.history_DPC in addition to the temperature history.
  1. Create a method Parcel.satadjust(self) that checks for the parcel being supersaturated and, if needed, eliminates the supersaturation by iteratively reducing w while adding heat to the parcel. I will go over the details of how this method works in class. Among other things, you will have to add a definition of the value of the latent heat of vaporization L to your physical constants
  1. Within the existing Parcel.convect() method, add a call to self.satadjust() following the code where the parcel pressure, temperature, and vertical velocity have been updated.
  1. In addition to specifying pinit and VertVel, add a line to specify DeltaT, which is the temperature of the parcel relative to the environment at its starting location.
  1. Modify the instantiation of myparcel to utilize TK + DeltaT as the starting temperature.

Once you have made and carefully tested the above modifications, load the sounding from the file “DDC_01May2012_12Z.html”, and use the following parameters to initialize and convect your parcel:

pinit = 850*hPa
DeltaT = 7.0
VertVel = 10.0

You should get the following results: The parcel follows a dry adiabat to its LCL, then follows a moist adiabat that crosses to the right of the environmental sounding, so that the parcel accelerates rapidly upward, achieving a maximum vertical velocity of around 80 m/sec and overshooting the 100 hPa level before descending again and oscillating steadily with a period of around 7 minutes.

If everything looks okay, turn in the plot showing the above behavior.