tChange pointer style - cngf-pf - continuum model for granular flows with pore-… | |
git clone git://src.adamsgaard.dk/cngf-pf | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 1dd08e43898129e92e949305a12b8d73eed889ad | |
parent 43b852a03b63ecd7ddf16379421318595d7b87af | |
Author: Anders Damsgaard <[email protected]> | |
Date: Thu, 14 May 2020 16:47:39 +0200 | |
Change pointer style | |
Diffstat: | |
M arrays.h | 48 ++++++++++++++++-------------… | |
M fluid.c | 4 ++-- | |
M simulation.c | 6 +++--- | |
M simulation.h | 42 ++++++++++++++++-------------… | |
4 files changed, 50 insertions(+), 50 deletions(-) | |
--- | |
diff --git a/arrays.h b/arrays.h | |
t@@ -19,36 +19,36 @@ unsigned int idx2g( | |
unsigned int idx1g(const unsigned int i); | |
-double* spacing(const double* x, const int n); | |
-double* linspace(const double lower, const double upper, const int n); | |
-double* zeros(const int n); | |
-double* ones(const int n); | |
-double* initval(const double value, const int n); | |
-double* empty(const int n); | |
- | |
-double max(const double* a, const int n); | |
-double min(const double* a, const int n); | |
- | |
-void print_array(const double* a, const int n); | |
-void print_arrays(const double* a, const double* b, const int n); | |
-void print_arrays_2nd_normalized(const double* a, const double* b, const int n… | |
+double * spacing(const double *x, const int n); | |
+double * linspace(const double lower, const double upper, const int n); | |
+double * zeros(const int n); | |
+double * ones(const int n); | |
+double * initval(const double value, const int n); | |
+double * empty(const int n); | |
+ | |
+double max(const double *a, const int n); | |
+double min(const double *a, const int n); | |
+ | |
+void print_array(const double *a, const int n); | |
+void print_arrays(const double *a, const double *b, const int n); | |
+void print_arrays_2nd_normalized(const double *a, const double *b, const int n… | |
void print_three_arrays( | |
- const double* a, | |
- const double* b, | |
- const double* c, | |
+ const double *a, | |
+ const double *b, | |
+ const double *c, | |
const int n); | |
-void fprint_arrays(FILE* fp, const double* a, const double* b, const int n); | |
+void fprint_arrays(FILE *fp, const double *a, const double *b, const int n); | |
void fprint_three_arrays( | |
- FILE* fp, | |
- const double* a, | |
- const double* b, | |
- const double* c, | |
+ FILE *fp, | |
+ const double *a, | |
+ const double *b, | |
+ const double *c, | |
const int n); | |
-void copy_values(const double* in, double* out, const int n); | |
-double* copy(const double* in, const int n); | |
-double* normalize(const double* in, const int n); | |
+void copy_values(const double *in, double *out, const int n); | |
+double * copy(const double *in, const int n); | |
+double * normalize(const double *in, const int n); | |
#endif | |
diff --git a/fluid.c b/fluid.c | |
t@@ -250,8 +250,8 @@ darcy_solver_1d(struct simulation *sim, | |
p_f_ghost_new[i + 1] = p_f_ghost_old[i + 1] * … | |
+ p_f_ghost_new[i + 1] * theta; | |
- r_norm[i] = residual_normalized(p_f_ghost_new[… | |
- sim->p_f_ghost… | |
+ r_norm[i] = fabs(residual(p_f_ghost_new[i + 1], | |
+ sim->p_f_ghost[i + 1… | |
} | |
r_norm_max = max(r_norm, sim->nz); | |
diff --git a/simulation.c b/simulation.c | |
t@@ -594,9 +594,9 @@ set_bc_dirichlet(double *a, | |
} | |
double | |
-residual_normalized(double new, double old) | |
+residual(double new, double old) | |
{ | |
- return fabs((new - old) / (old + 1e-16)); | |
+ return (new - old) / (old + 1e-16); | |
} | |
static void | |
t@@ -803,7 +803,7 @@ coupled_shear_solver(struct simulation *sim, | |
* converged */ | |
if (sim->transient) { | |
for (i = 0; i < sim->nz; ++i) | |
- r_norm[i] = residual_normalized(sim->g… | |
+ r_norm[i] = fabs(residual(sim->gamma_d… | |
r_norm_max = max(r_norm, sim->nz); | |
if (r_norm_max <= rel_tol) | |
break; | |
diff --git a/simulation.h b/simulation.h | |
t@@ -61,7 +61,7 @@ struct simulation { | |
double L_z; | |
/* array of cell coordinates */ | |
- double* z; | |
+ double *z; | |
/* cell spacing [m] */ | |
double dz; | |
t@@ -99,22 +99,22 @@ struct simulation { | |
double rho_f; /* fluid density [kg/m^3] */ | |
/* arrays */ | |
- double* mu; /* static yield friction [-] */ | |
- double* mu_c; /* critical-state static yield friction [-] */ | |
- double* sigma_n_eff; /* effective normal pressure [Pa] */ | |
- double* sigma_n; /* normal stress [Pa] */ | |
- double* p_f_ghost; /* fluid pressure [Pa] */ | |
- double* k; /* hydraulic permeability [m^2] */ | |
- double* phi; /* porosity [-] */ | |
- double* phi_c; /* critical-state porosity [-] */ | |
- double* phi_dot; /* porosity change [s^-1] */ | |
- double* xi; /* cooperativity length */ | |
- double* gamma_dot_p; /* plastic shear strain rate [s^-1] */ | |
- double* v_x; /* shear velocity [m/s] */ | |
- double* g_local; /* local fluidity */ | |
- double* g_ghost; /* fluidity with ghost nodes */ | |
- double* I; /* inertia number [-] */ | |
- double* tan_psi; /* tan(dilatancy_angle) [-] */ | |
+ double *mu; /* static yield friction [-] */ | |
+ double *mu_c; /* critical-state static yield friction [-] */ | |
+ double *sigma_n_eff; /* effective normal pressure [Pa] */ | |
+ double *sigma_n; /* normal stress [Pa] */ | |
+ double *p_f_ghost; /* fluid pressure [Pa] */ | |
+ double *k; /* hydraulic permeability [m^2] */ | |
+ double *phi; /* porosity [-] */ | |
+ double *phi_c; /* critical-state porosity [-] */ | |
+ double *phi_dot; /* porosity change [s^-1] */ | |
+ double *xi; /* cooperativity length */ | |
+ double *gamma_dot_p; /* plastic shear strain rate [s^-1] */ | |
+ double *v_x; /* shear velocity [m/s] */ | |
+ double *g_local; /* local fluidity */ | |
+ double *g_ghost; /* fluidity with ghost nodes */ | |
+ double *I; /* inertia number [-] */ | |
+ double *tan_psi; /* tan(dilatancy_angle) [-] */ | |
}; | |
void init_sim(struct simulation *sim); | |
t@@ -139,21 +139,21 @@ void compute_shear_velocity(struct simulation *sim); | |
void compute_effective_stress(struct simulation *sim); | |
void compute_friction(struct simulation *sim); | |
-void set_bc_neumann(double* a, | |
+void set_bc_neumann(double *a, | |
const int nz, | |
const int boundary, | |
const double df, | |
const double dx); | |
-void set_bc_dirichlet(double* a, | |
+void set_bc_dirichlet(double *a, | |
const int nz, | |
const int boundary, | |
const double value); | |
-double residual_normalized(double new, double old); | |
+double residual(double new, double old); | |
void write_output_file(struct simulation *sim, const int normalize); | |
-void print_output(struct simulation *sim, FILE* fp, const int normalize); | |
+void print_output(struct simulation *sim, FILE *fp, const int normalize); | |
int coupled_shear_solver(struct simulation *sim, | |
const int max_iter, |