From: Daniel Arndt Date: Fri, 10 May 2019 22:57:58 +0000 (+0200) Subject: Provide some output X-Git-Tag: v9.1.0-rc1~33^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d4fb7e20d781cf003f7f76d906b3106c77f5a6d9;p=dealii.git Provide some output --- diff --git a/examples/step-64/step-64.cu b/examples/step-64/step-64.cu index 5b03c3524b..5d256396fa 100644 --- a/examples/step-64/step-64.cu +++ b/examples/step-64/step-64.cu @@ -438,6 +438,9 @@ namespace Step64 solver_control); cg.solve(*system_matrix_dev, solution_dev, system_rhs_dev, preconditioner); + pcout << " Solved in " << solver_control.last_step() << " iterations." + << std::endl; + // Copy the solution from the device to the host to be able to view its // values and display it in output_results(). LinearAlgebra::ReadWriteVector rw_vector(locally_owned_dofs); @@ -446,9 +449,6 @@ namespace Step64 constraints.distribute(ghost_solution_host); - std::cout << "solution norm: " << ghost_solution_host.l2_norm() - << std::endl; - ghost_solution_host.update_ghost_values(); } @@ -487,6 +487,19 @@ namespace Step64 std::ofstream master_output(master_name); data_out.write_pvtu_record(master_output, filenames); } + + Vector cellwise_norm(triangulation.n_active_cells()); + VectorTools::integrate_difference(dof_handler, + ghost_solution_host, + Functions::ZeroFunction(), + cellwise_norm, + QGauss(fe.degree + 2), + VectorTools::L2_norm); + const double global_norm = + VectorTools::compute_global_error(triangulation, + cellwise_norm, + VectorTools::L2_norm); + pcout << " solution norm: " << global_norm << std::endl; } @@ -495,17 +508,21 @@ namespace Step64 template void HelmholtzProblem::run() { - for (unsigned int cycle = 0; cycle < 5 - dim; ++cycle) + for (unsigned int cycle = 0; cycle < 7 - dim; ++cycle) { pcout << "Cycle " << cycle << std::endl; if (cycle == 0) - { - GridGenerator::hyper_cube(triangulation, 0., 1.); - triangulation.refine_global(4 - dim); - } + GridGenerator::hyper_cube(triangulation, 0., 1.); triangulation.refine_global(1); + setup_system(); + + pcout << " Number of active cells: " + << triangulation.n_global_active_cells() << std::endl + << " Number of degrees of freedom: " << dof_handler.n_dofs() + << std::endl; + assemble_rhs(); solve(); output_results(cycle);