Skip to content

Week 08 (February 26)

Donna Calhoun edited this page Mar 1, 2018 · 14 revisions

Tuesday

Discuss implementation details

  • More on node-based vs. cell-based meshes
  • Choice of norms
  • Choice of stopping criteria
  • Computing matrix vector multiply
  • Handling boundary conditions and right hand side
  • Dependence of convergence on right hand side

Added more command line switches

$ mpirun -n 4 prob1_cc --kmax 100000 --tol 1e-10 -m 10 --loglevel essential

Loglevel options : silent, essential, production, info, debug.

More additions to demo_util library

  • log level functionality

    • print_essential - only print essential information (only node 0)
    • print_production - print results for analysis (only node 0)
    • print_info - print more results for analysis/debugging (only node 0)
    • print_debug - print debug information (all processors)
    • print_global - kept for backward compatibility; same as print_essential
  • Added linspace_array - works just like Matlab command.

  • Added constant_array - creates an array and sets entries to user supplied constant value.

Homework #3 posted

  • For this assignment, you will write 5 codes. In the first two, you will implement the Jacobi method for both cell-centered and node-centered meshes. In the second two, you will implement the the Gauss-Seidel method on both type of meshes. In the last code, you will implement the Conjugate Gradient method, on a mesh of your choice. My guess is that you will spend about 60% of your time on the first two codes. After you get those working, you will find that Gauss-Seidel and Conjugate Gradient are relatively straightforward.

Sample code

A notebook showing you the basic algorithm for Jacobi, GS and CG is provided here.

Thursday

How to work with the Git repository

  • To get the latest code from our git repo, you can use the command

    $ git pull

This will automatically download and merge the latest repo code (from origin) to your repo. Alternatively, you coudl use the two commands

$ git fetch
$ git merge origin/master

If these commands don't work as expected, it is most likely because you have modified your copy of one or more files in the repo. If this is the case, you can either check out a fresh copy of the file you modified (you will lose any changes your made)

$ git status

to see what files have changed. Then

$ git checkout hmwk3_demo.c   # example!

to get a fresh copy of a file that has changed.

A better strategy is to view the class repo as a "read-only" repo. Make local copies of any files you wish to modify (preferably in a separate directory) and then you should never have any trouble pulling from the repo.

for example

  • Red-black ordering to parallelize Gauss-Seidel
  • A different approach to iterative methods : Steepest descent
  • Questions on homework

Clone this wiki locally