Free surface contour
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 |
Quote:
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 |
Quote:
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 |
Quote:
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 |
Quote:
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 |
Quote:
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 |
Quote:
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 |
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 |
Quote:
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 |
Quote:
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 |
Quote:
|
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:
|
1 Attachment(s)
Quote:
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 |
All times are GMT -4. The time now is 09:12. |