xref: /phasta/converterIO/README.md (revision 595995161822a203c8467e0e4a253d7bd7d6df32)
1*59599516SKenneth E. JansenconverterIO
2*59599516SKenneth E. Jansen===========
3*59599516SKenneth E. Jansen
4*59599516SKenneth E. JansenFile Conversion Tool for PHASTA Files.
5*59599516SKenneth E. Jansen
6*59599516SKenneth E. Jansen1) Description:
7*59599516SKenneth E. Jansen
8*59599516SKenneth E. JansenThis library provides two IO converters for PHASTA files, from the original Posix format to the SyncIO format and vice versa.
9*59599516SKenneth E. JansenThe original Posix format is characterized by 1 geombc and 1 restart file per mesh part, whereas SyncIO relies on MPI-IO and can handle several parts per file.
10*59599516SKenneth E. Jansen
11*59599516SKenneth E. Jansen2) Compilation
12*59599516SKenneth E. Jansen
13*59599516SKenneth E. JansenBoth IO converters are compiled by default along with the phasta executable using cmake.
14*59599516SKenneth E. JansenNote that the phastaIO library is also required to compile this library
15*59599516SKenneth E. JansenBoth conversion executables are named respectively converterO2N (Posix->SyncIO) and converterN2O (SyncIO->Posix).
16*59599516SKenneth E. Jansen
17*59599516SKenneth E. Jansen3) Usage
18*59599516SKenneth E. Jansen
19*59599516SKenneth E. Jansena) converterO2N
20*59599516SKenneth E. Jansen
21*59599516SKenneth E. JansenLet us assume we have already generated a typical #-procs_case directory that contains phasta files under the Posix format (one single geombc and restart file per part), where # is the number of parts in the partitioned mesh.
22*59599516SKenneth E. JansenLet us also assume that we want @ SyncIO files, where "@" is an integer.
23*59599516SKenneth E. JansenThe first requirement is that mod(#,@)=0 so that we end up #/@ parts per SyncIO file.
24*59599516SKenneth E. Jansen
25*59599516SKenneth E. JansenIn order to converter the #-procs_case directory, we simply need to run the converterO2N executable in the following way:
26*59599516SKenneth E. Jansen
27*59599516SKenneth E. Jansen  mpirun -np NP converterO2N
28*59599516SKenneth E. Jansen
29*59599516SKenneth E. Jansenwhich will read the PHASTA files in the #-procs_case directory and generate a new directory named #-procs_case-SyncIO-@ which contains @ new geombc and @ new restart files under the SyncIO format.
30*59599516SKenneth E. JansenThe number of processes NP can be relatively flexible but must follow the following rules:
31*59599516SKenneth E. Janseni) @ <= NP <= #
32*59599516SKenneth E. Jansenii) mod(NP,@)=0
33*59599516SKenneth E. Janseniii) nod(#,NP)=0
34*59599516SKenneth E. Jansen
35*59599516SKenneth E. JansenFor instance, if we have 16 parts and we want 2 SyncIO files (8 parts per SyncIO files), then NP can be equal to 2, 4, 8 and 16.
36*59599516SKenneth E. JansenNote that PHASTA always expects a directory named #-procs_case so that the output directory #-procs_case-SyncIO-@ has to be renamed accordingly.
37*59599516SKenneth E. Jansen
38*59599516SKenneth E. JansenConverterO2N also requires an input file named IO.O2N.input. This input files includes
39*59599516SKenneth E. Jansen- the number of part in the mesh (i.e. #),
40*59599516SKenneth E. Jansen- the time step number of the restart files,
41*59599516SKenneth E. Jansen- the number of output SyncIO files (i.e. @),
42*59599516SKenneth E. Jansen- the number of fields (integer and double) in both the geombc and restart files to convert, and
43*59599516SKenneth E. Jansen- the list of all the fields in both the geombc and restart files to convert.
44*59599516SKenneth E. Jansen
45*59599516SKenneth E. JansenIt can be a tidious task to list all the fields that are essential for the PHASTA simulation.
46*59599516SKenneth E. JansenNo worry, there is a bash script which can generate automatically this input file, which is provided with this converterIO code.
47*59599516SKenneth E. JansenThe script's name is create_IO_O2N_input.sh. Run this script a first time without any argument to learn about its usage.
48*59599516SKenneth E. JansenIt basically requires the time step number of the restart files, the number of parts #, and the number of output SyncIO files.
49*59599516SKenneth E. JansenWe can always add more fields if needed, especially for the restart files (ybar, dwal, error, etc).
50*59599516SKenneth E. JansenNote that the double fields for either the geombc or restart files must always preceed the integer field in the list and the fields counter needs also to be increased in the header of IO.O2N.input.
51*59599516SKenneth E. Jansen
52*59599516SKenneth E. JansenBeware! This script relies on grep, awk, etc and needs to be applied to ALL the phasta files contained in the #-procs_case directory.
53*59599516SKenneth E. JansenIndeed, for mixed topology meshes, there is no garantee that a single geombc file will contain all the topologies present in the mesh.
54*59599516SKenneth E. JansenTherefore, it is strongly advised to run this script on a limited part count mesh (up to a few thousands is ok) and not on multiple million part meshes (don't do that!).
55*59599516SKenneth E. JansenInstead, we can always recycle the same input file from a small partitioning to a large one as long as the topology of the mesh has not changed.
56*59599516SKenneth E. Jansen
57*59599516SKenneth E. Jansenb) converterN2O
58*59599516SKenneth E. Jansen
59*59599516SKenneth E. JansenLet us assume again that we have a #-procs_case directory that contains @ phasta files under the SyncIO format this time.
60*59599516SKenneth E. Jansen
61*59599516SKenneth E. JansenIn order to deconverter the #-procs_case directory from the SyncIO format to the Posix format, we simply need to run the converterN2O executable in the following way:
62*59599516SKenneth E. Jansen
63*59599516SKenneth E. Jansen  mpirun -np # converterN2O
64*59599516SKenneth E. Jansen
65*59599516SKenneth E. Jansenwhich will read the PHASTA files in the #-procs_case directory and generate a new directory named #-procs_case-1PPP which contains # geombc and # restart files under the Posix format.
66*59599516SKenneth E. Jansen
67*59599516SKenneth E. JansenAlthough there is a serial reader for SyncIO file that is used in Paraview for instance, converterN2O can currently read the phasta files under the SyncIO format only collectively.
68*59599516SKenneth E. JansenThis means that the number of processes in this case must be equal to the total number of parts, like for PHASTA.
69*59599516SKenneth E. JansenThis could be improved in the future for more flexibility like for converterO2N.
70*59599516SKenneth E. Jansen
71*59599516SKenneth E. JansenSimilarly to create_IO_O2N_input.sh, there is also a bash script named create_IO_N2O_input.sh which can generate the input file for converterN2O.
72*59599516SKenneth E. JansenThis script is simpler since only the fields in the restart file really need to be deconverted (blocks and double).
73*59599516SKenneth E. JansenIndeed, you should already have the original geombc files under the Posix format somewhere so it is useless (and time consuming) to generate them again.
74*59599516SKenneth E. JansenThe usage of this script is the same as above.
75*59599516SKenneth E. JansenBy default, it will add to the input file all the blocks present in the restart files and assume they are all double.
76*59599516SKenneth E. JansenAfterwards, we can manually adapt this script for any specific need.
77*59599516SKenneth E. Jansen
78*59599516SKenneth E. Jansen
79*59599516SKenneth E. JansenQuestions, comments or suggestions are always welcome.
80*59599516SKenneth E. Jansen
81*59599516SKenneth E. JansenFeel free to contact:
82*59599516SKenneth E. Jansen
83*59599516SKenneth E. Jansen  Michel Rasquin
84*59599516SKenneth E. Jansen  michel.rasquin@colorado.edu
85*59599516SKenneth E. Jansen
86*59599516SKenneth E. Jansen
87*59599516SKenneth E. Jansen
88*59599516SKenneth E. Jansen
89*59599516SKenneth E. Jansen
90*59599516SKenneth E. Jansen
91*59599516SKenneth E. Jansen
92*59599516SKenneth E. Jansen
93*59599516SKenneth E. Jansen
94*59599516SKenneth E. Jansen
95*59599516SKenneth E. Jansen
96*59599516SKenneth E. Jansen
97*59599516SKenneth E. Jansen
98*59599516SKenneth E. Jansen
99*59599516SKenneth E. Jansen
100*59599516SKenneth E. Jansen
101*59599516SKenneth E. Jansen
102*59599516SKenneth E. Jansen
103*59599516SKenneth E. Jansen
104*59599516SKenneth E. Jansen
105*59599516SKenneth E. Jansen
106*59599516SKenneth E. Jansen
107*59599516SKenneth E. Jansen
108