trenamed test case, added debug flag, the code 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 502702ca8b1d45e5023f4e1f5fa5b5408a614ed4
 (DIR) parent 58f406613c0c30ec7f453095e1d9399539341ad5
 (HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
       Date:   Tue,  4 Mar 2014 12:02:40 +0100
       
       renamed test case, added debug flag, the code works
       
       Diffstat:
         D cons_of_mass.py                     |       7 -------
         A pressure_anomaly.py                 |       8 ++++++++
         M src/main.c                          |      18 +++++++++++++++++-
       
       3 files changed, 25 insertions(+), 8 deletions(-)
       ---
 (DIR) diff --git a/cons_of_mass.py b/cons_of_mass.py
       t@@ -1,7 +0,0 @@
       -#!/usr/bin/env python
       -import ns2dfd
       -
       -sim = ns2dfd.fluid()
       -sim.run()
       -sim.read(sim.sim_id + '00004.dat')
       -print(sim.P)
 (DIR) diff --git a/pressure_anomaly.py b/pressure_anomaly.py
       t@@ -0,0 +1,8 @@
       +#!/usr/bin/env python
       +import ns2dfd
       +
       +sim = ns2dfd.fluid()
       +sim.P[5,3] = 1.0
       +sim.run()
       +sim.read(sim.sim_id + '00004.dat')
       +print(sim.P)
 (DIR) diff --git a/src/main.c b/src/main.c
       t@@ -10,6 +10,8 @@
        
        #define VERSION 0.1
        
       +/*#define DEBUG*/
       +
        int main(int argc, char** argv)
        {
            double t, t_file, t_end, tau;
       t@@ -81,9 +83,12 @@ int main(int argc, char** argv)
            allocate_matrix(&RHS, nx+2, ny+2);
            allocate_matrix(&RES, nx+2, ny+2);
        
       -    print_matrix("P", P, nx+2, ny+2);
       +#ifdef DEBUG
       +    print_matrix("V", P, nx+2, ny+2);
            print_matrix("U", U, nx+2, ny+2);
            print_matrix("V", V, nx+2, ny+2);
       +#endif
       +
            while (t <= t_end+dt) {
        
                dt = select_time_step(tau, re, dx, dy, nx, ny, U, V);
       t@@ -106,11 +111,17 @@ int main(int argc, char** argv)
                        nx, ny);
        
                compute_f_g(F, G, U, V, P, re, nx, ny, dx, dy, gx, gy, dt, gamma);
       +
       +#ifdef DEBUG
                print_matrix("F", F, nx+2, ny+2);
                print_matrix("G", G, nx+2, ny+2);
       +#endif
        
                compute_rhs(RHS, F, G, dt, dx, dy, nx, ny);
       +
       +#ifdef DEBUG
                print_matrix("RHS", RHS, nx+2, ny+2);
       +#endif
        
                it = 0;
                res = 1.0e9;
       t@@ -120,16 +131,21 @@ int main(int argc, char** argv)
        
                    res = max_residual_norm(RES, P, RHS, nx, ny, dx, dy);
        
       +#ifdef DEBUG
                    printf("\nit = %d\n", it);
                    print_matrix("P", P, nx+2, ny+2);
                    print_matrix("RES", RES, nx+2, ny+2);
       +#endif
        
                    it++;
                }
        
                correct_velocities(U, V, F, G, P, nx, ny, dt, dx, dy);
       +
       +#ifdef DEBUG
                print_matrix("U", U, nx+2, ny+2);
                print_matrix("V", V, nx+2, ny+2);
       +#endif
        
                t += dt;
                n++;