New question #153689 on DOLFIN:
https://answers.launchpad.net/dolfin/+question/153689

Hi,

I try to solve a time-dependent problem, however the plotting does not show the 
change of the function over time. The plot window always shows the function in 
that timestep in which the plot command was first called. What am I doing 
wrong? The time-dependent example look similar, but they work.
Here is the simplest example that goes wrong:

from dolfin import *

T_initial = Constant(293.0)

dt = 1.0
t = dt

mesh = Interval(200, 0, 20.0)

V = FunctionSpace(mesh, "CG", 1)

T = TrialFunction(V)
v = TestFunction(V)

def inflow(x, on_boundary):
    return on_boundary and x[0] < 1.0
    
BC = DirichletBC(V, 800.0, inflow)
T_prev = interpolate(T_initial, V)

a = (T*v + dt*T.dx(0)*v.dx(0))*dx
L = T_prev*v*dx

f = Function(V)


while t < 1000:
    A = assemble(a)
    l = assemble(L)
    BC.apply(A,l)
    solve(A,f.vector(), l)
    plot(f)
    T_prev.assign(f)
    t += dt

-- 
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.

_______________________________________________
Mailing list: https://launchpad.net/~dolfin
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~dolfin
More help   : https://help.launchpad.net/ListHelp

Reply via email to