Chapter 20 Debuggers
A debugger is a very useful tool for developing codes, and in finding and fixing bugs introduced in the code development. Most compiler providers include a debugger as part of their software bundle. Since we are using the Portland Gro

MSC321 Homework 3
MSC321 February 10, 2011
1
1. 2. 3. 4. 5. 6.
Reviews
What are the differences between functions and subroutines? How are arguments passed to procedures in FORTRAN? What does the term "dummy argument" refer to and contrast it to an "actua

MSC321 Homework 4
Due Feb 28
1
1. 2. 3. 4.
Readings
What is the difference between an array and an array element? How may arrays be declared? What are the definitions of the rank, extent, size and shape of an array? Determine the above quantities for the

MSC321 Homework 5
b
-1
b
0
r
1
r
2
r
i-2
r
i-1
r
i
r
i+1
r
i+2
r
M
r
b
b
M +1 M +2 M +3
Figure 1: Discrete grid with halo/ghost points of depth 2 shown as halo circles numbered in red. The solid circles numbered in black are the computational points where

Chapter 8 Arrays
All variables we have used so far are scalar single values, meaning that the storage space is reserved to store only real or one double precision. Often time however we need to work with a collection of these variables. Many engineering a

Chapter 4 More on Intrisic Scalar Data Types
Fortran was developed primarily for computations and as such has built-in capabilities to deal with data types common in mathematical fields as varied as complex numbers, linear algebra, optimization, and diffe

Chapter 6 Fortran Procedures: Subprograms and Functions
Numerical programming often requires repeating the same calculations with different data and variables. Examples include having to integrate different functions or the same function over different in

Chapter 21 2D Vortex Methods
Vortex methods are powerful numerical methods to study the evolution of inviscid flow fields. The idea behind the method will be developed in the following notes.
21.1
Vorticity and Streamfunction
The 3D vorticity is defined a

Introduction
Solution of a nonlinear equation
Goal: solve an equation of the form (find x) f (x) = 0 Approximations Graphical Representation Bisection Method Newton Raphson Method (1)
Example Used Throughout
Given , h, g , find k such that 2 = gk tanh kh

Particle Tracking Project, Phase 1
This project is the starting point for the Vortex Method project and the pollution prediction projects on the sphere. The first phase is to develop the infrac-structure needed to track a number of particles in a flow fie

4
Pollution Tracking
In order to track pollutants with a particle tracking code, it is useful to imagine that the particles are actually blobs with an umbrella representing the amount of pollution they carry. This umbrella is usually represented by a Gaus

1
Text Books
Alfio Quarteroni, Fausto Saleri, and Paola Gervasio Scientific computing with MATLAB and Octave, Third Edition, Springer, New York, 2010.
2
Additional Readings
William H. Press, Brian P. Flannery, Saul A. Teukolsky, William T. Vetterling, N

Scientific Programming in Atmospheric Science MSC 321
Instructor Mohamed Iskandarani MSC 234A miskandarani@rsmas.miami.edu web site http:/www.rsmas.miami.edu/personal/miskandarani/Courses/MSC321/index.htm
Teaching Assistant Changheng Chen MSC 320 x 4045 c

MSC321 Homework 2 Due February 11
1. Write a program that will print out the value of the function defined below at 200 equally spaced set of points for -10 x 10:
f (x) =
1 + (x + 7.5) 1 - (x + 7.5) 1 - (x + 2.5)2 2 e-4(x-2.5) 1 0
-8.5 x -7.5 -7.5 x -6.

MSC321 Homework 1
Due Feb 4th 2011 1. Explain the difference between comments, variable declaration and executable statements. 2. What values are expected from the following operations (a) (2.0 + 3.0*2) / (8.0-2.0+1.0) (b) (2.0+3.0)*2 / (8.0-2.0+1.0) (c)

Amdahl
Parallel Performance
Mohamed Iskandarani
December 2, 2008
Amdahl
Outline
Amdahl
Amdahl
Amdahl's law
Definitions: ts (P) execution time of serial portion on P processors tp (P) execution time of parallel portion on P processors ts (1) + tp (1) time

Scientific Programming in Atmospheric Science MSC321 Lab 1
Learning the basics
When you login in a Linux system, you are greeted by a prompt. The prompt indicates you are talking to a shell What is a shell? A shell is a command interpreter. You type comm

Chapter 1 Introduction
The principle focus of this course is the discipline of scientific programming. The aim is to acquaint the students with how to program computers to solve analytically (pencil and paper approach) difficult but numerically tractable

Chapter 2 The Baby Steps
Computers can do arithmetic, logical operation, storing and retrieving data, and communicate with users via its input/output ports. A program is needed to coordinate these elementary operations so that useful tasks can be performe

Chapter 4 Flow Control
The programs presented so far are example of straight-line code in which the executable statements are performed exactly once in the order they appear in. Occasionally we need the computer to process the statement out-of-order, depe

Chapter 16 Boundary Element Method
We will proceed to learn about Object Oriented Programming and Design by looking at a specific example that revolves around the solution of the Laplace equation by the Boundary Element Method (BEM). The benefits of this

Chapter 11 Finite Difference Approximation of Derivatives
11.1 Introduction
u (x) = lim u(x + x) - u(x) x0 x (11.1)
The standard definition of derivative in elementary calculus is the following
Computers however cannot deal with the limit of x 0, and henc

Chapter 17 Finite Volume Method
. This chapter focusses on introducing finite volume method for the solution of partial differential equations. These methods have gained wide-spread acceptance in recent years for their robustness, their intuitive formulat

Chapter 19 Finite Volume Method for Scalar Advection in 2D
19.1 Introduction
The purpose of this exercise is to code a program to integrate the scalar advection equation in two-dimensional flows.
19.2
The 2D equation
Tt + (uT )x + (vTy ) = 0. (19.1)
The 2

Chapter 14 Finite Volume Method and Time Discretization
14.1 Introduction
The previous chapter focussed primarily on the issues of turning the partial differential equation into a finite volume formulation, and on the various ways of reconstructing the fu

Chapter 11 Coding & Numerical Integration of ODEs
11.1 Introduction
Translating algorithms into code takes art, patience, and hard work. The process can be greatly shortened by following a few rules to implement the algorithm. The sources of the algorithm

Chapter 12 Application of Finite Differences to ODE
In this chapter we explore the application of finite differences in the simplest setting possible, namely where there is only one independent variable. The equations are then referred to as ordinary diff

Chapter 10 Structures and Derived Data Types
Modern programming languages provide programmers with the mean to create and manipulate new data type, much like the intrinsic data types, like integer, real, and logical encountered so far. In C and C+, these

Chapter 14 Trapezoidal integration
The mathematical analysis of the error, EN , incurred when evaluating an integral via the trapezoidal rule using N interval
b a
f (x) dx = x
f0 fN + EN + f1 + f2 + . . . + fi + . . . + fN -1 + 2 2
(14.1)
is presented her