Ben,
The "package" keyword that is used in the WRF registry files is specifically set up to make the memory footprint as small as possible. For example, if the WRF model is selected at run-time for a dry ideal case, there is no need to consider the various "moist" components (vapor, rain mixing ratio, snow mixing ratio, ice mixing ratio, cloud water mixing ratio, etc).
There are several 4d arrays in the standard WRF Registry: moist, scalar (mostly these are the number concentration arrays associated with some of the moist species for the double moment microphysics schemes), tracer (passive tracers that are available for trajectory analysis), and chem (3d chemical constituents). For these (and all other 4d arrays), no space is allocated at run-time unless a specific request is made. The request is in the form of listing the variables in a package statement.
Here are a few lines of the Registry.EM_COMMON file, where the moist fields are defined.
Code:
state real qv ikjftb moist 1 - \
i0rh01usdf=(bdy_interp:dt) "QVAPOR" "Water vapor mixing ratio" "kg kg-1"
state real qc ikjftb moist 1 - \
i0rhusdf=(bdy_interp:dt) "QCLOUD" "Cloud water mixing ratio" "kg kg-1"
state real qr ikjftb moist 1 - \
i0rhusdf=(bdy_interp:dt) "QRAIN" "Rain water mixing ratio" "kg kg-1"
Here is a package declaration for a warm rain microphysics scheme:
Code:
package kesslerscheme mp_physics==1 - moist:qv,qc,qr
The syntax is to list the 4d array name (moist, in this case), and then list the components that are required for this microphysics option (qv, qc, qr for mp_physics==1).
There are some schemes in the WRF model that require extra variables, that are not needed by other schemes. The stochastic capability, the data assimilation options, the NoahMP scheme, the urban options are all examples of schemes that have a large number of state fields that are not part of a 4d encapsulating array. To save memory space, those are put into package statements also.
For example, the WSM5 scheme uses qv, qc, qr, qi (ice), qs (snow) from moist. It also uses a few state fields that are the effective radii of cloud, ice, and snow - which are all just members of the state keyword.
Code:
package wsm5scheme mp_physics==4 - moist:qv,qc,qr,qi,qs;state:re_cloud,re_ice,re_snow
Every state field that is NOT part of a 4d array is always available to the WRF model, UNLESS it is listed in a package. If the field is listed in a package, then that field is available ONLY if that package is requested at run-time.
The rules are pretty simple:
1. If you are adding 2d and 3d arrays that are specific to your scheme, they should be part of the package declaration for your scheme.
2. If your scheme needs access to components of existing 4d arrays (for example, moist or scalar), then those encapsulating 4d arrays and the list of required 3d components need to be in your package declaration.
3. If your scheme needs access to components of existing 2d or 3d arrays that ALREADY exist in some package statement, then you must include those fields in your new package statement to use those fields.
4. If you are adding components to an existing 4d array, follow the templates of the existing 4d arrays.