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

 Register Blogs Members List Search Today's Posts Mark Forums Read

 April 27, 2013, 17:49 Plot the spreading of oil on the surface of water over time #1 Member   Guifan Li Join Date: Apr 2011 Location: New York City, U.S. Posts: 96 Rep Power: 7 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? Thanks in advance.

 April 28, 2013, 06:33 #2 Super Moderator   Bruno Santos Join Date: Mar 2009 Location: Lisbon, Portugal Posts: 9,679 Blog Entries: 39 Rep Power: 103 Greetings liguifan, Try the instructions from this thread: Temporal Analysis Best regards, Bruno __________________ OpenFOAM: FAQ | Getting started Forum: How to get help, to post code/output and forum guide What am I doing/planning: blog/wiki Read this before sending me PM

May 21, 2013, 17:07
#3
Member

Guifan Li
Join Date: Apr 2011
Location: New York City, U.S.
Posts: 96
Rep Power: 7
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 Greetings liguifan, Try the instructions from this thread: Temporal Analysis Best regards, Bruno

 May 21, 2013, 17:35 #4 Super Moderator   Bruno Santos Join Date: Mar 2009 Location: Lisbon, Portugal Posts: 9,679 Blog Entries: 39 Rep Power: 103 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 __________________ OpenFOAM: FAQ | Getting started Forum: How to get help, to post code/output and forum guide What am I doing/planning: blog/wiki Read this before sending me PM

May 21, 2013, 17:46
#5
Member

Guifan Li
Join Date: Apr 2011
Location: New York City, U.S.
Posts: 96
Rep Power: 7
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 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
Attached Images
 Screenshot.jpg (10.3 KB, 19 views) Screenshot-1.jpg (37.2 KB, 13 views)

 May 21, 2013, 18:03 #6 Super Moderator   Bruno Santos Join Date: Mar 2009 Location: Lisbon, Portugal Posts: 9,679 Blog Entries: 39 Rep Power: 103 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 __________________ OpenFOAM: FAQ | Getting started Forum: How to get help, to post code/output and forum guide What am I doing/planning: blog/wiki Read this before sending me PM

May 21, 2013, 18:14
#7
Member

Guifan Li
Join Date: Apr 2011
Location: New York City, U.S.
Posts: 96
Rep Power: 7
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 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

 May 21, 2013, 18:27 #8 Super Moderator   Bruno Santos Join Date: Mar 2009 Location: Lisbon, Portugal Posts: 9,679 Blog Entries: 39 Rep Power: 103 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 __________________ OpenFOAM: FAQ | Getting started Forum: How to get help, to post code/output and forum guide What am I doing/planning: blog/wiki Read this before sending me PM

May 22, 2013, 14:30
#9
Member

Guifan Li
Join Date: Apr 2011
Location: New York City, U.S.
Posts: 96
Rep Power: 7
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 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
Attached Images
 Screen Shot 2013-05-22 at 1.56.34 PM.jpg (44.2 KB, 14 views) Screen Shot 2013-05-22 at 1.57.01 PM.jpg (45.8 KB, 15 views)

May 22, 2013, 18:12
#10
Super Moderator

Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,679
Blog Entries: 39
Rep Power: 103
Hi Guifan,

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

Quote:
 Originally Posted by liguifan 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
Attached Images
 Screenshot from 2013-05-22 23:08:42.jpg (44.4 KB, 9 views)
__________________

January 29, 2014, 09:19
#11
Senior Member

Bernhard Linseisen
Join Date: May 2010
Location: Magdeburg/Geneva
Posts: 180
Blog Entries: 1
Rep Power: 8
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
Attached Images
 contour_forum.jpg (18.0 KB, 10 views)

 February 2, 2014, 08:51 #12 Super Moderator   Bruno Santos Join Date: Mar 2009 Location: Lisbon, Portugal Posts: 9,679 Blog Entries: 39 Rep Power: 103 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: Open your case. 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. Apply the Contour script. Apply the "Programmable Filter":Choose the "Output Data Set Type" to be "vtkPolyData". "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)``` Keep the entry "RequestInformation Script" empty. Apply. Now use the view splitter and choose the "Spreadsheet view". In the "Spreadsheet view", choose to see the entry for the "ProgrammableFilter1". Click on the only listed point in the "Point Data" attribute. 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

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post irishdave OpenFOAM Running, Solving & CFD 28 May 28, 2015 13:37 cp703 CFX 5 July 20, 2013 06:08 raagh77 OpenFOAM Paraview & paraFoam 5 February 8, 2011 11:18 paean OpenFOAM Running, Solving & CFD 0 November 14, 2008 22:14 liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 19:07

All times are GMT -4. The time now is 15:40.