dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #22814
[Bug 771259] [NEW] Viper fails to plot one-dim time dependent functions
Public bug reported:
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
Using mesh = Rectangle(0,0,20,1, 200, 1) instead works fine.
** Affects: dolfin
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of DOLFIN
Team, which is subscribed to DOLFIN.
https://bugs.launchpad.net/bugs/771259
Title:
Viper fails to plot one-dim time dependent functions
Status in DOLFIN:
New
Bug description:
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
Using mesh = Rectangle(0,0,20,1, 200, 1) instead works fine.
Follow ups
References