CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (https://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   Simulation of waves on a Water Surface (https://www.cfd-online.com/Forums/openfoam-pre-processing/95294-simulation-waves-water-surface.html)

Leech December 12, 2011 17:20

Simulation of waves on a Water Surface
 
Hi anyone,

my natural language is not english, so I hope i can still describe my problem.

What i want to do is to build a OpenFoam-Model which consists of a rectangular prism. The bottom half is filled with water, the top half with air.
So far I am able to do it.
Now I got 2 questions:
-The Air on Top is supposed to flow in a distribution. What i mean is that the air shall be injected with high speed on top of the prism and with low speed near the water surface (pretty simular to a boundary layer in big).
-The water shall be moved by the walls of the prism. For example one wall is oscillating in a sinus-shape or a wave-function so that waves will get build on the water surface.

Actually i got no idea how to build this model.
Any help would be appreciated.

I hope my english isnt that horrible, that nobody understands what I'm trying to ask.

Thanks a lot!

nimasam December 18, 2011 14:50

hi pier
could you tell me in which part you face the problem?
i didn't get what you are going to model, however if you want to have interface and see water surface you can use interFoam, if you want to make nonuniform boundary condition you should use a utility called groovyBC ( you can find it in wiki)

Leech December 18, 2011 18:52

hi,

i allready found the swak4foam library and succesfully installed it.
So what Im trying to do right now, is to create a box and fill it half with water. (Used with InterFOAM later with InterDymFoam, so ill use the setfieldsdict to fill it).
My only trouble right now is if ill get the groovy bc to work and to make some waves for me. But well see that.

Other question is: At the bottom half of the box ill use groovy bc to get waves into the water. At the top half i want to inject the wind (air in a distribution as described before). For that surpose i created 2 boxes right on top of each other, so i can insert 2 bc's (top-air inlet bottom-groovybc). Will this work? When the water gets waving itll move over the bottom box. What will the air inlet do to the waterwaves in front of it?

Thanks!

ngj December 19, 2011 01:56

Hi Pierre

Since you are going to generate waves, you might be interested in looking into waves2Foam (http://openfoamwiki.net/index.php/Contrib/waves2Foam). It is not straight forward applicable for your problem, since there has been given no thought for the velocity field in the air. However, if you change the waveVelocityFvVectorPatchField.* files, then I suppose you should be able to achieve what you describe.

Kind regards,

Niels

nimasam December 19, 2011 02:25

Quote:

Originally Posted by Leech (Post 336266)
hi,

i allready found the swak4foam library and succesfully installed it.
So what Im trying to do right now, is to create a box and fill it half with water. (Used with InterFOAM later with InterDymFoam, so ill use the setfieldsdict to fill it).
My only trouble right now is if ill get the groovy bc to work and to make some waves for me. But well see that.

Other question is: At the bottom half of the box ill use groovy bc to get waves into the water. At the top half i want to inject the wind (air in a distribution as described before). For that surpose i created 2 boxes right on top of each other, so i can insert 2 bc's (top-air inlet bottom-groovybc). Will this work? When the water gets waving itll move over the bottom box. What will the air inlet do to the waterwaves in front of it?

Thanks!

you can apply different BC in different position of a patch, just by groovyBC, in other words you dont need to creat two box at all,
if you look in groovyBc tutorials in wiki you will find some examples about it

ngj December 19, 2011 04:43

Hi Pierre,

One more consideration with respect to the problem you describe. The solver 'interFoam' produces considerable velocities in the air, which originate from numerical inaccuracies, so you should be very careful, if you are thinking of using interFoam to study the effect of wind on the shape and other properties of surface water waves.

Good luck,

Niels

Leech December 19, 2011 10:39

Quote:

Originally Posted by ngj (Post 336284)
Hi Pierre

Since you are going to generate waves, you might be interested in looking into waves2Foam (http://openfoamwiki.net/index.php/Contrib/waves2Foam). It is not straight forward applicable for your problem, since there has been given no thought for the velocity field in the air. However, if you change the waveVelocityFvVectorPatchField.* files, then I suppose you should be able to achieve what you describe.

Kind regards,

Niels


Thanks, ill take a look at that!

Leech December 19, 2011 10:41

Quote:

Originally Posted by ngj (Post 336302)
Hi Pierre,

One more consideration with respect to the problem you describe. The solver 'interFoam' produces considerable velocities in the air, which originate from numerical inaccuracies, so you should be very careful, if you are thinking of using interFoam to study the effect of wind on the shape and other properties of surface water waves.

Good luck,

Niels


Hi,

good to know about these limitations. But i guess these wont bother me too much. The goal ist to place a floating object on the water, the wind ist just there to make the sea-simulation a bit more complete. I dont think that the wind effect on the water surface is important.

Leech December 19, 2011 10:50

Quote:

Originally Posted by nimasam (Post 336288)
you can apply different BC in different position of a patch, just by groovyBC, in other words you dont need to creat two box at all,
if you look in groovyBc tutorials in wiki you will find some examples about it

Hi,

thanks for that tip. But what function exactly is it that is able to place different BC's on one face? Can't find it in the wiki :(

Phicau December 19, 2011 10:58

Hi

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

Code:

  inlet
  {
      type            groovyBC;
      valueExpression "(pos().z<=A*cos(-w*time())+0.5*k*A*A*cos(2*(-w*time()))) ? vector( A*w*exp(k*pos().z)*cos(-w*time()), 0, A*w*exp(k*pos().z)*sin(-w*time())) : wind)";
      variables      "l=5;A=0.1;g=vector(0,0,-9.81);k=2*pi/l;w=sqrt(k*mag(g));wind=vector(0,0,0);";
      timelines      ();
  }

Just change "wind" components to what you need.

Leech December 19, 2011 11:07

Quote:

Originally Posted by Phicau (Post 336348)
Hi

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

Code:

  inlet
  {
      type            groovyBC;
      valueExpression "(pos().z<=A*cos(-w*time())+0.5*k*A*A*cos(2*(-w*time()))) ? vector( A*w*exp(k*pos().z)*cos(-w*time()), 0, A*w*exp(k*pos().z)*sin(-w*time())) : wind)";
      variables      "l=5;A=0.1;g=vector(0,0,-9.81);k=2*pi/l;w=sqrt(k*mag(g));wind=vector(0,0,0);";
      timelines      ();
  }

Just change "wind" components to what you need.


I'm sorry but i don't get it :(
Where do you define that the wind is on the upper half of the patch and that the wave is on the lower half of the patch? Or are both of these functions intersecting over the complete patch?

Thank you so much!

Phicau December 19, 2011 11:16

Hi,

each time step it generates waves (alpha1=1) for cells with centers below the calculated eta, with the prescribed velocity.

Otherwise (what lies over it) gets alpha1=0 (air) and sets velocity to vector(0,0,0) on the original code. I changed that to define variable "wind", which is basically the same now, as it is set to (0,0,0). But you can modify that to introduce wind.

For example, wind=vector(1,0,0); will produce 1m/s of wind in the x direction.

Regards

nimasam December 19, 2011 11:20

groovyBC
 
let me simplify with an example:
consider you have a vertical face with the height of 1m
and your interface is in a position 0.5 so pos().z > 0.5 is air and pos().z < 0.5 is water
now you should change your boundary condition in file alpha and U to groovy BC
then in alpha file you should define which portion of face is water and which portion of it is air , some thing like this
Code:

valueExpression "pos().z>0.5 ? 1.0 : 0)";
and in U
Code:

valueExpression "vector(pos().z>0.5 ? a : b,0,0)";
instead of a and b you should implement your function
i hope you get the whole idea!

Leech December 19, 2011 11:22

I think i got it now!
Thank you all so much. I'll try to get it working :)

musahossein December 19, 2011 13:50

sampling forces from one phase only
 
Dear All:
In sampleDict is there any way to measure pressure due to one phase only (eg water and not the air above it?). I am trying to sample pressure forces on the left and right wall of a 2D tank using interDyMFoam. I get pressure at cell / cell point along the vertical face of the left and right walls. The tank is half full of water, with air in the top half of the tank. I am only interested in the pressure from the water. Can this be done?

Thanks

Leech December 20, 2011 15:41

1 Attachment(s)
Hey Anyone,

i still could use some help!
I am actually creating the tank with the groovy BC as you informed me.

I got some problems now (to find the problems i attached my wavetank-Folder):
-BlockMesh work fine (...)
-When I type setFields OpenFoam says :"Couldnt find value expression on inlet" for both U and alpha1. I tried to add value uniform 1 oder value uniform (1 0 0) and then it worked but I am not shure if these are ok? Why he asks me to add this line?

-I got no outlet somewhere. And I am using p_rgh. In the GroovyWaveTank-Tutorial they were using pd with an athmosphere. I am a bit confused what i need to do to create a athmosphere? (which i want to have)

-What conditions do I have to give to the walls, so that the waves transmitted from the inlet just go trough and do not rebound?

-When i am trying to run InterFoam he says: "Unknow BC at Inlet GroovyBC". But i installed the swak4foam library and i allready runned some of the examples and they worked?


So much questions...
Thank you all

Greetings

Leech December 20, 2011 15:51

Quote:

Originally Posted by nimasam (Post 336354)
let me simplify with an example:
consider you have a vertical face with the height of 1m
and your interface is in a position 0.5 so pos().z > 0.5 is air and pos().z < 0.5 is water
now you should change your boundary condition in file alpha and U to groovy BC
then in alpha file you should define which portion of face is water and which portion of it is air , some thing like this
Code:

valueExpression "pos().z>0.5 ? 1.0 : 0)";
and in U
Code:

valueExpression "vector(pos().z>0.5 ? a : b,0,0)";
instead of a and b you should implement your function
i hope you get the whole idea!

With "your function" you mean the function for the wind injection?
I just wrote 1,0,0 in the attached pack in the previous post, because the vector wind is also 1 0 0? Or did i missunderstood something?

nimasam December 20, 2011 17:15

two many questions :)
1) i suggest to use funkySetFields instead of setFields (find in wiki)
2) add this line into your controlDict
Code:

libs ("libOpenFOAM.so""libgroovyBC.so");
3) if air injection is uniform then it would be constant but you have chance to choose any function or distribution for air injection

Leech December 20, 2011 18:21

Quote:

Originally Posted by nimasam (Post 336533)
two many questions :)
1) i suggest to use funkySetFields instead of setFields (find in wiki)
2) add this line into your controlDict
Code:

libs ("libOpenFOAM.so""libgroovyBC.so");
3) if air injection is uniform then it would be constant but you have chance to choose any function or distribution for air injection

to 1) what would be the difference or the benefit?
to 2) ill try that tomorrow, thanks!
to 3) where is that function added? at a:b? what type of function can i write there?
to x) whats about the error of setFields "need to add value"?

Thanks!

nimasam December 21, 2011 00:36

to 1 and x ) use the funkySetFields you will find its great benefits
to 2) first try then, if you face problem, ask again ;)
3)a or b should be replaced with your function :))
for example you can use this function sin (pos().z), i didnt know what function was suitable for your simulation so i remained it for your modification

jignesh_thaker2007 January 9, 2012 01:17

Hello Sir,
 
i am trying to solve the two phase simulation of hose pipe which is located at sea so its shape becomes like wave. and continuously water and air are flow inside the one end of the pipe and the other hand is fixed.
pipe is moving like wave so when the inlet end of the pipe is going above then air is come inside the pipe and when it comes down then water come inside the pipe.
i got the simulation of moving mesh and also got the simulation of air and water inside the pipe with interDyMFoam. but it is for same velocity of air and water.
But now i have trouble in how to give the different velocity of air and water? so plz help me.
i m still waiting for ur reply.
thank you very much.

Nilesh_87 February 2, 2012 01:10

high courant number
 
Hello Sir,
I am solving 2D external aerodynamic case of simple ahmed car profile. I am using pisoFoam. deltat is 0.001. but i am getting very high courant number. I assumed Co. no. as 1 and fixed deltat. Can you please help me?

Thanks & regards
Nilesh

jignesh_thaker2007 February 3, 2012 04:04

hi Nilesh
 
Quote:

Originally Posted by Nilesh_87 (Post 342385)
Hello Sir,
I am solving 2D external aerodynamic case of simple ahmed car profile. I am using pisoFoam. deltat is 0.001. but i am getting very high courant number. I assumed Co. no. as 1 and fixed deltat. Can you please help me?

Thanks & regards
Nilesh



i am happy to see that you are using openFOAM. now for your problem first u see the openFoam tutorials of lid driven cavity in that tutorial u will find your answer because in that u will find the courant number condition and its definition,

if u unable to find that then replied me ok
best wishes

Jignesh

musahossein February 3, 2012 09:16

Quote:

Originally Posted by Nilesh_87 (Post 342385)
Hello Sir,
I am solving 2D external aerodynamic case of simple ahmed car profile. I am using pisoFoam. deltat is 0.001. but i am getting very high courant number. I assumed Co. no. as 1 and fixed deltat. Can you please help me?

Thanks & regards
Nilesh

Courant number of 1 is very high, and can lead to instability when you have fine mesh or your computations require many iterations. As suggested in another post, please review the lid driven cavity example and try with the courant number there. Once you have decided on a Courant number you can determine the appropriate deltaT based on your cell size. This is also explained in the referenced example.

zijun September 11, 2013 02:49

Hi Guru Foamers,

Will the above discussed approach work too is 'LTSInterFoam' solver is used (if main interest is on the free surface)?

Thanks

musahossein September 11, 2013 08:24

I would suggest that you look at the example for ltsinterfoam and determine the appropriate courant number. I have not used this solver. The example can be found at:

$FOAM_TUTORIALS/multiphase/LTSInterFoam/wigleyHul

As far as I know, the solver uses local courant number. However what that number actually is, you will need to find from the example.

zijun September 11, 2013 09:35

Dear Musahossein,

Thanks for your reply.

I used this tutorial and obtained nice Kelvin wave pattern on free surface.

However, I was thinking whether it is possible to use this solver to:

1. include the wind effect too, to simulate the wind generated ripples on free surface.
2. to include incoming wave (as there is sea state or something)

Another concern is how to avoid boundary reflection if the simulation running for very long time or much more steps than the tutorial setting.

Thought the previous discussion might be related to my doubts, any one can advise?

Thanks a lot!


zijun

pltw May 22, 2015 01:19

Quote:

Originally Posted by ngj (Post 336302)
Hi Pierre,

One more consideration with respect to the problem you describe. The solver 'interFoam' produces considerable velocities in the air, which originate from numerical inaccuracies, so you should be very careful, if you are thinking of using interFoam to study the effect of wind on the shape and other properties of surface water waves.

Good luck,

Niels

Hi Niels,
Firstly, thankyou for producing your excellent wave modelling package.
I am fairly new to CFD, and am trying to study wind wave /wind current interaction. If InterFOAM is a poor option, do you know of any other solver / package that is suited to wind wave interaction?
Regards,
Peter


All times are GMT -4. The time now is 17:45.