tuse common kozeny_carman function - cngf-pf - continuum model for granular flo… | |
git clone git://src.adamsgaard.dk/cngf-pf | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 86bfb546fc4ee751ba362a88bd1705e97bf82f5a | |
parent 50f06fc60f267608011e5c54e3170d98daa7569e | |
Author: Anders Damsgaard <[email protected]> | |
Date: Tue, 17 Aug 2021 10:49:54 +0200 | |
use common kozeny_carman function | |
Diffstat: | |
M fluid.c | 10 +++------- | |
M simulation.c | 12 +++++++++--- | |
M simulation.h | 1 + | |
3 files changed, 13 insertions(+), 10 deletions(-) | |
--- | |
diff --git a/fluid.c b/fluid.c | |
t@@ -238,7 +238,7 @@ darcy_solver_1d(struct simulation *sim, | |
const double rel_tol) | |
{ | |
int i, iter, solved = 0; | |
- double epsilon, p_f_top, omega, r_norm_max = NAN; | |
+ 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); | |
t@@ -246,7 +246,7 @@ darcy_solver_1d(struct simulation *sim, | |
* epsilon = 0.0: explicit | |
* epsilon = 0.5: Crank-Nicolson | |
* epsilon = 1.0: implicit */ | |
- epsilon = 0.5; | |
+ epsilon = 0.0; | |
/* underrelaxation parameter in ]0.0; 1.0], | |
* where omega = 1.0: no underrelaxation */ | |
t@@ -302,15 +302,11 @@ darcy_solver_1d(struct simulation *sim, | |
if (epsilon > 0.0) { | |
/* grabbing the n + 1 iteration values for k and phi */ | |
- double * k_n; | |
- double * phi_n; | |
k_n = zeros(sim->nz); | |
phi_n = zeros(sim->nz); | |
for (i = 0; i < sim->nz; ++i) { | |
phi_n[i] = sim->phi[i] + sim->dt*sim->phi_dot[i]; | |
- k_n[i] = sim->d * sim->d / 180.0 | |
- * phi_n[i] * phi_n[i] * phi_n[i] | |
- / pow(1.0 - phi_n[i], 2.0); | |
+ k_n[i] = kozeny_carman(sim->d, phi_n[i]); | |
} | |
#ifdef DEBUG | |
printf("\nEXPLICIT SOLVER IN %s\n", __func__); | |
diff --git a/simulation.c b/simulation.c | |
t@@ -493,15 +493,21 @@ compute_porosity_change(struct simulation *sim) | |
sim->phi_dot[i] = sim->tan_psi[i] * sim->gamma_dot_p[i] * sim-… | |
} | |
+double | |
+kozeny_carman(const double diameter, const double porosity) | |
+{ | |
+ return pow(diameter, 2.0) / 180.0 | |
+ * pow(porosity, 3.0) | |
+ / pow(1.0 - porosity, 2.0); | |
+} | |
+ | |
static void | |
compute_permeability(struct simulation *sim) | |
{ | |
int i; | |
for (i = 0; i < sim->nz; ++i) | |
- sim->k[i] = pow(sim->d, 2.0) / 180.0 | |
- * pow(sim->phi[i], 3.0) | |
- / pow(1.0 - sim->phi[i], 2.0); | |
+ sim->k[i] = kozeny_carman(sim->d, sim->phi[i]); | |
} | |
/* NEW FUNCTIONS END */ | |
diff --git a/simulation.h b/simulation.h | |
t@@ -149,6 +149,7 @@ void set_bc_dirichlet(double *a, | |
const double value); | |
double residual(double new_val, double old_val); | |
+double kozeny_carman(const double diameter, const double porosity); | |
void write_output_file(struct simulation *sim, const int normalize); | |
void print_output(struct simulation *sim, FILE *fp, const int normalize); |