Hi all,
I am trying to run the following loop for timestepping and getting this error:
Here $u$ = solution, $p$ = velocity, $a$ = acceleration
p0.vector()[:] = p_new
File "/usr/lib/python2.7/dist-packages/dolfin/cpp/la.py",line 1405, in setslice
raise IndexError("can only set full slices v[:]") IndexError: can only set full slices v[:]
u = TrialFunction(V)
v = TestFunction(V)
u_new = Function(V)
p_new = Function(V)
a_new = Function(V)
u0 = interpolate(ui, V) #initial condition
p0 = interpolate(Constant(0.0),V) #initial velocity
a0 = Function(V) #initial accn is calculated as shown in full code at link below
while t <= T:
file << (u0,t)
# Perform predictor step (gamma = 1/2)
u_p = u0_vec + dt*p0_vec + dt*dt/2*(1-2*beta)*a0_vec
p_p = p0_vec + dt*a0_vec/2
# Solve algebric system of equations
L = K*u_p
bc.apply(L)
Bsolve.solve(a_new.vector(), L)
t += dt
# Perform corrector step
u_new.vector()[:] = u_p + dt**2*beta*a_new.vector()
p_new.vector()[:] = p_p + dt/2*a_new.vector()
u0.assign(u_new) # update old vector
p0.vector()[:] = p_new
The entire code is posted on the below link where I have been trying to implement wave equation using newmark time stepping without any success. ANY HELP IS HIGHLY APPRECIATED.
http://fenicsproject.org/qa/8578/implementing-discretised-wave-equation-in-linear-form