From 7ecd67a5c8621c6d2f2d3c35e71f448340f59aa1 Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Mon, 10 May 2021 14:44:44 +0200 Subject: [PATCH] Make output of tests/simplex/step-40 more robust --- tests/simplex/step-40.cc | 24 ++++++++++++++++--- .../step-40.mpirun=1.with_petsc=true.output | 2 +- .../step-40.mpirun=4.with_petsc=true.output | 2 +- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/tests/simplex/step-40.cc b/tests/simplex/step-40.cc index bcac86dc50..54c5fc2c2c 100644 --- a/tests/simplex/step-40.cc +++ b/tests/simplex/step-40.cc @@ -292,12 +292,30 @@ namespace Step40 system_rhs, preconditioner); - pcout << " Solved in " << solver_control.last_step() << " iterations." - << std::endl; - constraints.distribute(completely_distributed_solution); locally_relevant_solution = completely_distributed_solution; + + Vector difference(triangulation.n_active_cells()); + +#ifdef HEX + const QGauss quadrature_formula(fe.degree + 1); +#else + const QGaussSimplex quadrature_formula(fe.degree + 1); +#endif + + VectorTools::integrate_difference(mapping, + dof_handler, + locally_relevant_solution, + Functions::ZeroFunction(), + difference, + quadrature_formula, + VectorTools::NormType::L2_norm); + + pcout << VectorTools::compute_global_error(triangulation, + difference, + VectorTools::NormType::L2_norm) + << std::endl; } template diff --git a/tests/simplex/step-40.mpirun=1.with_petsc=true.output b/tests/simplex/step-40.mpirun=1.with_petsc=true.output index 35bb2044a5..ca81c16970 100644 --- a/tests/simplex/step-40.mpirun=1.with_petsc=true.output +++ b/tests/simplex/step-40.mpirun=1.with_petsc=true.output @@ -1,4 +1,4 @@ Running with PETSc on 1 MPI rank(s)... Number of active cells: 512 Number of degrees of freedom: 1089 - Solved in 7 iterations. +0.0124965 diff --git a/tests/simplex/step-40.mpirun=4.with_petsc=true.output b/tests/simplex/step-40.mpirun=4.with_petsc=true.output index 41556ca6a2..d476df598c 100644 --- a/tests/simplex/step-40.mpirun=4.with_petsc=true.output +++ b/tests/simplex/step-40.mpirun=4.with_petsc=true.output @@ -1,4 +1,4 @@ Running with PETSc on 4 MPI rank(s)... Number of active cells: 512 Number of degrees of freedom: 1089 - Solved in 7 iterations. +0.0124965 -- 2.39.5