error on solving mixed formulation
I'm trying to solve a mixed formulation of a 2 point poisson problem (in one dimension):
-u'' = f(x); f(x) = (pi/2)^2 cos(pi*x/2)
-1 < x < 1, u(-1) = u(1) = 0
The code that I have written is :
"""
Solve
-u'' = f(x); f(x) = (pi/2)^2 cos(pi*x/2)
-1 < x < 1, u(-1) = u(1) = 0
14 subintervals
"""
from dolfin import *
import matplotlib as mpl
mesh = Interval(14, -1, 1)
V = FunctionSpace(mesh, 'Lagrange', 2)
V1 = FunctionSpace(mesh, 'DG', 0)
W = V*V1
(sigma, u) = TrialFunctions(W)
(tau, v) = TestFunctions(W)
u0 = Expression('0')
def u0_boundary(x, on_boundary):
return on_boundary
bc = DirichletBC(
f = Expression(
equation = (dot(sigma, tau) - tau.dx(0)*u + sigma.dx(0)*v)*dx == f*v*dx
w = Function(W)
#solve(a == L, w, bc)
solve(equation, w, bc)
(sigma, u) = w.split()
#plot(sigma)
#plot(u)
#plot(mesh)
interactive()
I'm using dolfin 0.8.3 (one you get in debian squeeze repo). Running this throws up an error:
Traceback (most recent call last):
File "problem5.py", line 30, in <module>
solve(equation, w, bc)
File "/usr/lib/
return _cpp.solve(*args)
TypeError: in method 'solve', argument 1 of type 'dolfin:
What might be the problem?
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- DOLFIN Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Pratik Mallya
- Solved:
- Last query:
- Last reply: