Replies: 4 comments 4 replies
-
Should the old internal JSON format be deprecated? It does have the advantage that it depends only on the Python Standard Library, not using meshio (which does evolve, sometimes by leaps & bounds). It's portable in that it is JSON but I don't think anything other than scikit-fem will understand the encoding within the JSON. There's also the slight disadvantage that the serialization of subdomains and boundaries in the JSON differs from that adopted in #680: it lists indices of subsets of cells and facets rather than enumerating the corresponding indicator-function for the subdomains or the indicator function multiplied by binary-encoding of subsets of facets for boundaries. It's probably not worth revising the JSON to match the new serialization, but what's the role of the JSON henceforth? I don't have an opinion on this, I probably won't use it much given the new options available in #680 (unless maybe a makeshift is required during a future upheaval of meshio). I don't think there's anything that needs doing here, unless it is to replace the JSON in |
Beta Was this translation helpful? Give feedback.
-
It might be worthwhile indicating to the user what a good fast compact format for serializing meshes with subdomains and boundaries (and possibly other point- or cell-data). I did have some findings on this in #680 (2021-08-10) and #693. In the former:
In the latter, some steps were taken to replace the JSON but withdrawn as that made the pull-request as too composite. It was replacing scikit-fem/docs/examples/ex27.py Line 109 in e4a4b2b with first MSH 4.1 dac551a and then VTU f799d23 for exx 24, 27. In that case, the MSH 4.1 was slightly smaller (178 K) than the JSON (193 K) and the VTU was much smaller (82.4 KB). VTU was chosen after inspecting the charts in the meshio Performance comparision, passing over those formats don't support cell-data (Exodus) or have additional dependencies (Exodus, MED, XDMF), and formats that I just wasn't familiar with (MOAB). I've been using XDMF heavily the last couple of years and it suits me well, but there might be situations where one mightn't want to depend on HDF5. MSH 2.2 is a poor choice for large files because it's very slow to read. It's one of several formats that defines the type of each cell so that the cells have to be read one at a time. This is intrinsically slow in Python. The fast formats have blocks of cells of the same type, which can be usually be read quickly with NumPy. Thus when Gmsh updated to MSH 4.1, it became literally a thousand times faster to read in my real-world application. Note that XDMF (which has quite a broad specification, only incompletely covered by meshio) writes inhomogeneous meshes |
Beta Was this translation helpful? Give feedback.
-
What I think would be important is to have some serialization format which is directly compatible with other tools in the sense that if we export "boundaries" then some other FEM package can use them via their own importers. I don't yet know what is the universal format but I think it will include separate facet elements based on my brief overview.
|
Beta Was this translation helpful? Give feedback.
-
Ah, yes, of course. Interoperability is another very important criterion, at least equal to size and speed, perhaps moreso. It is unfortunate that at the moment these goals conflict. At the moment, maybe MSH 2.2 is the most widely accepted input format? (Is that supported by your brief overview?) By format I mean format that includes subdomains and boundaries, and accepted and understood by finite element systems. If that's correct, perhaps we should have a method or option to save an Lines 182 to 189 in a1496b6 When MSH 2.2 was the main Gmsh output format, which it was for a very long time, Gmsh encoded subdomains and boundaries as what it called ‘physical tags’ of cells, every cell having exactly one physical tag, using (n − 1)-dimensional cells to represent the boundary-facets. When meshio reads these, it encodes them as Lines 105 to 121 in a1496b6 but not re-encode it in Amongst higher-end finite-element packages, perhaps Exodus is more popular? What was your finding in your brief overview? It does require netCDF4; not impossible, but an additional requirement. I'm not sure about the level of support of Exodus in meshio. It might be possible to lift that with some careful PRs, or perhaps the necessary work can be done prior to meshio in A basic difficulty is that meshio and VTK have no real concept of subdomain or boundary. meshio does how have But really my question here wasn't so much about the ultimate ‘universal format’ (as desirable and worthwhile a goal as that is), but rather just the immediate consequences of the splitting up of #693: whether scikit-fem/docs/examples/ex27.py Line 109 in e4a4b2b is to be retained for now or the JSON to be deprecated and here replaced by something else (MSH 2.2 or MSH 4.1 straight from Gmsh, something exploiting #680, ...). I don't think it's urgent to deprecate the JSON, but I recall the comment in #556 (2021-03-01)
So for exx 24, 27, I have prepared the pure MSH 4.1 and 2.2 files which could be used, also the #680-style VTU, or it can be left as JSON indefinitely till something decisively better is found. Should the file-formats used in |
Beta Was this translation helpful? Give feedback.
-
Should
docs/examples
prefer a particular format for static meshes? Or rather demonstrate the ability to read from multiple formats?The first split is between the internal JSON format and whatever can be read from meshio. The second split, in the latter, is between Gmsh's MSH, which can contain subdomains and boundaries (as (n − 1)-dimensional cells), other formats in which subdomains and boundary-facets have been encoded using #680, and other formats which are just plain meshes without subdomains or boundaries (e.g. which might have those defined subsequently using
.with_boundaries
, &c.). Thus:skfem.io.json.
skfem.io.meshio
Does that cover it?
Beta Was this translation helpful? Give feedback.
All reactions