[Archive] Script to export data and mesh into ASCII format

Message by julien:
Dear all,
Several SPIS’s users asked for a script to export mesh and data (i.e DataField) into an ASCII file with the whole needed connectivity.
Please find here of this thread an example of script. This script has been validated for scalar data in volume and localised on node (e.g plasma potential). It can be easily extented toother type of data.
To use it, just saved it on the main SPIS-UI directory, open a JyConsole in SPIS and, using the
a the right-button-click in JyConsole, load the script.
To change the path of the output file or the name of the DataField to export, please edit the script directly.

Message by Richard Marchand:
I just did some more tests and here are some things that I found:
I did a very simple simulation with a spherical domain of radius 2m, containing a spherical satellite of radius 1m. The mesh resolution was set to be 0.7 on the inner sphere and 1.0 on the outer one. I accepted all default values for the simulation.
When I save the mesh from gmsh, I get a mesh with 79 nodes and 150 elements. That looks reasonable to me. The number of tetrahedra shoul be typically between 2 and 3 times the number of nodes - Basically, if we add a vertex outside an existing mesh, we create ~ 1 new tetrahedeon. If we add a vertex inside an existing tetrahedron, we delete this tetrahedron, but create ~four new ones -> an increase in the number of tetrahedra by ~3. For dense meshes, the ratio should be close to 3 but for sparse meshes (as this one), it should be lower.
Now, when I use the script to export the mesh and its connectivity, I get 90 vertices and 285 elements (this looks like too many elements).
Then, if I export volume fields to ASCII, such as the potential or the ion density, from the GUI, then I get 88 nodes. I get the same number (88) whether I export these fields selecting on “Cell” or “Node” in the GUI of the “DataFields” manager. This is all very confusing to me, and I would appreciate having a little guidance.
Many thanks in advance. Richard.

Message by Richard Marchand:
If the script is going to be modified, I would like to suggest that it produce the mesh in exactly the same format as gmsh. This would then contain all the information about the geometry and the physical groups in the system. Of course, one might think of obtaining this information from gmsh directly, but the connection between gmsh output and spis output is not obvious. In particular, unless I did something wrong (see posting below) the number of vertices in spis and gmsh are not necessarily the same.

Message by Swadesh SWADESH PATRA:
What is the input to this script? Is it spis_JyTop4.log?But this file doesn’t have information about the nodes(I tried using it but it showed an error(similar to …‘node not found’)).
Is it possible to infer the calculated field positions from Tmp3D.msh?