CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   ParaView (https://www.cfd-online.com/Forums/paraview/)
-   -   Plot the spreading of oil on the surface of water over time (https://www.cfd-online.com/Forums/paraview/116900-plot-spreading-oil-surface-water-over-time.html)

 liguifan April 27, 2013 17:49

Plot the spreading of oil on the surface of water over time

Good afternoon everyone!

I am working on a case that measure the oil spreading over water and I want to measure how the oil behaves over time.

Now I am able to visualize the oil spreading, however, I am not able to plot the spreading of oil from central to the wall boundary.

As far as I can think of is to use the filter: plot selection over time. I used a clip filter to exact the water only and select the surface of the water then use Plot selection over time filter to do it, but it doesn't seem to be working.

Does anyone have any idea about how to do this?

 wyldckat April 28, 2013 06:33

Greetings liguifan,

Try the instructions from this thread: http://www.cfd-online.com/Forums/par...-analysis.html

Best regards,
Bruno

 liguifan May 21, 2013 17:07

Hi Bruno,

Thanks for the reply, I followed you instruction from the other thread, however, in the test case provided, you have fixed a position and measure the height change in that position. In my case, the point I am interested is spreading over the surface of the water.

If I use alpha=0.5 in the coutour, it will show the whole surface of the water, not just the oil on the surface, but what I am interested is plot the distance of oil spread on the water surface VS time.

Do you have any ideas about that?

Quote:
 Originally Posted by wyldckat (Post 423599) Greetings liguifan, Try the instructions from this thread: http://www.cfd-online.com/Forums/par...-analysis.html Best regards, Bruno

 wyldckat May 21, 2013 17:35

Hi Guifan,

Well, the other example allows us to tell apart water from air by using the contour "alpha=0.5", because "alpha=1" is water and "alpha=0" is air.

But in your case, I do not know how you can tell apart water from oil, because I do not see what you're seeing! ;)
What values/fields can you use to tell the two apart?

Best regards,
Bruno

 liguifan May 21, 2013 17:46

2 Attachment(s)
Hi Bruno,

Please have a look at these two photos, the first one shows that there are three phases, red one is air, white one is oil and blue is water. This is a wedge.
The alphawater =0 alphasoil=1 and alphaair=2.

The second photo is to use the clip filter to filter out the oil, so that you can see the oil only spreading on the surface of water.

Quote:
 Originally Posted by wyldckat (Post 429005) Hi Guifan, Well, the other example allows us to tell apart water from air by using the contour "alpha=0.5", because "alpha=1" is water and "alpha=0" is air. But in your case, I do not know how you can tell apart water from oil, because I do not see what you're seeing! ;) What values/fields can you use to tell the two apart? Best regards, Bruno

 wyldckat May 21, 2013 18:03

Hi Guifan,

Then it should be very simple: when you apply the "Contour" filter, you can choose more than one value. In this case, you can pick "0.5" and "1.5"! ;)

Best regards,
Bruno

 liguifan May 21, 2013 18:14

This is to separate the water and oil and air oil, but how can I plot the moving oil VS time if you have any idea?

I will give it a try tonight see what happens.
Best,
Guifan

Quote:
 Originally Posted by wyldckat (Post 429014) Hi Guifan, Then it should be very simple: when you apply the "Contour" filter, you can choose more than one value. In this case, you can pick "0.5" and "1.5"! ;) Best regards, Bruno

 wyldckat May 21, 2013 18:27

Hi Guifan,

Oh, sorry, I forgot about that particular detail of tracking the whole surface instead of a single point.

I've done a quick test and I think the following steps can help a bit:
1. Apply the "Contour" filter with the mentioned values "0.5" and "1.5".
2. Apply the filter "Plot Data".
1. Go to the tab "Display" in the "Object Inspector".
2. Select as "X Axis Data" to use the array "Points(0)".
3. Select in "Line Series" to use the array "Points(1)".
4. Line style -> None
5. Marker Style -> Cross
Best regards,
Bruno

 liguifan May 22, 2013 14:30

2 Attachment(s)
Hi Bruno,

I tested you method today, and got something as shown in the picture. The rectangular is the initial oil and the second picture is the oil film after a few seconds. As you can see, the upper bound of the plot is the outer boundary of the oil film on the surface of water, which is pretty good for now. But I am not sure why the plot is like this, looks quite messy. And I want to plot the upper bound( the max value of the plot) VS time. Do you have any idea about that?

Btw, why we need to mark the style as cross?
Thanks for that.

Quote:
 Originally Posted by wyldckat (Post 429018) Hi Guifan, Oh, sorry, I forgot about that particular detail of tracking the whole surface instead of a single point. I've done a quick test and I think the following steps can help a bit: Apply the "Contour" filter with the mentioned values "0.5" and "1.5". Apply the filter "Plot Data".Go to the tab "Display" in the "Object Inspector". Select as "X Axis Data" to use the array "Points(0)". Select in "Line Series" to use the array "Points(1)". Line style -> None Marker Style -> Cross Best regards, Bruno

 wyldckat May 22, 2013 18:12

1 Attachment(s)
Hi Guifan,

Quote:
 Originally Posted by liguifan (Post 429333) And I want to plot the upper bound( the max value of the plot) VS time. Do you have any idea about that?
:confused: Isn't that just a matter of only getting the contour for the upper interface? The "1.5" perhaps?

Quote:
 Originally Posted by liguifan (Post 429333) Btw, why we need to mark the style as cross?
Because this method does not sort the points by the order of connection.

Wait, I've done a few more tests and remembered about the "Plot on Sorted Lines" filter, which is shown in the attached image. Use this filter instead of the "Plot Data".
Another detail to look for is the "DataSet" blocks shown on the lower left part of the image, inside the "Select Block" tree. It looks like we can only show one line at a time, in case they become disconnected.

By the way, I used the "Slice" filter in order to make it easier plot the data.

Best regards,
Bruno

 Linse January 29, 2014 09:19

1 Attachment(s)
Dear all,

seems I have some difficulties in the transfer of this solution to my problem:
I have a gas cloud extending within a tunnel. Producing the contour at the different timesteps is not a problem. (see attached image)
But for proper comparison to other simulations (and experimental data at some point) I would need to have the propagation speed of the cloud front (i.e. the position of the most-forward point of the contour).

The steps I see are:
- get the contour (works nicely)
- get the point most distant from the reference plane (origin) (not working yet)
- plot the specific coordinate of that point (needs the point)
- make the plot over time (needs the previous data)

Anybody with an idea how I can get to the goal?

Cheers,
Bernhard

 wyldckat February 2, 2014 08:51

Greetings Bernhard,

Well, in your case, the only solution is to rely on the filter "Programmable Filter": http://www.paraview.org/Wiki/Python_Programmable_Filter

Here's what I tested and worked:
2. If you are opening multi-block data (it's the case with OpenFOAM results), then the first filter is to apply the "Merge Blocks", so that it's easier to create the script.
3. Apply the Contour script.
4. Apply the "Programmable Filter":
1. Choose the "Output Data Set Type" to be "vtkPolyData".
2. "Script":
Code:

```pdi = self.GetPolyDataInput() pdo =  self.GetPolyDataOutput() pdo.Allocate(1, 1) newPoints = vtk.vtkPoints() numPoints = pdi.GetNumberOfPoints() maxLocation = [-2.0e300, -2.0e300, -2.0e300] for i in range(0, numPoints):     coord = pdi.GetPoint(i)     if coord[0] > maxLocation[0]:       maxLocation = coord newPoints.InsertPoint(0, maxLocation[0], maxLocation[1], maxLocation[2]) pdo.SetPoints(newPoints)```
3. Keep the entry "RequestInformation Script" empty.
4. Apply.
5. Now use the view splitter and choose the "Spreadsheet view".
6. In the "Spreadsheet view", choose to see the entry for the "ProgrammableFilter1".
7. Click on the only listed point in the "Point Data" attribute.
8. Apply the filter "Plot Selection Over Time" and click on the "Copy Active Selection" button. Then Apply.
• Go into the tab "Display" and be sure to pick the "Point Coordinates (0)", so that you get the correct plot.
The problem is that this particular script will lock up on the first point that is found. If you have multiple points at the tip, then you'll need to do an average of all points at the maximum X:
Code:

```pdi = self.GetPolyDataInput() pdo =  self.GetPolyDataOutput() pdo.Allocate(1, 1) newPoints = vtk.vtkPoints() numPoints = pdi.GetNumberOfPoints() maxLocation = [-2.0e300, -2.0e300, -2.0e300] maxLocations = [] for i in range(0, numPoints):     coord = pdi.GetPoint(i)     if coord[0] > maxLocation[0]:       maxLocation = coord       maxLocations = [maxLocation]     elif abs(coord[0] - maxLocation[0]) < 1.0e-5:       maxLocations.append(coord) maxLocation = mean(maxLocations) newPoints.InsertPoint(0, maxLocation[0], maxLocation[1], maxLocation[2]) pdo.SetPoints(newPoints)```
By the way, this line:
Code:

`pdo.Allocate(1, 1)`
is for wiping out the cell list, otherwise it will think it should have the same number of cells as the original input.

Best regards,
Bruno

 All times are GMT -4. The time now is 02:35.