Library

5.1.4 Working With Arrays Kept Simple

We might consider the arrays created initially as long ladders with a number of rungs. Because this chapter deals with an ageing problem, each rung of our conceptual ladder represents a step in time. Of course, the size of each step in time is equivalent to the time-step used when building our models. How close the rungs on our ladder are (and how many we need) is related directly to the simulation time-step. For example, if we wish to simulate a period of 12 years through which saplings will age, and we choose a time-step of one year, we need 12 rungs on our ladder. Alternatively, when simulating the same period with a time-step of one quarter of a year, we will need 48 rungs on our ladder. Also, each of the variables we use must be specified in terms of the chosen time-step. The significance of this will be demonstrated as we build the SAPLINGS-ARRAY module. When building and verifying a module we would choose a relatively large time-step and a small number of rungs on our ladder (or cells in our array). Once the module is working properly, we make the time-step smaller and increase the number of rungs (array cells) to improve accuracy. That is, relatively small time-steps are needed to reduce the approximation errors. But, working with large numbers of array cells is tedious. To avoid the tedium, we increase the numbers of array cells (through changing array dimensions) only when we know the module works correctly.