# MM5 (weather model)

The MM5 (short for Fifth-Generation Penn State/NCAR Mesoscale Model) is a regional mesoscale model used for creating weather forecasts and climate projections. It is a community model maintained by Penn State University and the National Center for Atmospheric Research. The MM5 is a limited-area, terrain-following sigma coordinate model that is used to replicate or forecast mesoscale and regional scale atmospheric circulation. It has been updated many times since the 1970s to fix bugs, adapt to new technologies, and work on different types of computers and software. It is used in many different ways: for research and for weather prediction. In research, it is used to compare it to other models, to see what works and what does not work. It is also used for air quality models.
Active development on the model ended with version 3.7.2 in 2005, and it has been largely superseded by the Weather Research and Forecasting (WRF) model.

## Features

MM5 is globally relocatable, which helps support different latitudes, terrain types, elevations, soil types, etc. . The model can be either hydrostatic or non-hydrostatic, depending on the desired outcome. The fact that the model is regional implies that it requires initial conditions and lateral boundary conditions. This means that each boundary (there are four) has initialized wind speeds, temperatures, pressure and moisture fields. Thus, gridded data is needed for this program. This model takes and then analyzes its data based on pressure surfaces. However, these surfaces must first be interpolated by a specific vertical coordinate before it can be analyzed. This vertical coordinate, sigma, is computed and then used throughout the program. Σ is defined as: Σ = (p-p$_t$)/p*, p* = p$_s$-p$_t$, Where p is pressure, p$_s$ is surface pressure, and p$_t$ is the pressure at the top of the model. When Σ is close to the ground, the program follows the actual terrain, but when Σ is higher up, the program looks at isobaric surfaces. Σ ranges from 0 to 1. It has adaptable and multiple nesting capabilities, which allows multiple programs to run at once, while utilizing 2-way nesting. MM5 features inputs from actual data, which is helpful because routine observations can be used. Then, data can be compared and used in context with other models. MM5 also features terrain-following vertical coordinates and four-dimensional data assimilation (FDDA). FDDA is used when there is a lot of data that was taken over a longer period of time. Then this data that needed to be taken over a longer period of time gets placed into FDDA. It is also utilized for dynamical initialization and four-dimensional data sets. Most importantly, MM5 is well documented and has many places for user support.

## Functions

There are many pieces of the MM5 modeling system, each with different functions. These pieces include: TERRAIN, REGRID, LITTLE_R, NESTDOWN, INTERPF, INTERPB, and GRAPH/RIP. In the basic sense, the model begins by taking the information and then makes a model of the land. This is done by using the piece TERRAIN. Then, the model guesses the different pressures that exist in the atmosphere throughout this plot of land, which is done through REGRID. Then, the model takes these guesses, and with the help of some surface observations, can create an objective analysis, using LITTLE_R. RAWINS is an older version of LITTLE_R and thus LITTLE_R is more commonly used. Then INTERPF takes that data from RAWINS/LITTLE_R and REGRID to interpolate that data to the sigma coordinate explained above. MM5 itself computes the time combination. The NESTDOWN function has the ability to change the vertical sigma levels. INTERPB generates the first guess for RAWINS, as well as gathers the files used to make guesses for REGRID. Finally, GRAPH/RIP generates the plots that users can view from all of the data given from the other programs. RIP stands for Read/Interpolate/Plot, and it uses NCAR Graphics to help envisage the output from the MM5.

## Memory and code basics

MM5 is written in FORTRAN. These FORTRAN programs must be compiled on a local computer, and some need to be recompiled each time a model configuration is changed. The program uses pointers to assign variables to values. These pointers go into parts of the memory to assign specific values to the desired variables. MM5 can also perform multiple tasks at once. Specifically, two different tasks can be executed on different processors simultaneously and MM5 uses this as much as possible. This multi-tasking also uses nesting, and MM5 allows up to nine domains (processes) running at the same time and they interact throughout the whole process. The model utilizes two-way nesting, which occurs when the input from one nest's coarse mesh, which is a high density of cells in one area, comes from one of the four boundaries, but the feedback to the coarser mesh happens through the nest interior. Each domain gathers information from its parent domain each timestep, then it runs three timesteps, and then delivers the information back to its parent domain. There are three different ways to do two-way nesting: Nest interpolation, nest analysis input, and nest terrain input. Interpolation occurs when the terrain is smooth, such as water. There is no input that is required for this type of two-way nesting. Nest input requires a file called MMINPUT, and that file contains the meteorological and the terrain information so that initially, a better analysis can be done. Finally terrain input requires a TERRAIN file. Then the meteorological fields are interpolated. When multi-tasking occurs, the variables must be marked as either shared or private. Shared implies that the processors all have access to the same part of memory, while private implies that each processor must have its own private copy of an array with its personal memory location. The multi-tasking occurs specifically in the subroutines Solve1, Solve3, and Sound.

## Requirements

MM5 can be run in many different ways, depending on the computer. The model can be run on a single processor computer, shared memory architecture or distributed memory architecture. It can be run on many different platforms as well such as IBM, SGI origin 200/2000, CRAYs (J90, C90, T3E), DEC Alphas, Alphas running Linux, Sun, and more. The computer it is run on must have a Fortran 90 and 77 compilers and a C compiler. Additionally, it can have NCAR graphics and MPI tools for running the MPI MM5 model. However, this is not necessary. The MM5 model takes up at least half a gigabyte of memory and a few gigabytes of disk space.

## Source code

The MM5 code itself has over 220 subroutines, with more than 55,000 lines of code. It uses Standard Fortran 77 with “Cray” pointers. A list of the subroutines of all of the functions within the MM5, with a short description and the routines that are called within it can be found here.

## Use

The MM5 had been adapted for use in many different types of atmospheric simulations:
* Real-time regional weather forecasts
* Tropical cyclone prediction
* Climate change simulation and projection

## Developments and improvements

TERRAIN's latest update uses USGS global 30 sec terrain elevation data, which looks at the entire world, where before was only used in the continental United States. This new update also allows for a better quality terrain image that can be used in MM5. REGRID's improvement makes it simpler for its users to input the data and it also is more portable. LIITLE_R was developed in 2001 to replace RAWINS. LITTLE_R's improvement again makes it easier for users to input data.