awslabs / palace

3D finite element solver for computational electromagnetics
https://awslabs.github.io/palace/dev
Apache License 2.0
237 stars 49 forks source link

Reduce the result file size #162

Closed lcheng9 closed 9 months ago

lcheng9 commented 9 months ago

Description: A clear and concise description of what the feature is. Current VTU result file is big due to many duplicated nodes. Output the sole nodal results instead of each element's nodal result may reduce the result file and memory consumption in the post-processing.

sebastiangrimberg commented 9 months ago

Hi @lcheng9, I can refer you to three discussions in the MFEM repository regarding this behavior:

Essentially, most fields we actually care about are not continuous, that is they cannot be represented as a standard H^1 function on the mesh. For example, electric fields and magnetic fields only have partial continuity across interfaces where the domain permittivity or permeability changes. To deal with this, the visualization in ParaView is done in a fully discontinuous manner which, as you note, does lead to duplication of degrees of freedom on interfaces but this is only a problem for postprocessing and thus is not deemed too bad of a restriction.

There are many ways to save memory when loading files into ParaView for large data files, for example only loading the fields (electrostatic voltage in your case I presume) from the data files and ignoring the other ones. Palace also provides a secondary ParaView data set on the domain boundaries for visualization (saved with a _bdr suffix in the same directory as the domain visualization, see https://awslabs.github.io/palace/stable/guide/postprocessing/#Visualization). Moving forward we could support visualization with other tools which actually provide native support for H(curl) or H(div) fields (see https://glvis.org/) if performance is really an issue. But the tradeoff for us was that ParaView is likely more familiar to more users and maintaining multiple paths for postprocessing visualization is inherently more maintainability work.

lcheng9 commented 9 months ago

Hi @sebastiangrimberg, thank you so much for the response and elaboration.

I understand that the ParaViewDataCollection method is general for various element types. While it gives ~20x more nodal data for the continuous elements, maybe exposing a new result type parameter in the JSON input script can help this scenario, then the user can determine the result format, either ParaViewDataCollection, VisitDataCollection, or traditional H1 nodal results. It is not emergent for me, I had this performance concern when I was reading the result files from a transient model. Just feel that the traditional H1 nodal result seems an essential format, and supporting this result format may help many potential users.

sebastiangrimberg commented 9 months ago

That's right. I would certainly welcome such a feature addition in the future plugging into the respective MFEM functionality under the hood. This could be a good first contribution for any would-be developers.

Just as a final comment for your experience though: For transient simulations, the electrostatic potential is not written to disk for visualization, and all outputs (electric field, magnetic flux density, and derived quantities) are actually not continuous and thus not representable with a nodal function space. There is still room for improvement by using the non-L2 nature of the actual spaces (H(curl) and H(div), in particular), which is done with MFEM's GLVIS output. The optimizations for nodal fields specifically would only be applicable to electrostatic problems, and hence the rather narrow impact of such optimizations.