Tip Surface elevation in time

From OpenFOAMWiki

1 Introduction

Working with free surface flow, one might want to track a point at the interface in time, possibly as some kind of buoy.

A common method to achieve this (e.g. in interFoam), is to sample the value of alpha1 along a line (x,y,z(q)) and averaging z(q) based on the sampled value alpha1(z(q)) (with q some space parameter). Approaches following this procedure can be found at:

This wiki-page will describe a different method I used, based on first sampling the iso-surface of alpha1=0.5 (needed anyhow) and subsequentlly sampling points from this iso-surface using Python.

2 Iso-surface

Sampling the iso-surface of alpha1 is straight-forward to perform during runtime. It can be obtained by putting the following sampling function at the end of the controlDict of case.

       type            surfaces;
       outputControl   outputTime;
       outputInterval  1;  
       surfaceFormat  vtk;
               type        isoSurfaceCell;
               isoField    alpha1;
               isoValue    0.5;
               interpolate false;
               regularise  false;
       interpolationScheme cell;

3 Probing the buoy

Use the file below to sample coordinates from the stored iso-surfaces File:ElevationVsTime.tar.gz

Some notes to use this python script

  • Python and Numpy should be properly installed
  • The script assumes the vtk-files to be in freeSurface/<time-step>/
  • The script demands a freeSurface/0/ directory to read an initial (flat) surface
  • Deviations from this initial surface should not be too large
  • Gravity is assumed to act in the y-direction
  • A file 'coords' with two columns (x, z) is expected as probing coordinates

4 Disclaimer

This is probably a disk-space demanding operation if you don't necessarily need to sample the alpha1=0.5 isosurface. Feel free to implement this in the FOAM framework that operates during run-time. This code can easily be used to calculate a time-average free surface.