CodeCogs - An iteractive open source Numerical library Welcome... Login
CodeCogs
shopping cart
OSXWindowsLinux
Search CodeCogs
Numerical Components

Valid RSS

EngineeringWaves

Dispersion

Available under GPL (Free) and Commercial licence
get a GPL licence
COST (GBP)
this unit 3.00
sub units 0.00
add a commercial licence to your cart
0
viewed 2024 times and licensed 19 times

Uses a linear dispersion relationship to compute wave-frequency from wave-number

Controller: CodeCogs  Contact Controller
+View version details
Contents hide toc
buy now     get GPL     add to cart

Interface

#include <codecogs/engineering/waves/dispersion.h>

using namespace Engineering::Waves;

double dispersion_k (double k, double depth=0, double gravity=9.8066)
Uses a linear dispersion relationship to compute wave-frequency from wave-number
double dispersion_k2 (double a, double k, double depth=0, double gravity=9.8066)
Uses a 2nd order dispersion relationship, to obtain wave-frequency from wave-number
double dispersion_w (double w, double depth=0, double gravity=9.8066)
Itartively solves for wave-number from wave-frequency.

Function Documentation

Dispersion K Calculator
  
Add calculator to website or email
 
doubledispersion_kdoublek
doubledepth = 0
doublegravity = 9.8066 )
This function solves the linear dispersion equation, w^2 = g k tanh(k d), to obtain wave-frequency from a given wave-number, using a very simple rearrangement
w = \sqrt { g k tanh(k d) }
where w is wave-frequency, k is wave-number and g is gravity. In deep water (represented with d<=0), this solution reduces to
w = \sqrt { g k }

The opposite of this function is dispersion_w
Example 1:
#include <stdio.h>
#include <codecogs/engineering/waves/dispersion.h>
using namespace Engineering::Waves;
 
int main()
{
  printf("   k         w ");
  for(double k=0.01; k<1;k+=0.1)
  {
    printf("\n %.6lf", k);
    double w=dispersion_k(k,2);
    printf("  %.3lf", w);
  }
}
Output:
k         w
0.010000  0.044
0.110000  0.483
0.210000  0.904
0.310000  1.294
0.410000  1.648
0.510000  1.962
0.610000  2.241
0.710000  2.489
0.810000  2.710
0.910000  2.910
Parameters:
k(2\;\mathrm{\pi/m}) is wave-number. [rad/m]
depththe depth of the water to mean sea level. A value of zero or less corresponds to deep water. [m]
gravity(default 9.8066). [m/s^2]
Returns:
wave-frequency (2\;\mathrm{\pi/s}). [rad/s]
Source Code:

To view or download source code you need either a GPL or Commercial Licence.

buy now     get GPL     add to cart

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


Dispersion K2 Calculator
  
Add calculator to website or email
 
doubledispersion_k2doublea
doublek
doubledepth = 0
doublegravity = 9.8066 )
This function solves a 2nd order dispersion relationship to more accurate compute the relationship between wave-frequency and wave-number for the specified wave amplitude a. The solution is based on work by Dalrymple, who derived:
w^2 = g k (1 + f_1 \epsilon^2 D) tanh(k d + f_2 \epsilon)

where

In deep water(represented with d<=0), this solution reduces to
w = \sqrt { g k }
As in the linear dispersion relationship.
Example 2:
#include <stdio.h>
#include <codecogs/engineering/waves/dispersion.h>
using namespace Engineering::Waves;
 
int main()
{
  double amp=3;  // 3 meters
  printf("   k         w ");
  for(double k=0.01; k<1;k+=0.1)
  {
    printf("\n %.6lf", k);
    double w=dispersion_k2(amp,k,2);
    printf("  %.3lf", w);
  }
}
Output:
k         w
????
Parameters:
aamplitude of component with wavenumber k. [m]
kwave-number of component (2\;\mathrm{\pi/m}). [rad/m]
depththe depth of the water to mean sea level. A value of zero or less corresponds to deep water. [m]
gravity(default 9.8066\;\mathrm{m/s^2}). [m/s^2]
Returns:
wave-frequency (2\;\mathrm{\pi/s}). [rad/s]
Source Code:

To view or download source code you need either a GPL or Commercial Licence.

buy now     get GPL     add to cart

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


Dispersion W Calculator
  
Add calculator to website or email
 
doubledispersion_wdoublew
doubledepth = 0
doublegravity = 9.8066 )
Finds the wave-number associated with a particular wave-frequency, using this 2nd order dispersion equation, w^2 = g k tanh(k d) to obtain wave-number from a given wave-frequency.

In Deep water, this equations reduces to w^2 = g k, which can obviously solved directly.

For shallow water, an iterative approach must be used. For each iteration, we calculate the residual error:
\epsilon = \frac{w^2}{g} -  k tanh(k d)
where w is wave-frequency, k is wave-number and g is gravity.

We then seek to minimise ε using the first derivative \partial \epsilon / \partial k.

This convergence of this error function is fairly rapid, with poorest conversion, 8 iterations in water 2m deep (for 6dp precision) occurring when w is small i.e. w<=0.1. When \e w=1.5 only 4 iterations are needed, while \e w>3.5 needs only 2 iterations. Shallow water naturally requires more iteration. If your doing many calculation in either shallow water or very long wave periods (>30s), then you might want to consider fine tuning this function.

This relationship can me use to move from the wave-period (2\pi / w) to the wave-length (2\pi/k) of a water wave. This is also shown graphically in the following figure:
\graph  w=0:4, depth=1:5:3, gravity=9.8066
The opposite of this function is dispersion_k
Example 3:
#include <stdio.h>
#include <codecogs/engineering/waves/dispersion.h>
using namespace Engineering::Waves;
 
int main()
{
  printf("   k         w  recalculated k");
  for(double k=0.01; k<1;k+=0.1)
  {
    printf("\n %.6lf", k);
    double w=dispersion_k(k,2);
    double k2=dispersion_w(w,2);
    printf("  %.3lf  %.6lf", w, k2);
  }
  return 0;
}
Output:
k         w  recalculated k
0.010000  0.044  0.010000
0.110000  0.483  0.110000
0.210000  0.904  0.210000
0.310000  1.294  0.310000
0.410000  1.648  0.410000
0.510000  1.962  0.510000
0.610000  2.241  0.610000
0.710000  2.489  0.710000
0.810000  2.710  0.810000
0.910000  2.910  0.910000
Parameters:
w(2\;\mathrm{\pi/s}) is wave-frequency, usually written using \omega (omega).
depth(m) define the depth of the water to mean sea level. A value of zero or less corresponds to deep water.
gravity(default 9.8066\;\mathrm{m/s^2}).
Returns:
wave-number (2\;\mathrm{\pi/m}).
Source Code:

To view or download source code you need either a GPL or Commercial Licence.

buy now     get GPL     add to cart

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


Page Comments

Format Excel Equations

  You must login to leave a messge


Last Modified: 8 Apr 09 @ 23:28     Page Rendered: 2010-03-12 17:49:26

Valid CSS!   Valid XHTML 1.0 Transitional