commit add2fbd712616c5abb67c74ff9626b0f9d4890cb
parent 349c6b2a79c906087e03ff4462c3210e20653c3f
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Tue, 24 Mar 2020 13:04:32 +0100
Add filter shear_flux to determine flux from velocity profile
Diffstat:
5 files changed, 60 insertions(+), 2 deletions(-)
diff --git a/1d_fd_simple_shear.1 b/1d_fd_simple_shear.1
@@ -239,5 +239,6 @@ exits 0 on succes, and >0 if an error occurs.
.\" For sections 2, 3, 4, and 9 errno settings only.
.Sh SEE ALSO
.Xr max_depth_simple_shear 1
+.Xr shear_flux 1
.Sh AUTHORS
.An Anders Damsgaard Aq Mt anders@adamsgaard.dk
diff --git a/Makefile b/Makefile
@@ -12,10 +12,12 @@ HDR = \
simulation.h
BIN = \
1d_fd_simple_shear\
- max_depth_simple_shear
+ max_depth_simple_shear\
+ shear_flux
MAN1 = \
1d_fd_simple_shear.1\
- max_depth_simple_shear.1
+ max_depth_simple_shear.1\
+ shear_flux.1
DOC = \
README.md\
LICENSE
diff --git a/max_depth_simple_shear.1 b/max_depth_simple_shear.1
@@ -76,5 +76,6 @@ exits 0 on succes, and >0 if an error occurs.
.\" For sections 2, 3, 4, and 9 errno settings only.
.Sh SEE ALSO
.Xr 1d_fd_simple_shear 1
+.Xr shear_flux 1
.Sh AUTHORS
.An Anders Damsgaard Aq Mt anders@adamsgaard.dk
diff --git a/shear_flux b/shear_flux
@@ -0,0 +1,16 @@
+#!/usr/bin/awk -f
+BEGIN {
+ getline
+ integral = 0.0
+}
+NF{
+ if (NR > 1)
+ {
+ integral += ($2 + v_prev)/2.0*($1 - z_prev);
+ }
+ z_prev = $1;
+ v_prev = $2;
+}
+END{
+ print integral
+}
diff --git a/shear_flux.1 b/shear_flux.1
@@ -0,0 +1,38 @@
+.Dd $Mdocdate$
+.Dt SHEAR_FLUX 1
+.Os
+.Sh NAME
+.Nm shear_flux
+.Nd determines flux from profile of shear velocities
+.Sh SYNOPSIS
+.Nm
+.Op Ar file
+.Sh DESCRIPTION
+The
+.Nm
+utility outputs the cumulative sediment shear flux from a profile
+of positions and shear velocities.
+.Nm
+expects that the first column of input is a list of positions, and
+the second column is a list of shear velocities. All other columns
+are discarded. Input can be supplied through stdin or from a single
+file.
+.Pp
+The output is the cumulative sediment flux with units square meters
+per second (m^2/s).
+.Sh EXAMPLES
+The normal use is to pipe the output of
+.Xr 1d_fd_simple_shear 1
+into
+.Nm :
+.Pp
+.Dl $ 1d_fd_simple_shear -n 10e3 | shear_flux
+.Dl 6.19432e-06
+.Pp
+.Dl $ 1d_fd_simple_shear -n 100e3 | shear_flux
+.Dl 0.00101278
+.Sh SEE ALSO
+.Xr 1d_fd_simple_shear 1
+.Xr max_depth_simple_shear 1
+.Sh AUTHORS
+.An Anders Damsgaard Aq Mt anders@adamsgaard.dk