tregular output file writing works - ns2dfd - 2D finite difference Navier Stokes solver for fluid dynamics
(HTM) git clone git://src.adamsgaard.dk/ns2dfd
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit 774db92458969b251c42ee905cf9da083bbb5570
(DIR) parent 3eba95c436a2e58872c5a56f133fa08df65a214a
(HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
Date: Sun, 2 Mar 2014 21:21:59 +0100
regular output file writing works
Diffstat:
M src/main.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
---
(DIR) diff --git a/src/main.c b/src/main.c
t@@ -25,6 +25,7 @@ int main(int argc, char** argv)
double t_file_elapsed = 0.0;
char filename[50];
char *simulation_id;
+ char *dot;
int c;
while ((c = getopt(argc, argv, "hv")) != -1)
t@@ -66,29 +67,30 @@ int main(int argc, char** argv)
}
simulation_id = argv[optind];
- char* dot = strchr(simulation_id, '.');
- dot = '\0';
-
+ dot = strchr(simulation_id, '.');
+ dot[0] = '\0';
printf("%s\n", simulation_id);
- while (t < t_end) {
+ while (t <= t_end+dt) {
dt = select_time_step(tau, re, dx, dy, nx, ny, U, V);
- printf("dt = %f\n", dt);
+ printf("t = %f\tdt = %f\n", t, dt);
- if (t_file_elapsed >= t_file) {
- write_file("unnamed2.dat", &t, &t_end, &t_file, &tau, &itermax,
+ if (t_file_elapsed >= t_file || n == 0) {
+ printf("output file %d\n", nfile);
+ sprintf(filename, "%s%05d.dat", simulation_id, nfile);
+ write_file(filename, &t, &t_end, &t_file, &tau, &itermax,
&epsilon, &omega, &gamma,
&gx, &gy, &re, &w_left, &w_right, &w_top, &w_bottom,
&dx, &dy, &nx, &ny, &P, &U, &V);
t_file_elapsed = 0.0;
+ nfile++;
}
t += dt;
n++;
t_file_elapsed += dt;
- break;
}
free_memory(P, U, V, nx);