<TABLE WIDTH="60%" ALIGN="center">
<tr>
<td ALIGN="center">
- @image html grid-1.jpg
- <br>
- <a href="step-1.data/grid-1.jpg">(Click here for original
- version)</a>
+ @image html step-1.grid-1.jpg
</td>
<td ALIGN="center">
- @image html grid-2.jpg
- <br>
- <a href="step-1.data/grid-2.jpg">(Click here for original
- version)</a>
+ @image html step-1.grid-2.jpg
</td>
</tr>
</table>
<TABLE WIDTH="60%" ALIGN="center">
<tr>
<td ALIGN="center">
- @image html sparsity_pattern_1.jpg
- <br>
- <a href="step-2.data/sparsity_pattern_1.jpg">(Click here for original
- version)</a>
+ @image html step-2.sparsity-1.png
</td>
<td ALIGN="center">
- @image html sparsity_pattern_2.jpg
- <br>
- <a href="step-2.data/sparsity_pattern_2.jpg">(Click here for original
- version)</a>
+ @image html step-2.sparsity-2.png
</td>
</tr>
</table>
@endcode
to get the result at the right:
-<TABLE WIDTH="100%">
-<tr>
-<td>
-<IMG SRC="step-3.data/solution-1.jpg" ALT="solution-1" WIDTH="300">
-</td>
-<td>
-<IMG SRC="step-3.data/solution-2.jpg" ALT="solution-2" WIDTH="300">
-</td>
-</tr>
+<TABLE WIDTH="60%" ALIGN="center">
+ <tr>
+ <td ALIGN="center">
+ @image html step-3.solution-1.png
+ </td>
+
+ <td ALIGN="center">
+ @image html step-3.solution-2.png
+ </td>
+ </tr>
</table>
<a name="Results"></a>
<h1>Results</h1>
-<p>
+
The output of the program looks as follows (the number of iterations
may vary by one or two, depending on your computer, since this is
often dependent on the round-off accuracy of floating point
operations, which differs between processors):
-<pre><code>
+@code
Solving problem in 2 space dimensions.
Number of active cells: 256
Total number of cells: 341
Total number of cells: 4681
Number of degrees of freedom: 4913
30 CG iterations needed to obtain convergence.
-</code></pre>
+@endcode
It is obvious that in three spatial dimensions the number of cells and
therefore also the number of degrees of freedom is
much higher. What cannot be seen here, is that besides this higher
dimensions. Together, this leads to a much higher numerical effort for
solving the system of equation, which you can feel when you actually
run the program.
-</p>
-<p>
+
+
The program produces two files: <code>solution-2d.gmv</code> and
<code>solution-3d.gmv</code>, which can be viewed using the program
GMV (in case you do not have that program, you can easily change the
output format in the program to something which you can view more
easily). From the two-dimensional output, we have produced the
following two pictures:
-</p>
-
-<p>
-<TABLE WIDTH="100%">
-<tr>
-<td>
-<IMG SRC="step-4.data/solution-2d.jpg" ALT="solution-2d" HEIGHT="300">
-</td>
-<td>
-<IMG SRC="step-4.data/grid-2d.jpg" ALT="grid-2d" HEIGHT="300">
-</td>
-</tr>
+
+
+
+<TABLE WIDTH="60%" ALIGN="center">
+ <tr>
+ <td ALIGN="center">
+ @image html step-4.solution-2d.png
+ </td>
+
+ <td ALIGN="center">
+ @image html step-4.grid-2d.png
+ </td>
+ </tr>
</table>
-</p>
-<p>
+
The left one shows the solution of the problem under consideration as
a 3D plot. As can be seen, the solution is almost flat in the interior
of the domain and has a higher curvature near the boundary. This, of
the domain, where also the solution is moving most rapidly.
It is also nice to see that the solution follows the desired quadratic
boundary values along the boundaries of the domain.
-</p>
-<p>
+
+
The right picture shows the two dimensional grid, colorized by the
values of the solution function. This is not very exciting, but the
colors are nice.
-</p>
-<p>
+
+
In three spatial dimensions, visualization is a bit more difficult. To
the left, you can see the solution at three of the six outer faces of
the cube in which we solved the equation, and on a plane through the
origin. On some of the planes, the cut through the grid is also shown.
-</p>
-
-<p>
-<TABLE WIDTH="100%">
-<tr>
-<td>
-<IMG SRC="step-4.data/solution-3d.jpg" ALT="solution-3d" HEIGHT="300">
-</td>
-<td>
-<IMG SRC="step-4.data/grid-3d.jpg" ALT="grid-3d" HEIGHT="300">
-</td>
-</tr>
+
+
+
+<TABLE WIDTH="60%" ALIGN="center">
+ <tr>
+ <td ALIGN="center">
+ @image html step-4.solution-3d.png
+ </td>
+
+ <td ALIGN="center">
+ @image html step-4.grid-3d.png
+ </td>
+ </tr>
</table>
-</p>
-<p>
+
+
The right picture shows the three dimensional grid, colorized by the
solutions values. 3D grids are difficult to visualize, which can be
seen here already, even though the grid is not even locally refined.
-</p>
+
<a name="extensions"></a>
<h3>Possibilities for extensions</h3>
-<p>
+
Essentially the possibilities for playing around with the program are the same
as for the previous one, except that the will now also apply to the 3d
-case. For inspiration read up on <a href="step-3.html#extensions"
+case. For inspiration read up on <a href="step_3.html#extensions"
target="body">possible extensions in the documentation of step-3</a>.
-</p>
+
<a name="Results"></a>
<h1>Results</h1>
-<p>
+
When the last block in <code>main()</code> is commented in, the output
of the program looks as follows:
-<pre><code>
+@code
Cycle 0:
Number of active cells: 20
Total number of cells: 20
#1 ./step-5: main
--------------------------------------------------------
make: *** [run] Aborted
-</code></pre>
-</p>
+@endcode
+
+
-<p>
Let's first focus on the things before the error:
In each cycle, the number of cells quadruples and the number of CG
iterations roughly doubles.
Also, in each cycle, the program writes one output graphic file in EPS
format. They are depicted in the following:
-</p>
-<p>
+
+
<TABLE WIDTH="100%">
-<tr>
-<td>
-<IMG SRC="step-5.data/solution-0.jpg" ALT="solution-0" WIDTH="300">
-</td>
-<td>
-<IMG SRC="step-5.data/solution-1.jpg" ALT="solution-1" WIDTH="300">
-</td>
-</tr>
-
-<tr>
-<td>
-<IMG SRC="step-5.data/solution-2.jpg" ALT="solution-2" WIDTH="300">
-</td>
-<td>
-<IMG SRC="step-5.data/solution-3.jpg" ALT="solution-3" WIDTH="300">
-</td>
-</tr>
-
-<tr>
-<td>
-<IMG SRC="step-5.data/solution-4.jpg" ALT="solution-4" WIDTH="300">
-</td>
-<td>
-<IMG SRC="step-5.data/solution-5.jpg" ALT="solution-5" WIDTH="300">
-</td>
-</tr>
+ <tr>
+ <td>
+ @image html step-5.solution-0.png
+ </td>
+ <td>
+ @image html step-5.solution-1.png
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ @image html step-5.solution-2.png
+ </td>
+ <td>
+ @image html step-5.solution-3.png
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ @image html step-5.solution-4.png
+ </td>
+ <td>
+ @image html step-5.solution-5.png
+ </td>
+ </tr>
</table>
-</p>
-<p>
+
+
Due to the variable coefficient (the curvature there is reduced by the
same factor by which the coefficient is increased), the top region of
the solution is flattened. The gradient of the solution is
discontinuous there, although this is not very clearly visible in the
pictures above. We will look at this in more detail in the next
example.
-</p>
-<p>
+
+
As for the error — let's look at it again:
-<pre><code>
+@code
--------------------------------------------------------
An error occurred in line <273> of file <step-5.cc> in function
void Coefficient<dim>::value_list(const std::vector<Point<dim>, std::allocator<Point<dim> > >&, std::vector<double, std::allocator<double> >&, unsigned int)
#1 ./step-5: main
--------------------------------------------------------
make: *** [run] Aborted
-</code></pre>
-</p>
+@endcode
+
+
-<p>
What we see is that the error was triggered in line 273 of the
step-5.cc file (as we modify tutorial programs over time, these line
numbers change, so you should check what line number you actually get
more. First, it prints the function this happens in, and then the
plain text version of the condition that was violated. This will
almost always be enough already to let you know what exactly went wrong.
-</p>
-<p>
+
+
But that's not all yet. You get to see the name of the exception
(<code>ExcDimensionMismatch</code>) and this exception even prints the
values of the two array sizes. If you go back to the code in
<code>main()</code>, you will remember that we gave the two variables
sizes 1 and 2, which of course are the ones that you find in the
output again.
-</p>
-<p>
+
+
So now we know pretty exactly where the error happened and what went
wrong. What we don't know yet is how exactly we got there. The
stacktrace at the bottom actually tells us what happened: the problem
<code>LaplaceProblem<2>::assemble_system</code>, stack frame 2
would be <code>LaplaceProblem<2>::run</code>, and stack frame 3
would be <code>main()</code> — you get the idea.
-</p>
+