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

[waves2Foam] Free surface contour

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Kun_zheng

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 12, 2017, 11:35
Default Free surface contour
  #1
Member
 
Ahmed Elhanfi
Join Date: Nov 2014
Posts: 30
Rep Power: 11
Ahmed Elhanafi is on a distinguished road
Hi Everyone,
I have an isosurface for alpha = 0.5, and I would like to plot the free surface contour (i.e., the free surface elevation). Does anyone have any idea on how to do this in paraFoam or any other visualization software?
Kind regards,
Ahmed
Ahmed Elhanafi is offline   Reply With Quote

Old   December 13, 2017, 05:14
Post
  #2
New Member
 
Kun Zheng
Join Date: May 2017
Location: Harbin, China
Posts: 20
Rep Power: 9
Kun_zheng is on a distinguished road
Quote:
Originally Posted by Ahmed Elhanafi View Post
Hi Everyone,
I have an isosurface for alpha = 0.5, and I would like to plot the free surface contour (i.e., the free surface elevation). Does anyone have any idea on how to do this in paraFoam or any other visualization software?
Kind regards,
Ahmed
Hi Ahmed,

I am not sure what do you want.
I think you have plotted the isosurface for alpha=0.5 in paraView and you want to get the value of the surface elevation. Am I right ? As far as I know, you could not get it from paraView.

I have an another solution. I think you may have the alpha.water in the whole computational domain. It is easy to integral the alpha.water in the direction of water depth. The sum of alpha.water should be convergent when it close to the free surface. Maybe the alpha.water at here is not equal to 0.5 precisely, but it could be very easy to get the accurate location by interpolation. And that is the location of the free surface !

Best regards,
Kun
LiangHongjian likes this.
Kun_zheng is offline   Reply With Quote

Old   December 13, 2017, 06:39
Default
  #3
Member
 
Ahmed Elhanfi
Join Date: Nov 2014
Posts: 30
Rep Power: 11
Ahmed Elhanafi is on a distinguished road
Quote:
Originally Posted by Kun_zheng View Post
Hi Ahmed,

I am not sure what do you want.
I think you have plotted the isosurface for alpha=0.5 in paraView and you want to get the value of the surface elevation. Am I right ? As far as I know, you could not get it from paraView.

I have an another solution. I think you may have the alpha.water in the whole computational domain. It is easy to integral the alpha.water in the direction of water depth. The sum of alpha.water should be convergent when it close to the free surface. Maybe the alpha.water at here is not equal to 0.5 precisely, but it could be very easy to get the accurate location by interpolation. And that is the location of the free surface !

Best regards,
Kun
Hi Kun,
Thank you for your swift response. It is highly appreciated.
Yes, you got what I want to do. So, your suggestion is to get the free surface elevation for the whole domain in the same way we get it for a vertical line (wave probe/gauge)? Could you please explain it to me a bit more how can I do this for the whole domain?
Thanks in advance.
Kind regards,
Ahmed
Ahmed Elhanafi is offline   Reply With Quote

Old   December 13, 2017, 11:23
Post
  #4
New Member
 
Kun Zheng
Join Date: May 2017
Location: Harbin, China
Posts: 20
Rep Power: 9
Kun_zheng is on a distinguished road
Quote:
Originally Posted by Ahmed Elhanafi View Post
Hi Kun,
Thank you for your swift response. It is highly appreciated.
Yes, you got what I want to do. So, your suggestion is to get the free surface elevation for the whole domain in the same way we get it for a vertical line (wave probe/gauge)? Could you please explain it to me a bit more how can I do this for the whole domain?
Thanks in advance.
Kind regards,
Ahmed
Hi Ahmed,

Yes, it is the same way for wave gauge.
For example, some folders corresponding to the snapshot of the whole domain will generated after running the case "waveFlume". In these folders, the file "alpha.water" save the alpha of the whole domain.

If you read the file, you may find that it gives the alpha, cells by cells, from the inlet to the outlet and from the bottom to the top of computational domain. It means you can check the alpha in a vertical line at any location (x) in horizon. The good news is you do not need to check the alpha from the bottom to the top in the vertical line, because the alpha only varies in the cells close to free surface. Then you can obtained the precise location of free surface by interpolation scheme. For my wave the linear interpolation is enough.

I hope you can obtain what you want. Please do not hesitate to tell me if my explaination is unclear.


Best regards,
Kun
Kun_zheng is offline   Reply With Quote

Old   December 13, 2017, 13:44
Default
  #5
Member
 
Ahmed Elhanfi
Join Date: Nov 2014
Posts: 30
Rep Power: 11
Ahmed Elhanafi is on a distinguished road
Quote:
Originally Posted by Kun_zheng View Post
Hi Ahmed,

Yes, it is the same way for wave gauge.
For example, some folders corresponding to the snapshot of the whole domain will generated after running the case "waveFlume". In these folders, the file "alpha.water" save the alpha of the whole domain.

If you read the file, you may find that it gives the alpha, cells by cells, from the inlet to the outlet and from the bottom to the top of computational domain. It means you can check the alpha in a vertical line at any location (x) in horizon. The good news is you do not need to check the alpha from the bottom to the top in the vertical line, because the alpha only varies in the cells close to free surface. Then you can obtained the precise location of free surface by interpolation scheme. For my wave the linear interpolation is enough.

I hope you can obtain what you want. Please do not hesitate to tell me if my explaination is unclear.


Best regards,
Kun
Hi Kun,
Thanks for the detailed explanation. I do have those saved files for alpha.water as some time steps, but my problem is that these files give the value of alpha for each cell without giving me the coordinates (x,y,z) of each cell. without these coordinates, how can I do the integration? If I know the coordinates then I can sort these values according to their coordinates and then do the integration for the desired location. Is that what you mean or I misunderstood you?
Kind regards,
Ahmed
Ahmed Elhanafi is offline   Reply With Quote

Old   December 13, 2017, 14:07
Post
  #6
New Member
 
Kun Zheng
Join Date: May 2017
Location: Harbin, China
Posts: 20
Rep Power: 9
Kun_zheng is on a distinguished road
Quote:
Originally Posted by Ahmed Elhanafi View Post
Hi Kun,
Thanks for the detailed explanation. I do have those saved files for alpha.water as some time steps, but my problem is that these files give the value of alpha for each cell without giving me the coordinates (x,y,z) of each cell. without these coordinates, how can I do the integration? If I know the coordinates then I can sort these values according to their coordinates and then do the integration for the desired location. Is that what you mean or I misunderstood you?
Kind regards,
Ahmed
Hi Ahmed,

You are right, the file "alpha.water" do not give the coordinates. But the alpha is given in orders. For example, you have nx cell in X, ny cell in Y (vertical) and 1 cell in Z.
The coordinates is:
(1, 1, 1) the bottom
(2, 1 ,1) the bottom
...
(nx, 1, 1) the bottom
...
...
...
(1, ny, 1) the top
(2, ny ,1) the top
...
(nx, ny, 1) the top

And the first cell in X is inlet, the nx cell in X is outlet.

Best regards,
Kun
Kun_zheng is offline   Reply With Quote

Old   December 13, 2017, 21:17
Default
  #7
Member
 
Ahmed Elhanfi
Join Date: Nov 2014
Posts: 30
Rep Power: 11
Ahmed Elhanafi is on a distinguished road
Quote:
Originally Posted by Kun_zheng View Post
Hi Ahmed,

You are right, the file "alpha.water" do not give the coordinates. But the alpha is given in orders. For example, you have nx cell in X, ny cell in Y (vertical) and 1 cell in Z.
The coordinates is:
(1, 1, 1) the bottom
(2, 1 ,1) the bottom
...
(nx, 1, 1) the bottom
...
...
...
(1, ny, 1) the top
(2, ny ,1) the top
...
(nx, ny, 1) the top

And the first cell in X is inlet, the nx cell in X is outlet.

Best regards,
Kun
Hi Kun,
That's great to know that cells are sorted in order. However, I think I still need to have the size (say in mm) of each cell in the vertical direction in order to get the total length of the water column that represents the location of the free surface at this particular point. Is that correct? if so, how can I automatically do this in OpenFOAM? considering that mesh size is different as we get closer to the free surface interface.
Kind regards,
Ahmed
Ahmed Elhanafi is offline   Reply With Quote

Old   December 14, 2017, 02:43
Default
  #8
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,902
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Good morning Kun and Ahmed,

1. The ordering of the cells only holds for very simple grids, so it is not a generic approach; e.g. imagine adding a ship in the domain and everything will be different in terms of ordering.

2. Why do you not use the surfaceElevation tool, which was designed to measure the surface elevation?

Kind regards

Niels
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Old   December 14, 2017, 03:29
Default
  #9
Member
 
Ahmed Elhanfi
Join Date: Nov 2014
Posts: 30
Rep Power: 11
Ahmed Elhanafi is on a distinguished road
Quote:
Originally Posted by ngj View Post
Good morning Kun and Ahmed,

1. The ordering of the cells only holds for very simple grids, so it is not a generic approach; e.g. imagine adding a ship in the domain and everything will be different in terms of ordering.

2. Why do you not use the surfaceElevation tool, which was designed to measure the surface elevation?

Kind regards

Niels
Hi Niels,

Thanks for the clarification. Indeed, I am using the surfaceElevation tool to get the free surface elevation at a particular point in the domain, and I am quite happy with the tool you developed. However, what I am looking for is more complex than getting results at a finite/limited number of points. I need to get the free surface contours for the whole domain or at least around the structure (a cylinder). Is that something the surfaceElevation tool can handle? It would be great if you can provide some guidance/suggestions on this topic.

Kind Regards,
Ahmed
Ahmed Elhanafi is offline   Reply With Quote

Old   December 14, 2017, 05:29
Default
  #10
New Member
 
Kun Zheng
Join Date: May 2017
Location: Harbin, China
Posts: 20
Rep Power: 9
Kun_zheng is on a distinguished road
Quote:
Originally Posted by Ahmed Elhanafi View Post
Hi Kun,
That's great to know that cells are sorted in order. However, I think I still need to have the size (say in mm) of each cell in the vertical direction in order to get the total length of the water column that represents the location of the free surface at this particular point. Is that correct? if so, how can I automatically do this in OpenFOAM? considering that mesh size is different as we get closer to the free surface interface.
Kind regards,
Ahmed
Hi Ahmed,

Yes, my method can only deal with the grid with uniform mesh size along the water column. I am afraid I do not know how to do it automatically in OF, so I just wrote a simple code in Fortran.

Best regards,
Kun
Kun_zheng is offline   Reply With Quote

Old   December 14, 2017, 13:19
Default
  #11
Member
 
Ahmed Elhanfi
Join Date: Nov 2014
Posts: 30
Rep Power: 11
Ahmed Elhanafi is on a distinguished road
Quote:
Originally Posted by Kun_zheng View Post
Hi Ahmed,

Yes, my method can only deal with the grid with uniform mesh size along the water column. I am afraid I do not know how to do it automatically in OF, so I just wrote a simple code in Fortran.

Best regards,
Kun
Thanks Kun. I hope Niels can provide a solution or suggestions for this subject.
Ahmed Elhanafi is offline   Reply With Quote

Old   December 15, 2017, 10:17
Default
  #12
New Member
 
Hao Chen
Join Date: Nov 2017
Location: Manchester, UK
Posts: 10
Rep Power: 8
cfd_hchen is on a distinguished road
Hi Ahmed,

I have never done such prosessing, but maybe you can try to output it from Paraview. When you got the isosurface for alpha=0.5, then cut the surface again with say y=0 plane (if y is the transverse direction). Then you should be able to get a very thin slice very only one cell width. Output each cell coordinate you can get the surface elevation.

Good luck with it.

Best regards
Hao

Quote:
Originally Posted by Ahmed Elhanafi View Post
Thanks Kun. I hope Niels can provide a solution or suggestions for this subject.
cfd_hchen is offline   Reply With Quote

Old   December 16, 2017, 04:34
Default
  #13
Member
 
Ahmed Elhanfi
Join Date: Nov 2014
Posts: 30
Rep Power: 11
Ahmed Elhanafi is on a distinguished road
Quote:
Originally Posted by cfd_hchen View Post
Hi Ahmed,

I have never done such prosessing, but maybe you can try to output it from Paraview. When you got the isosurface for alpha=0.5, then cut the surface again with say y=0 plane (if y is the transverse direction). Then you should be able to get a very thin slice very only one cell width. Output each cell coordinate you can get the surface elevation.

Good luck with it.

Best regards
Hao
Hi Hao,
Thank you for your support. I did manage to extract the cells' coordinates for the isosurface using the following steps:

1. Creat an isofurface for alpha = 0.5

2. Make sure you click on the isosurface not the whole domain, then go to File > Save Data > chosse Field Association "Points". See attached photo.
This will give you the following variables
"alpha1","U:0","U:1","U:2","Normals:0","Normals:1" ,"Normals:2","Points:0","Points:1","Points:2"
0.5,-0.38988,-0.07155,0.19407,-0.43294,0.38926,-0.81304,3.0227,-0.18525,1.7954
0.5,-0.27263,-0.091876,0.17662,-0.44535,0.42994,-0.78538,3.0279,-0.18558,1.7924

If you want to get the pressure values or any other variables then tick the boxes of the desired variables in the Volume field window in paraview

3. You can get the same results of step 2 by using the following two steps
3-1. Use the "writeCellCentres" utility. This will write the cells' coordinates ccx, ccy, ccz for each time step folder you have.
3-2. Now, you can find ccx, ccy, ccz in paraview in the volume field window (same location as alpha and U and P, etc). Tick the boxes for ccx, ccy, ccz, and re-do step 2.
This will give you the following output
"ccy","ccx","ccz","alpha1","U:0","U:1","U:2","Norm als:0","Normals:1","Normals:2","Points:0","Points: 1","Points:2"
-0.18525,3.0226,1.7953,0.5,-0.38988,-0.07155,0.19407,-0.43294,0.38926,-0.81304,3.0227,-0.18525,1.7954
-0.18558,3.0279,1.7923,0.5,-0.27263,-0.091876,0.17662,-0.44535,0.42994,-0.78538,3.0279,-0.18558,1.7924

Kind regards,
Ahmed
Attached Images
File Type: jpg Step2.jpg (67.1 KB, 88 views)
Ahmed Elhanafi 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
[Gmsh] Problem with Gmsh nishant_hull OpenFOAM Meshing & Mesh Conversion 23 August 5, 2015 03:09
Cluster ID's not contiguous in compute-nodes domain. ??? Shogan FLUENT 1 May 28, 2014 16:03
free surface problem with capillary effect rabbitmelon CFX 25 August 16, 2013 04:05
[snappyHexMesh] Layers don't fully surround surface EVBUCF OpenFOAM Meshing & Mesh Conversion 14 August 20, 2012 05:31
Multiphase flow. Dispersed and free surface model Luis CFX 8 May 29, 2007 19:13


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