From: Luca Heltai Date: Tue, 9 Apr 2019 23:26:56 +0000 (+0200) Subject: ParsedConvergenceTable, vector function + scalar function X-Git-Tag: v9.1.0-rc1~143^2~15 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5c11b99945bfcf79e336debccb9bc31aa31b54e2;p=dealii.git ParsedConvergenceTable, vector function + scalar function --- diff --git a/tests/base/parsed_convergence_table_05.cc b/tests/base/parsed_convergence_table_05.cc new file mode 100644 index 0000000000..8cfb65071a --- /dev/null +++ b/tests/base/parsed_convergence_table_05.cc @@ -0,0 +1,63 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2019 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE.md at +// the top level directory of deal.II. +// +// --------------------------------------------------------------------- + +// Test the functionality of the ParsedConvergenceTable class for +// vector function + scalar function + +#include +#include + +#include + +#include +#include + +#include +#include + +#include + +#include + +#include "../tests.h" + +int +main() +{ + initlog(); + + ParsedConvergenceTable table({"u", "u", "p"}, + {{ParsedConvergenceTableFlags::H1}, + {ParsedConvergenceTableFlags::L2}}); + + ParameterHandler prm; + table.add_parameters(prm); + + Triangulation<2> tria; + GridGenerator::hyper_cube(tria); + + FESystem<2> fe(FE_Q<2>(1), 3); + DoFHandler<2> dh(tria); + + for (unsigned int i = 0; i < 5; ++i) + { + tria.refine_global(1); + dh.distribute_dofs(fe); + Vector sol(dh.n_dofs()); + VectorTools::interpolate(dh, Functions::CosineFunction<2>(3), sol); + table.error_from_exact(dh, sol, Functions::CosineFunction<2>(3)); + } + table.output_table(deallog.get_file_stream()); +} diff --git a/tests/base/parsed_convergence_table_05.output b/tests/base/parsed_convergence_table_05.output new file mode 100644 index 0000000000..1cc8dca7fc --- /dev/null +++ b/tests/base/parsed_convergence_table_05.output @@ -0,0 +1,7 @@ + +dofs cells u_H1 p_L2 +27 4 3.699e-01 - 5.156e-02 - +75 16 1.799e-01 1.41 1.333e-02 2.65 +243 64 8.927e-02 1.19 3.360e-03 2.34 +867 256 4.455e-02 1.09 8.418e-04 2.18 +3267 1024 2.226e-02 1.05 2.106e-04 2.09