commit d39ad4042ece03da57c502cdceed7ce1ccd1b61a
parent 0ff63f4ba9cd7f4e6ee2b46f2621b0508e3917fd
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Fri, 6 Mar 2020 09:49:42 +0100
Add man page for main program and install docs
Diffstat:
A | 1d_fd_simple_shear.1 | | | 238 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
M | Makefile | | | 64 | ++++++++++++++++++++++++++++++++++++++++++++++++---------------- |
2 files changed, 286 insertions(+), 16 deletions(-)
diff --git a/1d_fd_simple_shear.1 b/1d_fd_simple_shear.1
@@ -0,0 +1,238 @@
+.Dd $Mdocdate$
+.Dt 1D_FD_SIMPLE_SHEAR 1
+.Os
+.Sh NAME
+.Nm 1d_fd_simple_shear
+.Nd simulate granular flows with pore-pressure dynamics
+.\" .Sh LIBRARY
+.\" For sections 2, 3, and 9 only.
+.\" Not used in OpenBSD.
+.Sh SYNOPSIS
+.Nm 1d_fd_simple_shear
+.Op Fl A Ar grain-nonlocal-ampl
+.Op Fl a Ar fluid-pressure-ampl
+.Op Fl b Ar grain-rate-dependence
+.Op Fl C Ar fluid-compressibility
+.Op Fl c Ar grain-cohesion
+.Op Fl d Ar grain-size
+.Op Fl e Ar end-time
+.Op Fl F
+.Op Fl f Ar applied-shear-friction
+.Op Fl g Ar gravity-accel
+.Op Fl H Ar fluid-pressure-phase
+.Op Fl h
+.Op Fl I Ar file-interval
+.Op Fl i Ar fluid-viscosity
+.Op Fl K Ar dilatancy-constant
+.Op Fl k Ar fluid-permeability
+.Op Fl L Ar length
+.Op Fl l Ar applied-shear-vel-limit
+.Op Fl m Ar grain-friction
+.Op Fl N
+.Op Fl n Ar normal-stress
+.Op Fl O Ar fluid-pressure-top
+.Op Fl o Ar origo
+.Op Fl p Ar grain-porosity
+.Op Fl q Ar fluid-pressure-freq
+.Op Fl R Ar fluid-density
+.Op Fl r Ar grain-density
+.Op Fl S Ar fluid-pressure-pulse-shape
+.Op Fl s Ar applied-shear-vel
+.Op Fl T
+.Op Fl t Ar curr-time
+.Op Fl U Ar resolution
+.Op Fl u Ar fluid-pulse-time
+.Op Fl v
+.Op Fl Y Ar max-porosity
+.Op Fl y Ar min-porosity
+.Op name
+.Sh DESCRIPTION
+The
+.Nm
+utility simulates the coupled continuum dynamics of granular
+deformation and pore pressure. The simulation space is one-dimensional
+and undergoes confined, simple shear at a pretedermined velocity
+or friction ratio. The effective stress is modulated by pore-pressure
+dynamics when fluid dynamics are enabled.
+
+The arguments are as follows:
+.Bl -tag -width Ds
+.It Fl A Ar grain-nonlocal-ampl
+Amplitude of granular non-locality [-] (default 0.4).
+.It Fl a Ar fluid-pressure-ampl
+Amplitude of fluid-pressure perturbations [Pa] (default 0).
+.It Fl b Ar grain-rate-dependence
+Granular rate dependence beyond yield [-], (default 0.9377).
+.It Fl C Ar fluid-compressibility
+Fluid adiabatic compressibility [Pa^-1] (default 3.9e-10).
+Only relevant with fluid dynamics enabled
+.Fl ( F ) .
+.It Fl c Ar grain-cohesion
+Granular material cohesion [Pa] (default 0).
+.It Fl d Ar grain-size
+Granular material representative grain size [m] (default 0.04).
+.It Fl e Ar end-time
+Simulation end time [s] (default 1).
+.It Fl F
+Enable pore-space fluid dynamics.
+.It Fl f Ar applied-shear-friction
+Applied ratio between shear stress and normal stress at the top
+boundary [-] (default 0.45), overridden by
+.Fl s
+and
+.Fl l
+if these are set.
+.It Fl g Ar gravity-accel
+Gravity magnitude [m/s^2] (default 9.81).
+.It Fl H Ar fluid-pressure-phase
+Phase of fluid-pressure perturbations [s] (default 0).
+Only relevant with fluid dynamics enabled
+.Fl ( F ) .
+.It Fl h
+Show usage information.
+.It Fl I Ar file-interval
+Simulation time interval between writing output to disk [s] (default
+0.1).
+.It Fl i Ar fluid-viscosity
+Fluid dynamic viscosity [Pa*s] (1.787e-3).
+Only relevant with fluid dynamics enabled
+.Fl ( F ) .
+.It Fl K Ar dilatancy-constant
+Factor relating dilatancy and shear stress [TODO] (default 1.0).
+Only relevant with transient granular dynamics enabled
+.Fl ( T ) .
+.It Fl k Ar fluid-permeability
+Darcian intrinsic permeability of granular material [m^2] (default
+1.9e-15).
+Only relevant with fluid dynamics enabled
+.Fl ( F ) .
+.It Fl L Ar length
+Simulation domain length [m] (default 1).
+.It Fl l Ar applied-shear-vel-limit
+Upper limit to modeled shear velocity [m/s] (default nan), overrides
+.Fl f
+and
+.Fl s .
+.It Fl m Ar grain-friction
+Grain friction coefficient [-] (default 0.404026).
+.It Fl N
+Normalize output velocities to the range [0;1].
+.It Fl n Ar normal-stress
+Normal stress applied at the top boundary [Pa] (default 120e3).
+.It Fl O Ar fluid-pressure-top
+Fluid pressure applied at the top boundary [Pa] (default 0).
+Only relevant with fluid dynamics enabled
+.Fl ( F ) .
+.It Fl o Ar origo
+Simulation domain origo [m] (default 0).
+.It Fl p Ar grain-porosity
+Granular material porosity [-] (default 0.25).
+.It Fl q Ar fluid-pressure-freq
+Frequency of fluid-pressure perturbations [s^-1] (default 1).
+Only relevant with fluid dynamics enabled
+.Fl ( F ) .
+.It Fl R Ar fluid-density
+Fluid density [kg/m^3] (default 1000).
+Only relevant with fluid dynamics enabled
+.Fl ( F ) .
+.It Fl r Ar grain-density
+Granular material density [kg/m^3] (default 2600).
+.It Fl S Ar fluid-pressure-pulse-shape
+Shape of pulse perturbations in fluid pressure at the top boundary.
+Valid options are
+.Ar triangular
+(default) or
+.Ar square .
+Only relevant with fluid dynamics enabled
+.Fl ( F ) .
+.It Fl s Ar applied-shear-vel
+Shear the material under constant velocity [m/s] instead of a friction value.
+Overrides
+.Fl f
+and is overridden by
+.Fl l .
+.It Fl T
+Enable transient granular properties.
+.It Fl t Ar curr-time
+Simulation start time [s] (default 0).
+.It Fl U Ar resolution
+Numerical resolution of simulation domain [-] (default nan). If
+not set, the cell size equals the grain size.
+.It Fl u Ar fluid-pulse-time
+Time of fluid-pressure pulse peak [s] (default nan).
+Only relevant with fluid dynamics enabled
+.Fl ( F ) .
+.It Fl v
+Show version information.
+.It Fl Y Ar max-porosity
+Granular material porosity [-] at inertia number I=1 in transient
+simulations
+.Fl ( T )
+(default 0.2).
+.It Fl y Ar min-porosity
+Minimum granular material porosity [-] in transient simulations
+.Fl ( T )
+(default 0.8).
+.El
+
+The final simulation state is written to stdout, see
+.Sx OUTPUT FORMAT
+for a description of the data format.
+
+.\" .Sh CONTEXT
+.\" For section 9 functions only.
+.\" .Sh IMPLEMENTATION NOTES
+.\" Not used in OpenBSD.
+.\" .Sh RETURN VALUES
+.\" For sections 2, 3, and 9 function return values only.
+.\" .Sh ENVIRONMENT
+.\" For sections 1, 6, 7, and 8 only.
+.Sh OUTPUT FORMAT
+The output consists of the following tab-delimited fields, with one
+row per cell in the simulation domain:
+
+.Bl -enum -compact
+.It
+position [m]
+.It
+shear velocity [m/s]
+.It
+effective normal stress [Pa]
+.It
+fluid pressure [Pa]
+.It
+friction [-]
+.It
+shear strain rate [-]
+.It
+porosity [-]
+.It
+inertia number [-]
+.It
+shear stress [Pa]
+.El
+.Sh FILES
+If
+.Ar name
+is set, the simulation state is written to files in the current
+directory named in the format
+.Pa <name>.outputDDDDD.txt .
+Here, DDDDD is a integer counter starting from 00000, and incrementing
+by 1 for each new file. Each file contains the state at a single
+point in simulation time. The output format is specified in the
+section
+.Sx OUTPUT FORMAT ,
+and output files are generated with the interval specified with
+.Fl I Ar file-interval .
+.Sh EXIT STATUS
+.Nm
+exits 0 on succes, and >0 if an error occurs.
+.\" .Sh EXAMPLES
+.\" .Sh DIAGNOSTICS
+.\" For sections 1, 4, 6, 7, 8, and 9 printf/stderr messages only.
+.\" .Sh ERRORS
+.\" For sections 2, 3, 4, and 9 errno settings only.
+.Sh SEE ALSO
+.Xr max_depth_simple_shear 1
+.Sh AUTHORS
+.An Anders Damsgaard Aq Mt anders@adamsgaard.dk
diff --git a/Makefile b/Makefile
@@ -1,36 +1,68 @@
-CFLAGS = -std=c99 -pedantic -Wall -O2 -g
-LDFLAGS = -lm
-HDR = arrays.h fluid.h parameter_defaults.h simulation.h
-BIN = 1d_fd_simple_shear max_depth_simple_shear
+NAME = 1d_fd_simple_shear
+VERSION = 0.5.0
PREFIX ?= /usr/local
-INSTALL ?= install
-STRIP ?= strip
+MANPREFIX ?= ${PREFIX}/man
+DOCPREFIX ?= ${PREFIX}/share/doc/${NAME}
-VERSION = 0.5.0
+HDR = \
+ arrays.h\
+ fluid.h\
+ parameter_defaults.h\
+ simulation.h
+BIN = \
+ 1d_fd_simple_shear\
+ max_depth_simple_shear
+MAN1 = \
+ 1d_fd_simple_shear.1
+DOC = \
+ README.md\
+ LICENSE
+
+HERE_CFLAGS = ${CFLAGS} -std=c99 -pedantic -Wall -O2 -g
+HERE_LDFLAGS = ${LDFLAGS} -lm
GLOBALCONST = -DVERSION=\"${VERSION}\"
-default: ${BIN}
+all: ${BIN}
.o:
${CC} ${LDFLAGS} -o $@ ${LIBS}
.c.o:
- ${CC} ${CFLAGS} ${GLOBALCONST} -c $<
+ ${CC} ${HERE_CFLAGS} ${GLOBALCONST} -o $@ -c $<
1d_fd_simple_shear: 1d_fd_simple_shear.o arrays.o fluid.o simulation.o ${HDR}
- ${CC} ${LDFLAGS} 1d_fd_simple_shear.o arrays.o fluid.o simulation.o -o $@
+ ${CC} ${HERE_LDFLAGS}\
+ 1d_fd_simple_shear.o arrays.o fluid.o simulation.o\
+ -o $@
max_depth_simple_shear: max_depth_simple_shear.o arrays.o fluid.o simulation.o ${HDR}
- ${CC} ${LDFLAGS} max_depth_simple_shear.o arrays.o fluid.o simulation.o -o $@
+ ${CC} ${HERE_LDFLAGS}\
+ max_depth_simple_shear.o arrays.o fluid.o simulation.o\
+ -o $@
install: ${BIN}
- ${STRIP} ${BIN}
- ${INSTALL} -m 0755 -d ${DESTDIR}${PREFIX}/bin
- ${INSTALL} -m 0755 ${BIN} ${DESTDIR}${PREFIX}/bin
+ # installing executables
+ mkdir -p ${DESTDIR}${PREFIX}/bin
+ cp -f ${BIN} ${DESTDIR}${PREFIX}/bin
+ for f in ${BIN}; do chmod 755 ${DESTDIR}${PREFIX}/bin/$$f; done
+ # installing documentation and license information
+ mkdir -p ${DESTDIR}${DOCPREFIX}
+ cp -f ${DOC} ${DESTDIR}${DOCPREFIX}
+ for f in ${DOC}; do chmod 644 ${DESTDIR}${DOCPREFIX}/$$f; done
+ # installing man pages
+ mkdir -p ${DESTDIR}${MANPREFIX}/man1
+ cp -f ${MAN1} ${DESTDIR}${MANPREFIX}/man1
+ for f in ${MAN1}; do echo chmod 644 ${DESTDIR}${MANPREFIX}/man1/$$f; done
uninstall:
- rm -f ${DESTDIR}${PREFIX}/bin/${BIN}
+ # removing executable files
+ for f in ${BIN}; do rm -f ${DESTDIR}${PREFIX}/bin/$$f; done
+ # removing documentation and license information
+ for f in ${DOC}; do rm -f ${DESTDIR}${DOCPREFIX}/$$f; done
+ -rmdir ${DESTDIR}${DOCPREFIX}
+ # removing man pages
+ for f in ${MAN1}; do rm -f ${DESTDIR}${MANPREFIX}/man1/$$f; done
test: ${BIN}
make -C test/
@@ -40,4 +72,4 @@ clean:
rm -f *.o
rm -f ${BIN}
-.PHONY: default install uninstall watch test memtest clean
+.PHONY: all install uninstall watch test memtest clean