On 22 Dec 2015, at 15:06, Andrew McRae <A.T.T.McRae@bath.ac.uk> wrote:Yes, but outfile is only defined once, and gets written to every 10th step. I removed the output mess from the code I just sent..._______________________________________________On 22 December 2015 at 14:04, Colin Cotter <colin.cotter@imperial.ac.uk> wrote:--cjcall the bestHi Angwenyi,You're still defining "output" inside the time loop.On 22 December 2015 at 13:18, Angwenyi David <kipkoej@gmail.com> wrote:On 22 Dec 2015, at 14:12, Andrew McRae <A.T.T.McRae@bath.ac.uk> wrote:Send your complete code please.>>> from firedrake import *
>>> nx = 10
>>> ny = 10
>>> nz = 5
>>> mesh = BoxMesh(nx, ny, nz, 2.0, 2.0, 1.0)
>>> V = FunctionSpace(mesh, 'Lagrange', 1)
>>> p = Function(V, name="p")
>>> phi = Function(V, name="phi")
>>>
>>> u = TrialFunction(V)
>>> v = TestFunction(V)
>>> outfile = File("out.pvd")
>>> outfile << phi
>>> bcval = Constant(0.0)
>>> bc = DirichletBC(V, bcval, 1)
>>> T = 10.
>>> dt = 0.001
>>> t = 0
>>> step = 0
>>> lump_mass = True
>>> while t <= T:
... step += 1
... bcval.assign(sin(2*pi*5*t))
... phi -= dt / 2 * p
... if lump_mass:
... p += assemble(dt * inner(nabla_grad(v), nabla_grad(phi))*dx) / assemble(v*dx)
... bc.apply(p)
... else:
... solve(u * v * dx == v * p * dx + dt * inner(grad(v), grad(phi)) * dx,p, bcs=bc, solver_parameters={'ksp_type': 'cg','pc_type': 'sor','pc_sor_symmetric': True})
... phi -= dt / 2 * p
... t += dt
... if step % 10 == 0:
... outfile << phi
... File("waveEqn.pvd")<< phi
... output = File("waveEqn.pvd")
... output << phi
... del output
...
On 22 December 2015 at 13:10, Angwenyi David <kipkoej@gmail.com> wrote:Dear Cotter, dear Andrew,I get one .vtu file in both cases.AngwenyiOn 22 Dec 2015, at 13:11, Colin Cotter <colin.cotter@imperial.ac.uk> wrote:_______________________________________________--cjcall the bestDear Angwenyi,The output should be one .pvd file, but many .vtu files, one per dump. Then, you open the .pvd file in Paraview, set up your visualisation and press the play button.On 22 December 2015 at 12:06, Angwenyi David <kipkoej@gmail.com> wrote:Dear Cotter,I did so, but got a single file. I thought I could get as many files as timesteps; which files I could open all at once in Paraview to generate a video. Any direction?Angwenyi
--
firedrake mailing list
firedrake@imperial.ac.uk
https://mailman.ic.ac.uk/mailman/listinfo/firedrake_______________________________________________
firedrake mailing list
firedrake@imperial.ac.uk
https://mailman.ic.ac.uk/mailman/listinfo/firedrake
firedrake mailing list
firedrake@imperial.ac.uk
https://mailman.ic.ac.uk/mailman/listinfo/firedrake