From cc43574c1b90985c899269a2e9b15818b7a682dc Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 19 Aug 2008 05:35:21 +0000 Subject: [PATCH] Re-assemble the solution vectors into a combined DoFHandler so that we can output everything into the same output file. git-svn-id: https://svn.dealii.org/trunk@16594 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-31/step-31.cc | 92 ++++++++++++++++++++++------- 1 file changed, 70 insertions(+), 22 deletions(-) diff --git a/deal.II/examples/step-31/step-31.cc b/deal.II/examples/step-31/step-31.cc index b1ccf2d3dd..08f3682145 100644 --- a/deal.II/examples/step-31/step-31.cc +++ b/deal.II/examples/step-31/step-31.cc @@ -2083,34 +2083,82 @@ void BoussinesqFlowProblem::output_results () const if (timestep_number % 10 != 0) return; -//TODO!! -// Assert (false, ExcNotImplemented()); + const FESystem joint_fe (stokes_fe, 1, + temperature_fe, 1); + DoFHandler joint_dof_handler (triangulation); + joint_dof_handler.distribute_dofs (joint_fe); + Assert (joint_dof_handler.n_dofs() == + stokes_dof_handler.n_dofs() + temperature_dof_handler.n_dofs(), + ExcInternalError()); -// std::vector solution_names (dim, "velocity"); -// solution_names.push_back ("p"); -// solution_names.push_back ("T"); + Vector joint_solution (joint_dof_handler.n_dofs()); -// DataOut data_out; + { + std::vector local_joint_dof_indices (joint_fe.dofs_per_cell); + std::vector local_stokes_dof_indices (stokes_fe.dofs_per_cell); + std::vector local_temperature_dof_indices (temperature_fe.dofs_per_cell); + + typename DoFHandler::active_cell_iterator + joint_cell = joint_dof_handler.begin_active(), + joint_endc = joint_dof_handler.end(), + stokes_cell = stokes_dof_handler.begin_active(), + temperature_cell = temperature_dof_handler.begin_active(); + for (; joint_cell!=joint_endc; ++joint_cell, ++stokes_cell, ++temperature_cell) + { + joint_cell->get_dof_indices (local_joint_dof_indices); + stokes_cell->get_dof_indices (local_stokes_dof_indices); + temperature_cell->get_dof_indices (local_temperature_dof_indices); -// data_out.attach_dof_handler (dof_handler); + for (unsigned int i=0; i joint_solution_names (dim, "velocity"); + joint_solution_names.push_back ("p"); + joint_solution_names.push_back ("T"); -// std::vector -// data_component_interpretation -// (dim+2, DataComponentInterpretation::component_is_scalar); -// for (unsigned int i=0; i data_out; + + data_out.attach_dof_handler (joint_dof_handler); + + std::vector + data_component_interpretation + (dim+2, DataComponentInterpretation::component_is_scalar); + for (unsigned int i=0; i::type_dof_data, -// data_component_interpretation); -// data_out.build_patches (degree); + data_out.add_data_vector (joint_solution, joint_solution_names, + DataOut::type_dof_data, + data_component_interpretation); + data_out.build_patches (degree); -// std::ostringstream filename; -// filename << "solution-" << Utilities::int_to_string(timestep_number, 4) << ".vtk"; + std::ostringstream filename; + filename << "solution-" << Utilities::int_to_string(timestep_number, 4) << ".vtk"; -// std::ofstream output (filename.str().c_str()); -// data_out.write_vtk (output); + std::ofstream output (filename.str().c_str()); + data_out.write_vtk (output); } @@ -2306,7 +2354,7 @@ void BoussinesqFlowProblem::run () old_old_temperature_solution = old_temperature_solution; old_temperature_solution = temperature_solution; } - while (time <= 10); + while (time <= 100); } -- 2.39.5