$$ \newcommand{\uex}{{u_{\small\mbox{e}}}} \newcommand{\uexd}[1]{{u_{\small\mbox{e}, #1}}} \newcommand{\vex}{{v_{\small\mbox{e}}}} \newcommand{\vexd}[1]{{v_{\small\mbox{e}, #1}}} \newcommand{\Aex}{{A_{\small\mbox{e}}}} \newcommand{\half}{\frac{1}{2}} \newcommand{\halfi}{{1/2}} \newcommand{\tp}{\thinspace .} \newcommand{\Ddt}[1]{\frac{D #1}{dt}} \newcommand{\E}[1]{\hbox{E}\lbrack #1 \rbrack} \newcommand{\Var}[1]{\hbox{Var}\lbrack #1 \rbrack} \newcommand{\Std}[1]{\hbox{Std}\lbrack #1 \rbrack} \newcommand{\xpoint}{\boldsymbol{x}} \newcommand{\normalvec}{\boldsymbol{n}} \newcommand{\Oof}[1]{\mathcal{O}(#1)} \newcommand{\x}{\boldsymbol{x}} \newcommand{\X}{\boldsymbol{X}} \renewcommand{\u}{\boldsymbol{u}} \renewcommand{\v}{\boldsymbol{v}} \newcommand{\w}{\boldsymbol{w}} \newcommand{\V}{\boldsymbol{V}} \newcommand{\e}{\boldsymbol{e}} \newcommand{\f}{\boldsymbol{f}} \newcommand{\F}{\boldsymbol{F}} \newcommand{\stress}{\boldsymbol{\sigma}} \newcommand{\strain}{\boldsymbol{\varepsilon}} \newcommand{\stressc}{{\sigma}} \newcommand{\strainc}{{\varepsilon}} \newcommand{\I}{\boldsymbol{I}} \newcommand{\T}{\boldsymbol{T}} \newcommand{\dfc}{\alpha} % diffusion coefficient \newcommand{\ii}{\boldsymbol{i}} \newcommand{\jj}{\boldsymbol{j}} \newcommand{\kk}{\boldsymbol{k}} \newcommand{\ir}{\boldsymbol{i}_r} \newcommand{\ith}{\boldsymbol{i}_{\theta}} \newcommand{\iz}{\boldsymbol{i}_z} \newcommand{\Ix}{\mathcal{I}_x} \newcommand{\Iy}{\mathcal{I}_y} \newcommand{\Iz}{\mathcal{I}_z} \newcommand{\It}{\mathcal{I}_t} \newcommand{\If}{\mathcal{I}_s} % for FEM \newcommand{\Ifd}{{I_d}} % for FEM \newcommand{\Ifb}{{I_b}} % for FEM \newcommand{\setb}[1]{#1^0} % set begin \newcommand{\sete}[1]{#1^{-1}} % set end \newcommand{\setl}[1]{#1^-} \newcommand{\setr}[1]{#1^+} \newcommand{\seti}[1]{#1^i} \newcommand{\sequencei}[1]{\left\{ {#1}_i \right\}_{i\in\If}} \newcommand{\basphi}{\varphi} \newcommand{\baspsi}{\psi} \newcommand{\refphi}{\tilde\basphi} \newcommand{\psib}{\boldsymbol{\psi}} \newcommand{\sinL}[1]{\sin\left((#1+1)\pi\frac{x}{L}\right)} \newcommand{\xno}[1]{x_{#1}} \newcommand{\Xno}[1]{X_{(#1)}} \newcommand{\yno}[1]{y_{#1}} \newcommand{\Yno}[1]{Y_{(#1)}} \newcommand{\xdno}[1]{\boldsymbol{x}_{#1}} \newcommand{\dX}{\, \mathrm{d}X} \newcommand{\dx}{\, \mathrm{d}x} \newcommand{\ds}{\, \mathrm{d}s} \newcommand{\Real}{\mathbb{R}} \newcommand{\Integerp}{\mathbb{N}} \newcommand{\Integer}{\mathbb{Z}} $$ previous next

Table of contents

INF5620 in a nutshell
      The new official six-point course description
      More specific description of the contents; part 1
      More specific description of the contents; part 2
      Philosophy: simplify, understand, generalize
      The exam
      Required software
      Assumed/ideal background
      Start-up example for the course
      Start-up example
      What to learn in the start-up example; standard topics
      What to learn in the start-up example; programming topics
      What to learn in the start-up example; mathematical analysis
      What to learn in the start-up example; generalizations
Finite difference methods
      Topics in the first intro to the finite difference method
      A basic model for exponential decay
      Applications
      Continuous problem
      Discrete problem
      The steps in the finite difference method
      Step 1: Discretizing the domain
      Step 1: Discretizing the domain
      What about a mesh function between the mesh points?
      Step 2: Fulfilling the equation at discrete time points
      Step 3: Replacing derivatives by finite differences
      Step 3: Replacing derivatives by finite differences
      Step 4: Formulating a recursive algorithm
      Let us apply the scheme
      A backward difference
      The Backward Euler scheme
      A centered difference
      The Crank-Nicolson scheme; part 1
      The Crank-Nicolson scheme; part 2
      The unifying \( \theta \)-rule
      Constant time step
      Test the understanding!
      Compact operator notation for finite differences
      Compact operator notation for difference operators
      The Backward Euler scheme with operator notation
      The Forward Euler scheme with operator notation
      The Crank-Nicolson scheme with operator notation
Implementation
      Requirements of a program
      Tools to learn
      Why implement in Python?
      Why implement in Python?
      Algorithm
      Translation to Python function
      Integer division
      Doc strings
      Formatting of numbers
      Running the program
Verifying the implementation
      Simplest method: run a few algorithmic steps by hand
      Comparison with an exact discrete solution
      Making a test based on an exact discrete solution
      Test the understanding!
      Computing the numerical error as a mesh function
      Computing the norm of the error
      Norms of mesh functions
      Implementation of the norm of the error
      Comment on array vs scalar computation
Plotting solutions
      Decorating a plot
      How the plots look like
      Plotting with SciTools
Creating user interfaces
      Accessing command-line arguments
      Reading a sequence of command-line arguments
      Implementation
      Working with an argument parser
      Reading option-values pairs
      A graphical user interface
      The Parampool package
      Making a compute function
      The hard part of the compute function: the HTML code
      How to embed a PNG plot in HTML code
      Generating the user interface
      Running the web application
      More advanced use
Computing convergence rates
      Estimating the convergence rate \( r \)
      Implementation
      Execution
      Debugging via convergence rates
      Memory-saving implementation
      Memory-saving solver function
      Reading computed data from file
      Usage of memory-saving code
Software engineering
      Making a module
      Test block
      Prefixing imported functions by the module name
      Downside of module prefix notation
      Doctests
      Running doctests
      Unit testing with nose
      Basic use of nose
      Example on a nose test in the source code
      Example on a nose test in a separate file
      The habit of writing nose tests
      Purpose of a test function: raise AssertionError if failure
      Advantages of nose
      Demonstrating nose (ideas)
      Demonstrating nose (code)
      Floats as test results require careful comparison
      Test of wrong use
      Test of convergence rates
      Classical unit testing with unittest
      Basic use of unittest
      Demonstration of unittest
Implementing simple problem and solver classes
      What to learn
      The problem class
      Improved problem class
      The solver class
      The visualizer class
      Combing the classes
Implementing more advanced problem and solver classes
      A generic class for parameters
      The problem class
      The solver class
      The visualizer class
Performing scientific experiments
      Model problem and numerical solution method
      Plan for the experiments
      Typical plot summarizing the results
      Script code
      Comments to the code
      Interpreting output from other programs
      Code for grabbing output from another program
      Code for interpreting the grabbed output
      Making a report
      Publishing a complete project
Analysis of finite difference equations
      Encouraging numerical solutions
      Discouraging numerical solutions; Crank-Nicolson
      Discouraging numerical solutions; Forward Euler
      Summary of observations
      Problem setting
      Experimental investigation of oscillatory solutions
      Exact numerical solution
      Stability
      Computation of stability in this problem
      Computation of stability in this problem
      Explanation of problems with Forward Euler
      Explanation of problems with Crank-Nicolson
      Summary of stability
      Comparing amplification factors
      Plot of amplification factors
      Series expansion of amplification factors
      Error in amplification factors
      The fraction of numerical and exact amplification factors
      The true/global error at a point
      Computing the global error at a point
      Convergence
      Integrated errors
      Truncation error
      Computation of the truncation error
      The truncation error for other schemes
      Consistency, stability, and convergence
Model extensions
      Extension to a variable coefficient; Forward and Backward Euler
      Extension to a variable coefficient; Crank-Nicolson
      Extension to a variable coefficient; \( \theta \)-rule
      Extension to a variable coefficient; operator notation
      Extension to a source term
      Implementation of the generalized model problem
      Implementations of variable coefficients; functions
      Implementations of variable coefficients; classes
      Implementations of variable coefficients; lambda function
      Verification via trivial solutions
      Verification via trivial solutions; nose test
      Verification via manufactured solutions
      Linear manufactured solution
      Nose test for linear manufactured solution
      Extension to systems of ODEs
      The Backward Euler method gives a system of algebraic equations
General first-order ODEs
      Generic form
      The \( \theta \)-rule
      Implicit 2-step backward scheme
      The Leapfrog scheme
      The filtered Leapfrog scheme
      2nd-order Runge-Kutta scheme
      4th-order Runge-Kutta scheme
      2nd-order Adams-Bashforth scheme
      3rd-order Adams-Bashforth scheme
      The Odespy software
      Example: Runge-Kutta methods
      Plots from the experiments
      Example: Adaptive Runge-Kutta methods

previous next