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

Wave tutorial

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 22, 2022, 13:45
Default
  #21
Member
 
Tony Zhang
Join Date: Nov 2019
Location: soton
Posts: 45
Rep Power: 7
zyfsoton is on a distinguished road
Quote:
Originally Posted by JNSN View Post
Hi Tony, what do you mean with wave velocity?
Hi Jan,

Thank you for your reply.

The calculation is about the ship running in calm water first with a speed of 1.588m/s, then letting the wave encounter the moving ship and the wave speed is 2.602m/s.

When I did the simulation, the hull is still while the domain has a speed of 1.588m/s, so I am not sure how to set up when a moving ship encounters the wave.


Many thanks and best regards,
Tony
zyfsoton is offline   Reply With Quote

Old   April 22, 2022, 13:55
Default
  #22
Senior Member
 
JNSN's Avatar
 
Jan
Join Date: Jul 2009
Location: Hamburg
Posts: 144
Rep Power: 20
JNSN is on a distinguished road
Hi Tony, sorry but I still don't understand what you mean with wave velocity. The ship is still sailing with 1.588 m/s?
The orbital velocities of the wave results from the wave length.
JNSN is offline   Reply With Quote

Old   April 22, 2022, 16:24
Default
  #23
Member
 
Tony Zhang
Join Date: Nov 2019
Location: soton
Posts: 45
Rep Power: 7
zyfsoton is on a distinguished road
Quote:
Originally Posted by JNSN View Post
Hi Tony, sorry but I still don't understand what you mean with wave velocity. The ship is still sailing with 1.588 m/s?
The orbital velocities of the wave results from the wave length.
Dear Jan,

Yes, the ship is still sailing at 1.588m/s.

Like in the towing tank test, the ship is towed by the carriage and the speed is 1.588m/s. The wave generator can generate the wave from one end of the towing tank. The wave condition is wavelength=4.338m, wave frequency=0.60Hz, wave period=1.667s, wave speed=2.602m/s, wave amplitude=0.038m.

My current simulation seems the wave has been generated at t=0, which I can see from the paraview when I generate the free surface contour. I am thinking about how to make the wave start from the inlet and encounter the moving ship, is this possible?

Many thanks,
Tony
zyfsoton is offline   Reply With Quote

Old   April 25, 2022, 12:20
Default
  #24
Senior Member
 
JNSN's Avatar
 
Jan
Join Date: Jul 2009
Location: Hamburg
Posts: 144
Rep Power: 20
JNSN is on a distinguished road
Quote:
Originally Posted by zyfsoton View Post
Dear Jan,

Yes, the ship is still sailing at 1.588m/s.

Like in the towing tank test, the ship is towed by the carriage and the speed is 1.588m/s. The wave generator can generate the wave from one end of the towing tank. The wave condition is wavelength=4.338m, wave frequency=0.60Hz, wave period=1.667s, wave speed=2.602m/s, wave amplitude=0.038m.

My current simulation seems the wave has been generated at t=0, which I can see from the paraview when I generate the free surface contour. I am thinking about how to make the wave start from the inlet and encounter the moving ship, is this possible?

Many thanks,
Tony

Ok, understand. Assuming your ship is sailing in positive x-direction and the waves approaching from the inlet (i. e. head waves) towards the ship, then you should set:

Code:
UMean to (-1.588 0 0);
direction (-1 0 0);
As said, you can not specify the wave velocity directly, it is a result from the underlying wave model. The waves are defined by length, amplitude, phase and angle.

The wave is always generated at the inlet, and then travels through the domain. If you look at the free surface elevation at t=0, this is the result from the initialization with setWaves. If you want to have the wave crest at t=0 at any other postion, you can change the origin of the wave coordinate system.


Have a look at the DTCHullWave tutorial. There the ship sails with 1.668 m/s through head waves.


Hope this helps,
Jan
JNSN is offline   Reply With Quote

Old   April 25, 2022, 12:51
Default
  #25
Member
 
Tony Zhang
Join Date: Nov 2019
Location: soton
Posts: 45
Rep Power: 7
zyfsoton is on a distinguished road
Quote:
Originally Posted by JNSN View Post
Ok, understand. Assuming your ship is sailing in positive x-direction and the waves approaching from the inlet (i. e. head waves) towards the ship, then you should set:

Code:
UMean to (-1.588 0 0);
direction (-1 0 0);
As said, you can not specify the wave velocity directly, it is a result from the underlying wave model. The waves are defined by length, amplitude, phase and angle.

The wave is always generated at the inlet, and then travels through the domain. If you look at the free surface elevation at t=0, this is the result from the initialization with setWaves. If you want to have the wave crest at t=0 at any other postion, you can change the origin of the wave coordinate system.


Have a look at the DTCHullWave tutorial. There the ship sails with 1.668 m/s through head waves.


Hope this helps,
Jan
Dear Jan,

Many thanks for your detailed reply.

I think now I know how to setup the ship speed and for wave, just set wavelength, wave height, phase, angle rather than wave velocity.

But I am confused about the scale table in waveProperties file. I have attached my waveProerties file and also the free surface contours. You can see wave is there at t=0. but the simulation starts, there seems no wave, I dont know why, maybe the wrong setup in that scale table. And my domain ranges from -9.5 to +9 in x-direction. Thus I think I need to make sure the scale is 1 when x<9m, thats the reason why I set (10,1) (20,0). Please correct me if I am wrong.
Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  7
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "constant";
    object      waveProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

origin          (0 0 0.1772);

direction       (-1 0 0);

speed           1.588; 

waves
(
    Stokes2
    {
        length      2.455;
        amplitude   0.019;
        phase       0;
        angle       0;
    }
);

UxMean          -1.958;

UMean           ($UxMean 0 0);

scale           table ((10 1) (20 0));


// ************************************************************************* //
Also, I have looked the DTCHullWave tutorial and also wave tutorial in OF7. In both tutorials' waveProperties, (x1, 1) (x2,0). x1 is within their domain range. In DTCHullWave tutorial, x1 is at about the middle point of the hull. So I am not sure how this scale table works and what value should be for x1 and x2 for my case.

Many thanks for your help and best regards,
Tony
Attached Images
File Type: jpg freesurfacecontours.jpg (115.4 KB, 55 views)
zyfsoton is offline   Reply With Quote

Old   April 25, 2022, 13:10
Default
  #26
Senior Member
 
JNSN's Avatar
 
Jan
Join Date: Jul 2009
Location: Hamburg
Posts: 144
Rep Power: 20
JNSN is on a distinguished road
When I remember correctly, the scale is calclulated with reference to the wave coordinate system. So, if you want the scaling to be effective behind your ship, you should habe something similar as in the tutorial, e.g. :

Code:
scale           table ((2 1) (9 0));
means, that the waves are scaled down from 1*amplitude to zero amplitude in the from 2 to 9 meter away from the wave origin.
But from the contour plots you have shown, it seems there is something other going wrong. Do you specifiy some damping in the fvModels file?
JNSN is offline   Reply With Quote

Old   April 25, 2022, 13:23
Default
  #27
Member
 
Tony Zhang
Join Date: Nov 2019
Location: soton
Posts: 45
Rep Power: 7
zyfsoton is on a distinguished road
Quote:
Originally Posted by JNSN View Post
When I remember correctly, the scale is calclulated with reference to the wave coordinate system. So, if you want the scaling to be effective behind your ship, you should habe something similar as in the tutorial, e.g. :

Code:
scale           table ((2 1) (9 0));
means, that the waves are scaled down from 1*amplitude to zero amplitude in the from 2 to 9 meter away from the wave origin.
But from the contour plots you have shown, it seems there is something other going wrong. Do you specifiy some damping in the fvModels file?
Dear Jan,

Many thanks for your quick reply.

I will try to resetup the waveProperties and see how it is going.

I am not sure about the fvModels file, I dont think I have that file in my case. I am using OpenFOAM version 7 now.

The ship is free to heave and pitch and I setup the damping restraints in dynamicMeshDict file according to DTCHullMoving tutorial.

I also attached the fvsolution file, please have a look:

Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  7
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

solvers
{
    "alpha.water.*"
    {
        nAlphaCorr      3;
        nAlphaSubCycles 1;
        cAlpha          1;
        icAlpha         0;

        MULESCorr       yes;
        nLimiterIter    15;
        alphaApplyPrevCorr  yes;

        solver          smoothSolver;
        smoother        symGaussSeidel;
        tolerance       1e-10;
        relTol          0;
        minIter         1;
    }

    "pcorr.*"
    {
        solver          GAMG;

        smoother        DIC;

        tolerance       1e-3;
        relTol          0;
    };

    p_rgh
    {
        solver          GAMG;

        smoother        DIC;

        tolerance       5e-8;
        relTol          0;
    };

    p_rghFinal
    {
        $p_rgh;
        relTol          0;
    }

    "(U|k|omega).*"
    {
        solver          smoothSolver;

        smoother        symGaussSeidel;
        nSweeps         1;

        tolerance       1e-7;
        relTol          0;
        minIter         1;
    };
}

PIMPLE
{
    momentumPredictor no;

    nOuterCorrectors 3;
    nCorrectors      1;
    nNonOrthogonalCorrectors 0;

    correctPhi      yes;
    moveMeshOuterCorrectors yes;
    turbOnFinalIterOnly yes;
}

relaxationFactors
{
    equations
    {
        ".*" 1;
    }
}

cache
{
    grad(U);
}


// ************************************************************************* //
Many thanks,
Tony
zyfsoton is offline   Reply With Quote

Old   April 25, 2022, 13:51
Default
  #28
Senior Member
 
JNSN's Avatar
 
Jan
Join Date: Jul 2009
Location: Hamburg
Posts: 144
Rep Power: 20
JNSN is on a distinguished road
with damping I mean some kind of source term, which enforces the velocity field to some defined value. This can be used to damp out reflections, which otherwise lead to unphysiclly oscillating forces. I think in Version7 this can be defined in fvOptions. Or if you dont have one, there must be some other reason why your waves are vanishing. May you mesh is way too coarse..
JNSN is offline   Reply With Quote

Old   May 3, 2022, 12:25
Default
  #29
Member
 
Tony Zhang
Join Date: Nov 2019
Location: soton
Posts: 45
Rep Power: 7
zyfsoton is on a distinguished road
Quote:
Originally Posted by JNSN View Post
with damping I mean some kind of source term, which enforces the velocity field to some defined value. This can be used to damp out reflections, which otherwise lead to unphysiclly oscillating forces. I think in Version7 this can be defined in fvOptions. Or if you dont have one, there must be some other reason why your waves are vanishing. May you mesh is way too coarse..
Dear Jan,

Hope you are doing well.

Based on your suggestion, I have reduced the distance between the inlet and the ship bow, also refine the mesh around the bow and inlet. Now the wave seems working, please have a look at the attached free surface contours.

Also, I changed the deltaT to 0.0001 from 0.01, this setting is based on the DTCHullWave tutorial. But smaller delta T means longer simulation time, I am not sure whether different values of delta T will make a difference to the results?

Many thanks for your help as always,

Best regards,
Tony
Attached Images
File Type: jpg waveelevation.jpg (87.0 KB, 35 views)
zyfsoton is offline   Reply With Quote

Old   May 6, 2022, 04:46
Default
  #30
Senior Member
 
JNSN's Avatar
 
Jan
Join Date: Jul 2009
Location: Hamburg
Posts: 144
Rep Power: 20
JNSN is on a distinguished road
Hi Tony,


good to see that you are making progress. Just be careful not to have your inlet too close to the ship in order to avoid influence of the boundary conditions on the result.

Regarding you question on time step size: in general smaller time step will give better results, as the temporal discretization error is reduced. Similar as reducing spatial discretization error by refining the mesh.

But as you said, with smaller time step the simulation time increases. Therefore you need to find a good compromise between accuracy and efficiency. If you are using Euler as ddt scheme, you can also try to use a higher order scheme instead, i.e. Crank-Nicholson.


Best,
Jan
JNSN is offline   Reply With Quote

Old   August 10, 2023, 02:25
Default what's the angle in waveProperties?
  #31
New Member
 
Zicheng Li
Join Date: Dec 2019
Posts: 8
Rep Power: 7
Liz1219 is on a distinguished road
Can anyone tell me what the angle in waveProperties means?
HTML Code:
waves
(
    Stokes2
    {
        length      3;
        amplitude   0.04;
        phase       0;
       [U] angle       0;[/U]
    }
);
Liz1219 is offline   Reply With Quote

Old   August 14, 2023, 05:49
Default
  #32
Senior Member
 
JNSN's Avatar
 
Jan
Join Date: Jul 2009
Location: Hamburg
Posts: 144
Rep Power: 20
JNSN is on a distinguished road
This is the angle relative to the
Code:
direction
ali_b124 likes this.
JNSN is offline   Reply With Quote

Old   September 12, 2023, 18:42
Default Total displacement of the water when created a wave
  #33
New Member
 
Sarah Aguiar
Join Date: Sep 2023
Posts: 10
Rep Power: 3
Sarah_Ag is on a distinguished road
Hey everyone, I'm in a bit of a situation now. I created a mesh using blockmesh and basewaveflume tutorial like base, BUT my simulation goes crazy, it's like the wave created displace all the water of the ocean and become a tsuname. I'm sending the pics so you guys can understand better. I'm putting below my wave dict, fvschemes, and fvsolution here.



Dis you guys already saw something like this? Can help me or give me any tips? Thanks in advance.


FVSCHEMES


/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

ddtSchemes
{
default Euler;
}

gradSchemes
{
default Gauss linear;
}

divSchemes
{
div(rhoPhi,U) Gauss limitedLinearV 1;
div(U) Gauss linear;
div((rhoPhi|interpolate(porosity)),U) Gauss upwind 1;
div(rhoPhiPor,UPor) Gauss upwind 1;
div(rhoPhi,UPor) Gauss upwind 1;
div(rhoPhiPor,U) Gauss upwind 1;
div(phi,alpha) Gauss vanLeer;
div(phirb,alpha) Gauss interfaceCompression;
div((muEff*dev(T(grad(U))))) Gauss linear;
div(phi,k) Gauss upwind;
div(phi,epsilon) Gauss upwind;
div((phi|interpolate(porosity)),k) Gauss upwind;
div((phi|interpolate(porosity)),epsilon) Gauss upwind;
div(phi,omega) Gauss upwind;
div((phi|interpolate(porosity)),omega) Gauss upwind;
}

laplacianSchemes
{
default Gauss linear corrected;
}

interpolationSchemes
{
default linear;
}

snGradSchemes
{
default corrected;
}

fluxRequired
{
default no;
p_rgh;
pcorr;
alpha.water;
}


// ************************************************** *********************** //









FVSOLUTION





/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

solvers
{
"alpha.water.*"
{
nAlphaCorr 1;
nAlphaSubCycles 2;
alphaOuterCorrectors yes;
cAlpha 1;

MULESCorr no;
nLimiterIter 3;

solver PCG;
preconditioner DIC;
tolerance 1e-07;
relTol 0.05;
}

"pcorr.*"
{
solver PCG;
preconditioner DIC;
tolerance 1e-5;
relTol 0;
}

p_rgh
{
solver PCG;
preconditioner DIC;
tolerance 1e-07;
relTol 0.05;
}

p_rghFinal
{
$p_rgh;
relTol 0;
}

U
{
solver PCG;
preconditioner DIC;
tolerance 1e-07;
relTol 0.05;
}
}

PIMPLE
{
momentumPredictor no;
nOuterCorrectors 1;
nCorrectors 3;
nNonOrthogonalCorrectors 0;
}

relaxationFactors
{
fields
{
}
equations
{
".*" 1;
}
}


// ************************************************** *********************** //









WAVE DICT


/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.3 |
| \\ / A nd | Web: http://www.openfoam.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object waveDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

waveType regular;

waveTheory StokesII;

genAbs 1;

absDir 0.0;

nPaddles 1;

waveHeight 1.0;

wavePeriod 4.05;

waveDir 0.0;

wavePhase 1.57079633;

// Change both entries to true to re-read this dictionary upon restart.
rereadAlpha false;
rereadU false;

// ************************************************** *********************** //
Attached Images
File Type: jpg Sem título.jpg (95.6 KB, 17 views)
File Type: jpg Sem título(1).jpg (101.8 KB, 9 views)
Sarah_Ag is offline   Reply With Quote

Old   December 6, 2023, 08:05
Default
  #34
New Member
 
Ali Burhan
Join Date: Apr 2017
Location: İstanbul
Posts: 13
Rep Power: 9
ali_b124 is on a distinguished road
Hello everyone,

What exactly the "phase" in waveProperties file?

Does that mean phase shift in Stokes 2 formula?

Quote:
waves
(
Stokes2
{
length 3;
amplitude 0.04;
phase 0;
angle 0;
}
);
ali_b124 is offline   Reply With Quote

Old   December 7, 2023, 05:10
Default
  #35
Senior Member
 
JNSN's Avatar
 
Jan
Join Date: Jul 2009
Location: Hamburg
Posts: 144
Rep Power: 20
JNSN is on a distinguished road
yes. With the phase entry you can controll the "position" of the wave (crest and trough) relative to space and time of your reference system. Time is the simulation time and space the wave coordinate system defined with the origin entry in the waveProperties file.
JNSN is offline   Reply With Quote

Old   December 7, 2023, 05:13
Default
  #36
Senior Member
 
JNSN's Avatar
 
Jan
Join Date: Jul 2009
Location: Hamburg
Posts: 144
Rep Power: 20
JNSN is on a distinguished road
you can easily check by specifiying an arbitrary phase angle (e.g. 0.5 pi), initialize with setWaves and vizualize the resulting wave.
JNSN is offline   Reply With Quote

Reply

Tags
openfoam 5.0, speed, wave boundary conditions


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
need tutorial files(Simulation of Wave Generation in a Tank) gholamghar FLUENT 45 May 6, 2018 11:57
[Virtualization] OpenFOAM oriented tutorial on using VMware Player - support thread wyldckat OpenFOAM Installation 2 July 11, 2012 17:01
How to generate waves of particular wave height...please help nims FLUENT 0 September 21, 2010 03:48
Scaling up a wave energy converter - free surface flow mark_l CFX 3 February 17, 2010 17:57
need tutorial files(Simulation of Wave Generation in a Tank) gholamghar FLUENT 0 March 28, 2009 04:08


All times are GMT -4. The time now is 14:55.