-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
serialization of meshes and solutions #158
Comments
For meshes created with |
Closed
Closed
You can now serialize meshes via import json
json.dumps(m.to_dict()) |
Merged
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In working on combining a Navier–Stokes solution #145 with an advection–diffusion problem #152, I thought to first solve for the flow, then save it. Then in a second script, for the advection–diffusion, load the mesh and velocity and solve for the temperature.
The motivation is that, depending on fineness of the mesh, the flow takes a few minutes to solve whereas the advection–diffusion should take much less and I might be making lots of little changes to the second script and don't want to have to rerun the first script every time.
The two hurdles I see are:
save
doesn't save theboundaries
attribute. This attribute doesn't fit into either thepoint_data
orcell_data
optional arguments as I think these are supposed to have lengths matching.shape[1]
of.p
or.t
, respectively. Thus it's not obvious how to get meshio to save this, despite its various output formats. It could be stored in thefield_data
of ameshio.Mesh
, but I don't know whether this would be stored in an ouput mesh file, or whether it would subsequently be reread. Maybe construct the (n − 1)-dimensional elements corresponding to the boundary facets and pack these into thecells
variable passed to themeshio.Mesh
constructor insideskfem.Mesh.save
? Along with the appropriatecell_data
.'triangle'
cells (in two dimensions), which only have three nodes. It's not obvious how to get meshio to save a P2 solution on a mesh of simple triangles or tetrahedra. Should the facet-midpoint nodes and then the six-node triangles be constructed? (Which gets back to finding dof locations Finding dof locations #84).For the moment, it'll probably do to locally pickle the boundaries attribute and
numpy.save
the solution array, but serialization of meshes and solutions is likely to be something that's going to be wanted eventually, as more problems get more complicated and solution times grow.The text was updated successfully, but these errors were encountered: