Skip to content

Commit 09c7201

Browse files
committed
Store phi
1 parent 1e40a3c commit 09c7201

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

examples/obstacle/lvpp_example.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def phi_set(x):
112112
Qe = basix.ufl.quadrature_element(msh.topology.cell_name(), degree=quadrature_degree)
113113
Vq = fem.functionspace(msh, Qe)
114114
# Lower bound for the obstacle
115-
phi = fem.Function(Vq)
115+
phi = fem.Function(Vq, name="phi")
116116
phi.interpolate(phi_set)
117117

118118
# Define non-linear residual
@@ -252,6 +252,11 @@ def phi_set(x):
252252

253253
num_primal_dofs = V_primal.dofmap.index_map.size_global
254254

255+
phi_out_space = fem.functionspace(msh, basix.ufl.element("Lagrange", msh.basix_cell(), 6))
256+
phi_out = fem.Function(phi_out_space, name="phi")
257+
phi_out.interpolate(phi_set)
258+
with io.VTXWriter(msh.comm, output_dir / "phi.bp", [phi_out]) as bp:
259+
bp.write(0.0)
255260
if MPI.COMM_WORLD.rank == 0:
256261
df = pd.DataFrame()
257262
df["Energy"] = energies

0 commit comments

Comments
 (0)