next up previous contents
Next: VTK RECTILINEAR_GRID BINARY files Up: The Filetypes TYCHO offers Previous: The Filetypes TYCHO offers   Contents

The native TYCHO filetype

The native TYCHO filetype is a raw binary file in double precision. TYCHO writes density, temperature, velocity, obstacles, pressure on obstacles and marker-field files as output. The velocity files are written in the order $v_{x}^{i}$, $v_{y}^{i}$ and $v_{z}^{i}$ for a given cell$i$. The obstacles distribution files as well as the marker-field files are written in raw binary files with integer precision. Like for all filetypes,they are stored in the directory specified by the parameterfile. For each timestep defined by the output-frequency a set of files are generated with an ascending number in the filename and the extension .tyc. The header in each file has a size of 200 bytes and gives information about the content, the simulation time in seconds, resolution in human-readable form and a intern filecounter. An example Header for a TYCHO density file.
TYCHO Density File

The C-routine writing the native TYCHO density file is shown here:

 In this routine a TYCHO density file is written.
int write_tyc(int x, int y, int z, int counter) {
    FILE *fd;
    char filename[600];
    int i, j, k, tmp1;
    double tmp;

    sprintf(filename, "%srho_%i.tyc", output_dir, counter);
    fd = fopen(filename, "w");
    if (fd == NULL) {
        printf("The output directory does not exist\n");
    fprintf(fd, "TYCHO Density File\n%g\n%i\n%i\n%i\n%i\n",
            time_sim, x, y, z, counter);
    fseek(fd, 200, SEEK_SET);
    for (i = 0; i < x; i++) {
        for (j = 0; j < y; j++) {
            for (k = 0; k < z; k++) {
                tmp = rho[i][j][k];
                if (isnan(tmp)) {
                    printf("NaN in density array %i %i %i\n", i, j, k);
                fwrite(&tmp, 1, sizeof (double), fd);

  return 0;