Unable to extract all indices
Hi, I am new to Fenics, and I am trying to solve a linear convection-
alpha*du/dt +beta*inner(
# implementation of the constant coefficient convection-
from dolfin import *
# Create mesh and define function space
mesh=UnitSquare
V=FunctionSpace
#Define boundary condition
u0 = Expression("20+t", t=0)
#Define the Dirichlet boundary condition
def boundary(x, on_boundary):
return on_boundary
bc = DirichletBC(V, u0, boundary)
u_1 = interpolate(u0, V) #u_1 is the value of u at time step k-1
# Time step and some problem parameters
dt=0.3
K=1
alpha=1
#beta=1
w = as_vector([1.0, 1.0])
u= TrialFunction(V)
v=TestFunction(V)
f = Expression("0.0")
a=alpha*
L=alpha*u_1*v*dx + f*v*dx
A=assemble(a)
u=Function(V)
T=10 # total simulation time
t=dt
while t <= T:
b = assemble(L)
u0.t = t
# bc.apply(A,b)
solve(A, u.vector(), b)
t += dt
u_1.assign(u)
plot(u)
plot(mesh)
interactive()
I am getting the following error: Unable to extract all indices. Can some one help. Thank you.
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- DOLFIN Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Hans Petter Langtangen
- Solved:
- Last query:
- Last reply: