Tests.h

class Tests

Parent classes:

  • dolfin::Variable

This class provides easy to use methods for testing the fmg solver against a given problem. Example usage:

// ... create coarse bilinearform a, linearform L, solution u and boundary conditions bcs

LinearVariationalProblem problem(a, L, u, bcs);

// create tests instance
fmg::Tests tests(problem);

// set some parameters (optional)
tests.parameters("fmg_solver")["pre_smoother_relax"] = 0.6;
tests.parameters("fmg_solver")["post_smoother_relax"] = 0.6;
tests.parameters("fmg_solver")["pre_smoother"] = "jacobi";
tests.parameters("fmg_solver")["post_smoother"] = "jacobi";
tests.parameters["test_solver"] = "cg,cg+fmg";
tests.parameters["num_refinements"] = 3;
tests.parameters.parse(argc, argv);

// run the tests on problem
tests.run();

The following parameters may be configured for the tests:

Parameter Default Description
num_refinements 1 Specifies the number of refinements for the problem.
primary_solver “cg” for symmetric problems, “gmres” else Specifies the primary Krylov solver for the problem. This should be set to “gmres” for non-symmetric problems for example.
test_solver “” Specifies a (comma) separated list of solver(+preconditioner) pairs that should be tested for the problem where “*” is replaced by the primary_solver. The primary_solver+fmg are added automatically to the end of this list. “fmg” may be used as direct solver and as preconditioner for any Krylov solver available within dolfin::PETScKrylovSolver::methods(). Valid direct solvers are given by dolfin::PETScLUSolver::methods().
test_coarse_solver “” Specifies a (comma) separated list of solver(+preconditioner) pairs that should be tested as coarse level solver for the problem where “*” is replaced by the primary_solver. Valid solvers are given by dolfin::PETScKrylovSolver::methods() and dolfin::PETScLUSolver::methods().
test_smoothers “” Specifies a (comma) separated list of pre-smoother(@relaxation)(+post-smoother(@relaxation)) pairs that should be tested for the problem.
test_cycle_patterns “” Specifies a (comma) separated list of cycle patterns that should be tested for the problem. See VectorCyclePattern for valid pattern values.
max_smoothing_reps 1 Specifies the maximum number of smoothing repetitions that should be tested.
min_coarse_depth 1 Specifies the minimum number of coarsenings when testing different cycle depths.
write_solutions false If set to true files of the solution for each refinement level are written to filenames given by solution_file_format.
solution_file_format “solution_%d.pvd” File format for write_solutions the “%d” is replaced by the mesh refinement level starting from zero.
residual_count -1 Specifies the number of residuals to be listed in the residual table. If set to -1 the number will be equal to the number of iterations required for convergence.
integration_time 0.0 Specifies the minimum runtime of tests in order to improve accuracy by averaging the runtime.
table_format “console” Specifies the table output format for the results. Valid values are “console”, “csv”, “tab”, “latex” and “rest”.
show_help true If set to true for each table additional help text is displayed.
fmg_solver Parameters Specifies the default parameters for the multigrid solver.

Methods:

Tests(dolfin::LinearVariationalProblem& problem, bool symmetric=true)

Construct from given linear problem (adaptively refined). For non-symmetric problems set symmetric explicitly to false.

Tests(dolfin::NonlinearVariationalProblem& problem, bool symmetric=false)

Construct from given nonlinear problem (adaptively refined). If nrefine is greater zero, the problem will be refined uniformly nrefine times. For symmetric problems set symmetric explicitly to true.

void run()

Run all tests.

static const dolfin::Parameters& default_parameters(bool linear=true, bool symmetric=true, bool uniform=true)

Return default parameters.

Previous topic

FMG test module

This Page