Skip to main content

7.9) Insolation Submodel


Add the following code to the bottom of your code as a submodel:

to calculate-insolation
   let fog-reduction 0.7
   if elevation > 50 [set fog-reduction 1]
   let orientation 180
   let lowest-neighbor min-one-of other patches in-radius 4 [elevation]
   set orientation atan ([pxcor] of lowest-neighbor - pxcor) ([pycor] of lowest-neighbor - pycor)
   set insolation 300 + (1000 * fog-reduction * (1 - cos orientation) / 2)
end

The idea is to calculate insolation from orientation of patch on slope (sun in south or at the bottom of the view) and height of patch (the higher the less fog) between a minimum of 300 and a maximum of 1300 W/m2. To do that we need two local variables, one fog reduction factor and one for the slope orientation. The fog-reduction is the easier of the two which is set to 70% below an elevation of 50m, above there is no fog. The orientation is a bit trickier as NetLogo has a build-in orientation for turtles (heading) but not for patches so we need to find out in which direction is downhill. We do that by searching for the lowest neighbouring patch in a certain radius and then use the trigonometric function atan to set the orientation (trigonometric function: tangent (orientation) = opposite / adjacent, but check out the NetLogo dictionary for the atan function). We then calculate the insolation by reducing it‘s maximum by the fog factor and the orientation. For getting a maximal insolation at a south facing hill (orientation is 180°) and a minimal at a north facing hill, we subtract the cos of the orientation from 1 and divide it by 2.

With more complicated procedures like this make use of comments to explain what the model does!