# Stokes

**will**

## Interface

## Overview

The Stokes wave is an analytical model for regular (each wave looks identical), steady (the wave form doesn't change with time) and unidirectional (all travelling in the same direction) waves. In such an environment, the Stoke's solution provides an accurate description of both the surface elevation and all the underlying kinematics. In particular it is the first model to demonstrate that:- the wave velocity increases slightly with increase of wave steepness.
- the wave profile is more peaked at the crests with wide, less shallow, troughs.
- the trajectories of water particles are not closed, leading to a mass transport in the direction of the waves, often called Stoke's drift.
- the waves break when the wave crest angle reached .

## Class Stokes

This Stokes class provides a rapid mechanism for computing the surface elevation and internal kinematics within a wave. It is optimised on the assumption that many requests will be made for different spatial and temporal locations, where as the wave properties and water depth will be varied less frequently.### Example 1

- To following example outputs the surface elevation and then the velocities beneath the central wave:
#include <codecogs/engineering/fluid_mechanics/waves/analytic/stokes.h> #include <stdio.h> int main() { double Length=200; // Wave length [m] double Amplitude=15; // Wave Height [m] double Depth=30; // Depth [m] double time=0; // Time [seconds] Engineering::Waves::Analytic::Stokes water(2*pi()/Length, amplitude, 0, depth); for(double x=-200;x<=200;x+=10) printf("\n Eta(%lf)=%lf",x, water.getEta(x, time); double eta=water.getEta(0,0); for(double z=eta;z>-30;z--) printf("\n Phi(%lf)=%lf\tu(%lf)=%lf\tv(%lf)=%lf", z, water.getKin(0,z,time), z, water.getKin(0,z,time,ddx), z, water.getKin(0,z,time,ddz); }

### Authors

*William Bateman (April 2010)*

##### Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.

## Members of Stokes

#### Stokes

Constructor for this class. Call the init(...) function, below, with the supplied sea conditions and depthStokes( double `k`double `amplitude`double `phase``= 0`

double `depth``= 0`

double `gravity``= 9.8066`

int `sign``= 1`

) *[constructor]*#### Init

Computes a number of constants for the given sea state, which allow rapid evaluation of water surface at different temporal and spatial locations.voidinit( double `k`double `amplitude`double `phase``= 0`

double `depth``= 0`

double `gravity``= 9.8066`

int `sign``= 1`

) k Wave number of dominant wave component [] amplitude Amplitude of the dominant wave component [m] phase Phase adjustment for the wave in radians depth Depth of water, from sea bed to still water level [m] gravity Acceleration due to gravity [] sign The Direction the wave propagate in. 1=left to right. -1=right to left.

#### Component

Returns the amplitude of underlying frequency componentsdoublecomponent( int `i`) i the ith component from 1 to 5

#### GetEta

Computes the surface elevation at the point for the given Stokes 5th wave profile with wave-number(doublegetEta( double `x`double `time`) *k*) and an*amplitude*.x Spatial location at which to compute the elevation [m] time Temporal location at which to compute the elevation [sec]

### Returns

- The surface elevation about still water level [m]

#### GetKin

Computes the kinematics at the point for the given Stokes 5th wave profile with wave-number(doublegetKin( double `x`double `z`double `time`Derivative `derivative``= norm`

) *k*) and an*amplitude*. The derivate term allows different kinematics to be returns:- Norm return Phi()
- ddx, computes or the horizontal velocity (u)
- ddz, computer or the vertical Velocity (v)

x Spatial location at which to compute the kinematics[m] z Depth at which to compute the kinematics [m] time Temporal location at which to compute the elevation [sec] derivative The derivative of Phi to compute

### Returns

- Velocity Potential [] or Horizontal/Vertical velocity potential []

## Stokes Eta

doubleStokes_eta( | double | k | |

double | amplitude | ||

double | x | ||

double | time` = 0` | ||

double | depth` = 0` | ) |

**Stokes_eta**with options k=0.0279 amplitude=15 x=-224:224 .width=450

**Error Message:**Function Stokes_eta failed. Ensure that: **Invalid C++**

### Parameters

k Wave number [] amplitude Wave amplitude [m] x Spatial location [m] time Temporal location [sec] depth Depth of water [m]

### Authors

*William Bateman (April 2010)*

##### Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.

## Stokes Kin

doubleStokes_kin( | double | k | |

double | amplitude | ||

double | x | ||

double | z | ||

double | time` = 0` | ||

Derivative | derivative` = norm` | ||

double | depth` = 0` | ) |

**Stokes_kin**with options k=0.0279 amplitude=15 z=-20:15 x=0 time=0 derivative=1 depth=50 .width=400 .rotate

**Error Message:**Function Stokes_kin failed. Ensure that: **Invalid C++**

### Parameters

k Wave number [] amplitude Wave amplitude [m] x Spatial location [m] z Vertical location [m] time Temporal location [sec] derivative The derivative of Phi depth Depth of water [m]

### Authors

*William Bateman (April 2010)*

##### Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.

## Stokes Surface Kin

doubleStokes_surface_kin( | double | k | |

double | amplitude | ||

double | x | ||

double | time` = 0` | ||

Derivative | derivative` = norm` | ||

double | depth` = 0` | ) |

**Stokes_surface_kin**with options k=0.0279 amplitude=12 x=-200:200 derivative=1 .width=500

**Error Message:**Function Stokes_surface_kin failed. Ensure that: **Invalid C++**

### Parameters

k Wave number [] amplitude Wave amplitude [m] x Spatial location [m] time Temporal location [sec] derivative The derivative of Phi depth Depth of water [m]

##### Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.

## Stokes MaxVel

doubleStokes_maxVel( | double | k | |

double | amplitude | ) |

**Stokes_maxVel**with options k=0.01:0.03:3 amplitude=0:20 .width=500

**Error Message:**Function Stokes_maxVel failed. Ensure that: **Invalid C++**

### Parameters

k Wave number [] amplitude Wave amplitude [m]

##### Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.

## Stokes Component

doubleStokes_component( | int | i | |

double | k | ||

double | amplitude | ||

double | depth` = 0` | ) |

### Parameters

i the component number (1-5) k Wave number [] amplitude Wave amplitude [m]

##### Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.

Last Modified: 12 May 13 @ 12:16 Page Rendered: 2022-03-14 14:58:19