commit 914b18b1c0cda93757a5555d09f706a57868fa90
parent ecc6fe2a7904b99027b257d50282d0c2ea651329
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Fri, 3 Jul 2026 12:57:31 +0200
refactor(fluid): remove dead p_f_dot_expl machinery
Diffstat:
3 files changed, 1 insertion(+), 15 deletions(-)
diff --git a/fluid.c b/fluid.c
@@ -104,7 +104,7 @@ int darcy_solver_1d(struct simulation *sim) {
double *phi_n = sim->darcy_phi_n;
for (i = 0; i < sim->nz; ++i)
- sim->p_f_dot_impl[i] = sim->p_f_dot_expl[i] = 0.0;
+ sim->p_f_dot_impl[i] = 0.0;
if (isnan(sim->p_f_mod_pulse_time))
p_f_top = sim->p_f_top + sine_wave(sim->t, sim->p_f_mod_ampl,
@@ -197,7 +197,6 @@ int darcy_solver_1d(struct simulation *sim) {
/* Apply Boundary Conditions to Linear System */
/* Bottom (i=0): Neumann. p_{-1} = p_0 + C. */
- /* Bottom (i=0): Neumann. p_{-1} = p_0 + C. */
double bc_neumann_val = sim->phi[0] * sim->rho_f * sim->G * sim->dz;
b[0] += a[0];
@@ -234,20 +233,11 @@ int darcy_solver_1d(struct simulation *sim) {
set_fluid_bcs(sim->p_f_ghost, sim, p_f_top);
set_fluid_bcs(sim->p_f_next_ghost, sim, p_f_top);
#ifdef DEBUG
- puts(".. p_f_dot_expl:");
- print_array(sim->p_f_dot_expl, sim->nz);
puts(".. p_f_dot_impl:");
print_array(sim->p_f_dot_impl, sim->nz);
#endif
for (i = 0; i < sim->nz; ++i)
- if (isnan(sim->p_f_dot_expl[i]) || isinf(sim->p_f_dot_expl[i])) {
- fprintf(stderr, "invalid: sim->p_f_dot_expl[%d] = %g (t = %g s)\n", i,
- sim->p_f_dot_expl[i], sim->t);
- return 1;
- }
-
- for (i = 0; i < sim->nz; ++i)
if (isnan(sim->p_f_dot_impl[i]) || isinf(sim->p_f_dot_impl[i])) {
fprintf(stderr, "invalid: sim->p_f_dot_impl[%d] = %g (t = %g s)\n", i,
sim->p_f_dot_impl[i], sim->t);
diff --git a/simulation.c b/simulation.c
@@ -141,7 +141,6 @@ int prepare_arrays(struct simulation *sim) {
sim->p_f_ghost = zeros(sim->nz + 2);
sim->p_f_next_ghost = zeros(sim->nz + 2);
sim->p_f_dot = zeros(sim->nz);
- sim->p_f_dot_expl = zeros(sim->nz);
sim->p_f_dot_impl = zeros(sim->nz);
sim->phi = zeros(sim->nz);
sim->phi_c = zeros(sim->nz);
@@ -179,7 +178,6 @@ void free_arrays(struct simulation *sim) {
free(sim->p_f_ghost);
free(sim->p_f_next_ghost);
free(sim->p_f_dot);
- free(sim->p_f_dot_expl);
free(sim->p_f_dot_impl);
free(sim->k);
free(sim->phi);
@@ -218,7 +216,6 @@ void reset_column(struct simulation *sim) {
memset(sim->sigma_n_eff, 0, nz_bytes);
memset(sim->sigma_n, 0, nz_bytes);
memset(sim->p_f_dot, 0, nz_bytes);
- memset(sim->p_f_dot_expl, 0, nz_bytes);
memset(sim->p_f_dot_impl, 0, nz_bytes);
memset(sim->phi_c, 0, nz_bytes);
memset(sim->phi_dot, 0, nz_bytes);
diff --git a/simulation.h b/simulation.h
@@ -110,7 +110,6 @@ struct simulation {
double *p_f_ghost; /* fluid pressure [Pa] */
double *p_f_next_ghost; /* fluid pressure for next iteration [Pa] */
double *p_f_dot; /* fluid pressure change [Pa/s] */
- double *p_f_dot_expl; /* fluid pressure change (explicit solution) [Pa/s] */
double *p_f_dot_impl; /* fluid pressure change (implicit solution) [Pa/s] */
double *k; /* hydraulic permeability [m^2] */