Transitioning from Excel to MATLAB Diffusion Models
Upon completion of this assignment students should:
- have the ability to transfer work from a visual-based program (Excel) to a computational program (MATLAB)
- regularly comment their code to describe the purpose of each line or each section and the relevant references for given values (T, P, fO2, diffusion coefficients)
- be able to implement a for loop to run calculations that iterate through time (e.g., time steps)- be able to quantify the effects of variations in the geological parameters implemented in the model (e.g., temperature, crystal orientation) on the retrieved timescale
Context for Use
Students should have some background in igneous and metamorphic petrology/geochemistry, and some familiarity with the basics of MATLAB. Earlier in this course I provide a lab session "Intro to MATLAB Crash Course" to introduce basic functions and program features. I use this activity around weeks 4-5 as the first model development for fitting natural data. A key skill introduced in this exercise is the implementation of a for loop for iterative calculations.
Description and Teaching Materials
x.mat (Matlab .MAT File 260bytes Nov6 19)
Fo_initial.mat (Matlab .MAT File 205bytes Nov6 19)
x_EPMA.mat (Matlab .MAT File 224bytes Nov6 19)
Fo_EPMA.mat (Matlab .MAT File 444bytes Nov6 19)
DiffusionPractical_Data.xlsx (Excel 2007 (.xlsx) 368kB Aug9 19)
Student Handout for Diffusion Practical (Microsoft Word 25kB Oct14 19)
Instructor Example Script (Matlab File 2kB Nov6 19)
AssessmentRubric.docx (Microsoft Word 2007 (.docx) 13kB Nov6 19)
Teaching Notes and Tips
Throughout this exercise, it is useful for the instructor to show small sections of code on the projector, especially if several groups of students are struggling with how to implement the equations. As an example, for loops can be a challenge if students have not used them before.
References and Resources
Useful references, which are included in the assignment materials, include:
Crank, J. (1975). The Mathematics of Diffusion, 2nd ed. Oxford Science Publications, Oxford.
Dohmen, R. and Chakraborty, S. (2007a). Fe-Mg diffusion in olivine II: point defect chemistry, change of diffusion mechanisms and a model for calculation of diffusion coefficients in natural olivine. Physics and Chemistry of Minerals, 34, 409-430. doi: 10.1007/s00269-007-0158-6.
Dohmen, R., and Chakraborty, S. (2007b). Erratum to: Fe-Mg diffusion in olivine II: point defect chemistry, change of diffusion mechanisms and a model for calculation of diffusion coefficients in natural olivine. Physics and Chemistry of Minerals, 34, 597-598. doi: 10.1007/s00269-007-0185-3.
Helz, R., and Thornber, T. (1987) Geothermometry of Kilauea Iki lava lake, Hawaii. Bulletin of Volcanology, 49, 651-668. doi: 10.1007/BF01080357.
Lynn, K.J., Garcia, M.O., Shea, T., Costa, F., and Swanson, D.A. (2017). Timescales of mixing and storage for Keanakāko'i Tephra magmas (1500-1820 C.E.), Kīlauea Volcano, Hawai'i. Contributions to Mineralogy and Petrology, 172, 76. doi: 10.1007/s00410-017-1395-4.