Numerical Simulation Basics: Part II – Boundary Conditions & Numerical Stability for a Finite-Difference Equation
Summary
Learning Goals
2. Students learn numerical simulation models in the geosciences must represent physical processes which will evolve in time within a spatial domain. These models must incorporate boundary conditions which are applied at the edges of the model domain to evolve,
3. Students learn about numerical stability and how numerical stability criteria relate to simulation model parameters such as time step size and spatial grid size and what instability looks like,
4. Students learn numerical simulation models can be a useful tool to investigate the influence of parameters, such as turbulent diffusion, on a physical system,
5. Students learn that while it may not be possible to properly validate a numerical simulation model in the geosciences, model results should, as a minimum, be compared to observations.
Context for Use
This activity is taught as part of the laboratory component for a junior-level physical oceanography course with class sizes up to 20 students. Prerequisites for this class include calculus-based physics, introductory statistics and introductory computer science. Overall, the laboratory includes three modules: (1) introduction to scientific computer programming in MATLAB, (2) hands-on experiments in physical oceanography and (3) web-based activities associated with physical oceanography. Data processing, analysis and visualization using MATLAB are introduced in module one and reinforced in modules two and three.
This is the second and last activity in a set introducing students to rudimentary numerical simulation methods it occurs in the last weeks of the course, so students have good basic programming skills. While the first activity focuses on numerical accuracy and model validation, this activity introduces the concepts of boundary conditions and numerical stability.
This second activity incorporates the physical processes of advection and diffusion (learned earlier in the course) into a hypothetical start for an El Nino event thereby keeping students' attention on oceanography.
The instructor reviews a 3-page discussion document (attached) and a partially complete M-file (attached) during the first 15 minutes of the laboratory period. Each group then has the remainder of the laboratory period and the following week to complete the assignment.
Description and Teaching Materials
This activity is the second part of a three week-long assignment in a junior-level physical oceanography course. Pre-requisites for this class include: two semesters of calculus-based physics, introductory statistics, and introductory computer science. The students have one semester experience with programming typically in the Java or Python languages. There are typically 16 students in the class.
The primary focus of the physical oceanography laboratory is introducing students to scientific computer programming in MATLAB, so the first six weeks of laboratory sessions are used to teach MATLAB basics. During this period, we review the first two-thirds of the textbook "Essential MATLAB for Scientists and Engineers" B. Hahn and D. Valentine (see references). The last eight weeks of the course are used to apply computational methods towards solving problems in physical oceanography, including data processing, analysis and visualization using MATLAB as well as numerical simulation basics.
The first activity introduces students to rudimentary numerical simulation methods. It establishes a numerical model for a freely falling object – a concept students are familiar with from prerequisite courses and from life experience. Its focus is to teach about numerical accuracy (1st and 2nd order schemes) and that all numerical simulation models should be validated. The first activity is stand-alone and can be used in a variety of science and engineering courses. It is available at: https://serc.carleton.edu/teaching_computation/workshop_2023/activities/279846.html
This second activity (Part II) develops a more complex numerical model directly related to physical oceanography. The physical process of interest is a hypothetical migration of the western tropical Pacific warm pool eastward along the equator in association with an incipient El Nino event. This situation is modeled using a partial differential equation – a simple one-dimensional temperature advection process with diffusion, it is not intended to capture the features of an equatorial Kelvin wave. Numerical simulation concepts introduced in Part II include generating a uniform spatial grid in geophysical coordinates, developing open boundary conditions and investigation of numerical stability criteria. This Part II assignment is taught during the subsequent two laboratory periods.
Numerical Simulation Basics (Part II): Activity Description (Acrobat (PDF) 229kB Oct10 24)
Numerical Simulation Basics (Part II): Hand-written Assignment (Acrobat (PDF) 120kB Oct10 24)
Numerical Simulation Basics (Part II): M-file, Advection Only (Matlab File 6kB Oct10 24)
Numerical Simulation Basics (Part II): M-file, Advection with Diffusion (Matlab File 5kB Oct10 24)
Teaching Notes and Tips
It is important to have the students start work on the assignment by completing the initial questions in the hand-written assignment. These questions focus student attention on the recursion relations for advection, diffusion, and the boundary conditions. This will allow a significant portion of the programming to be completed efficiently during the initial laboratory session when the instructor is available to answer questions as the students write code.
It should be stressed to the students they must get their programs to function during the week-long period between laboratory sessions. Then the second laboratory session allotted for this activity can be spent by the students using their functioning code to investigate the model parameter (e.g., eddy diffusivity, time-step size, grid-space size) influences on numerical stability and to complete the assigned deliverables.
Assessment
For each MATLAB activity, students are given a list of Deliverables. Completion of these deliverables should ensure students meet the goals for the activity. The deliverables for the activity include submittal of:
1. individually hand-written answers to questions posed in handouts,
2. an M-file script for the group of two students,
3. a two-dimensional graphic, properly annotated with titles and axis labels. This graphic is a longitude-time Hovmoller diagram.
The hand-written questionnaires (attached) and the Hovmoller diagram (figure 1 in the discussion attachment) are manually graded, with scores based on points for each answer. The instructor has access to and runs the M-file script from each group of two students – this script must function properly.
References and Resources
This is Part II of a two part activity wherein students learn the basic concepts and methods of numerical simulation. Part I is available at:
https://serc.carleton.edu/teaching_computation/workshop_2023/activities/279846.html
Print resources include two textbooks:
Textbook: "Essential MATLAB for Scientists and Engineers", Fifth Edition, Chapter 12 and Chapter 14; B. Hahn and D. Valentine, ISBN-13 978-0123943989
Reference: "A First Course in Atmospheric Numerical Modeling", First Edition; A. DeCaria and G. Van Knowe, ISBN-13 978-0972903349