Using Visual Basic to model geoscience processes.


Reading: Read appropriate parts of the VB help files. Your focus this week should be on learning VB in the context of your project.


VB graphical space coordinate system: If you just want to crunch numbers then you can do quite a bit using VBA in Excel. However, visualization can be very helpful in providing understanding and so you need to depict the results in some graphical space. Hence we will focus on how to do this.

The default scale is in twips, with 567 twips = 1 cm. A number of other possible scale modes are provided and are set using the ScaleMode = k code, where k specifies the type of code. See documentation for a description of possibilities. ScaleMode = 6 uses millimeters and ScaleMode = 7 uses centimeters. you can define your own vertical and horizontal scales (but better to keep it simple for this exercise).

The origin is at the upper left corner of the form. Positive x is to the right. Positive y is down! Note the latter! Luckily it is easier for geoscientists to think of thinks increasing as you go down (e.g. temperature and pressure).

VB graphics command: these are some commands likely to be useful.

Timer object: This is very useful for doing incremental graphics at the speed of the viewer, i.e. for creating animations. For modeling processes with a visualization component it particularly useful. Associated code is performed at specified event intervals. Units are milliseconds and the interval is specified in the Properties window. It can be initiated and stopped by setting the abled or disabled property anywhere in the program.

Turn the AutoRedraw function of your form on in the Properties window.

Suggestion: Create a folder on a disk and save all your work consistently there. Things can get screwed up easily if you are shuffling VB files around.

Example: modeling gravity profiles over a buried sphere. gz in milligals = .02794 * density contrast in gm/cc * radius in meters cubed * depth in meters all divided by (x^2+z^2)^1.5, where x is horizontal distance from center of sphere in meters (formula from Lillie, 1999, Whole Earth Geophysics, Prentice Hall)


Exercise 12: The basic task for this week is to compile a program in Visual Basic that models some type of geologic process. In order for this to be doable as a one-week exercise the model needs to be very simple. Still, you can find a lot of insight with even some simple models. I expect to see you a lot this week as this will be one of the more difficult assignments for some of you (in other words do not hesitate to come in and get help). Your program should allow the user to set basic parameters and then display the result of the modeling. Suggested processes you can model are described below. Again, bonus points for coming up with your own.

What you need to hand in:

Possible geologic processes to model:

Modeling of radioactive decay. The model should model an assemblage of atoms of an unstable isotope that is undergoing decay. The user should be able to change the decay rate. It would be helpful if some sort of plot of the decay process also developed as the visualization was running.

Modeling of a fracture intersection pattern. A propagating fracture may truncate (stop propagating) when it encounters another fracture. The model should randomly seed a fracture at a point and then propagate it until it encounters another fracture. There can be many variants on this program depending on various rules you devise for fracture propagation directions. The Point(x,y) function that returns the color value of a point is very useful here. Note that this is also a fragmentation behavior.

Modeling of a styolite. Start out with a straight line (a long linear array) and then using the random number generator dissolve an element on either one side or the other as you go down the line. Have the program go through at least several hundred reiterations to see how the line evolves in its shape. Markers on either side should also move showing the dissolution with time.

Modeling of a dendritic growth with time. Start with a point and add points to it with time within a 180 degree range with some sort of branching rule built in. Since you are restricted to 180 degrees there will be a gradient to the growth and you won't get the problem of a tip growing back on itself. Given the pixel mode their will be 5 possible ways for the tip to move. One possible branching rule could be that if the tip is at > a certain distance from any other tip it branches, otherwise it doesn't. The tip positions could be stored as x,y values in an array.

Slip events on a linear array: Have a linear array that represents the shear stress values of elements. Using a loop a shear stress increment can be added along the the array. When the the shear stress exceeds a certain value that specific elements slips and transmits some portion of its shear stress to its neighbor element. If that element slips then it transmits more shear stress down the line. Of course if all the initial shear stress values are the same then it will always propagate all the way down the line, but for all sorts of reasons shear stress can be expected to vary. Therefore seed the array with random variations in initial shear stress values. The random variation should be several times the increment added, but less than the critical shear stress necessary for slip. The goal is to produce slip events of different sizes (with different number of elements that move).

Daisyworld temperature evolution: This one is well written up in the literature. Imagine a surface populated by black and white daisies. The daisies, through their albedo control the local temperature. As more black daisies grow the temperature would increase, but such a temperature increase favors white daisies, which would cool the system. The opposite feedback would occur. Treat it as a probability distribution of survival over a temperature range. For example at 40 degrees black daisies may have a 100% chance of surviving, at 60 degrees a 50 % chance of surviving, and at 80 degrees a 0% chance of surviving. Tie this with a temperature effect. For example at 100% black daisies the temperature increases 1 degree per increment of time, and with 100% white daisies it decreases 1 degree per increment of time. Start with 50-50% distribution of daisies and set a temperature this is not in stability with and watch how the pattern and the temperature evolves.


Copyright by Harmon D. Maher Jr.. This material may be used for non-profit educational purposes if proper attribution is given. Otherwise please contact Harmon D. Maher Jr.