next up previous contents
Next: Lock exchange Up: Time accuracy Previous: Boundary conditions   Contents

Running the test

The accuracy test case is run at the command line with

make test
This will compile the local initial and boundary condition files and link them with the executable ../../sun. The script accuracy.sh loops through different time step sizes given by $\Delta t_n = \Delta t_0/2^n$, with $n=0,1,\dots,5$, where $\Delta t_0 = 0.1$ s. If the reference solution is given by the solution $\phi^{ref}$ with a time step size of $\Delta t_0/32$, then the error between a solution using $\Delta t=\Delta t_0/2^n$ and the reference solution can be calculated with

\begin{displaymath}
Error(n)^2 = \frac{\sum_{i=0}^{Nc-1}\sum_{k=0}^{N_{kmax}-1} ...
...-1}\sum_{k=0}^{N_{kmax}-1} \left(\phi^{ref}_{i,k}\right)^2} .
\end{displaymath}

Since this is a second-order method, we must have $Error(n)/Error(n-1)=4$ since the time step size for $Error(n)$ is double that of $Error(n-1)$. Therefore, $Error(n)/Error(0) = 4^n = (\Delta t_0/\Delta t_n)^2$, $n=0,1,\dots,4$. After the accuracy.sh script finishes, the results are analyzed with the code in accuracy.c, which computes $Error(n)$. The output of this code is given by
Error results (Error(n)/Error(0)):

Your results:
--------------------------------------------------
dt0/dt  U       W       S       Q       Q0      h
--------------------------------------------------
1       1.0     1.0     1.0     1.0     1.0     1.0
2       3.9     3.9     4.0     4.1     1.2     4.0
4       15.6    15.5    16.2    16.4    2.1     16.4
8       65.1    64.8    68.1    68.9    4.4     69.1
16      324.7   323.5   340.6   344.8   12.8    345.9

Reference results:
1       1.0     1.0     1.0     1.0     1.0     1.0
2       3.9     3.9     4.0     4.1     1.2     4.0
4       15.6    15.5    16.2    16.4    2.1     16.4
8       65.1    64.8    68.1    68.9    4.4     69.1
16      324.7   323.5   340.6   344.8   12.8    345.9

Difference (relative):
1       0.00    0.00    0.00    0.00    0.00    0.00
2       -0.00   0.00    0.00    0.00    0.00    -0.00
4       -0.00   0.00    0.00    0.00    0.00    -0.00
8       -0.00   0.00    0.00    0.00    0.00    -0.00
16      -0.00   0.00    0.00    0.00    0.00    -0.00
The code outputs the results from the current run, then displays the results that have been saved from a working version of this simulation, and then plots the relative difference between your results and the stored results as

\begin{displaymath}
\mbox{Difference} = \frac{\mbox{Your($Error(n)/Error(0)$)} -...
...$Error(n)/Error(0)$)}}
{\mbox{Stored($Error(n)/Error(0)$)}} .
\end{displaymath}

Each column represents: The first time you download and run the examples, the results you obtain should be identical to the stored results since they were obtained with the same code, and the relative difference should be identically zero. Changing parts of the code may or may not affect the accuracy, but if it does then this will be reflected by nonzero values for the relative difference.


next up previous contents
Next: Lock exchange Up: Time accuracy Previous: Boundary conditions   Contents
2014-08-06