illegal choices for linear solvers not intercepted
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
DOLFIN |
Fix Released
|
Medium
|
Anders Logg |
Bug Description
I would like to solve a linear system with CG, and did the following
=======
from dolfin import *
# Create mesh and define function space
mesh = UnitSquareMesh(32, 32)
V = FunctionSpace(mesh, "Lagrange", 1)
# Define boundary condition
bc = DirichletBC(V, Constant(0.0), 'on_boundary')
# Define variational problem
u = TrialFunction(V)
v = TestFunction(V)
a = inner(grad(u), grad(v)) * dx
L = Constant(1.0) * v * dx
# Compute solution
u = Function(V)
set_log_
solve(a == L, u, bc,
solver_
=======
The output of this script is
=======
[...]
Solving linear system of size 1089 x 1089 (PETSc LU solver, umfpack).
=======
This is because "cg" not a valid choice for "linear_solver", only "direct" and "iterative" are. If I'm not mistaken, this has changed between 1.0 and 1.1.
Related branches
Changed in fenics: | |
status: | New → Confirmed |
assignee: | nobody → Johan Hake (johan-hake) |
affects: | fenics → dolfin |
Changed in dolfin: | |
milestone: | none → trunk |
importance: | Undecided → Low |
importance: | Low → Medium |
Changed in dolfin: | |
milestone: | trunk → 1.0.2 |
Changed in dolfin: | |
assignee: | Johan Hake (johan-hake) → Anders Logg (logg) |
Changed in dolfin: | |
status: | Confirmed → Fix Committed |
Changed in dolfin: | |
status: | Fix Committed → Fix Released |
This little patch here takes care of things:
================ *snip* ================ fem//LinearVari ationalSolver. cpp 2013-01-16 16:19:25.447426420 +0100 fem/LinearVaria tionalSolver. cpp 2013-01-16 16:27:05.787448401 +0100 parameters. update( parameters( "krylov_ solver" )); solve(* A, *u->vector(), *b); parameters. update( parameters( "lu_solver" )); solve(* A, *u->vector(), *b); error(" LinearVariation alSolver. cpp",
--- a/dolfin/
+++ b/dolfin/
@@ -186,13 +186,17 @@
solver.
solver.
}
- else
+ else if (solver_type == "direct")
{
// Solve linear system
LUSolver solver;
solver.
solver.
}
+ else
+ dolfin_
+ "initialize linear solver",
+ "Illegal solver type. Valid choices are \"iterative\" and \"direct\"");
end();
}
================ *snap* ================