# Numerical Solutions & distribution

The governing differential equations are converted to non-linear ordinary differential equations whose unknowns are the values of the prime variables at a finite number of nodes by using Galerkin’s method of weighted residuals. Then, a finite-difference time-stepping scheme is applied to evaluate the time derivatives, which is solved by a successive linearization iterative scheme. To describe the spatial discretization and time stepping of the governing equations, an example of the derivation is presented below, using the moisture equation. For the dry air equation and the energy equation, the procedure is similar. The standard piecewise linear basis functions for approximation of the prime variables are expressed as

where j is the node index,and  the usual shape function defined element by element (). If the approximations given by equation (4.1) are substituted into the equations (3.10), (3.13) and (3.19) (see secion 3 of STEMMUS document for equation numbers), residuals are obtained for each governing differential equation, which are then minimized using Galerkin’s method. Introducing the new notation for the coefficients in the moisture mass  conservation equation, equation (3.10) becomes

where c1 to c8 are defined implicitly by equation (3.10) and (4.2). Following Galerkin’s method of weighted residuals, for each element, the residuals obtained by substituting , and into equation (4.2) are required to be orthogonal to the set of trial functions:

where z is the solution domain, and i = 1, 2. We apply integration by part () to the third, fourth and fifth term, which may be recognized as the flux divergence.

where z1 and z2 are two points in one element and subscripted according to a local numbering system. According to the definition of c3, c4, c5, c6, c7 and c8, Qm is implicitly seen as the sum of liquid and vapor mass flux. Now, substituting from equation (4.1) into equation (4.4) yields