Dear fenics users/developers,
first I have to say I am not a fenics expert, but I am trying to have a wrapper class to ease creation of mesh, equations, and plotting, etc. Since we want to ship the created C++ objects created by python classes to HPC nodes, it is desirable to serialize these objects in an HDF5 file. I read for example here, that this can be possible somehow.
For example:
mesh = UnitSquareMesh(nx, ny)
V = FunctionSpace(mesh, 'P', 1)
# Define boundary condition
u_D = Expression('1 + x[0]*x[0] + alpha*x[1]*x[1] + beta*t',
degree=2, alpha=alpha, beta=beta, t=0)
def boundary(x, on_boundary):
return on_boundary
bc = DirichletBC(V, u_D, boundary)
# Define initial value
u_n = interpolate(u_D, V)
#u_n = project(u_D, V)
# Define variational problem
u = TrialFunction(V)
v = TestFunction(V)
f = Constant(beta - 2 - 2*alpha)
F = u*v*dx + dt*dot(grad(u), grad(v))*dx - (u_n + dt*f)*v*dx
and I am interested to serialize u, v, f, F, BC, u_n into a HDF5 file. Is this possible?
I would be grateful for any guidance. Thank you.