// @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);
}
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);
}
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