            ===============================
            Comparison of ScaFES with PETSc
            ===============================

Problem
=======
2D Heat Equation on unit square.
* Given initial solution
  utilde(x,y) := x*(x-0.5)*(x-0.5)*(1-x) * y*(y-0.5)*(y-0.5)*(1-y)
* Find u = u(x,y) such that
          \partial_t(u) - (u_xx + u_yy) = 0    in \Omega:=(0,1)^2,
          u(., 0) = utilde                     in \Omega,
          u(. , t) = 0                         on \partial\Omega.

Discretized Problem
===================
* Discretization in space: Finite Difference Method.
* Discretization in time:  Forward Euler method.
* Let n the number of grid nodes in dimension x.
* Let m the number of grid nodes in dimension y.
* Assume that n = m ===> h:= h_x = h_y.
* Let dt the given time step size.
* Find U^{n+1} such that
       U^{n+1}_{i,j} = ( -4 U^{n}_{i,j} + U^{n}_{i+1,j}+ U^{n}_{i,j+1}
                                    + U^{n}_{i-1,j}+ U^{n}_{i,j-1} ) * dt/(h^2)
                           + U^{n}_{i,j}  for all i, j = 1, ..., n-1



                     =======================
                     Implementation in PETSc
                     =======================

* The problem is formulated as A*U = F in each time step.
* The source code is an extension of the PETSc example

             petsc/src/ts/examples/tutorials/ex4.c

  which solves the 1D heat equation using finite differences and the Euler
  method with parallel PETSc matrices and PETSc vectors.
  The source code is free available under the PETSc BSD-style license.
* The CPU time needed for solving the system A*U = F is measured.


Visualization of the results
============================
Three files will be written:
Each file was created using PETSc::VecView(),
* xx.data     Grid in x direction.
* yy.data     Grid in y direction.
* value.data  Solution vector.

Remark: As the voundary conditions are incorperated in the matrix vector
        formulation, these conditions are not included in the data file.

* Collect all files in one file using a Python script.

    python createPlotfile.py

Remark: The number of rows must be set in createPlotfile.py
        plus 3 for PETSc header.

* Open the created file solutionUh.3D using VisIt:

      - open -> solutionUh.3D (Open file as type: Guess from file/extension)
        -> Add -> Pseudocolor -> value -> Draw
      - PlotAtts -> Pseudocolor -> PointSize = 20 -> Apply


                        =============
                        Scaling Tests
                        =============

Strong scaling tests for both implementations were performed by 
executing the following shell scripts: 

    ./submitJobsPetscStrongScalingMpi.sh
    ./submitJobsScafesStrongScalingMpi.sh

                        ===================
                        Performance Results
                        ===================

All performance results can be found in the folder "results".


                        ====================================
                        Visualization of Performance Results
                        ====================================

Performance results can be visualized using Gnuplot:

* Strong scaling test w.r.t. MPI for ScaFES and PETSc:

    gnuplot ZIH_ATLAS-cputimes_mpi-scafes_vs_petsc.plt

* Strong scaling test w.r.t. OpenMP for ScaFES and PETSc:

    gnuplot ZIH_ATLAS-scaling_strong_openmp-scafes.plt

