dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #22769
Re: [Question #153689]: plotting time-dependent functions
Question #153689 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/153689
Status: Open => Answered
Johan Hake proposed the following answer:
This looks like a bug in Viper for plotting of 1D functions. If you switch
your mesh to a square it works.
Consider filing a bug (in dolfin) for this and attach the script.
Johan
On Thursday April 21 2011 01:16:44 Bento wrote:
> 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.