Difference between revisions of "Model Structure"

From SourceWiki
Jump to navigation Jump to search
 
(5 intermediate revisions by the same user not shown)
Line 58: Line 58:
  
 
=== Function calcacab ===
 
=== Function calcacab ===
This function returns the mass balance profile for the current year. Depending on the setting of '''''whichacab''''', the mass balance is either calculated using a degree day (whichacab set to 0) or a simple energy balance model (whichacab set to 1).  simple model for melt water retention as superimposed ice. <br>
+
This function returns the mass balance profile for the current year. Depending on the setting of '''''whichacab''''', the mass balance is either calculated using a degree day method (whichacab set to 0) or a simple energy balance model (whichacab set to 1).  To account for superimposed ice a simple model is used whereby a fraction of the meltwater refreezes in the snowpack, after which susequent melt runs off. The routines that are used in this function are described in the section '''[[Model mass balance]]'''.<br>
  
 
The function is called once per year from the main valley model and has a daily time step.   
 
The function is called once per year from the main valley model and has a daily time step.   
Line 80: Line 80:
  
 
<font-size: 20>'''If thickness/width evolution is included (''whichthck'' =1) then the model runs a set of rotuines to determine the glacier's dynamic response ([[Model dynamics]]).''' </font>
 
<font-size: 20>'''If thickness/width evolution is included (''whichthck'' =1) then the model runs a set of rotuines to determine the glacier's dynamic response ([[Model dynamics]]).''' </font>
 
 
=== function calcacab ===
 
 
 
function massbalseasons
 
This function …
 
function rainorsnw
 
This function determines whether precipitation falls as rain or snow (it returns amount of rainfall) using air temperature.  If it is called with the flag not equal to 1, a simple comparison between daily mean temperature and a prescribed rain-snow transition temperature is made: if the daily mean is above the threshold then all precipitation falls as rain, otherwise none. 
 
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 ( ) with prescribed range ( from mean to peak NOT peak to peak)
 
 
which can be rearranged to give time of day  (in radians) at which the threshold  is equaled
 
.
 
The proportion of the day for which temperatures exceed the threshold is therefore  .  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 ( ) 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 otherwise nothing. 
 
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 ( ) with prescribed range ( from mean to peak NOT peak to peak)
 
 
which can be rearranged to give time of day  (in radians) at which the temperature equals zero
 
.
 
We now need to integrate  from the this time to midday ( ) and scale from radians into fractions of a day
 
 
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
 
 
5. 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.
 
6. 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. 
 
7. If any melt potential remains then proceed to melt glacier ice ice (reducing potential and increasing runoff accordingly).
 
Module energy_balance (energy_balance.f90)
 
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).
 

Latest revision as of 17:12, 9 November 2007

skadia.f90

The main program calls readcontrol to read in the user’s preferences for the model run from the control file control.nml. The information in this file determines several factors within the model; the length of the model run, the mode the model is going to be run in, and the input and output files required and generated, respectively.

Call Readoptimfile reads in the initial and the range of values that can be taken for the parameters that are able to be optimized within the model. Depending on the mode that the model is running in determines which set of routines are called next,

  1. Mode = 0; Optimisation mode
  2. Mode = 1; Phase space mode
  3. Mode = 2; Inverse model mode
  4. Mode = 3; Forward mode

Valley

This is the main program that runs the valley glacier model. Within this routine the following subroutines and functions are called before the model time step is initiated:

  1. call getoptimvalues
  2. call initial
  3. call readgeometry
  4. function calcwdth
  5. call readcostdata

Main time loop is controlled by count and determined variables trun, tinc and tstr (all units of years and defined in the control file).


Call getoptimvalues

Depending on which mode the model is running in the parameter values for the current model run are selected. In the optimisation mode, the final model run uses the 'best' parameter set. In the other modes, this routine selects parameter values from either; the parameter file, the space survey or the genetic algorithm (GaFortran).


Call initial

This routine is where the parameter values are scaled. For further information see the section, scaling.

Call readgeometry

to read basic geometry of glacier system. The format and name of the input file containing the geometry information is shown in the control file. The information to be read in:

  • current surface and bedrock elevations
  • reference widths
  • reference thicknesses.

All the variables are scaled and the current ice thickness is determined from the upper surface and bedrock elevation.

Call readcostdata

The files that contain glacier observations against which the model's performance is measured are read in. The names and the format of these files are described in the control file section. The model is capable of using a range of optimisation data including;

  • ice thickness profiles through time
  • seasonal and annual/net mass balance for the whole glacier
  • seasonal and annual/net mass balance for different elevation bands.
  • glacier length changes
  • ela changes.

<font-size: 20>Within the main time loop the following routines are called from the main Valley program.

Call readmet

Reads in the meteorological data for the current year. The format of the meteorological data read in depends on the mass balance method being used in the model. In its current configuration the model requires the following fields;

  • year
  • julian day
  • temperature
  • temperature range
  • precipitation.

Each year's data is in a seperate text file.

Function calcacab

This function returns the mass balance profile for the current year. Depending on the setting of whichacab, the mass balance is either calculated using a degree day method (whichacab set to 0) or a simple energy balance model (whichacab set to 1). To account for superimposed ice a simple model is used whereby a fraction of the meltwater refreezes in the snowpack, after which susequent melt runs off. The routines that are used in this function are described in the section Model mass balance.

The function is called once per year from the main valley model and has a daily time step.

  1. There are stores for the depths of snow, super-imposed ice and glacier ice along the glacier. The latter is set the zero every year and is a relative store, while the other two inherit depths from the end of the previous year.
  2. The main loops are for days in the year (leap years are determined elsewhere and dayinyr is corrected for them) and points along the glacier. Mass balance is determined at end point on the transect (glacier or not).
  3. The loop proceeds by determining surface air temperatures using a lapse rate and the daily mean temperature at the met. station (or equivalent model-based data or assumed elevation).
  4. A similar procedure is used to estimate daily precipitation totals along the glacier. Note that this is only done if precipitation actually occurred on the day in question.
  5. An estimation of the amount of precipitation falling as snow is then made based on diurnal air temperatures.
  6. Total potential melt rates are then determined for the day using either day-degree or a simple energy-balance model. In the former case, snow is initially assumed but a correction for ice is made within the surface mass balance subroutine.
  7. The evolution of the snow, superimposed ice and glacier ice along the transect is then determined using the potential melt totals, as well as daily rainfall and total precipitation.
  8. After the main loops, we tidy up by remembering the end of year depths of snow and super-imposed ice and sorting out the mass-balance season information required in the cost function.

Function calcmask

This function is called from valley and returns a mask that indicates where calculations for ice flow etc need to be performed and where not. In the former case, a unique integer value is given to each cell; while 0 is entered in the latter case. For a point to be included one of the following must be true:

  • the point has ice thickness greater than zero;
  • its mass balance is positive;
  • one of its up- or down-stream neighbours has non-zero ice thickness; or
  • the point is at a branch in the system and one of its branched neighbours has non-zero ice thickness.


<font-size: 20>If thickness/width evolution is included (whichthck =1) then the model runs a set of rotuines to determine the glacier's dynamic response (Model dynamics).