]> https://gitweb.dealii.org/ - dealii.git/commitdiff
update graphical output in examples 2171/head
authorTimo Heister <timo.heister@gmail.com>
Thu, 11 Feb 2016 19:26:51 +0000 (14:26 -0500)
committerTimo Heister <timo.heister@gmail.com>
Thu, 11 Feb 2016 19:26:51 +0000 (14:26 -0500)
- switch from gmv to vtu in several places
- format numbers in filenames with leading zeros
- vector output in step-20
- step-29: enable some debug output

examples/step-20/step-20.cc
examples/step-21/step-21.cc
examples/step-28/doc/results.dox
examples/step-28/step-28.cc
examples/step-29/doc/results.dox
examples/step-29/step-29.cc
examples/step-29/step-29.prm

index 7c01c502cba99a64aedc60b2e17faff8387f1a70..a12e7ea5f6776249d1758577e57b47bb7b347ddb 100644 (file)
@@ -849,59 +849,36 @@ namespace Step20
   // @sect4{MixedLaplace::output_results}
 
   // The last interesting function is the one in which we generate graphical
-  // output. Everything here looks obvious and familiar. Note how we construct
-  // unique names for all the solution variables at the beginning, like we did
-  // in step-8 and other programs later on. The only thing worth mentioning is
-  // that for higher order elements, in seems inappropriate to only show a
-  // single bilinear quadrilateral per cell in the graphical output. We
-  // therefore generate patches of size (degree+1)x(degree+1) to capture the
-  // full information content of the solution. See the step-7 tutorial program
-  // for more information on this.
-  //
-  // Note that we output the <code>dim+1</code> components of the solution
-  // vector as a collection of individual scalars here. Most visualization
-  // programs will then only offer to visualize them individually, rather than
-  // allowing us to plot the flow field as a vector field. However, as
-  // explained in the corresponding function of step-22 or the @ref VVOutput
-  // "Generating graphical output" section of the @ref vector_valued module,
-  // instructing the DataOut class to identify components of the FESystem
-  // object as elements of a <code>dim</code>-dimensional vector is not
-  // actually very difficult and will then allow us to show results as vector
-  // plots. We skip this here for simplicity and refer to the links above for
-  // more information.
+  // output. Note that all velocity components get the same solution name
+  // "u". Together with using
+  // DataComponentInterpretation::::component_is_part_of_vector this will
+  // cause DataOut<dim>::write_vtu() to generate a vector representation of
+  // the individual velocity components, see step-22 or the
+  // @ref VVOutput "Generating graphical output"
+  // section of the
+  // @ref vector_valued
+  // module for more information. Finally, it seems inappropriate for higher
+  // order elements to only show a single bilinear quadrilateral per cell in
+  // the graphical output. We therefore generate patches of size
+  // (degree+1)x(degree+1) to capture the full information content of the
+  // solution. See the step-7 tutorial program for more information on this.
   template <int dim>
   void MixedLaplaceProblem<dim>::output_results () const
   {
-    std::vector<std::string> solution_names;
-    switch (dim)
-      {
-      case 2:
-        solution_names.push_back ("u");
-        solution_names.push_back ("v");
-        solution_names.push_back ("p");
-        break;
-
-      case 3:
-        solution_names.push_back ("u");
-        solution_names.push_back ("v");
-        solution_names.push_back ("w");
-        solution_names.push_back ("p");
-        break;
-
-      default:
-        Assert (false, ExcNotImplemented());
-      }
-
+    std::vector<std::string> solution_names(dim, "u");
+    solution_names.push_back ("p");
+    std::vector<DataComponentInterpretation::DataComponentInterpretation>
+    interpretation (dim,
+                    DataComponentInterpretation::component_is_part_of_vector);
+    interpretation.push_back (DataComponentInterpretation::component_is_scalar);
 
     DataOut<dim> data_out;
-
-    data_out.attach_dof_handler (dof_handler);
-    data_out.add_data_vector (solution, solution_names);
+    data_out.add_data_vector (dof_handler, solution, solution_names, interpretation);
 
     data_out.build_patches (degree+1);
 
-    std::ofstream output ("solution.gmv");
-    data_out.write_gmv (output);
+    std::ofstream output ("solution.vtu");
+    data_out.write_vtu (output);
   }
 
 
index 208c1c87d378664142b8f0b5ee81312ee6b02b1c..3b821afd44bef1f6fd5a0da1f099a820680c574f 100644 (file)
@@ -1122,7 +1122,9 @@ namespace Step21
     data_out.build_patches (degree+1);
 
     std::ostringstream filename;
-    filename << "solution-" << timestep_number << ".vtk";
+    filename << "solution-"
+             << Utilities::int_to_string(timestep_number,4)
+             << ".vtk";
 
     std::ofstream output (filename.str().c_str());
     data_out.write_vtk (output);
index edbacad4431ca0fb0881622c16b3dc748320e187..390bb1feb53378c9cd24e9411061a6de7daebe98 100644 (file)
@@ -2,8 +2,8 @@
 
 
 The output of this program consist of the console output, a file 
-named ``convergence_table'' to record main results of mesh iteration, the eps
-files including the grids, and the solutions given in gnuplot format.
+named ``convergence_table'' to record main results of mesh iteration, 
+and the graphical output in vtu format.
 
 When we set Polynomial_Order to 2, we got following console output:
 @code
index b73f9070de3553027732aeee698d555812f3ca1c..5a84cfd9137746bb4cb9a0ed258428fe89e96dfc 100644 (file)
@@ -1133,34 +1133,20 @@ namespace Step28
   void
   EnergyGroup<dim>::output_results (const unsigned int cycle) const
   {
-    {
-      const std::string filename = std::string("grid-") +
-                                   Utilities::int_to_string(group,1) +
-                                   "." +
-                                   Utilities::int_to_string(cycle,1) +
-                                   ".eps";
-      std::ofstream output (filename.c_str());
-
-      GridOut grid_out;
-      grid_out.write_eps (triangulation, output);
-    }
+    const std::string filename = std::string("solution-") +
+                                 Utilities::int_to_string(group, 2) +
+                                 "." +
+                                 Utilities::int_to_string(cycle, 2) +
+                                 ".vtu";
 
-    {
-      const std::string filename = std::string("solution-") +
-                                   Utilities::int_to_string(group,1) +
-                                   "." +
-                                   Utilities::int_to_string(cycle,1) +
-                                   ".gmv";
+    DataOut<dim> data_out;
 
-      DataOut<dim> data_out;
+    data_out.attach_dof_handler (dof_handler);
+    data_out.add_data_vector (solution, "solution");
+    data_out.build_patches ();
 
-      data_out.attach_dof_handler (dof_handler);
-      data_out.add_data_vector (solution, "solution");
-      data_out.build_patches ();
-
-      std::ofstream output (filename.c_str());
-      data_out.write_gmv (output);
-    }
+    std::ofstream output (filename.c_str());
+    data_out.write_vtu (output);
   }
 
 
index 9ff67525cf7252ca79229bf468ccb0cbdd046f63..6a8ad54a69488dc6ad1aa39db85b5dd9a374da64 100644 (file)
@@ -27,14 +27,14 @@ subsection Output parameters
   set Output file   = solution
 
   # A name for the output format to be used
-  set Output format = gmv
+  set Output format = vtu
 end
 @endcode
 
 As can be seen, we set
 $d=0.3$, which amounts to a focus of the transducer lens
 at $x=0.5$, $y=0.3$. The coarse mesh is refined 5 times,
-resulting in 160x160 cells, and the output is written in gmv
+resulting in 160x160 cells, and the output is written in vtu
 format. The parameter reader understands many more parameters
 pertaining in particular to the generation of output, see the
 explanation in step-19, but we need none of these
index d5e0f231e34e1c566cf85528584ff08b8221ae74..bf1789e42f75dffe71fed59bc7bcf2f863772f15 100644 (file)
@@ -940,6 +940,8 @@ int main ()
       using namespace dealii;
       using namespace Step29;
 
+      deallog.depth_console(5);
+
       ParameterHandler  prm;
       ParameterReader   param(prm);
       param.read_parameters("step-29.prm");
index 13b589c477b448f37296e0567ae1ac5c175c912b..d6c5f37ee8521fabc0b985b342293922624b71ec 100644 (file)
@@ -24,5 +24,5 @@ subsection Output parameters
   set Output file   = solution
 
   # A name for the output format to be used
-  set Output format = gmv
+  set Output format = vtu
 end

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.