From: kronbichler Date: Mon, 6 May 2013 20:16:54 +0000 (+0000) Subject: Add a test (that currently fails) showing that early success in Bicgstab solver is... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e610e41543fa1c0f4e9439da9f4737bd9051b602;p=dealii-svn.git Add a test (that currently fails) showing that early success in Bicgstab solver is not handled correctly when large numbers are present git-svn-id: https://svn.dealii.org/trunk@29466 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/lac/bicgstab_large.cc b/tests/lac/bicgstab_large.cc new file mode 100644 index 0000000000..13262582a0 --- /dev/null +++ b/tests/lac/bicgstab_large.cc @@ -0,0 +1,85 @@ +//---------------------------- bicgstab_large.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2013 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//---------------------------- bicgstab_large.cc --------------------------- + +// check that bicgstab does not exit early when very large matrices are used + +#include "../tests.h" +#include +#include +#include +#include +#include "testmatrix.h" +#include +#include +#include +#include +#include + + +int main() +{ + std::ofstream logfile("bicgstab_large/output"); + deallog << std::setprecision(4); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + SparsityPattern sparsity_pattern(4,4); + sparsity_pattern.compress(); + + SparseMatrix M(sparsity_pattern); + M.diag_element(0) = 1; + M.diag_element(1) = 10; + M.diag_element(2) = 11; + M.diag_element(3) = 42; + + Vector rhs(4); + rhs(0) = rhs(2) = 0; + rhs(1) = rhs(3) = 0.0975; + + Vector solution (4); + + { + SolverControl control(100, 1.e-3); + SolverBicgstab<> bicgstab(control); + bicgstab.solve (M, solution, rhs, PreconditionIdentity()); + } + + for (unsigned int i=0; i<4; ++i) + deallog << solution(i) << std::endl; + + Vector res (4); + M.residual (res, solution, rhs); + deallog << "residual=" << res.l2_norm() + << std::endl; + + // now set up the same problem but with matrix entries scaled by 1e10 and + // solver tolerance scaled by 1e10. should get the same solution + SparseMatrix M1 (sparsity_pattern); + M1.add(1e10,M); + rhs *= 1e10; + + { + SolverControl control(100, 1.e7); + SolverBicgstab<> bicgstab(control); + bicgstab.solve (M1, solution, rhs, PreconditionIdentity()); + } + + for (unsigned int i=0; i<4; ++i) + deallog << solution(i) << std::endl; + + M1.residual (res, solution, rhs); + deallog << "residual=" << res.l2_norm() + << std::endl; +} + diff --git a/tests/lac/bicgstab_large/cmp/generic b/tests/lac/bicgstab_large/cmp/generic new file mode 100644 index 0000000000..c20f61f9cc --- /dev/null +++ b/tests/lac/bicgstab_large/cmp/generic @@ -0,0 +1,8 @@ + +DEAL:Bicgstab::Starting value 0.1379 +DEAL:Bicgstab::Convergence step 1 value 0 +DEAL::0 +DEAL::0.009242 +DEAL::0 +DEAL::0.009242 +DEAL::residual=0