I have forgotten

• http://facebook.com/
• https://www.google.com/accounts/o8/id
• https://me.yahoo.com COST (GBP) 20.00 0.00 0

# Stokes

viewed 333 times and licensed 46 times
Stokes 5th order wave theory, which computes the surface profile and kinematics
Controller: will   C++

## 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:
1. the wave velocity increases slightly with increase of wave steepness.
2. the wave profile is more peaked at the crests with wide, less shallow, troughs.
3. the trajectories of water particles are not closed, leading to a mass transport in the direction of the waves, often called Stoke's drift.
4. the waves break when the wave crest angle reached .

In forming this solutions, Stokes (1874) assumed the fluid was inviscid and therefore irrotational, and also incompressible. Using the mathematical technique of series expansions (also called Stokes' expansion) he was able to derive a solution to the boundary conditions.

## 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

 Stokes( double k double amplitude double phase = 0 double depth = 0 double gravity = 9.8066 int sign = 1 )[constructor]
Constructor for this class. Call the init(...) function, below, with the supplied sea conditions and depth

#### Init

 voidinit( double k double amplitude double phase = 0 double depth = 0 double gravity = 9.8066 int sign = 1 )
Computes a number of constants for the given sea state, which allow rapid evaluation of water surface at different temporal and spatial locations.
 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

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

#### GetEta

 doublegetEta( double x double time )
Computes the surface elevation at the point for the given Stokes 5th wave profile with wave-number(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

 doublegetKin( double x double z double time Derivative derivative = norm )
Computes the kinematics at the point for the given Stokes 5th wave profile with wave-number(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 )
Return the surface elevation for the Stokes 5th wave at the spatial and temporal locations specified.

These function are used when you need a quick estimate of a value at a specific point. For repeated evaluation it is best to use the Stokes Class.

The following graph shows the surface profile for a wave of length 224m (or period=12s) and a fundamental amplitude of 15m.

There is an error with your graph parameters for 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 )
Computes the kinematics within a Stokes 5th wave:

The following example shows the horizontal velocity profile with depth, beneath the crest of a wave of length 224m (or period=12s) and a fundamental amplitude of 15m.

There is an error with your graph parameters for 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 )
This function combines the previous functions to first work out the height of the wave at a specific location, and then to compute the kinematics at this this surface locations.

The following graph shows the surface profile for a wave of length 224m (or period=12s) and a fundamental amplitude of 12m.
There is an error with your graph parameters for 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 )
Returns the maximum velocity anywhere within a stokes wave within deep water. For a regular solution this maximum will always be the horizontal wave velocity in the peak of the wave crest.

Example solutions:
There is an error with your graph parameters for 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 )
Returns the ith wave component for a Stokes 5th order wave component.

### 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.