Model mass balance

There are two methods to calculate the mass balance within the model;
 * degree day method
 * simple energy balance model.

Degree day method
The degree day method is the simplest method to calculate the ablation. In this type of model the potential ablation is determined as a linear function of the excess of daily mean air temperature above 0 °C. This potential ablation is transformed into an amount of melt through the application of degree day factors. The positive degree-day factor parameterises the physical processes that characterise the exchange of energy between the atmosphere and the surface. As a parameterisation of complex surface interchanges, degree-day factors are spatially and temporally variable. The degree day factor for snow and ice are two of the free parameters that are specified in Readoptimfile.

function rainorsnw
This function determines whether precipitation falls as rain or snow using air temperature(it returns amount of rainfall). If it is called with the flag not equal to 1, a simple comparison between the daily mean temperature and a prescribed rain-snow transition temperature is made: if the daily mean air temperature is above the threshold then all precipitation on that day falls as rain, otherwise it is assumed that all the precipitation is snow, so the function returns zero. If the function is called with flag set to 1, it estimates the rainfall by assuming a cosine for the diurnal variation of temperature about its mean ($$\bar{T}$$) with prescribed range, $$\Delta\,T$$, (the range is from the mean to the peak, NOT peak to peak),

$$T(t)=\bar{T}-\Delta\,T \cos(t)$$ which can be rearranged to give time of day $$t^{'}$$ (in radians) at which the threshold $$T^{'}$$ is reached,

$$t^{'}=\cos^{-1}\left({\frac{\bar{T}-T^{'}}{\Delta\,T}}\right)$$.

The proportion of the day for which temperatures exceed the threshold is therefore $$(\pi\,-t^{'})/\pi\, $$. If we assume that there is an equal probability of the precipitation falling at any time during the day then we simply need to multiply by the daily precipitation total to get the amount of rainfall.

function finddegdays
This function finds the number of positive day degrees (d) during a day using air temperature. If it is called with the flag not equal to 1, the number of day degrees is simply the daily mean temperature if its is above zero, or none if the temperature is below zero. If the function is called with flag set to 1, it estimates the number of positive day degrees by assuming a cosine for the diurnal variation of temperature about its mean ($$t^{'}$$) with prescribed range, $$\Delta\,T$$, (the range is from the mean to the peak, NOT peak to peak),

$$T(t)=\bar{T}-\Delta\,T \cos(t)$$

which can be rearranged to give time of day, $$t^{'}$$, (in radians) at which the temperature equals zero,

$$t^{'}=\cos^{-1}\left({\frac{\bar{T}}{\Delta\,T}}\right)$$.

We now need to integrate T(t) from the this time to midday $$\left({\pi\,}\right)$$ and scale from radians into fractions of a day,

$$d=\frac{1}{\pi\,} \int\limits_{t^{'}}^{\pi\,}\bar{T}-\Delta\,T\cos(t)dt$$


 * $$=\frac{1}{\pi\,}\left[{\bar{T}\left({\pi\,-t^{'}}\right)+\Delta\,T\sin\left({t^{'}}\right)}\right]$$.

function lapsecalc
This function simply applies the prescribed lapse rate to what ever variable is given. This is usually done for air temperature (daily means but not amplitudes) and precipitation. In the latter case, there is a guard in the calling routine that avoids creating precipitation if there was none in the base met. data. The lapse rate is applied relative to the prescribed elevation of the met. data and everything is done in scaled units.

function surfacemodel
This function takes the estimated daily precipitation (total), rainfall and meltwater depths and evolves the accumulated snow, super-imposed ice and glacier ice stores. We call firn the combined depths of snow and super-imposed ice. The logic of the process is as follows.
 * 1) The depth of snow is increased by snowfall (total precipitation minus rainfall).
 * 2) The depth of super-imposed ice is increased by rainfall (assumed to refreeze).
 * 3) Use the total potential melt to melt snow. If there is snow left then set melt to zero, otherwise reduce it by amount of snow melted.  Any melted snow is assumed to refreeze and become super-imposed ice.
 * 4) Estimate the depth of super-imposed ice that would result in the firn reaching its capacity. Here firn is assumed to be the sum of the snow (s) and super-imposed ice (i) depths.  We assume that only a fixed proportion (w or wmax) of the firn can be super-imposed ice and estimate this depth as,

$$i=w\left({s+i}\right)$$

$$i=\frac{ws}{1-w}$$.


 * 1) Any super-imposed ice above this capacity is assumed to have run off – or more accurately the melt water that would have formed super-imposed ice is rejected before it gets a chance to freeze.
 * 2) If any melt potential remains then proceed to melt super-imposed ice (reducing potential and increasing runoff accordingly). If the melt potential exceeds the amount of super-imposed ice, remove all of and amend runoff and potential melt figures accordingly. Note that in the case of the degree day model, this requires a re-determination of the appropriate degree-day factor from that of snow to ice.
 * 3) If any melt potential remains then proceed to melt glacier ice ice (reducing potential and increasing runoff accordingly).

Energy balance model
subroutine initialstart_ebm Sets up a number of parameters that are used in the energy balance calculation of surface melt. Points to note include: scaling of time from second in day to radians. subroutine initial4day_ebm Calculate energy-budget parameters that vary daily. In this case, this is the solar declination which is then used later on with the latitude  to calculate the solar zenith (z) and azimuth where  is the julian day expressed in radians, and

the primes indicates that these are parameters used in the final calculation of zenith and azimuths. subroutine nexttimestep_ebm This is the main solver for the energy-balance model and steps both the surface temperature (T) and the accumulated melt forward in time. The equation being solved is

where  is the surface’s aspect and   its slope (in radians);   is the fraction of the day expressed in radians and relative to midday; A, B and C are free parameters;  is the co-albedo of the surface; d is the depth of the thermally-active layer,  its density and c its specific heat capacity (we currently assume snow throughout); the 2-m air temperature (T2m) is based on the daily mean and amplitude value supplied; and temperatures are in K.  Appropriate sets are taken to ensure that the sun does not sun when it is below the horizon.

We use an implicit time-marching scheme

In these subroutines, time through the day is in radians. If the new temperature is above the melt point then we estimate an amount of melt by converting energy with active layer into an equivalent melt depth. We use the trapezium rule to do this. There are two cases. The first is where the preceeding temperature is at the melt point also; this is easy. The second in when the preceeding temperature is below the melt point, in which case we need to estimate the fraction of the time step during which temperature was above the melt point (using linear interpolation).