











Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!












MEA712: Mesoscale Modeling Class mesoscale model (CMM) project, assignment 1 Due at start of class on Thursday, 5 October. In–class supervised work period on Tuesday, 3 October.
We will be following a set of notes developed by Dr. Rob Fovell of UCLA. Our first four tasks will involve setting up the basic model state and implementing our four governing equations. After that, we will depart from Dr. Fovell’s notes and add some other things to the model on our own.
We will deviate from Fovell’s task as follows: we will use the original Weisman and Klemp (1982) sounding, which is more general than what Fovell gives in Chapter 9 (Fovell simply hardwires the default values). WK82 actually had a form that allowed the user to tune the temperature and humidity profiles by setting a few key parameters. This will enable you more easily to do some experimenting later on. Here are some excerpts from my code that show you how to modify Fovell’s examples:
! parameters to describe the sounding real tsurf! potential temperature at the surface (K) parameter(tsurf=300.0)! default is 300.0 K real qsurf! mixing ratio at the surface (kg/kg) parameter(qsurf=0.0161)! default is 0. real q4km! mixing ratio at 4 km AGL (kg/kg) parameter(q4km=0.0026)! default is 0. real ztr! height of the tropopause (m) parameter(ztr=12000.0)! default is 12000.0 m real temptr! temperature at the tropopause (K) parameter(temptr=213.0)! default is 213.0 K real ttr! pot. temperature at the tropopause (K) parameter(ttr=343.0)! default is 343.0 K
! assign mixing ratios if(zu(k).le.4000.0) then qb(k) = qsurf - (qsurf-q4km)zu(k)/4000. elseif(zu(k).le.8000.0) then qb(k) = q4km - q4km(zu(k)-4000.0)/4000. else qb(k) = 0. endif
! assign potential temperatures if(zu(k).le.ztr) then tb(k) = tsurf + (ttr-tsurf)(zu(k)/ztr)1. else tb(k) = ttrexp(grav(zu(k)-ztr)/(cptemptr)) endif
(Assignment continues on next page)
The grid box width and depth will be called ∆x and ∆z, respectively. Note that u and the scalar variables are at the same physical height levels, while w is displaced 0.5∆z above and below. These two height levels will be called the u and w heights, respectively. In this arrangement, we only really need boundary conditions in the vertical direction on w, and we will assume the boundaries are rigid, flat plates such that w = 0 there.
The only density our model will need is base state density — at least explicitly. Density, a scalar variable, is most naturally defined at the grid box center with the other scalars (the u height level). However, since density is so important, we will find it useful to also define density at the w height levels. The base state densities at the u and w height levels will be called RHOU and RHOW, respectively, for coding purposes. The base states for the other variables will be called UB (for ¯u), TB (for θ¯), QB (for ¯qv), and PIB (for ¯π). Mean w is zero.
The vertical grid index will be termed k, and all base state arrays will be vectors with dimension N Z, as there are a total of N Z grid points (see Figs. 1 and 2). Since the grid is staggered, note that a given k-index value, say “k = 5”, refers to different physical heights for the w and u/scalar variables!. To facilitate coding, we will include one fictitious grid volume at the top and bottom of each model column. It will be seen that this permits simpler and more efficient coding of our equations at a small cost of increased storage. (Fictitious grids will be added along the horizontal boundaries as well, for the same reason.)
In Fortran (Fig. 1), the index for an array dimensioned N Z begins at index 1 and runs to N Z, inclusive. Thus, the real boundaries for w will be located at k = 2 and N Z, and w will be zero at both. Therefore, the lowest and highest physical u and scalar points are located at k = 2 and N Z-1, respectively. The scalar/u grid points at k = 1 and N Z are fictitious, as is the w point for k=1.
In C++ (Fig. 2), array indices start at 0 and thus the maximum index for an array dimensioned N Z is actually N Z-1. So, we will enforce w to be zero at k = 1 and N Z-1 and the lowest and highest u and scalar points are located at k = 1 and N Z-2. The scalar/u grid points at k = 0 and N Z-1 are fictitious, as is w at k=0. Note that in an array dimensioned N Z the point k=N Z does not exist – at least, not within the range of the array under examination. The attempt to access array
location N Z in an array dimensioned N Z is the single most common coding error I’ve seen.
The base state environment described similar to that employed by Weisman and Klemp (1982, MWR, p. 504) and represents conditions common to the Midwestern United States during the spring season. Let zT R and TT R be the height level (12000 m) and temperature (213 K) of the tropopause, with θT R being the potential temperature there (343 K). Let zT be the distance of a given scalar location above the model surface. In Fortran, the model surface is the k = 2 w point in Fortran and so the physical height of the first scalar point is (k − 1 .5)∆z. In C++, the model surface is the k = 1 w point and so the physical height of the first scalar point is (k − 0 .5)∆z. The Weisman and Klemp vertical mean potential temperature (θ¯) is:
θ¯ =
zT zT R
zT ≤ zT R; θT R exp
[g(z cT^ −zT R) pTT R
zT > zT R.
where g = 9.8 m s−^1 , and cp = 1004 J kg−^1 K−^1. Let the base state mean vapor mixing ratio, ¯qv (kg kg−^1 ), be given by:
q¯v =
Take NZ=40 and ∆z = 700 m and compute both. Then use these data to create vir- tual potential temperatures, which should also be contained in an array of dimension N Z and positioned at the scalar heights, using θ¯v = θ¯ [1. + 0.61 ¯qv]. I’ll call this array TBV.
u u
w
w
θ,π
vertical grid arrangement for C++
k-index for w
k-index for u, θ, π
dx
dz
model top (w=0)
model surface (w=0)
0
1
nz-
0
1
2
nz-
nz-
k
k+
k
nz-
Figure 9.2: Vertical grid arrangement for C++ code. The first and last real w points are at k = 1 and N Z-1, respectively. The first and last real scalar/u points are at k = 1 and N Z-2. Note presence of two fictitious grid boxes, located just above and below the model’s vertical boundaries.
Next, the base state nondimensional pressure (¯π) has to be computed^1. Pressure is nondimensionalized as:
π =
[ (^) p p 0
]Rcpd ,
where Rd = 287 J kg−^1 and p 0 = 100000 N m−^2 (1000 mb). The hydrostatic equation, written in terms of π is: dπ¯ dz =^ −^
g cp θ¯v^. We will obtain ¯π as a function of height by integrating this equation upwards from the surface, starting with a supplied surface pressure which will be taken to be 96500 N m−^2 (965 mb). This surface pressure (PSURF) is recorded at the lowest real w point (k = 2 in Fortran, k = 1 in C++). The first task is then to compute π¯ at the first real scalar point, located 0.5∆z above the surface. The mean virtual potential temperature, θ¯v, will be taken to be its value at the first real scalar point and presumed constant below that point. This can be coded in Fortran as:
xk = rd/cp pisfc = (psurf/p0)xk pib(2) = pisfc - grav0.5dz/(cp*tbv(2)
In C++, the code might look like this:
xk = rd/cp; pisfc = pow((psurf/p0),xk); pib[1] = pisfc - grav0.5dz/(cp*tbv[1]);
Now we need to integrate the hydrostatic equation up through the rest of the column. Each step will be of height dz as we traverse from one scalar point to the next. From the hydrostatic equation, we know that the pressure at the top of a designated layer depends on two things: the pressure at the layer bottom, and the mean virtual temperature of the layer. To get the mean θ¯v for a layer between two scalar heights, we need to average the TBV values at the layer top and bottom. (^1) The advantage of avoiding dimensional pressure will be seen later.
p = p 0 π Rcp d
and the relationship between T and θ is:
T = θπ.
Compute ¯qvs for each scalar grid point and use it to calculate the relative humidity.
The present task is to assess the convective instability of the sounding we created in Task #1. This instability, called Convective Available Potential Energy (CAPE), is usually gauged for an insulated parcel originating in the lower troposphere that is subsequently raised without mixing with — nor experiencing resistance from — the environment. If the parcel can become positively buoyant, it will convert the poten- tial energy represented by its buoyancy (CAPE) into kinetic energy of motion. In actuality, the parcel will experience some degree of mixing with its surroundings, and has to push air residing above it out of the way. Thus, the CAPE is an overestimate of the true amount of kinetic energy that might be realized by the parcel.
Figure 1 sets up the problem and presents a hypothetical situation. In the grid view we are defining a parcel at the lowest real scalar grid point by specifying its potential temperature and water vapor mixing ratio. Call these θp and qvp. (We’re using these properties because they are conserved, at least until the parcel saturates.) Once defined, we will raise the parcel, grid point by grid point, until we reach the model’s topmost scalar point. There are two parts to this problem: first, we compute potential temperature and vapor content along the parcel’s path, and then we assess its instability (if any) relative to its surroundings. We use the fundamental air parcel assumption that the parcel’s pressure equals that of its surroundings at all times.
Call the lowest scalar point index k 1 ; this is k = 2 in Fortran and k = 1 in C++. When we raise the parcel to the next grid point up (k = k 1 +1), its θp and qvp are
θ
θ
θ
θ
k=
k=
k=
k=
θ
θ+ ∆ θ
θe
k=
k=
k=
k=
Fortran C++
LCL
Figure 10.1: Grid and Stuve diagram views of an ascending parcel.
We compute the isobaric saturation adjustment in the following way: The amount of vapor that can be condensed from a supersaturated parcel starting with pre- adjustment values of potential temperature θp, vapor mixing ratio qvp and saturation mixing ratio qvs is: C = qvp 1 +^ −^ φqvs
where φ is defined as:
φ = qvs
and Lv is the latent heat of vaporization (2.5 x 106 J kg−^1 ). The vapor loss due to condensation is then qvp = qvp − C,
and the heat released raises the parcel’s potential temperature according to:
θp = θp + (^) cLv pd π ¯
Finally, we wish to compute the sounding’s CAPE. This is an integrated property, defined as: CAP E =
∫ (^) zEQL zLF C
g
θpv − θ¯v θ^ ¯v
dz
and represents the “positive area” on a thermodynamic diagram when both the en- vironmental sounding and the parcel path are plotted. As the parcel rises, it may find itself less dense than the environment at some point. The height where this first occurs is called the level of free convection (LFC). Eventually, the parcel will become more dense than the surrounding environment; this height is termed the equilibrium level (abbreviated EQL) and is the first guess at cloud top. CAPE is computed between these two levels.
Note that the formula uses virtual potential temperatures for the parcel and envi- ronment (θpv and θ¯v, respectively). These are defined as:
θpv = θp(1 + 0. 61 qvp),
and θ¯v = θ¯(1 + 0.61 ¯qv).
Using virtual temperatures allows us to incorporate the effect of moisture on parcel density.
The units of CAPE are J kg−^1 or, equivalently, m^2 s−^2. The latter suggests that CAPE is a (vertical) velocity squared. In our discussion of gravity waves, we rewrote the vertical equation of motion into a form similar to that below (though now with moisture): dw dt
ρ¯
∂p′ ∂x
′ v θ^ ¯v^. The hydrostatically balanced mean state has already been removed and the primed values represent the difference between the parcel and its surrounding environment. Given the air parcel assumption of mechanical equilibrium, p′^ = 0, and the equation is revised to: dw dt = g θpv^ −^
¯θv θ^ ¯v^ (10.1) Note the right hand side already looks like CAPE, all it needs is to be integrated between the LFC and EQL height levels. If the motion is strictly one-dimensional (in the vertical) and steady with time, then
dw dt =^
dw dz
dz dt =^ w
dw dz =
d(w^2 ) dz. Integrate (10.1), using the rightmost expression above to replace the left hand side of (10.1). So, after rearranging:
CAP E = 1 2
∫ (^) zEQL zLF C
d(w^2 )
= 1 2 w^2 EQL − w^2 LF C
= 12 w^2 EQL (10.2)
where it has been assumed that w = 0 at the LFC (not a bad assumption). Thus, the vertical velocity at the estimated cloud top (EQL) depends on the vertically integrated parcel positive buoyancy such that:
wEQL =
For a CAPE of 2000 J kg−^1 , such as might be found in a late spring Midwestern environment during the afternoon, this predicts a parcel would strike cloud top with a