Wednesday, October 14, 2015

3D Rainfall Model in Netlogo

Hi, recently I have developed a 3D rainfall model using Netlogo. The model shows how Netolog can display elevation in a 3D model, and run simulation based on the elevation. The raindrops are also created in a 3D way for visualization.The map being used here is the Crake Lake. I use the ASCII file obtained from nationalmap.gov.

Here is a video recording the simulation process.



Please find the code here:
https://github.com/YangZhouCSS/Rainfall_Model_3D

See this post for the 2D version of this model:
http://geospatialcss.blogspot.com/2015/10/rainfall-model-of-crater-lake-national.html

I would like to briefly introduce how I created this model in Netlogo.

The method I used to visualize the elevation in a 3D way is inspired by Netlogo's Hill Climbing 3D. Netlogo does not have a built-in function to create a surface based on elevation data. What I did is that I asked patches with pzcor = 0 to read the elevation data, and each create a turtle at zcor equal to the elevation. Then, I use  the comment "create-links-with turtles-on neighbors" to create links between the turtles created in the last step, then I hide the turtles. In this way, a "surface" will be created, at least, it looks like a surface for visualization purpose.

The way I created the raindrops falling is inspired by Netlogo's Raindrops 3D. I created turtles representing raindrops at the top of the world, and ask them to face down and forward 2 steps in a tick, until they reach the surface.

To move the raindrops on the surface, it is more tricky. Patches at the base (those with pzcor = 0) have a variable called [top], which measures the elevation plus water height here. The raindrops read the variable [top] and flow to patches with lowest top.

I hope you enjoy this post!


No comments:

Post a Comment