From: guido Date: Thu, 6 Jul 2006 13:34:41 +0000 (+0000) Subject: include 1d results X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5935ce848d52a7b36d4224078d555b8ed515dd7d;p=dealii-svn.git include 1d results git-svn-id: https://svn.dealii.org/trunk@13344 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/examples/step-4/doc/results.dox b/deal.II/examples/step-4/doc/results.dox index cfd3be1c1f..d0870b877b 100644 --- a/deal.II/examples/step-4/doc/results.dox +++ b/deal.II/examples/step-4/doc/results.dox @@ -7,6 +7,11 @@ 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): @code +Solving problem in 1 space dimensions. + Number of active cells: 16 + Total number of cells: 31 + Number of degrees of freedom: 17 + 16 CG iterations needed to obtain convergence. Solving problem in 2 space dimensions. Number of active cells: 256 Total number of cells: 341 @@ -18,18 +23,22 @@ Solving problem in 3 space dimensions. Number of degrees of freedom: 4913 30 CG iterations needed to obtain convergence. @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 +It is obvious that the number of cells and +therefore also the number of degrees of freedom increases exponentially with +the space dimension. What cannot be seen here, is that besides this increase in number of rows and columns in the matrix, there are also significantly -more entries per row of the matrix in three space +more entries per row of the matrix in higher space 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. +run the program. Therefore, it is really helful to develop a program in two dimensions +and transfer it to three dimensions by the mechanism studied in this step. By the way, +one dimensional examples are usually not sufficiently general to serve as a basis for +three dimensions. -The program produces two files: solution-2d.gmv and +The program produces three files: solution-1d.gmv, + solution-2d.gmv and solution-3d.gmv, 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 @@ -98,6 +107,20 @@ solutions values. 3D grids are difficult to visualize, which can be seen here already, even though the grid is not even locally refined. +For completeness, we add the graphical output of the one dimensional run: + + + + + + + +
+ @image html step-4.solution-1d.png + + @image html step-4.grid-1d.png +
+ diff --git a/deal.II/examples/step-4/step-4.cc b/deal.II/examples/step-4/step-4.cc index ed4161fa22..afb3663ae2 100644 --- a/deal.II/examples/step-4/step-4.cc +++ b/deal.II/examples/step-4/step-4.cc @@ -620,9 +620,10 @@ void LaplaceProblem::output_results () const data_out.build_patches (); - std::ofstream output (dim == 2 ? + std::ofstream output (dim == 1 ? "solution-1d.gmv" + : (dim == 2 ? "solution-2d.gmv" : - "solution-3d.gmv"); + "solution-3d.gmv")); data_out.write_gmv (output); } @@ -650,14 +651,12 @@ void LaplaceProblem::run () // @sect3{The main function} // And this is the main function. It also - // looks mostly like in step-3, but if you - // look at the code below, note how we first + // looks mostly like in step-3, we first // create a variable of type - // LaplaceProblem@<2@> (forcing the - // compiler to compile the class template - // with dim replaced by 2) and run a - // 2d simulation, and then we do the whole - // thing over in 3d. + // LaplaceProblem@<1@> compiling the class template + // with dim replaced by 1) and run a + // 1d simulation. Then, we do the whole + // thing over in 2d and 3d. // // In practice, this is probably not what you // would do very frequently (you probably