Hi @dokken thank you for the suggestion. I updated my docker image to the version 0.7.3:
DOLFINx version: 0.7.3 based on GIT commit: 25db9a743ef95a78f686f05e38607aa18281b0d6
And then I installed adios4dolfinx
Now to save the files externally, I followed both Parallel function saving and reading it back using PETSc or adios4dolfinx - dolfinx - FEniCS Project as well as checkpointing slides (jsdokken.com)
Quick reminder: I’m solving the Navier stokes solver in the FEniCSx tutorial: Test problem 1: Channel flow (Poiseuille flow) — FEniCSx tutorial (jsdokken.com)
Where
mesh = create_unit_square(MPI.COMM_WORLD, 10, 10)
And u_n
is the solution constructed as:
v_cg2 = VectorElement("Lagrange", mesh.ufl_cell(), 2)
V = FunctionSpace(mesh, v_cg2)
u_n = Function(V)
u_n.name = "u_n"
The final u_n
looks like:
u_n = Coefficient(FunctionSpace(Mesh(blocked element (Basix element (P, triangle, 1, gll_warped, unset, False), (2,)), 0), VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2)), 0)
So, to save the file, I used:
import adios4dolfinx as adx
from pathlib import Path
checkpoint_file = Path("function_checkpoint.bp")
adx.write_mesh(mesh, checkpoint_file, engine="BP4")
adx.write_function(u_n, checkpoint_file, engine="BP4")
Now, to read the file I used:
checkpoint_file = Path("function_checkpoint.bp")
domain = adx.read_mesh(MPI.COMM_WORLD, checkpoint_file, "BP4", dolfinx.mesh.GhostMode.none)
v_cg2 = VectorElement("Lagrange", domain.ufl_cell(), 2)
V = FunctionSpace(domain, v_cg2)
u_new = Function(V)
u_new.name = "u_n"
adx.read_function(u_new, checkpoint_file, "BP4")