24 long long int tmp1, tmp1_vx, tmp1_vy, tmp1_vz;
25 double tmp, tmp_vx, tmp_vy, tmp_vz;
28 fd = fopen(filename,
"wb");
30 printf(
"-----------------------------------\n");
31 printf(
"The output directory does not exist\n");
32 printf(
"-----------------------------------\n");
35 fprintf(fd,
"# vtk DataFile Version 3.0\n");
37 fprintf(fd,
"BINARY\n");
38 fprintf(fd,
"DATASET RECTILINEAR_GRID\n");
39 fprintf(fd,
"DIMENSIONS %i %i %i\n", x, y, z);
40 fprintf(fd,
"X_COORDINATES %i double\n", x);
41 for (i = 0; i <
x; i++) {
42 tmp = ((double)
xmax / (
double)
x) * (
double) i;
43 tmp1 =
ntohll(*((
long long int*) & tmp));
44 fwrite(&tmp1, 1,
sizeof (
double), fd);
46 fprintf(fd,
"\nY_COORDINATES %i double\n", y);
47 for (i = 0; i <
y; i++) {
48 tmp = ((double)
ymax / (
double)
y) * (
double) i;
49 tmp1 =
ntohll(*((
long long int*) & tmp));
50 fwrite(&tmp1, 1,
sizeof (
double), fd);
52 fprintf(fd,
"\nZ_COORDINATES %i double\n", z);
53 for (i = 0; i <
z; i++) {
54 tmp = ((double)
zmax / (
double)
z) * (
double) i;
55 tmp1 =
ntohll(*((
long long int*) & tmp));
56 fwrite(&tmp1, 1,
sizeof (
double), fd);
58 fprintf(fd,
"\nPOINT_DATA %i\n", x * y * z);
59 fprintf(fd,
"SCALARS density double 1\n");
60 fprintf(fd,
"LOOKUP_TABLE default\n");
61 for (k = 0; k <
z; k++) {
62 for (j = 0; j <
y; j++) {
63 for (i = 0; i <
x; i++) {
65 tmp1 =
ntohll(*((
long long int*) & tmp));
66 fwrite(&tmp1, 1,
sizeof (
double), fd);
72 sprintf(filename,
"%spressure_ic.vtk",
output_dir);
73 fd = fopen(filename,
"wb");
75 printf(
"-----------------------------------\n");
76 printf(
"The output directory does not exist\n");
77 printf(
"-----------------------------------\n");
80 fprintf(fd,
"# vtk DataFile Version 3.0\n");
82 fprintf(fd,
"BINARY\n");
83 fprintf(fd,
"DATASET RECTILINEAR_GRID\n");
84 fprintf(fd,
"DIMENSIONS %i %i %i\n", x, y, z);
85 fprintf(fd,
"X_COORDINATES %i double\n", x);
86 for (i = 0; i <
x; i++) {
87 tmp = ((double)
xmax / (
double)
x) * (
double) i;
88 tmp1 =
ntohll(*((
long long int*) & tmp));
89 fwrite(&tmp1, 1,
sizeof (
double), fd);
91 fprintf(fd,
"\nY_COORDINATES %i double\n", y);
92 for (i = 0; i <
y; i++) {
93 tmp = ((double)
ymax / (
double)
y) * (
double) i;
94 tmp1 =
ntohll(*((
long long int*) & tmp));
95 fwrite(&tmp1, 1,
sizeof (
double), fd);
97 fprintf(fd,
"\nZ_COORDINATES %i double\n", z);
98 for (i = 0; i <
z; i++) {
99 tmp = ((double)
zmax / (
double)
z) * (
double) i;
100 tmp1 =
ntohll(*((
long long int*) & tmp));
101 fwrite(&tmp1, 1,
sizeof (
double), fd);
103 fprintf(fd,
"\nPOINT_DATA %i\n", x * y * z);
104 fprintf(fd,
"SCALARS pressure double 1\n");
105 fprintf(fd,
"LOOKUP_TABLE default\n");
106 for (k = 0; k <
z; k++) {
107 for (j = 0; j <
y; j++) {
108 for (i = 0; i <
x; i++) {
109 if (
dom[i][j][k] == 0) tmp =
pre[i][j][k];
110 if (
dom[i][j][k] == 1) tmp = 0.0;
111 tmp1 =
ntohll(*((
long long int*) & tmp));
112 fwrite(&tmp1, 1,
sizeof (
double), fd);
118 sprintf(filename,
"%stemp_ic.vtk",
output_dir);
119 fd = fopen(filename,
"wb");
121 printf(
"-----------------------------------\n");
122 printf(
"The output directory does not exist\n");
123 printf(
"-----------------------------------\n");
126 fprintf(fd,
"# vtk DataFile Version 3.0\n");
128 fprintf(fd,
"BINARY\n");
129 fprintf(fd,
"DATASET RECTILINEAR_GRID\n");
130 fprintf(fd,
"DIMENSIONS %i %i %i\n", x, y, z);
131 fprintf(fd,
"X_COORDINATES %i double\n", x);
132 for (i = 0; i <
x; i++) {
133 tmp = ((double)
xmax / (
double)
x) * (
double) i;
134 tmp1 =
ntohll(*((
long long int*) & tmp));
135 fwrite(&tmp1, 1,
sizeof (
double), fd);
137 fprintf(fd,
"\nY_COORDINATES %i double\n", y);
138 for (i = 0; i <
y; i++) {
139 tmp = ((double)
ymax / (
double)
y) * (
double) i;
140 tmp1 =
ntohll(*((
long long int*) & tmp));
141 fwrite(&tmp1, 1,
sizeof (
double), fd);
143 fprintf(fd,
"\nZ_COORDINATES %i double\n", z);
144 for (i = 0; i <
z; i++) {
145 tmp = ((double)
zmax / (
double)
z) * (
double) i;
146 tmp1 =
ntohll(*((
long long int*) & tmp));
147 fwrite(&tmp1, 1,
sizeof (
double), fd);
149 fprintf(fd,
"\nPOINT_DATA %i\n", x * y * z);
150 fprintf(fd,
"SCALARS temperature double 1\n");
151 fprintf(fd,
"LOOKUP_TABLE default\n");
152 for (k = 0; k <
z; k++) {
153 for (j = 0; j <
y; j++) {
154 for (i = 0; i <
x; i++) {
156 tmp1 =
ntohll(*((
long long int*) & tmp));
157 fwrite(&tmp1, 1,
sizeof (
double), fd);
163 sprintf(filename,
"%svel_ic.vtk",
output_dir);
164 fd = fopen(filename,
"wb");
166 printf(
"-----------------------------------\n");
167 printf(
"The output directory does not exist\n");
168 printf(
"-----------------------------------\n");
171 fprintf(fd,
"# vtk DataFile Version 3.0\n");
173 fprintf(fd,
"BINARY\n");
174 fprintf(fd,
"DATASET RECTILINEAR_GRID\n");
175 fprintf(fd,
"DIMENSIONS %i %i %i\n", x, y, z);
176 fprintf(fd,
"X_COORDINATES %i double\n", x);
177 for (i = 0; i <
x; i++) {
178 tmp = ((double)
xmax / (
double)
x) * (
double) i;
179 tmp1 =
ntohll(*((
long long int*) & tmp));
180 fwrite(&tmp1, 1,
sizeof (
double), fd);
182 fprintf(fd,
"\nY_COORDINATES %i double\n", y);
183 for (i = 0; i <
y; i++) {
184 tmp = ((double)
ymax / (
double)
y) * (
double) i;
185 tmp1 =
ntohll(*((
long long int*) & tmp));
186 fwrite(&tmp1, 1,
sizeof (
double), fd);
188 fprintf(fd,
"\nZ_COORDINATES %i double\n", z);
189 for (i = 0; i <
z; i++) {
190 tmp = ((double)
zmax / (
double)
z) * (
double) i;
191 tmp1 =
ntohll(*((
long long int*) & tmp));
192 fwrite(&tmp1, 1,
sizeof (
double), fd);
194 fprintf(fd,
"\nPOINT_DATA %i\n", x * y * z);
195 fprintf(fd,
"VECTORS velocity double 1\n");
196 for (k = 0; k <
z; k++) {
197 for (j = 0; j <
y; j++) {
198 for (i = 0; i <
x; i++) {
199 tmp_vx =
vx[i][j][k];
200 tmp1_vx =
ntohll(*((
long long int*) & tmp_vx));
201 tmp_vy =
vy[i][j][k];
202 tmp1_vy =
ntohll(*((
long long int*) & tmp_vy));
203 tmp_vz =
vz[i][j][k];
204 tmp1_vz =
ntohll(*((
long long int*) & tmp_vz));
206 fwrite(&tmp1_vx, 1,
sizeof (
double), fd);
207 fwrite(&tmp1_vy, 1,
sizeof (
double), fd);
208 fwrite(&tmp1_vz, 1,
sizeof (
double), fd);
215 sprintf(filename,
"%spressure_on_solid_ic.vtk",
output_dir);
216 fd = fopen(filename,
"wb");
218 printf(
"-----------------------------------\n");
219 printf(
"The output directory does not exist\n");
220 printf(
"-----------------------------------\n");
223 fprintf(fd,
"# vtk DataFile Version 3.0\n");
225 fprintf(fd,
"BINARY\n");
226 fprintf(fd,
"DATASET RECTILINEAR_GRID\n");
227 fprintf(fd,
"DIMENSIONS %i %i %i\n", x, y, z);
228 fprintf(fd,
"X_COORDINATES %i double\n", x);
229 for (i = 0; i <
x; i++) {
230 tmp = ((double)
xmax / (
double)
x) * (
double) i;
231 tmp1 =
ntohll(*((
long long int*) & tmp));
232 fwrite(&tmp1, 1,
sizeof (
double), fd);
234 fprintf(fd,
"\nY_COORDINATES %i double\n", y);
235 for (i = 0; i <
y; i++) {
236 tmp = ((double)
ymax / (
double)
y) * (
double) i;
237 tmp1 =
ntohll(*((
long long int*) & tmp));
238 fwrite(&tmp1, 1,
sizeof (
double), fd);
240 fprintf(fd,
"\nZ_COORDINATES %i double\n", z);
241 for (i = 0; i <
z; i++) {
242 tmp = ((double)
zmax / (
double)
z) * (
double) i;
243 tmp1 =
ntohll(*((
long long int*) & tmp));
244 fwrite(&tmp1, 1,
sizeof (
double), fd);
246 fprintf(fd,
"\nPOINT_DATA %i\n", x * y * z);
247 fprintf(fd,
"SCALARS pressure_on_solid double 1\n");
248 fprintf(fd,
"LOOKUP_TABLE default\n");
249 for (k = 0; k <
z; k++) {
250 for (j = 0; j <
y; j++) {
251 for (i = 0; i <
x; i++) {
253 tmp1 =
ntohll(*((
long long int*) & tmp));
254 fwrite(&tmp1, 1,
sizeof (
double), fd);
260 sprintf(filename,
"%TYCHO dB_map_ic.vtk",
output_dir);
261 fd = fopen(filename,
"wb");
263 printf(
"-----------------------------------\n");
264 printf(
"The output directory does not exist\n");
265 printf(
"-----------------------------------\n");
268 fprintf(fd,
"# vtk DataFile Version 3.0\n");
270 fprintf(fd,
"BINARY\n");
271 fprintf(fd,
"DATASET RECTILINEAR_GRID\n");
272 fprintf(fd,
"DIMENSIONS %i %i %i\n", x, y, z);
273 fprintf(fd,
"X_COORDINATES %i double\n", x);
274 for (i = 0; i <
x; i++) {
275 tmp = ((double)
xmax / (
double)
x) * (
double) i;
276 tmp1 =
ntohll(*((
long long int*) & tmp));
277 fwrite(&tmp1, 1,
sizeof (
double), fd);
279 fprintf(fd,
"\nY_COORDINATES %i double\n", y);
280 for (i = 0; i <
y; i++) {
281 tmp = ((double)
ymax / (
double)
y) * (
double) i;
282 tmp1 =
ntohll(*((
long long int*) & tmp));
283 fwrite(&tmp1, 1,
sizeof (
double), fd);
285 fprintf(fd,
"\nZ_COORDINATES %i double\n", z);
286 for (i = 0; i <
z; i++) {
287 tmp = ((double)
zmax / (
double)
z) * (
double) i;
288 tmp1 =
ntohll(*((
long long int*) & tmp));
289 fwrite(&tmp1, 1,
sizeof (
double), fd);
291 fprintf(fd,
"\nPOINT_DATA %i\n", x * y * z);
292 fprintf(fd,
"SCALARS pressure_on_solid double 1\n");
293 fprintf(fd,
"LOOKUP_TABLE default\n");
294 for (k = 0; k <
z; k++) {
295 for (j = 0; j <
y; j++) {
296 for (i = 0; i <
x; i++) {
298 tmp1 =
ntohll(*((
long long int*) & tmp));
299 fwrite(&tmp1, 1,
sizeof (
double), fd);
309 sprintf(filename,
"%smarker_ic.vtk",
output_dir);
310 fd = fopen(filename,
"wb");
312 printf(
"-----------------------------------\n");
313 printf(
"The output directory does not exist\n");
314 printf(
"-----------------------------------\n");
317 fprintf(fd,
"# vtk DataFile Version 3.0\n");
319 fprintf(fd,
"BINARY\n");
320 fprintf(fd,
"DATASET RECTILINEAR_GRID\n");
321 fprintf(fd,
"DIMENSIONS %i %i %i\n", x, y, z);
322 fprintf(fd,
"X_COORDINATES %i double\n", x);
323 for (i = 0; i <
x; i++) {
324 tmp = ((double)
xmax / (
double)
x) * (
double) i;
325 tmp1 =
ntohll(*((
long long int*) & tmp));
326 fwrite(&tmp1, 1,
sizeof (
double), fd);
328 fprintf(fd,
"\nY_COORDINATES %i double\n", y);
329 for (i = 0; i <
y; i++) {
330 tmp = ((double)
ymax / (
double)
y) * (
double) i;
331 tmp1 =
ntohll(*((
long long int*) & tmp));
332 fwrite(&tmp1, 1,
sizeof (
double), fd);
334 fprintf(fd,
"\nZ_COORDINATES %i double\n", z);
335 for (i = 0; i <
z; i++) {
336 tmp = ((double)
zmax / (
double)
z) * (
double) i;
337 tmp1 =
ntohll(*((
long long int*) & tmp));
338 fwrite(&tmp1, 1,
sizeof (
double), fd);
340 fprintf(fd,
"\nPOINT_DATA %i\n", x * y * z);
341 fprintf(fd,
"SCALARS marker_density double 1\n");
342 fprintf(fd,
"LOOKUP_TABLE default\n");
343 for (k = 0; k <
z; k++) {
344 for (j = 0; j <
y; j++) {
345 for (i = 0; i <
x; i++) {
347 tmp1 =
ntohll(*((
long long int*) & tmp));
348 fwrite(&tmp1, 1,
sizeof (
double), fd);