From: Luca Heltai Date: Tue, 9 Apr 2019 23:55:56 +0000 (+0200) Subject: ParsedConvergenceTable, custom error computations, time rates X-Git-Tag: v9.1.0-rc1~143^2~11 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e40da7fc62cc648fe8d4784c4145fec398093faa;p=dealii.git ParsedConvergenceTable, custom error computations, time rates --- diff --git a/tests/base/parsed_convergence_table_09.cc b/tests/base/parsed_convergence_table_09.cc new file mode 100644 index 0000000000..05a07c6245 --- /dev/null +++ b/tests/base/parsed_convergence_table_09.cc @@ -0,0 +1,65 @@ +// --------------------------------------------------------------------- +// +// 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 +// custom error computations, time rates + +#include +#include + +#include + +#include +#include + +#include +#include + +#include + +#include + +#include "../tests.h" + +int +main() +{ + initlog(); + + ParsedConvergenceTable table({"u"}, {{ParsedConvergenceTableFlags::custom}}); + + ParameterHandler prm; + table.add_parameters(prm); + + std::string input = "set Extra columns = dt\n" + "set Rate key = dt\n"; + + prm.parse_input_from_string(input); + + Triangulation<2> tria; + GridGenerator::hyper_cube(tria); + + FESystem<2> fe(FE_Q<2>(1), 1); + DoFHandler<2> dh(tria); + + for (unsigned int i = 0; i < 5; ++i) + { + tria.refine_global(1); + dh.distribute_dofs(fe); + auto cycle = [&](const unsigned int) { return (i + 1) * 1.0; }; + table.custom_error(cycle, dh, "cycle", true, 1.0 / (i * i + 1)); + } + table.output_table(deallog.get_file_stream()); +} diff --git a/tests/base/parsed_convergence_table_09.output b/tests/base/parsed_convergence_table_09.output new file mode 100644 index 0000000000..9b5f696c0d --- /dev/null +++ b/tests/base/parsed_convergence_table_09.output @@ -0,0 +1,7 @@ + + dt u_cycle +1.0000 1.000e+00 - +0.5000 2.000e+00 2.00 +0.2000 3.000e+00 0.89 +0.1000 4.000e+00 0.83 +0.0588 5.000e+00 0.84