$$ \newcommand{\tp}{\thinspace .} $$

 

 

 

Scientific software engineering; wave equation model

Hans Petter Langtangen [1, 2]

[1] Center for Biomedical Computing, Simula Research Laboratory
[2] Department of Informatics, University of Oslo

Oct 20, 2015


Warning. This document is in a very incomplete state!

Table of contents

A 1D wave equation simulator
      Mathematical model
      Numerical discretization
      A solver function
Saving large arrays in files
      Using savez to store arrays in files
      Using joblib to store arrays in files
      Using a hash to create a file or directory name
Software for the 1D wave equation
      Making hash strings from input data
      Avoiding rerunning previously run cases
      Verification
Programming the solver with classes
      Class Problem
      Class Mesh
      Class Function
      Class Solver
Migrating loops to Cython
      Declaring variables and annotating the code
      Visual inspection of the C translation
      Building the extension module
      Calling the Cython function from Python
Migrating loops to Fortran
      The Fortran subroutine
      Building the Fortran module with f2py
      How to avoid array copying
Migrating loops to C via Cython
      Translating index pairs to single indices
      The complete C code
      The Cython interface file
      Building the extension module
Migrating loops to C via f2py
      Migrating loops to C++ via f2py
Exercises
      Exercise 1: Make an improved numpy.savez function
Bibliography

Read »