commit 1b7a4d4eb534ef7b24357bb256d4bb7348047ce4
parent 97aeefc97cce4d47e465c51adfec76f34131257a
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Tue, 8 Dec 2020 09:35:36 +0100
use separate temporary storage arrays for fluid and transient solver
Reported by Ian Madden. Thanks!
Diffstat:
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/fluid.c b/fluid.c
@@ -232,7 +232,7 @@ darcy_solver_1d(struct simulation *sim,
copy_values(sim->p_f_ghost, sim->tmp_ghost, sim->nz + 2);
for (iter = 0; iter < max_iter; ++iter) {
- copy_values(sim->p_f_dot_impl, sim->old_val, sim->nz);
+ copy_values(sim->p_f_dot_impl, sim->fluid_old_val, sim->nz);
#ifdef DEBUG
puts(".. p_f_ghost bfore BC:");
@@ -267,7 +267,7 @@ darcy_solver_1d(struct simulation *sim,
for (i = 0; i < sim->nz - 1; ++i)
sim->p_f_dot_impl_r_norm[i] = fabs(residual(sim->p_f_dot_impl[i],
- sim->old_val[i]));
+ sim->fluid_old_val[i]));
r_norm_max = max(sim->p_f_dot_impl_r_norm, sim->nz - 1);
#ifdef DEBUG
diff --git a/simulation.c b/simulation.c
@@ -168,6 +168,7 @@ prepare_arrays(struct simulation *sim)
sim->I = zeros(sim->nz);
sim->tan_psi = zeros(sim->nz);
sim->old_val = empty(sim->nz);
+ sim->fluid_old_val = empty(sim->nz);
sim->tmp_ghost = empty(sim->nz + 2);
}
@@ -197,6 +198,7 @@ free_arrays(struct simulation *sim)
free(sim->I);
free(sim->tan_psi);
free(sim->old_val);
+ free(sim->fluid_old_val);
free(sim->tmp_ghost);
}
diff --git a/simulation.h b/simulation.h
@@ -123,6 +123,7 @@ struct simulation {
double *I; /* inertia number [-] */
double *tan_psi; /* tan(dilatancy_angle) [-] */
double *old_val; /* temporary storage for iterative solvers */
+ double *fluid_old_val;/* temporary storage for fluid iterative solver */
double *tmp_ghost; /* temporary storage for iterative solvers */
};