CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

runTime processing of water level (wave height)

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Phicau

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 16, 2022, 06:49
Default runTime processing of water level (wave height)
  #1
Member
 
Callum Guy
Join Date: Dec 2019
Location: Scotland
Posts: 44
Rep Power: 7
CallumG is on a distinguished road
Hi Foamers,

I'm using olaFlow (https://olaflow.github.io/), a set of wave boundary conditions used with interFoam to simulate some wave conditions and would like to process the wave height (i.e. water level where alpha>0.5) during runtime at certain locations.

I'm currently achieving this via adding the following function to my controlDict:

Code:
functions
{
    WG1
    {
        type sets;
        writeControl timeStep;
        outputInterval 1;
        interpolationScheme cellPoint;
        setFormat raw;

        sets
        (
            data
            {
                type uniform;
                axis z;
                start (2.5 5 1);
                end   (2.5 5 2);
                nPoints 1000;
            }
        );

    fields (alpha.water U);
    }
}
This samples the specified line and returns the alpha value against the z position. I then look through the series, find where alpha goes from >0.5 to <0.5, and voilą wave height.

The only issue is the curves I'm getting look like the attached, for regular sinusoidal waves.

When I check in ParaView the waves look correct.

Could anyone offer any advice on what's going on and how to correct it?

Cheers,
Callum
Attached Images
File Type: png wave_height.png (89.4 KB, 62 views)
CallumG is offline   Reply With Quote

Old   February 21, 2022, 20:29
Default
  #2
Senior Member
 
Pablo Higuera
Join Date: Jan 2011
Location: Auckland
Posts: 627
Rep Power: 19
Phicau is on a distinguished road
Hi Callum,
I think I know what is going on. I have a couple of other pointers for you too. These learnings have made me adopt the method that I use (and recommend using) in https://github.com/phicau/olaFlow/bl...ls/breakwater/

- I believe that your postprocessing script may be wrong. When you sort the folders you should sort them by value, not by their name (I have been there before...)

- If the coordinates coincide with a face, sampling may jump between different cells. Add a small number (e.g., 1e-6) to the coordinates to prevent this.

- The uniform sampling procedure requires a lot of storage and gives you the wrong impression of accuracy, because in the end the mesh resolution is what it is, and uniform is just interpolating linearly to all those points. Using lineCellFace/midPointAndFace saves you from choosing a randomly large number of points to sample, as it samples only when the line passes through faces and in the middle point between them (cell centers). You can use interpolationScheme as cellPoint or cellPointFace.

- Integrating the VOF in the vertical direction is a widely accepted to obtain free surface elevation and provides subgrid accuracy, as VOF ranges from 0 to 1. The result is approximated when overturning waves exist, but it is very robust otherwise. Searching for VOF = 0.5 in the context of an algebraic VOF may be problematic too when overturning occurs too.

I hope it helps.

Best,
Pablo
PC6823 likes this.
__________________
Check out my new project: olaFlow --> The olaFlow Support Thread
Phicau is offline   Reply With Quote

Old   March 14, 2022, 10:40
Default
  #3
Member
 
Callum Guy
Join Date: Dec 2019
Location: Scotland
Posts: 44
Rep Power: 7
CallumG is on a distinguished road
Hi Pablo,

thanks for the advice! As always, you are correct on every point :-)

Although I had implemented natural sorting, for some unknown reason, my time steps had been mixed up in my post-processing code. Equally, because my mesh is structured, and I had sampled at 1/4, 1/2, and 3/4 domain locations respectively, my sample lines did fall on cell faces!

So now, as you advised, I've repaired these issues and moved to type "midPointAndFace" with a "cellPoint" interpolation scheme. This is now much better!

I'd be interested to know how you would deal with free surface position. I'm not dealing with breaking waves at all and my mesh resolution is reasonably dense around the free surface, so I've opted to maintain the alpha>0.5 as before. It seems to work fine, but would welcome ant better logic.

All the best,
Callum
CallumG is offline   Reply With Quote

Old   March 15, 2022, 11:01
Default
  #4
Senior Member
 
Pablo Higuera
Join Date: Jan 2011
Location: Auckland
Posts: 627
Rep Power: 19
Phicau is on a distinguished road
My pleasure, glad to know that it worked!
I would continue with the 0.5 threshold, which is generally accepted. I don't expect much variation between looking for the free surface location by interpolating or by integrating the water column; perhaps the first one may show a little bit more of noise (?) since it only depends on the values of 2 cells rather than being an integrated result.

The only condition in which I have applied other values (0.1) is to calculate runup, since 10% of the cell being filled with water seemed wet enough to constitute runup.

Pablo
__________________
Check out my new project: olaFlow --> The olaFlow Support Thread
Phicau is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Virtual wave problem at ship calm water simulation xdo2004 STAR-CCM+ 2 October 24, 2024 01:58
[IHFOAM] The IHFOAM Thread Phicau OpenFOAM Community Contributions 392 September 8, 2023 19:10
Problem in3D model processing mebinitap OpenFOAM 2 December 12, 2014 05:40
How to generate waves of particular wave height...please help nims FLUENT 0 September 21, 2010 03:48
uptodate water distribution network fredius,magige,tanzanian,(e.a) Main CFD Forum 0 January 27, 2002 08:10


All times are GMT -4. The time now is 21:05.