tShow default values in help text - cngf-pf - continuum model for granular flow… | |
git clone git://src.adamsgaard.dk/cngf-pf | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 957c062f6dd340902a9812224bb06ae759d624f4 | |
parent 07a7991cd25c38df4b7991934d5c517c23eb05dd | |
Author: Anders Damsgaard <[email protected]> | |
Date: Sat, 11 May 2019 13:34:59 -0500 | |
Show default values in help text | |
Diffstat: | |
M Makefile | 4 ++++ | |
M main.c | 88 +++++++++++++++++++++--------… | |
2 files changed, 65 insertions(+), 27 deletions(-) | |
--- | |
diff --git a/Makefile b/Makefile | |
t@@ -7,6 +7,10 @@ HDR=$(wildcard *.h) | |
.PHONY: default | |
default: 1d_fd_simple_shear | |
+.PHONY: install | |
+install: 1d_fd_simple_shear | |
+ install $< /usr/local/bin/ | |
+ | |
.PHONY: plots | |
plots: 1d_fd_simple_shear.png \ | |
1d_fd_simple_shear_rheology.png \ | |
diff --git a/main.c b/main.c | |
t@@ -13,39 +13,69 @@ | |
static void usage(void) | |
{ | |
+ struct simulation sim = init_sim(); | |
printf("%s: %s [OPTIONS] [NAME]\n" | |
"runs a simulation and outputs state in files prefixed with NAME.\… | |
+ "If NAME is not specified, the default value '%s' is used.\n" | |
"optional arguments:\n" | |
" -N, --normalize normalize output velocity\n" | |
- " -G, --gravity VAL gravity magnitude [m/s^2]\n" | |
- " -P, --normal-stress VAL normal stress on top [Pa]\n" | |
- " -m, --stress-ratio VAL applied stress ratio [-]\n" | |
- " -V, --velocity-bottom VAL base velocity at bottom [m/s]\n" | |
- " -A, --nonlocal-amplitude VAL amplitude of nonlocality [-]\n" | |
- " -b, --rate-dependence VAL rate dependence beyond yield [-]… | |
- " -f, --friction-coefficient VAL grain friction coefficient [-]\n" | |
- " -p, --porosity VAL porosity fraction [-]\n" | |
- " -d, --grain-size VAL representative grain size [m]\n" | |
- " -r, --density VAL grain material density [kg/m^3]\… | |
- " -n, --resolution VAL number of cells in domain [-]\n" | |
- " -o, --origo VAL coordinate system origo [m]\n" | |
- " -L, --length VAL domain length [m]\n" | |
+ " -G, --gravity VAL gravity magnitude [m/s^2] (defau… | |
+ " -P, --normal-stress VAL normal stress on top [Pa] (defau… | |
+ " -m, --stress-ratio VAL applied stress ratio [-] (defaul… | |
+ " -V, --velocity-bottom VAL base velocity at bottom [m/s] (d… | |
+ " -A, --nonlocal-amplitude VAL amplitude of nonlocality [-] (de… | |
+ " -b, --rate-dependence VAL rate dependence beyond yield [-]… | |
+ " -f, --friction-coefficient VAL grain friction coefficient [-] (… | |
+ " -p, --porosity VAL porosity fraction [-] (default %… | |
+ " -d, --grain-size VAL representative grain size [m] (d… | |
+ " -r, --density VAL grain material density [kg/m^3] … | |
+ " -n, --resolution VAL number of cells in domain [-] (d… | |
+ " -o, --origo VAL coordinate system origo [m] (def… | |
+ " -L, --length VAL domain length [m] (default %g)\n" | |
" -F, --fluid enable pore fluid computations\n" | |
- " -c, --fluid-compressibility VAL fluid compressibility [Pa^-1]\n" | |
- " -i, --fluid-viscosity VAL fluid viscosity [Pa*s]\n" | |
- " -R, --fluid-density VAL fluid density [kg/m^3]\n" | |
- " -k, --fluid-permeability VAL fluid intrinsic permeability [m^… | |
- " -O, --fluid-pressure-top VAL fluid pressure at +z edge [Pa]\n" | |
- " -a, --fluid-pressure-ampl VAL amplitude of pressure variations… | |
- " -q, --fluid-pressure-freq VAL frequency of pressure variations… | |
- " -H, --fluid-pressure-phase VAL fluid pressure at +z edge [Pa]\n" | |
- " -t, --time VAL simulation start time [s]\n" | |
- " -T, --time-end VAL simulation end time [s]\n" | |
- " -D, --time-step VAL computational time step length [… | |
- " -I, --file-interval VAL interval between output files [s… | |
+ " -c, --fluid-compressibility VAL fluid compressibility [Pa^-1] (d… | |
+ " -i, --fluid-viscosity VAL fluid viscosity [Pa*s] (default … | |
+ " -R, --fluid-density VAL fluid density [kg/m^3] (default … | |
+ " -k, --fluid-permeability VAL fluid intrinsic permeability [m^… | |
+ " -O, --fluid-pressure-top VAL fluid pressure at +z edge [Pa] (… | |
+ " -a, --fluid-pressure-ampl VAL amplitude of pressure variations… | |
+ " -q, --fluid-pressure-freq VAL frequency of pressure variations… | |
+ " -H, --fluid-pressure-phase VAL fluid pressure at +z edge [Pa] (… | |
+ " -t, --time VAL simulation start time [s] (defau… | |
+ " -T, --time-end VAL simulation end time [s] (default… | |
+ " -D, --time-step VAL computational time step length [… | |
+ " -I, --file-interval VAL interval between output files [s… | |
" -v, --version show version information\n" | |
- " -h, --help show this message\n" | |
- , __func__, PROGNAME); | |
+ " -h, --help show this message\n", | |
+ __func__, PROGNAME, | |
+ sim.name, | |
+ sim.G, | |
+ sim.P_wall, | |
+ sim.mu_wall, | |
+ sim.v_x_bot, | |
+ sim.A, | |
+ sim.b, | |
+ sim.mu_s, | |
+ sim.phi[0], | |
+ sim.d, | |
+ sim.rho_s, | |
+ sim.nz, | |
+ sim.origo_z, | |
+ sim.L_z, | |
+ sim.beta_f, | |
+ sim.mu_f, | |
+ sim.rho_f, | |
+ sim.k[0], | |
+ sim.p_f_top, | |
+ sim.p_f_mod_ampl, | |
+ sim.p_f_mod_freq, | |
+ sim.p_f_mod_phase, | |
+ sim.t, | |
+ sim.t_end, | |
+ sim.dt, | |
+ sim.file_dt); | |
+ free(sim.phi); | |
+ free(sim.k); | |
} | |
static void version(void) | |
t@@ -109,9 +139,13 @@ int main(int argc, char* argv[]) | |
case 'h': | |
usage(); | |
+ free(sim.phi); | |
+ free(sim.k); | |
return 0; | |
case 'v': | |
version(); | |
+ free(sim.phi); | |
+ free(sim.k); | |
return 0; | |
case 'n': | |
sim.nz = atoi(optarg); |