tadd program for computing Deborah number - cngf-pf - continuum model for granu… | |
git clone git://src.adamsgaard.dk/cngf-pf | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 9f3947dfb50b3757b433ba0516ae486795be91ad | |
parent fb6ea6a60071ea36a485ef60394b247e00918e89 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Thu, 10 Jun 2021 14:34:14 +0200 | |
add program for computing Deborah number | |
Diffstat: | |
M Makefile | 6 ++++++ | |
A deborah.1 | 62 +++++++++++++++++++++++++++++… | |
A deborah.c | 132 +++++++++++++++++++++++++++++… | |
3 files changed, 200 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/Makefile b/Makefile | |
t@@ -10,6 +10,7 @@ DOCPREFIX = ${PREFIX}/share/doc/${NAME} | |
BIN = \ | |
cngf-pf\ | |
+ deborah\ | |
max_depth_simple_shear\ | |
shear_flux | |
SRC = ${BIN:=.c} arrays.c fluid.c simulation.c | |
t@@ -49,6 +50,11 @@ cngf-pf: cngf-pf.o arrays.o fluid.o simulation.o | |
cngf-pf.o arrays.o fluid.o simulation.o\ | |
-o $@ ${CNGFPFLDFLAGS} | |
+deborah: deborah.o arrays.o fluid.o simulation.o | |
+ ${CC}\ | |
+ deborah.o arrays.o fluid.o simulation.o\ | |
+ -o $@ ${CNGFPFLDFLAGS} | |
+ | |
max_depth_simple_shear: max_depth_simple_shear.o arrays.o fluid.o simulation.o | |
${CC}\ | |
max_depth_simple_shear.o arrays.o fluid.o simulation.o\ | |
diff --git a/deborah.1 b/deborah.1 | |
t@@ -0,0 +1,62 @@ | |
+.Dd $Mdocdate$ | |
+.Dt MAX_DEPTH_SIMPLE_SHEAR 1 | |
+.Os | |
+.Sh NAME | |
+.Nm max_depth_simple_shear | |
+.Nd deformation characteristics from fluid perturbation | |
+.Sh SYNOPSIS | |
+.Nm | |
+.Op Fl d Ar grain-size | |
+.Op Fl h | |
+.Op Fl i Ar fluid-viscosity | |
+.Op Fl k Ar fluid-permeability | |
+.Op Fl P Ar grain-compressibility | |
+.Op Fl p Ar grain-porosity | |
+.Op Fl s Ar applied-shear-vel | |
+.Op Fl v | |
+.Sh DESCRIPTION | |
+The | |
+.Nm | |
+utility outputs the modified Deborah number. Values much smaller than 1 corre… | |
+.Pp | |
+The arguments mirror the sister program | |
+.Xr cngf-pf 1 | |
+and are as follows: | |
+.Bl -tag -width Ds | |
+.It Fl d Ar grain-size | |
+Granular material representative grain size [m] (default 0.04). | |
+.It Fl i Ar fluid-viscosity | |
+Fluid dynamic viscosity [Pa*s] (1.787e-3). | |
+.It Fl k Ar fluid-permeability | |
+Darcian intrinsic permeability of granular material [m^2] (default | |
+1.9e-15). | |
+.It Fl P Ar grain-compressibility | |
+Granular material compressibility [Pa^-1] (default 1e-8). | |
+.It Fl p Ar grain-porosity | |
+Granular material porosity [-] (default 0.25). | |
+.It Fl s Ar applied-shear-vel | |
+Shear the material under constant velocity [m/s] instead of a friction value. | |
+.It Fl v | |
+Show version information. | |
+.El | |
+.Pp | |
+The result is written to stdout. | |
+.Sh EXIT STATUS | |
+.Nm | |
+exits 0 on succes, and >0 if a runtime error occurs: | |
+.Pp | |
+.Bl -tag -width Ds -compact | |
+.It 0 | |
+successful exit | |
+.It 1 | |
+unspecified error | |
+.It 2 | |
+.Xr pledge 2 | |
+error | |
+.El | |
+.Sh SEE ALSO | |
+.Xr cngf-pf 1 , | |
+.Xr max_depth_simple_shear 1 , | |
+.Xr shear_flux 1 | |
+.Sh AUTHORS | |
+.An Anders Damsgaard Aq Mt [email protected] | |
diff --git a/deborah.c b/deborah.c | |
t@@ -0,0 +1,132 @@ | |
+#include <unistd.h> | |
+#include <stdio.h> | |
+#include <stdlib.h> | |
+#include <math.h> | |
+#include <getopt.h> | |
+#include <time.h> | |
+#include <err.h> | |
+ | |
+#include "simulation.h" | |
+#include "arg.h" | |
+ | |
+#define EPS 1e-12 | |
+ | |
+/* depth accuracy criteria in meter for solver */ | |
+#define TOL 1e-10 | |
+#define MAX_ITER 100 | |
+ | |
+/* uncomment to print time spent per time step to stdout */ | |
+/* #define BENCHMARK_PERFORMANCE */ | |
+ | |
+#ifndef M_PI | |
+#define M_PI 3.141592653589793238462643383279502884197169399375105820974944592… | |
+#endif | |
+ | |
+char *argv0; | |
+ | |
+static void | |
+usage(void) | |
+{ | |
+ fprintf(stderr, "usage: %s " | |
+ "[-h] " | |
+ "[-d grain-size] " | |
+ "[-i fluid-viscosity] " | |
+ "[-k fluid-permeability] " | |
+ "[-P grain-compressibility] " | |
+ "[-p grain-porosity] " | |
+ "[-s applied-shear-vel] " | |
+ "[-v] " | |
+ "\n", argv0); | |
+ exit(1); | |
+} | |
+ | |
+static double | |
+deborah_number(const struct simulation *sim) | |
+{ | |
+ return sim->alpha * sim->mu_f * sim->d * sim->v_x_fix | |
+ / (sim->k[0] * (1.0 - sim->phi[0])); | |
+} | |
+ | |
+int | |
+main(int argc, char *argv[]) | |
+{ | |
+ int i; | |
+ double new_phi, new_k; | |
+ struct simulation sim; | |
+ | |
+#ifdef BENCHMARK_PERFORMANCE | |
+ clock_t t_begin, t_end; | |
+ double t_elapsed; | |
+ | |
+#endif | |
+ | |
+#ifdef __OpenBSD__ | |
+ if (pledge("stdio", NULL) == -1) | |
+ err(2, "pledge failed"); | |
+#endif | |
+ | |
+ init_sim(&sim); | |
+ new_phi = sim.phi[0]; | |
+ new_k = sim.k[0]; | |
+ | |
+ ARGBEGIN { | |
+ case 'd': | |
+ sim.d = atof(EARGF(usage())); | |
+ break; | |
+ case 'h': | |
+ usage(); | |
+ break; | |
+ case 'i': | |
+ sim.mu_f = atof(EARGF(usage())); | |
+ break; | |
+ case 'k': | |
+ new_k = atof(EARGF(usage())); | |
+ break; | |
+ case 'P': | |
+ sim.alpha = atof(EARGF(usage())); | |
+ break; | |
+ case 'p': | |
+ new_phi = atof(EARGF(usage())); | |
+ break; | |
+ case 's': | |
+ sim.v_x_fix = atof(EARGF(usage())); | |
+ break; | |
+ case 'v': | |
+ printf("%s-" VERSION "\n", argv0); | |
+ return 0; | |
+ break; | |
+ default: | |
+ usage(); | |
+ } ARGEND; | |
+ | |
+ if (argc > 0) | |
+ usage(); | |
+ | |
+ sim.nz = 2; | |
+ prepare_arrays(&sim); | |
+ | |
+ if (!isnan(new_phi)) | |
+ for (i = 0; i < sim.nz; ++i) | |
+ sim.phi[i] = new_phi; | |
+ if (!isnan(new_k)) | |
+ for (i = 0; i < sim.nz; ++i) | |
+ sim.k[i] = new_k; | |
+ | |
+ check_simulation_parameters(&sim); | |
+ | |
+#ifdef BENCHMARK_PERFORMANCE | |
+ t_begin = clock(); | |
+#endif | |
+ | |
+ printf("%.17g\n", deborah_number(&sim)); | |
+ | |
+#ifdef BENCHMARK_PERFORMANCE | |
+ t_end = clock(); | |
+ t_elapsed = (double) (t_end - t_begin) / CLOCKS_PER_SEC; | |
+ printf("time spent = %g s\n", t_elapsed); | |
+#endif | |
+ | |
+ free_arrays(&sim); | |
+ | |
+ return 0; | |
+} |