Skip to content

Commit 0d7f6de

Browse files
committed
Adapt demos
1 parent 476f551 commit 0d7f6de

9 files changed

Lines changed: 14 additions & 14 deletions

python/demo/demo_axis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,6 @@ def create_eps_mu(pml, rho, eps_bkg, mu_bkg):
794794
Es_dg = fem.Function(W)
795795
Es_expr = fem.Expression(Esh, W.element.interpolation_points)
796796
Es_dg.interpolate(Es_expr)
797-
with VTXWriter(mesh_data.mesh.comm, out_folder / "Es.bp", Es_dg) as f:
797+
with VTXWriter(mesh_data.mesh.comm, out_folder / "Es.bp", "w", Es_dg) as f:
798798
f.write(0.0)
799799
# -

python/demo/demo_biharmonic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@
330330
if has_adios2:
331331
out_folder = Path("out_biharmonic")
332332
out_folder.mkdir(parents=True, exist_ok=True)
333-
with io.VTXWriter(msh.comm, out_folder / "biharmonic.bp", [uh]) as file:
333+
with io.VTXWriter(msh.comm, out_folder / "biharmonic.bp", "w", [uh]) as file:
334334
file.write(0.0)
335335

336336
# and displayed using [pyvista](https://docs.pyvista.org/).

python/demo/demo_half_loaded_waveguide.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -469,10 +469,10 @@ def verify_mode(
469469

470470
if has_vtx:
471471
# Save solutions
472-
with VTXWriter(msh.comm, out_folder / f"Et_{i}.bp", Et_dg) as f:
472+
with VTXWriter(msh.comm, out_folder / f"Et_{i}.bp", "w", Et_dg) as f:
473473
f.write(0.0)
474474

475-
with VTXWriter(msh.comm, out_folder / f"Ez_{i}.bp", ezh) as f:
475+
with VTXWriter(msh.comm, out_folder / f"Ez_{i}.bp", "w", ezh) as f:
476476
f.write(0.0)
477477

478478
# Visualize solutions with Pyvista

python/demo/demo_hdg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,9 @@ def u_e(x):
264264
if dolfinx.has_adios2:
265265
from dolfinx.io import VTXWriter
266266

267-
with VTXWriter(msh.comm, "u.bp", u, "bp4") as f:
267+
with VTXWriter(msh.comm, "u.bp", "w", u, "bp4") as f:
268268
f.write(0.0)
269-
with VTXWriter(msh.comm, "ubar.bp", ubar, "bp4") as f:
269+
with VTXWriter(msh.comm, "ubar.bp", "w", ubar, "bp4") as f:
270270
f.write(0.0)
271271
else:
272272
print("ADIOS2 required for VTX output")

python/demo/demo_interpolation-io.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
if has_adios2:
8383
from dolfinx.io import VTXWriter
8484

85-
with VTXWriter(msh.comm, out_folder / "output_nedelec.bp", u0) as f:
85+
with VTXWriter(msh.comm, out_folder / "output_nedelec.bp", "w", u0) as f:
8686
f.write(0.0)
8787
else:
8888
print("ADIOS2 required for VTX output")

python/demo/demo_mixed-poisson.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@
352352
if dolfinx.has_adios2:
353353
from dolfinx.io import VTXWriter
354354

355-
with VTXWriter(msh.comm, "output_mixed_poisson.bp", u) as f:
355+
with VTXWriter(msh.comm, "output_mixed_poisson.bp", "w", u) as f:
356356
f.write(0.0)
357357
else:
358358
print("ADIOS2 required for VTX output.")

python/demo/demo_navier-stokes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,8 @@ def jump(phi, n):
367367
if has_adios2:
368368
u_vis = fem.Function(W, name="u_init")
369369
u_vis.interpolate(u_h)
370-
u_file = io.VTXWriter(msh.comm, "u.bp", u_vis)
371-
p_file = io.VTXWriter(msh.comm, "p.bp", p_h)
370+
u_file = io.VTXWriter(msh.comm, "u.bp", "w", u_vis)
371+
p_file = io.VTXWriter(msh.comm, "p.bp", "w", p_h)
372372
u_file.write(t)
373373
p_file.write(t)
374374
else:

python/demo/demo_pml.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ def create_eps_mu(
666666
Esh_dg = fem.Function(V_dg)
667667
Esh_dg.interpolate(Esh)
668668

669-
with VTXWriter(mesh_data.mesh.comm, out_folder / "Esh.bp", Esh_dg) as vtx:
669+
with VTXWriter(mesh_data.mesh.comm, out_folder / "Esh.bp", "w", Esh_dg) as vtx:
670670
vtx.write(0.0)
671671
# -
672672

@@ -702,7 +702,7 @@ def create_eps_mu(
702702
E_dg = fem.Function(V_dg)
703703
E_dg.interpolate(E)
704704

705-
with VTXWriter(mesh_data.mesh.comm, out_folder / "E.bp", E_dg) as vtx:
705+
with VTXWriter(mesh_data.mesh.comm, out_folder / "E.bp", "w", E_dg) as vtx:
706706
vtx.write(0.0)
707707
# -
708708

python/demo/demo_scattering_boundary_conditions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ def curl_2d(f: fem.Function):
655655
assert isinstance(Esh, fem.Function)
656656
Esh_dg.interpolate(Esh)
657657

658-
with io.VTXWriter(mesh_data.mesh.comm, out_folder / "Esh.bp", Esh_dg) as vtx:
658+
with io.VTXWriter(mesh_data.mesh.comm, out_folder / "Esh.bp", "w", Esh_dg) as vtx:
659659
vtx.write(0.0)
660660
# -
661661

@@ -694,7 +694,7 @@ def curl_2d(f: fem.Function):
694694
E.x.array[:] = Eb.x.array[:] + Esh.x.array[:]
695695
E_dg = fem.Function(V_dg)
696696
E_dg.interpolate(E)
697-
with io.VTXWriter(mesh_data.mesh.comm, "E.bp", E_dg) as vtx:
697+
with io.VTXWriter(mesh_data.mesh.comm, "E.bp", "w", E_dg) as vtx:
698698
vtx.write(0.0)
699699
# -
700700

0 commit comments

Comments
 (0)