tstyle fixes - cngf-pf - continuum model for granular flows with pore-pressure dynamics (renamed from 1d_fd_simple_shear)
 (HTM) git clone git://src.adamsgaard.dk/cngf-pf
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit b414aead1ca8a6918118c7f0dff595724d1ff7c8
 (DIR) parent 0526958f21b76c192ee129e28352355fbcd99d69
 (HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
       Date:   Tue, 17 Aug 2021 11:49:02 +0200
       
       style fixes
       
       Diffstat:
         M fluid.c                             |      15 ++++++---------
         M max_depth_simple_shear.c            |       2 +-
         M shear_flux.c                        |       6 ++----
         M simulation.c                        |       3 +--
       
       4 files changed, 10 insertions(+), 16 deletions(-)
       ---
 (DIR) diff --git a/fluid.c b/fluid.c
       t@@ -32,8 +32,7 @@ int
        set_largest_fluid_timestep(struct simulation *sim, const double safety)
        {
                int i;
       -        double dx_min, diff, diff_max;
       -        double *dx;
       +        double dx_min, diff, diff_max, *dx;
        
                dx = spacing(sim->z, sim->nz);
                dx_min = INFINITY;
       t@@ -180,8 +179,7 @@ darcy_pressure_change_1d_impl(const int i,
                                 const double mu_f,
                                 const double D)
        {
       -        double k_, div_k_grad_p, k_zn, k_zp, rhs_term;
       -        double omega = 1.0;
       +        double k_, div_k_grad_p, k_zn, k_zp, rhs_term, omega = 1.0;
        
                if (D > 0.0)
                        return D * (p_f_ghost_in[i + 2]
       t@@ -239,14 +237,14 @@ darcy_solver_1d(struct simulation *sim,
        {
                int i, iter, solved = 0;
                double epsilon, p_f_top, omega, r_norm_max = NAN, *k_n, *phi_n;
       +
                copy_values(sim->p_f_dot, sim->p_f_dot_old, sim->nz);
       -        
        
                /* choose integration method, parameter in [0.0; 1.0]
                 * epsilon = 0.0: explicit
                 * epsilon = 0.5: Crank-Nicolson
                 * epsilon = 1.0: implicit */
       -        epsilon = 0.0;
       +        epsilon = 0.5;
        
                /* underrelaxation parameter in ]0.0; 1.0],
                 * where omega = 1.0: no underrelaxation */
       t@@ -378,9 +376,8 @@ darcy_solver_1d(struct simulation *sim,
                                        iter);
                                fprintf(stderr, ".. Residual normalized error: %f\n", r_norm_max);
                        }
       -        } else {
       +        } else
                        solved = 1;
       -        }
        
                for (i = 0; i < sim->nz; ++i)
                        sim->p_f_dot[i] = epsilon * sim->p_f_dot_impl[i]
       t@@ -390,7 +387,7 @@ darcy_solver_1d(struct simulation *sim,
                            sim->p_f_dot[i] = omega * sim->p_f_dot[i]
                                              + (1.0 - omega) * sim->p_f_dot_old[i];
        
       -  for (i = 0; i < sim->nz-1; ++i)
       +        for (i = 0; i < sim->nz-1; ++i)
                        sim->p_f_next[i+1] = sim->p_f_dot[i] *sim->dt + sim->p_f_ghost[i+1];
        
                set_fluid_bcs(sim->p_f_ghost, sim, p_f_top);
 (DIR) diff --git a/max_depth_simple_shear.c b/max_depth_simple_shear.c
       t@@ -155,6 +155,7 @@ zbrent(struct simulation *sim,
                warnx("error: %s: exceeded maximum number of iterations", __func__);
                free_arrays(sim);
                exit(12);
       +
                return NAN;
        }
        
       t@@ -169,7 +170,6 @@ main(int argc, char *argv[])
        #ifdef BENCHMARK_PERFORMANCE
                clock_t t_begin, t_end;
                double t_elapsed;
       -
        #endif
        
        #ifdef __OpenBSD__
 (DIR) diff --git a/shear_flux.c b/shear_flux.c
       t@@ -23,11 +23,9 @@ usage(void)
        static double
        find_flux(FILE *f)
        {
       -        int i;
       -        double pos, vel, pos_prev, vel_prev, flux;
       +        int i = 0;
       +        double pos, vel, pos_prev, vel_prev, flux = 0.0;
        
       -        i = 0;
       -        flux = 0.0;
                while (fscanf(f, "%lf\t%lf%*[^\n]", &pos, &vel) == 2) {
                        if (i++ > 0)
                                flux += (vel + vel_prev) / 2.0 * (pos - pos_prev);
 (DIR) diff --git a/simulation.c b/simulation.c
       t@@ -684,8 +684,7 @@ implicit_1d_jacobian_poisson_solver(struct simulation *sim,
                                            const double rel_tol)
        {
                int iter, i;
       -        double r_norm_max = NAN;
       -        double *tmp;
       +        double r_norm_max = NAN, *tmp;
        
                for (iter = 0; iter < max_iter; ++iter) {
        #ifdef DEBUG