dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #20538
Re: [Question #139524]: plot in same window
Question #139524 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/139524
Johan Hake proposed the following answer:
On Saturday January 1 2011 00:57:57 S Wood wrote:
> Question #139524 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/139524
>
> S Wood requested for more information:
> Hi Andres,
>
> Sorry I am new to dofin and fenics, but I was wondering if you can
> clarify what you mean by "update"? Here is a segment of the code I have
> and I don't get the plot on the same loop!
>
You are recreating the solution Function each timestep. The plot command can
then not figure out that you are plotting the same Function.
Change the code to:
u, v = TrialFunction(V), TestFunction(V)
Fuv = v*u*dx + ......
u = Function(V)
F = action(Fuv, u)
J = derivative(F, u, du)
# Solve nonlinear variational problem
problem = VariationalProblem(J, F, bc, nonlinear=True)
newton = problem.parameters['newton_solver']
newton["maximum_iterations"] = 40
while t <= T:
problem.solve(u)
# Plot u
plot(u)
# March in time
t += dt
u_prev.assign(u)
Johan
> Thank you very much.
>
> S.
--
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.