I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
get GPL
COST (GBP)
this unit 20.00
sub units 0.00
+
0

Stokes

viewed 340 times and licensed 48 times
Stokes 5th order wave theory, which computes the surface profile and kinematics
Controller: will

Interface

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 \inline 120^\circ.

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

 
Stokesdoublek
doubleamplitude
doublephase = 0
doubledepth = 0
doublegravity = 9.8066
intsign = 1 )[constructor]
Constructor for this class. Call the init(...) function, below, with the supplied sea conditions and depth

Init

 
voidinitdoublek
doubleamplitude
doublephase = 0
doubledepth = 0
doublegravity = 9.8066
intsign = 1 )
Computes a number of constants for the given sea state, which allow rapid evaluation of water surface at different temporal and spatial locations.
kWave number of dominant wave component [\inline 2\pi/m]
amplitudeAmplitude of the dominant wave component [m]
phasePhase adjustment for the wave in radians
depthDepth of water, from sea bed to still water level [m]
gravityAcceleration due to gravity [\inline m/s^2]
signThe Direction the wave propagate in. 1=left to right. -1=right to left.

Component

 
doublecomponentinti )
Returns the amplitude of underlying frequency components
ithe ith component from 1 to 5

GetEta

 
doublegetEtadoublex
doubletime )
Computes the surface elevation at the point \inline (x,time) for the given Stokes 5th wave profile with wave-number(k) and an amplitude.
xSpatial location at which to compute the elevation [m]
timeTemporal location at which to compute the elevation [sec]

Returns

The surface elevation about still water level [m]

GetKin

 
doublegetKindoublex
doublez
doubletime
Derivativederivative = norm )
Computes the kinematics at the point \inline (x,z,time) 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(\inline \phi)
  • ddx, computes \inline \frac{d\phi}{dx} or the horizontal velocity (u)
  • ddz, computer \inline \frac{d\phi}{dz} or the vertical Velocity (v)
xSpatial location at which to compute the kinematics[m]
zDepth at which to compute the kinematics [m]
timeTemporal location at which to compute the elevation [sec]
derivativeThe derivative of Phi to compute

Returns

Velocity Potential [\inline m^2/s] or Horizontal/Vertical velocity potential [\inline m/s]


Stokes Eta

 
doubleStokes_etadoublek
doubleamplitude
doublex
doubletime = 0
doubledepth = 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

kWave number [\inline 2\pi/m]
amplitudeWave amplitude [m]
xSpatial location [m]
timeTemporal location [sec]
depthDepth 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_kindoublek
doubleamplitude
doublex
doublez
doubletime = 0
Derivativederivative = norm
doubledepth = 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

kWave number [\inline 2\pi/m]
amplitudeWave amplitude [m]
xSpatial location [m]
zVertical location [m]
timeTemporal location [sec]
derivativeThe derivative of Phi
depthDepth 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_kindoublek
doubleamplitude
doublex
doubletime = 0
Derivativederivative = norm
doubledepth = 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

kWave number [\inline 2\pi/m]
amplitudeWave amplitude [m]
xSpatial location [m]
timeTemporal location [sec]
derivativeThe derivative of Phi
depthDepth 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_maxVeldoublek
doubleamplitude )
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

kWave number [\inline 2\pi/m]
amplitudeWave 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_componentinti
doublek
doubleamplitude
doubledepth = 0 )
Returns the ith wave component for a Stokes 5th order wave component.

Parameters

ithe component number (1-5)
kWave number [\inline 2\pi/m]
amplitudeWave 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.