Is there any terrain height simulator library available?

I am looking for a library for three.js which can help in creating an uneven terrain. In time i would want to simulate rainfall on that terrain so see how the water would flow through it. And also define different types of soil for different absorption level.
I am currently trying to integrate the editor into a java application. Any help and/or advise is very much appreciated.