Modeling the Steady State Geothermal Gradient

Kendra Murray, Idaho State University, Geosciences

Author Profile
Initial Publication Date: October 6, 2026
DOI | Cite this

Summary

Students use several analytical solutions to solve for the steady-state geothermal gradient given various boundary conditions, internal heat production scenarios, and exhumation rates. This activity emphasizes how to build and call user-defined MATLAB functions.

Share your modifications and improvements to this activity through the Community Contribution Tool »

Learning Goals

In this activity, students build user-defined functions in MATLAB and use them to implement several analytical solutions to the steady-state geothermal gradient. User-defined functions facilitate systematically exploring (i.e., sensitivity testing) how different variables, such as lithospheric thickness, internal heat production, exhumation rate, impact the geotherm. As written, this activity is also an opportunity to expose students to the relationship between partial-differential equations and their analytical solutions. The specific learning goals include:

  • Describe the connection between a partial-differential equation and a specific analytical solution
  • Write user-defined functions that implement analytical solutions for the steady-state geothermal gradient
  • Call user-defined functions in scripts
  • Evaluate the sensitivity of the steady-state geothermal gradient to variables such as thermal conductivity, internal heat production, lithospheric thickness, surface temperature, and basal temperature
  • Discuss the implications of the sensitivity analysis for predicting the geothermal gradient in a specific geologic setting
  • Evaluate the sensitivity of the steady-state geothermal gradient to exhumation rate
  • Interpret the significance of the dimensionless Peclet number for choosing an appropriate steady-state solution

Context for Use

Overview

This is an activity in a "MATLAB for the Geosciences" course for undergraduate and graduate students at an R2 university. The course prerequisites are introductory geology; no previous programming experience is assumed. In this course, Geosciences topics are used to motivate students to learn programming skills. Typically, students are advanced undergraduates and MS students. The course is flipped, with students doing in-class activities in small groups during each class period.

This activity is situated about 2/3 of the way through the course, after the fundamentals of programming and MATLAB syntax have been covered and students are practicing how to write and call user-defined functions. It is a two-part activity is designed to be done in person over two 75-minute class periods. It could be easily modified to be used during a laboratory period or even as a homework assignment.

Student backgrounds

  • Geoscience background: Students will need some familiarity with the geothermal gradient and heat flow in the Earth.
  • Mathematical background: The handout includes mathematical background information (e.g., the foundational PDEs), but the equations students actually implement in MATLAB are analytical and mathematically simple. The most difficult part is keeping track of units and order of operations. The background information about PDEs could be removed or not mentioned, if that is a better fit for students.
  • MATLAB background: This activity will follow students being introduced to writing and calling user-defined functions. Students should also already know the basics MATLAB syntax, including making arrays and plots in MATLAB and using the subplot function.

Description and Teaching Materials

The student handout introduces the activity and learning goals, provides background information on heat conduction-advection equations and a steady state solution, detailed assignment instructions, and questions for students to answer. As written, the background information starts with the relevant PDEs and builds toward the analytical solutions being used in the activity; this could be simplified or removed if just introducing the analytical solutions is a better fit for a course. Regardless, the background information should be provided before class, either as required reading or presented as part of a lecture, so students are ready to jump into the activity at the start of the class period. Additionally, students should already be familiar with user-defined functions in MATLAB, so they are ready to practice writing them in this activity. Each problem is accompanied by a starter script and starter function, which parallels the structure of the student handout. These .m files can be provided to students, or not, depending on instructor preferences for scaffolding the activity.

Students are encouraged to work together, but they must produce their own functions and scripts.

Murray_MATLABworkshop2026_steadystategeotherm_v4.docx (Microsoft Word 2007 (.docx) 422kB Oct27 26)

Problem 1 introduces a simple 1-D steady state head conduction equation, assuming no exhumation, and provides an analytical solution that students are tasked to implement as a function. Then, the handout walks students through how to use this function to explore the sensitivity of the steady-state geotherm to the key variables, and asks them to apply what they learn to a geologic setting of their choice. This problem requires students to not only build a function but also call it repeatedly in a script, using different inputs. These are both skills that students commonly struggle with, and doing this as an in-class activity provides students with ample opportunity to work with peers and ask instructors for help in real time. The intention is that after completing most or all of problem 1 during the first class period, students who may have previously struggled with calling user-defined functions will be able to work through problem 2 more efficiently during the second class period.

Part1_geotherm.m (Matlab File 3kB Oct27 26), SSGEOTHERM.m (Matlab File 1021bytes Oct27 26)

Problem 2 introduces a similar 1D solution that also takes into account rock exhumation (i.e., an advection term). This problem is opportunity to repeat the skills of problem 1, with different results. It also introduces how the dimensionless Peclet number can be used to assess the competing contributions of conduction and advection in heat transport, and thus can help one simply assess what kind of analytical solution may be most useful for a particular scenario of interest. As in problem 1, students implement a provided analytical solution as a user-defined function and then write a script that calls that function, in order to explore how exhumation rate controls the shape of the geothermal gradient.

Part2_geotherm_withexhumation.m (Matlab File 2kB Oct27 26), SSGEOTHERM_WITHEXHUMATION.m (Matlab File 1kB Oct27 26)

Teaching Notes and Tips

An emphasis on user-defined functions addresses a common student struggle. Writing and calling user-defined functions is one of the things that students struggle with most in a MATLAB programming class. This exercise is designed as a Geoscience-specific example of why user-defined functions are useful. It provides students in-class opportunities to work through the things they find confusing about user-defined functions.

Keeping track of units is essential. This is emphasized in the handout and instructions, but students may still struggle.


Assessment

To facilitate helping students write their functions, each problem provides an output answer for a specific function input. Students can use this to self-evaluate if their function is producing the correct answer and get help as needed, before calling the function to complete the activity tasks.

For the programming-related learning goals, student work is graded on the completeness, commenting, and functionality of the functions and scripts. In this course, the quality and completeness of plots is also emphasized. Narrative answers to the questions posed in the student handout are used to evaluate the depth of student understanding of how the results they produce relate to the equations they are solving.

For the geosciences-related learning goals, student work is graded on the quality of narrative answers to specific questions in the assignment. Students should make clear and specific connections among the mathematical solutions and how they may or may not accurately represent the real-world geothermal gradient at a level appropriate for their geoscience background or training.

Instructor Keys: Part1_geotherm_KEY.m (Matlab File 7kB Oct27 26), SSGEOTHERM_KEY.m (Matlab File 944bytes Oct27 26), Part2_geotherm_withexhumation_KEY.m (Matlab File 2kB Oct27 26), SSGEOTHERM_WITHEXHUMATION_KEY.m (Matlab File 1kB Oct27 26)

References and Resources

Mancktelow, N.S., and Grasemann, B., 1997, Time-dependent effects of heat advection and topography on cooling histories during erosion: Tectonophysics, v. 270, p. 167–195, doi:10.1016/s0040-1951(96)00279-x.

Turcotte, D.L., and Schubert, G., 2002, Geodynamics: Cambridge University Press, Cambridge University Press.