tgranular: add man page and add some options - granular - granular dynamics simulation
(HTM) git clone git://src.adamsgaard.dk/granular
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 355386ab0005d3ba09358f192fc20e04a14a7b5c
(DIR) parent a073560547b40f27f19e26cd637b882a77d098aa
(HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Thu, 25 Mar 2021 22:34:50 +0100
granular: add man page and add some options
Diffstat:
A granular.1 | 60 +++++++++++++++++++++++++++++++
M granular.c | 25 +++++++++++++++++++++++--
2 files changed, 83 insertions(+), 2 deletions(-)
---
(DIR) diff --git a/granular.1 b/granular.1
t@@ -0,0 +1,60 @@
+.Dd $Mdocdate$
+.Dt GRANULAR 1
+.Os
+.Sh NAME
+.Nm granular
+.Nd simulate granular interaction through time
+.Sh SYNOPSIS
+.Nm
+.Op Fl e Ar end-time
+.Op Fl g Ar gravity-accel
+.Op Fl h
+.Op Fl I Ar file-interval
+.Op Fl j Ar time-step
+.Op Fl t Ar curr-time
+.Op name
+.Sh DESCRIPTION
+.Nm
+reads
+.Xr granular 5
+data with grain properties from stdin, simulates granular interaction
+over time, and prints the resultant state.
+.Pp
+The options are as wollows:
+.Bl -tag -width Ds
+.It Fl e Ar end-time
+Set the time where to end the simulation [s] (default 0.0).
+.It Fl g Ar gravity-accel
+y-component of gravitational acceleration [m/s^2] (default 0.0).
+.It Fl h
+Show usage information.
+.It Fl I Ar file-interval
+Simulation time interval betweeen writing output to disk [s] (default
+1.0).
+.It Fl j Ar time-step
+Override numerical time step length [s].
+.It Fl t Ar curr-time
+Simulation start time [s] (default 0.0).
+.El
+.Sh EXIT STATUS
+.Nm
+exits 0 on success, 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 EXAMPLES
+.Dl $ granularpacking | granular | granular2vtk > out.vtk
+.Sh SEE ALSO
+.Xr granular2pdf 1 ,
+.Xr granular2vtu 1 ,
+.Xr granularpacking 1 ,
+.Xr granular 5
+.Sh AUTHORS
+.An Anders Damsgaard Aq Mt anders@adamsgaard.dk
(DIR) diff --git a/granular.c b/granular.c
t@@ -9,7 +9,13 @@ static void
usage(void)
{
errx(1, "usage: %s "
- "[-h]", argv0);
+ "[-e end-time] "
+ "[-g gravity-accel] "
+ "[-h] "
+ "[-I file-interval] "
+ "[-j time-step] "
+ "[-t curr-time] "
+ "[name]", argv0);
}
int
t@@ -25,9 +31,24 @@ main(int argc, char *argv[])
sim_defaults(&sim);
ARGBEGIN {
+ case 'e':
+ sim.t_end = atof(EARGF(usage()));
+ break;
+ case 'g':
+ sim.constacc[1] = atof(EARGF(usage()));
+ break;
case 'h':
usage();
break;
+ case 'I':
+ sim.file_dt = atof(EARGF(usage()));
+ break;
+ case 'j':
+ sim.dt = atof(EARGF(usage()));
+ break;
+ case 't':
+ sim.t = atof(EARGF(usage()));
+ break;
default:
usage();
} ARGEND;
t@@ -35,7 +56,7 @@ main(int argc, char *argv[])
sim_read_grains(&sim, stdin);
if (sim.t < sim.t_end)
sim_run_time_loop(&sim);
- sim_print_grains_vtk(stdout, &sim);
+ sim_print_grains(stdout, &sim);
sim_free(&sim);
return 0;