Scientific Programing and Numerical Computation


Instructor:  Wu-ting Tsai    wttsai@ntu.edu.tw

Teaching Assistant: Guan-hung Lu   d01525011@ntu.edu.tw

 Prerequisites: calculus

Recommended textbooks: 
     Stephen Chapman, Fortran 95/2003 for Scientists and Engineers, 3rd edition, McGraw-Hill Higher Education, 2007
     Parviz Moin, Fundamentals of Engineering Numerical Analysis, Cambridge University Press, 2010

Format of class:  one to two hours of lecture plus two to three hours of programming practice

Recommended Fortran compiler:
    
GNU Fortran
     To use GNU Fortran in Microsoft Window you can use Minimalist GNU for Windows (MinGW) or Cygwin
     GNU Fortran Wiki
     GNU Fortran on Chinese Wiki
     OpenMP in GNU Fortran    

Recommended editor:
     GNU Emacs
     GNU Emacs on Chinese Wiki

Download:
     A zipped folder containing
MinGW, GNU Emacs and cmd to start Fortran compiler and Emacs

    
A zipped folder containing GNU Emacs
 
    A zipped file containing built library of BLAS and Lapack  (unzip the files and put in GNU_emacs_Fortran folder)
     A zipped file containing built library of FFTW  (unzip the files and put in GNU_emacs_Fortran folder)

Homework:
    In-class and take-home exercises are for practice and will not be graded
   
No need to turn in the homework

Grade: midterm quiz and/or final examination and/or take-home projects
 
Class calendar:
15 classes and 2 in-class exams in 2017 Fall semester

September
October
November
December
January
Su
M
Tu
W
Th
F
Sa
Su
M
Tu
W
Th
F
Sa
Su
M
Tu
W
Th
F
Sa
Su
M
Tu
W
Th
Fr
Sa
Su
M
Tu
W
Th
Fr
Sa





1
2
1
2
3
4
5
6
7



1
2
3
4





1
2
31
1
2
3
4
5
6
3
4
5
6
7
8
9
8
9
10
11
12
13
14
5
6
7
8
9
10
11
3
4
5
6
7
8
9
7
8
9
10
11
12
13
10
11
12
13
14
15
16
15
16
17
18
19
20
21
12
13
14
15
16
17
18
10
11
12
13
14
15
16
14
15
16
17
18
19
20
17
18
19
20
21
22
23
22
23
24
25
26
27
28
19
20
21
22
23
24
25
17
18
19
20
21
22
23
21
22
23
24
25
26
27
24
25
26
27
28
29
30
29
30
31




26
27
28
29
30


24
25
26
27
28
29
30
28
29
30
31




 Syllabus:This is a good faith estimate -- it is subject to change


Topics
Reading
Examples
1
Introduction
Using Intel Fortran Compiler

1.1 ~ 1.6  
2
Basic Elements of Fortran 2.1 ~ 2.11
2-2.f90  2-6.f90
3
Program Design and Branching Structures

3.1  3.2  3.4

test_logical.f90  3-10.f90
4
Loops Structures 4.1
4-4.f90  4-8.f90  4-10.f90
5
Input and Output 5.1  5.3   5.4   5.5
 
6
Arrays 6.1 ~ 6.4 
6-7.f90
7
More on Input and Output
  • Data files and file processing (open & close)
  • More on Arrays
  • Multi-dimensional arrays
  • Allocatable arrays (dynamic memory allocation)

  • 5.5 

    8.1  8.2 
    8.6


    6-15.f90

    chap8_eg.f90

    8
    Procedures and Structured Programming 7.1  9.3  7.4
    chap7_eg.f90
    9
    Linear Algebra Computation & Test Driver
  • Random number generation
  • Basic linear algebra computation
  • Example 7-4
    netlib BLAS
    netlib Lapack
    BLAS Quick Reference Guide
    LAPACK Quick Reference Guide
    LAPACK Quick Reference Guide to Driver Routines
    Preliminary LAPACK Users' Guide

    t_intr_random.f90
    t_random.f90   random.f90
    t_comp_random.f90
    example_blas.f90
    t_blas.f90
    example_lapack.f90
    10
    -  Midterm examination on November 7
       How to turn in program


    11
    Additional Intrinsic Data Types 11.1  
    pi.f90  kinds.f90  sel_kind_1.f90
    sel_kind_2.f90
    12
    Module
    interface_example.f90
    t_explicit.f90  t_implicit.f90
    t_keywords.f90  t_optional.f90
    t_random1.f90  t_rename_mod.f90 
    t_rest_acc.f90
    13
    Discrete Fourier Transform
  • Discrete Fourier analysis


  • 14

  • Fast Fourier transform
  • Numerical Recipes
    ECMWF FFT (Temperton's routines)
    NCAR FFTpack
      (Swarztrauber's routines)
    FFTW
    example_FFTW.f90
    t_NR_fft.f90   NR_fft.f
    t_NCAR_fft.f90 NCAR_fft.f
    t_fftw.f90   fftw3.f90
    15

  • Spectral numerical differentiation

  • t_specderiv.f90 t_specderiv_2.f90
    16

  • Solution of Poisson equation using spectral method


  • 17

  • Numerical filtering


  • 18
    Finite-Difference Approximation


    19
    Low-Storage Runge-Kutta Scheme

    20
    Data Analysis
  • Cubic spline interpolation
  • Empirical mode decomposition


  • 21
    Parallel Computing Using OpenMP







     Why learn/teach FORTRAN in the 21th century?

    Learning

    Resources

    Computation

    Free but good utilities for research
         Gnuplot  (a portable command-line driven graphing utility)    
         Octave  (freeware similar to Matlab)
         Maxima  (a descendant of Macsyma, a legendary symbolic algebra system developed in the late 1960s at MIT)
         Scilab  (an alternative choice if you cannot afford Matlab)