So far, we have learned how to count spatial variability in our model. Please look at these two previous exercises here and here if you haven’t tried it yet. However, it only represents 1-Dimension models. In this exercise, we will try to expand our spatial consideration into a 2-Dimension model.
Have a look at this plan view below to get an illustration of how the 2-dimensions model work.
The water flows are stored in 2 different 2-D arrays.
1. QV: defines water flows between buckets down the screen (in plan view)
2. QH: defines water flows between buckets across the screen.
Let’s get into the modeling by cracking the exercises below. Answers to these exercises are available here. If you obtained a different (correct) answer than those listed on the solutions page, please feel free to post your answer as a comment on that page.
Set all the required settings for the model:
a. Set the number of time steps. Here we use 1000 (it shows how many time steps we are going to run in the model; you can change it as much as you want.)
b. Set the total number of cells; here we have 25 x 25 water tanks.
c. Set time steps in seconds; here is 1.
d. Set the time at the start of simulations.
e. Set k between each water tank. Here we set a uniform value of k; 0.01.
Create matrix H for the initial water level in the water tank.
Set boundary conditions for the model. Here we have water flow (qh) into the water tanks from three sides (top, left and right) and water flowing out on the bottom (qv; see the plan view.) Water flow to the right and to the bottoms are considered positive. Don’t forget to declare the matrix for qh and qv.
Create an output model for every 100 time steps.
Run the model by creating loop for qh, qv, water storage update and models output (remember the threshold loop on latest previous exercise.)
Plot a model output using a contour plot.