commit b2ac687bb7d375153de1d2c2c7e6efca1618e5e6
parent 5c573b658c6a58a05a56dfdbf04a73c22bbb266e
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Mon, 4 May 2020 16:13:49 +0200
Add function to calculate flux within program
Diffstat:
5 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/1d_fd_simple_shear.1 b/1d_fd_simple_shear.1
@@ -177,7 +177,7 @@ simulations
.It Fl y Ar min-porosity
Minimum granular material porosity [-] in transient simulations
.Fl ( T )
-(default 0.25).
+(default 0.20).
.Pp
.El
The final simulation state is written to stdout, see
diff --git a/fluid.c b/fluid.c
@@ -239,6 +239,7 @@ darcy_solver_1d(struct simulation *sim,
i, dp_f_dt_expl[i], i, dp_f_dt_impl[i]);
#endif
+ /* TODO */
p_f_ghost_new[i+1] = p_f_ghost_old[i+1]
+ epsilon*dp_f_dt_impl[i]*sim->dt;
diff --git a/shear_flux.c b/shear_flux.c
@@ -19,7 +19,7 @@ usage(void)
}
/* input format: positions<TAB>shear_velocities */
-double
+static double
find_flux(FILE *f)
{
int i;
diff --git a/simulation.c b/simulation.c
@@ -56,7 +56,7 @@ init_sim(struct simulation *sim)
sim->d = 0.04; /* Damsgaard et al 2013 */
sim->transient = 0;
- sim->phi_min = 0.25;
+ sim->phi_min = 0.20;
sim->phi_max = 0.55;
sim->dilatancy_angle = 1.0;
@@ -866,3 +866,16 @@ coupled_shear_solver(struct simulation *sim,
return 0;
}
+
+double
+find_flux(const struct simulation* sim)
+{
+ int i;
+ double flux;
+
+ flux = 0.0;
+ for (i=1; i<sim->nz; ++i)
+ flux += (sim->v_x[i] + sim->v_x[i-1])/2.0*sim->dz;
+
+ return flux;
+}
diff --git a/simulation.h b/simulation.h
@@ -161,4 +161,6 @@ int coupled_shear_solver(struct simulation *sim,
const int max_iter,
const double rel_tol);
+double find_flux(const struct simulation *sim);
+
#endif