CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Community Contributions (https://www.cfd-online.com/Forums/openfoam-community-contributions/)
-   -   [waves2Foam] Verification against linear waves (https://www.cfd-online.com/Forums/openfoam-community-contributions/208042-verification-against-linear-waves.html)

katakgoreng August 28, 2013 11:05

Verification against linear waves
 
Hi Niels,

Thanks for your effort in developing the wave2Foam toolbox.
I'm new to OPENFOAM and wave2Foam (start using if two weeks ago). Luckily, I managed to get things up and running.
I want to assess the accuracy of wave2Foam for the stokesFirst case. Using really low wave steepness in intermediate water, I tried running the waveFlume tutorial. The phasing matches well with linear potential waves theory but the amplitude got shifted upward making it slightly larger than that of analytical solution. I tried using mesh twice denser but still got the same result.

WAVE PARAMETER USED
WaveType = stokesFirst
Depth, d = 0.4 m
Period, T = 2 s
Height, H = 0.01 m
WaveNumber, k = 1.70048
Omega, w = 3.14159

CORRESPONDING WAVE PROPERTIES
Wave amplitude, a = 0.005 m
Wave steepness, ak = 0.0085
Dispersion parameter, kd = 0.68

DOMAIN AND MESH PARAMETERS
Domain length = 18 m
Domain height = 0.6 m
Horizontal cell = 360
Vertical cell = 60
Delta x = 0.05 m
Delta y = 0.01 m

ANALYTICAL SOLUTION FOR LINEAR WATER WAVES (FREE SURFACE)
ZetaAnalytical = a * cos ( k*x - omega*t )

RESULTS
Phasing error ~ 0 %
Amplitude error ~ 4 %

Is there anything that I should tweak in order to get more accurate result?
Does viscosity and density between the water and air affect the result?

http://i700.photobucket.com/albums/w...psaa3c1d54.jpg

Kind regards,
katakgoreng

ngj August 28, 2013 12:56

Hello Katakgoreng,

Have you tried comparing your solution with second order Stokes? From my quick look into second order Stokes, then the second order amplitude is 2.7% of the first order amplitude for your conditions, so 4% off is not that bad:)

Kind regards,

Niels

katakgoreng August 28, 2013 13:36

Quote:

Originally Posted by ngj (Post 448574)
Hello Katakgoreng,

Have you tried comparing your solution with second order Stokes? From my quick look into second order Stokes, then the second order amplitude is 2.7% of the first order amplitude for your conditions, so 4% off is not that bad:)

Kind regards,

Niels

Hi Niels,

Thank you for your suggestion.
Comparison with second order Stokes yield much better result.
With maximum amplitude error of 1.4 %. :D
Will try another case.

http://i700.photobucket.com/albums/w...psd8854e79.png

Kind regards,
katakgoreng

ngj August 28, 2013 18:25

Considering the fact that you only have 1 cell over the wave height, the result is really, really good!

Kind regards,

Niels

katakgoreng August 30, 2013 07:29

Hi Niels,

(# UPDATE : I MADE MISTAKES IN THIS SIMULATION. I INCREASE THE WATER DEPTH IN THE "waveProperties" FILE BUT I DON'T CHANGE THE SIZE OF THE DOMAIN. THANKS NIELS FOR POINTING THINGS OUT..)

After the success of running intermediate water waves, I tried running wave2Foam for deep water waves. It seems like for deep water, the dispersion is not properly resolved resulting in slower wave propagation (compared to Stokes 2nd Order). Furthermore, the maximum amplitude is damped a bit after propagate from the inlet and stays constant until the end. Below are the wave parameters that I used:

DOMAIN AND MESH PARAMETERS FOR BOTH CASES
Domain length = 18 m
Domain height = 0.6 m
Horizontal cell = 360
Vertical cell = 60
Delta x = 0.05 m
Delta y = 0.01 m

INTERMEDIATE WATER WAVE PROPERTIES
Water depth, d : 0.4
Wave period, T : 2
Wave height, H : 0.01
Wave number, k : 1.7005
Wave amplitude, a : 0.005
Wave frequency, omega : 3.1416
Wave steepness, ak : 0.0085024
Dispersion, kd : 0.68019

http://i700.photobucket.com/albums/w...ps7f318ce8.gif

DEEP WATER WAVE PROPERTIES
Water depth, d : 3.1416
Wave period, T : 2
Wave height, H : 0.01
Wave number, k : 1.0096
Wave amplitude, a : 0.005
Wave frequency, omega : 3.1416
Wave steepness, ak : 0.0050481
Dispersion, kd : 3.1718

http://i700.photobucket.com/albums/w...ps1a4a3464.gif

Note : Dash line (wave2Foam), solid line (Stokes 2nd Order)

Have you run parametric study on the range of validity of wave2Foam in terms of wave steepness as well as degree of dispersion?

Kind regards,
katakgoreng

ngj August 30, 2013 08:02

Hi,

It really looks strange. Good you upload the deep water case here, and I will try to have a look at it tonight.

The only thing, which I can think of: You have also increased the size of the computational domain, correct? Because it looks like the wave have the similar attributes as for the intermediate water depth. If not, then the model merely make the wave fit the water depth in the computational domain.

Kind regards

Niels

katakgoreng August 30, 2013 09:59

1 Attachment(s)
Quote:

Originally Posted by ngj (Post 448902)
Hi,

It really looks strange. Good you upload the deep water case here, and I will try to have a look at it tonight.

The only thing, which I can think of: You have also increased the size of the computational domain, correct? Because it looks like the wave have the similar attributes as for the intermediate water depth. If not, then the model merely make the wave fit the water depth in the computational domain.

Kind regards

Niels

Hi Niels,

I use the the same domain and mesh properties for both cases.

For the deep water case, I:
1. Change the water depth for the deep water case in "waveProperties.input"
2. Run "setWaveParameters" and obtain the wave properties.
3. Run wave2Foam ("./Allrun")
4. Verify with 2nd order Stokes

The wave number, k for both cases are different. However, when I do the verification, the analytical 2nd order Stokes uses values from each individual cases.

I have write a matlab code that
1. Extract the wave properties from "waveProperties" file
2. Extract free surface elevation from "surfaceElevation.dat"
3. Compare with 2nd Order Stokes
4. Produce gif animation

The code is attached with this post.
* If anyone interested to use the code, just copy the "Matlab" folder into "waveFlume" folder.

Kind regards,
katakgoreng

ngj August 30, 2013 10:02

The problem then is that the actual water depth is still 0.4 m, because the bottom is placed at this level. Therefore, the interior part of the computational domain will act accordingly, and that is why your comparison is as bad as it is.

Create a new mesh with the correct water depth, and I can assure you that the results will be substantially better.

Kind regards

Niels

katakgoreng August 30, 2013 10:48

Quote:

Originally Posted by ngj (Post 448921)
The problem then is that the actual water depth is still 0.4 m, because the bottom is placed at this level. Therefore, the interior part of the computational domain will act accordingly, and that is why your comparison is as bad as it is.

Create a new mesh with the correct water depth, and I can assure you that the results will be substantially better.

Kind regards

Niels

Hi Niels,

Owh. My bad. :eek: I totally missed that one. I should change the domain of the problem to reflect the increase in the water depth. That's why the simulation gave weird result.
So :
1. Increase water depth, d
2. Change the domain to reflect the increase in water depth (this is extremely important)
3. Change the vertical mesh resolution
4. Run wave2Foam

I will report back as soon as I get the result. Thanks Niels.


Kind regards,
katakgoreng

( # UPDATE )

Managed to get the deep water wave propagation right this time. Phase and amplitude shows good agreement with Stokes 2nd order. Although it seems that I should make the domain much longer to avoid wave reflection from polluting the solution.

http://i700.photobucket.com/albums/w...ps22ffa45b.gif

Note : Dashed line (wave2Foam), solid line (Stokes 2nd order)

ngj August 30, 2013 15:50

Thank you very much, Katakgoreng, for the disclaimer in your edited post.

Have a nice weekend.

Niels

katakgoreng September 9, 2013 14:43

Hi Niels,

I have tested wave2foam for regular waves and so far the results is quite accurate (provided that I have enough mesh in the viscinity of the free surface).
I'm interested to try the irregular waves function (JONSWAP).
I have specify the JONSWAP spectrum in "waveProperties.input" as follows:

waveType : irregular;
spectrum : JONSWAP;
N : 151;
Tsoft : 3;
writeSpectrum : false;
Hs : 0.046;
Tp : 1.2;
gamma : 2.5;
depth : 0.7;
direction : ( 1 0 0 );

There is no information for the focusing time and location so I assume that the focused wave occur at xf = 0 and tf = 0, where (xf is the focusing location and tf is the focusing time). Is there any way that I could change the focusing location and time to a specified values?

Kind regards,
katakgoreng

ngj September 9, 2013 15:05

Good evening Katakgoreng,

I am glad to hear that you are so far happy with the results. The irregular wave is exactly an irregular wave train, so the phasing is set to a random value, i.e. there is not any focusing time/location as an option. To achieve this, it will require some implementation.

Kind regards,

Niels

katakgoreng September 9, 2013 15:48

Quote:

Originally Posted by ngj (Post 450748)
Good evening Katakgoreng,

I am glad to hear that you are so far happy with the results. The irregular wave is exactly an irregular wave train, so the phasing is set to a random value, i.e. there is not any focusing time/location as an option. To achieve this, it will require some implementation.

Kind regards,

Niels

Hi Niels,

Thank you for your clarification. I noticed when I run "setWaveParameters", in "waveProperties", sets of values (from the JONSWAP spectrum) are generated:

(a) amplitude
(b) frequency
(c) phaselag
(d) waveNumber

amplitude, frequency and wavenumber are typical values corresponding to the JONSWAP spectrum.

Would you mind clarifying what "phaselag" is?
Is this what you mean by random phasing?
Is "phaselag" equal to "phi" as in regular wave theory?

Kind regards,
katakgoreng

ngj September 9, 2013 16:29

Yes, phaselag is the same as phi in the regular wave theories. Sorry for the inconsistency in naming. Also, phaselag is the random variable.

Kind regards,

Niels

katakgoreng September 10, 2013 09:29

Quote:

Originally Posted by ngj (Post 450762)
Yes, phaselag is the same as phi in the regular wave theories. Sorry for the inconsistency in naming. Also, phaselag is the random variable.

Kind regards,

Niels

Hi Niels,

So I guess, I could calculate the phaselag for every waves so that they coincide at the focusing time and location that I want. Will try it. Thanks Niels. :)

Kind regards,
katakgoreng

# UPDATE

I managed to get the waves to focused based on focusing time and location that I prescribed. I do this by calculating the phase-lag of each individual waves so that they coincide at the prescribed values.
So the formula that I used for calculating phase-lag is as follows:
phi = k * xf - omega * tf
where
phi = individual phase-lag
k = individual waves number
omega = individual waves angular frequency given by 2*pi*f
f = individual waves frequency
xf = focusing location
tf = focusing time
I replace the calculated phase-lag from "setWaveParameter" with the new phase-lag.

The result shows excellent agreement with linear random wave theory.
BTW, this is TopHat spectrum (same amplitude for each individual waves, again I replace the value generated from "setWaveParameter")
The focusing location, xf = 8 m from inlet whilst focusing time, tf = 32 s.
Maximum amplitude error is 1.5%.
The trough before and after the focused event is slightly under-predicted whilst the focused location drifted just abit due to either non-linear effect or inadequate mesh resolution in the vertical and horizontal direction.

http://i700.photobucket.com/albums/w...ps46759823.png

The legend supposed to be "waves2Foam"..sorry about that..

# UPDATE 2

Focused waves for JONSWAP spectrum at xf = 8m and tf = 32s.
The mesh used is the same as in TopHat spectrum. It is pretty evidence that the mesh is under-resolved as the short waves riding on longer waves is not being resolved properly, resulting in decreasing in maximum focused amplitude. Using denser mesh could result in much better result.

http://i700.photobucket.com/albums/w...ps29a1aeb6.png

ngj September 14, 2013 04:58

Hi Katakgoreng,

Thanks for the updates. I would say that the results do look pretty nice, and I am happy to see the predictive capabilities validated.

Just out of curiosity, have you constructed the wave components inside or outside setWaveParameters? If still outside, then I do have some ideas on how to make it all work with as little work as possible. Essentially, if you post the code, which you use for creating the phases, i.e. required information from the user and the exact computation of the phases, then I could probably put it into waves2Foam during this weekend.

Please, also add the waveProperties- and waveProperties.input-files for JONSWAP, such that I can compare the created files.

Kind regards

Niels

EDIT: Sorry, after carefully reading your post from above, I can see that the equations are already there. I will make sure that it get integrated in the setWaveProperties.

ngj September 15, 2013 03:50

Good morning,

This morning I have added the option of focusing an incident irregular wave train in a given time and a given location as inspired by Katakgoreng. For the control, please see

http://openfoamwiki.net/index.php/Co...ar_wave_theory

If you are using standard random phasing of the incident irregular waves, then you do not have to do anything, but a slight increase in control is added through a manual choice of seeding for the random number generator.

Kind regards

Niels

katakgoreng September 16, 2013 06:08

Hi Niels,

Sorry for not replying your previous post abit earlier. I haven't been online on the weekend.
The latest addition is pretty neat. No need to calculate the phaselag outside "setWaveParameters".

I have updated svn and recompile wave2Foam.
I have the following in "waveProperties.input"

phaseMethod focusingPhase;
focusTime 32;
focusPoint (8 0 0);


I have the following bug (not quite sure if its on my computer only) :

Bug 1:

When I run "setWaveParameters", I got

keyword equidistantFrequencyAxis is undefined in dictionary ...

I then add "equidistantFrequencyAxis" into the "waveProperties.input" and set the value to 1. The error then goes away. Is this new additional control that you add for irregular wave theory as I can't seem to find it ever mentioned in

http://openfoamwiki.net/index.php/Co...ar_wave_theory

Bug 2:

I have the following in "waveProperties.input".

outletCoeffs
{
waveType potentialCurrent;
U ( 0 0 0 );
Tsoft 2;

relaxationZone
{
relaxationScheme Spatial;
relaxationShape Rectangular;
beachType Empty;
relaxType OUTLET;
startX (15 0.0 -1);
endX (20 0.0 1);
orientation (1.0 0.0 0.0);
}
}


When I run "setWaveParameters", the "outletCoeffs" is not written in "waveProperties" file.

Do you experience similar problem or is it just on my system?

Kind regards,
katakgoreng

# UPDATE :

Thanks Niels for pointing things out.
Bug 1 : Not a bug, additional control added by Niels.
Bug 2 : Not a bug, using file provided by Niels, the code run just fine. It could be that I made some typo error in the input file.

ngj September 16, 2013 11:59

1 Attachment(s)
Hi,

With respect to "bug 1", then it is not a bug, but a new feature for increased control of the irregular wave spectrum. I have also added the option of user-defined frequency cut-offs. The description has now been updated on the wiki.

With respect to "bug 2", then I do not experience those type of problems. I made a quick test on the attached waveProperties.input file. This test, however, made me realise that not all the new information on phasing, etc, is carried along in the writing process. This does not have any consequence for the results, as they are purely pre-processing parameters, but they would be nice to have for future reference. This will be added in a future revision.

Kind regards,

Niels

P.S. I was not allowed to upload files called *.input, so merely rename.

katakgoreng September 17, 2013 06:14

Quote:

Originally Posted by ngj (Post 452054)
Hi,

With respect to "bug 1", then it is not a bug, but a new feature for increased control of the irregular wave spectrum. I have also added the option of user-defined frequency cut-offs. The description has now been updated on the wiki.

With respect to "bug 2", then I do not experience those type of problems. I made a quick test on the attached waveProperties.input file. This test, however, made me realise that not all the new information on phasing, etc, is carried along in the writing process. This does not have any consequence for the results, as they are purely pre-processing parameters, but they would be nice to have for future reference. This will be added in a future revision.

Kind regards,

Niels

P.S. I was not allowed to upload files called *.input, so merely rename.

Hi Niels,

Thanks. Both are not bugs. Using the file that you provided, I managed to get the waveProperties just fine.

Currently, I'm running quite an extensive simulation. I'm interested in the post-processing result given by waves2Foam such as the free surface elevation. If I stop the simulation, how can I continue from the latestTime and concatenated the result into "surfaceElevation.dat" file?

Kind regards,
katakgoreng


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