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:
Hi Angwenyi, You're still defining "output" inside the time loop.
all the best --cjc
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.
Angwenyi
On 22 Dec 2015, at 13:11, Colin Cotter <colin.cotter@imperial.ac.uk> wrote:
Dear 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.
all the best --cjc
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
On 22 Dec 2015, at 12:10, Colin Cotter <colin.cotter@imperial.ac.uk> wrote:
del output
-- http://www.imperial.ac.uk/people/colin.cotter
www.cambridge.org/9781107663916
_______________________________________________ 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
-- http://www.imperial.ac.uk/people/colin.cotter
www.cambridge.org/9781107663916
Thank you so much. I now see that we already have an output file named “out.pvd” and we need not have another. Thanks again. Angwenyi
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 <mailto:colin.cotter@imperial.ac.uk>> wrote: Hi Angwenyi, You're still defining "output" inside the time loop.
all the best --cjc
On 22 December 2015 at 13:18, Angwenyi David <kipkoej@gmail.com <mailto:kipkoej@gmail.com>> wrote:
On 22 Dec 2015, at 14:12, Andrew McRae <A.T.T.McRae@bath.ac.uk <mailto: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 <mailto:kipkoej@gmail.com>> wrote: Dear Cotter, dear Andrew,
I get one .vtu file in both cases.
Angwenyi
On 22 Dec 2015, at 13:11, Colin Cotter <colin.cotter@imperial.ac.uk <mailto:colin.cotter@imperial.ac.uk>> wrote:
Dear 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.
all the best --cjc
On 22 December 2015 at 12:06, Angwenyi David <kipkoej@gmail.com <mailto: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
On 22 Dec 2015, at 12:10, Colin Cotter <colin.cotter@imperial.ac.uk <mailto:colin.cotter@imperial.ac.uk>> wrote:
del output
-- http://www.imperial.ac.uk/people/colin.cotter <http://www.imperial.ac.uk/people/colin.cotter>
www.cambridge.org/9781107663916 <http://www.cambridge.org/9781107663916>
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk <mailto:firedrake@imperial.ac.uk> https://mailman.ic.ac.uk/mailman/listinfo/firedrake <https://mailman.ic.ac.uk/mailman/listinfo/firedrake>
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk <mailto:firedrake@imperial.ac.uk> https://mailman.ic.ac.uk/mailman/listinfo/firedrake <https://mailman.ic.ac.uk/mailman/listinfo/firedrake>
-- http://www.imperial.ac.uk/people/colin.cotter <http://www.imperial.ac.uk/people/colin.cotter>
www.cambridge.org/9781107663916 <http://www.cambridge.org/9781107663916>
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk <mailto:firedrake@imperial.ac.uk> https://mailman.ic.ac.uk/mailman/listinfo/firedrake <https://mailman.ic.ac.uk/mailman/listinfo/firedrake>
participants (2)
- 
                
                Andrew McRae
- 
                
                Angwenyi David