Skip to content

robertjwilson/bedshear

Repository files navigation

bedshear

bedshear is an R package that allows you to calculate bed shear stress from combined waves and tides, and wave orbital velocity. Bedshear stress for combined waves and tides is calculated using the equations of Soulsby and Clarke (2005), and wave orbital velocity is calculated using the equations of Souslby (2006).

Installation

You can install the development version of bedshear from github using:

# install.packages("devtools")
devtools::install_github("r4ecology/bedshear", dependencies = TRUE)

This depends on Rcpp, so please check you can compile C++ files that rely on the math library. If you are a Windows user you will need to have Rtools installed.

Examples

Calculating a time series of bed shear stress from wave and tide data near Stonehaven, Scotland.

# load the necessary libraries
library(bedshear)
library(dplyr)
library(ggplot2)
# calculate and plot the bed shear stress time series
stonehaven_stress <- shear_stress(
  bathymetry = 40, D50 = 0.0002, tidal_velocity = stonehaven_ts$tidal_velocity, tidal_direction = stonehaven_ts$tidal_direction, wave_height = stonehaven_ts$wave_height,
  wave_period = stonehaven_ts$wave_period, wave_direction = stonehaven_ts$wave_direction, switch = 0
)

stonehaven_ts %>%
  mutate(Stress = stonehaven_stress$shear_max) %>%
  ggplot(aes(Date, Stress)) +
  geom_line()

Calculating a time series of wave orbital velocities from wave data near Stonehaven, Scotland.

# load libraries
library(bedshear)
library(dplyr)
library(ggplot2)
# calculate and plot a time series of wave orbital velocities
stonehaven_orbital <- orbital_velocity(bathymetry = 40, wave_height = stonehaven_ts$wave_height, wave_period = stonehaven_ts$wave_period, switch = 0)
stonehaven_ts %>%
  mutate(Velocity = stonehaven_orbital) %>%
  ggplot(aes(Date, Velocity)) +
  geom_line()