Contrib/waves2Foam

From OpenFOAMWiki
< Contrib
Revision as of 18:54, 30 October 2011 by NGJ (Talk | contribs)

Valid versions: OF version 15.png OF Version 15dev.png OF Version 16ext.png OF Version 171.png OF Version 17x.png

Please report on other successful application of the toolbox

1 waves2Foam

This web page will shortly contain information of how to download "waves2Foam".

The package is to be used in the modelling of free surface water waves. The package contains the following:

  • One library libwaves2Foam. See description below.
  • Solver(s) to be used with 1.5 and 1.6+ (see below in section "Compatibility"). The foundation in the solvers is interFoam, where the relaxationZone part of waves2Foam has been added to the solver.
  • Preprocessing tools used to:
    • setWaveParameters: Sets the wave parameters for a given wave theory based on a set of input variables. E.g. for Airy wave theory, the period, water depth, and magnitude of the gravitational acceleration produces the wave number. The utility goes through all sub-dictionaries in waveProperties file, see below.
    • setWaveField: This utility sets initial conditions in the files U and gamma (v. 1.5)/alpha1 (v. 1.6 and more recent) based on a runTime selectable wave theory.
    • relaxationZoneLayout: Produces an overview of the spatial layout of the relaxation zone.
  • Tutorials
  • Since setWaveParameters is not working for all wave theories, a set of Matlab® functions are provided for the missing wave theories.

1.1 Referencing

Whenever used please do make prober referencing to the following journal paper:

@article { jacobsenFuhrmanFredsoe2011,
Author = {Jacobsen, N G and Fuhrman, D R and Freds\o{}e, J},
title = {{ A Wave Generation Toolbox for the Open-Source CFD Library: OpenFoam\textregistered{} } },
Journal = {{ Int. J. for Numerical Methods in Fluids} },
Year = {2011},
Volume = {In print},
Pages = {},
}

2 Distributed Libraries

  • convexPolyhedral
This library carries out intersection routines between faces/convex polyhedrals and the water surface given in terms of e.g. an algebraic equation such as \eta=a\sin (\omega t - \mathbf{k}\cdot\mathbf{x}), where \eta is the water surface elevation, a is the wave amplitude, \omega is the cyclic frequency, t is time, \mathbf{k} is the horizontal wave number vector, and \mathbf{x} is a spatial coordinate.
  • waves2Foam
This library contains implementations of wave theories, wave boundary conditions for p, \mathbf{u} and \alpha, being pressure, velocity, and void-ratio respectively. Furthermore the library also contain the implementation of the relaxation zone technique, which is the method used for avoiding reflections from e.g. outlet boundaries. Finally it also contains an object to be used for initialising the velocity and void-ratio fields with e.g. an Airy wave.

2.1 Available Wave Theories

The library is distributed with the following wave theories

  • Current-type
    • Potential current type (uniform velocity distribution from bottom to seaLevel)
  • Regular waves
    • Stokes first order wave theory (Airy wave)
    • First order Stokes standing wave theory
    • Stokes second order wave theory
    • Stokes fifth order wave theory
    • First order cnoidal theory
    • Stream function wave theory
  • Irregular waves
    • First order bi-chromatic wave train (wave group)
  • Other
    • combinedWaves, which allows for a combination of any of the above

3 waveProperties File

The file: waveProperties is to be placed in constant and must contain the following:

seaLevel 0.0; // Defines the still water level
relaxationNames ( <word0> <word1> ); // The list of names of the relaxation zones used in the simulation
initializationName <wordN>; // Used by setWaveField and is the sub-dictionary, 
                            // which defines what wave theory to use for initialization

Furthermore, sub-dictionaries are needed for every boundary, which uses any of the boundary conditions:

waveAlphaFvPatchScalarField    (type: waveAlpha)
wavePressureFvPatchScalarField (type: wavePressure)
waveVelocityFvPatchVectorField (type: waveVelocity)

and for all of the relaxationNames and the initializationName. The name of the sub-dictionaries are e.g.

<word0>+Coeffs

Please note that if an boundary called inlet uses one or several of the boundary conditions, then it is allowed for instance to have a relaxation zone called inlet in order not to duplicate the input.

An example of a combined boundary and relaxation zone input is given here, where Stokes first order wave theory (Airy wave) is the input

inletCoeffs
{
   // Wave type to be used at boundary "inlet" and in relaxation zone "inlet"
   waveType    stokesFirst;  
    
   // Ramp time of 2 s
   // Foam::sin(2 * mathematicalConstant::pi / (4.0 * Tsoft_) * Foam::min(Tsoft_, runTime.time().value() ))
   // and explicitly "1" for Tsoft = 0
   Tsoft       2;

   // Water depth at the boundary and in the relaxation zone
   depth       0.400000;

   // Cyclic wave frequency
   omega       3.141593;

   // Phase shift in the wave
   phi         0.000000;

   // Wave number vector, k. 
   waveNumber  (1.70048 0.0 0.0);

   // Wave height
   height      0.1;
    
   // Specifications on the relaxation zone shape and relaxation scheme
   relaxationZone
   {
       relaxationScheme Spatial;
       relaxationShape  Rectangular;
   
       startX           (0 0.0 -1);
       endX             (5 0.0  1);
       orientation      (1.0 0.0 0.0);
   }
};

4 Tutorials

4.1 Relaxation Zone Layout

  • Name: tutorials/relaxationZoneLayout
  • Utility: relaxationZoneLayout
  • Description: This tutorial will show how to use the utility to obtain a visual on the relaxation zones. This could be helpful to detect potential problems in the setup.

4.2 Wave Flume

  • Name: tutorials/waveFoam/waveFlume
  • Solver: waveFoam
  • Description: This tutorial will show the user how to use the constant/waveProperties dictionary to set-up the wave properties, relaxation zones and initialization specifications.

4.3 Periodic Solitary

  • Name: tutorials/waveFoam/periodicSolitary
  • Solver: waveFoam
  • Description: This tutorial uses the method for initialising a wave profile, which is different from a flat water surface with a sea-level, which differs from 0 m. The computational domain is cyclic in the direction of wave propagation and the initial field is a solitary wave.

5 Compatibility

The toolbox has been tested successfully with the following releases of OpenFoam:

  • 1.5.x
  • 1.5-dev
  • 1.6.x (Notice, that the release solves for total pressure, and the pressure boundary condition is given in excess pressure. It ought not change anything, however, it has not been tested)
  • 1.6-ext
  • 1.7.1

Because of considerable changes in the source code of OpenFoam between version 1.5 and 1.6, there exist a solvers15 and a solvers directory. Please also note that throughout the code, pre-processor choice are made based on the argument OFVERSION, which is given as

OFVERSION=`echo $WM_PROJECT_VERSION | sed -e 's/\./\n/g' -e 's/-/\n/' | grep "[0-9]" | tr -d '\n'`

which strips anything but the numbers from $WM_PROJECT_VERSION.

Furthermore note, that the dev/ext branches has an additional library called liblduSolvers.so, hence in the Allwmake script, linking to this particular library is stripped from all solvers, if $WM_PROJECT_VERSION contain neither of the strings dev and ext. Moving to these versions it is henceforth recommended to make a clean checkout.

6 Development / On-going and Future

  • In connection with each of the wave theories in src/waveTheories/, there should be a corresponding file in src/setWaveProperties/, which computes all of the necessary properties based on a minimum number of inputs, e.g. have height, H, water depth, h, and wave period, T.
This work is still ongoing, hence for those waves missing a property-file, the pre-processing tool setWaveParameters will fail.
  • Numerical beach type relaxation as part of the existing relaxation framework
  • Tests with other outlet boundary types [REF-NEEDED]

7 Download and Installation

7.1 Dependencies

Besides the standard dependencies in OpenFoam, waves2Foam also depend on Gnu Scientific Library (GSL). This is needed for two reasons:

  • In the cnoidal wave theory one has to evaluate Jacobian elliptic functions and complete elliptic integrals. These are not natively available in OpenFoam.
  • A pre-processing tool, which is currently being developed, computes the needed wave parameters giving the minimal number of input parameters. This quickly results in a set of N non-linear sets of equations in N unknowns. For this purpose GSL is currently being used.

GSL can e.g. be downloaded using the following commands[1]

Ubuntu: sudo apt-get install libgsl0-dev
Fedora: sudo yum install gsl-devel
Suse:   sudo zypper install gsl-devel

7.2 SVN on SourceForge

At present the package is located on a non-public SVN. It will shortly be moved to a public SVN on SourceForge.



--NGJ 21:39, 29 October 2011 (CET)

8 References

  1. Obtained from: http://lavandula.imim.es/adun-new/?page_id=186