CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > ParaView

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

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

Reply
 
LinkBack Thread Tools Display Modes
Old   April 27, 2013, 17:49
Default 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: 6
liguifan is on a distinguished road
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.
liguifan is offline   Reply With Quote

Old   April 28, 2013, 06:33
Default
  #2
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,312
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Greetings liguifan,

Try the instructions from this thread: Temporal Analysis

Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   May 21, 2013, 17:07
Default
  #3
Member
 
Guifan Li
Join Date: Apr 2011
Location: New York City, U.S.
Posts: 96
Rep Power: 6
liguifan is on a distinguished road
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 View Post
Greetings liguifan,

Try the instructions from this thread: Temporal Analysis

Best regards,
Bruno
liguifan is offline   Reply With Quote

Old   May 21, 2013, 17:35
Default
  #4
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,312
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
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 is offline   Reply With Quote

Old   May 21, 2013, 17:46
Default
  #5
Member
 
Guifan Li
Join Date: Apr 2011
Location: New York City, U.S.
Posts: 96
Rep Power: 6
liguifan is on a distinguished road
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 View Post
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
File Type: jpg Screenshot.jpg (10.3 KB, 18 views)
File Type: jpg Screenshot-1.jpg (37.2 KB, 13 views)
liguifan is offline   Reply With Quote

Old   May 21, 2013, 18:03
Default
  #6
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,312
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
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 is offline   Reply With Quote

Old   May 21, 2013, 18:14
Default
  #7
Member
 
Guifan Li
Join Date: Apr 2011
Location: New York City, U.S.
Posts: 96
Rep Power: 6
liguifan is on a distinguished road
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 View Post
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 is offline   Reply With Quote

Old   May 21, 2013, 18:27
Default
  #8
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,312
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
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
wyldckat is offline   Reply With Quote

Old   May 22, 2013, 14:30
Default
  #9
Member
 
Guifan Li
Join Date: Apr 2011
Location: New York City, U.S.
Posts: 96
Rep Power: 6
liguifan is on a distinguished road
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 View Post
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
Attached Images
File Type: jpg Screen Shot 2013-05-22 at 1.56.34 PM.jpg (44.2 KB, 14 views)
File Type: jpg Screen Shot 2013-05-22 at 1.57.01 PM.jpg (45.8 KB, 15 views)
liguifan is offline   Reply With Quote

Old   May 22, 2013, 18:12
Default
  #10
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,312
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Hi Guifan,

Quote:
Originally Posted by liguifan View Post
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 View Post
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
File Type: jpg Screenshot from 2013-05-22 23:08:42.jpg (44.4 KB, 8 views)
wyldckat is offline   Reply With Quote

Old   January 29, 2014, 09:19
Default Spread plot over 3D contour
  #11
Senior Member
 
Bernhard Linseisen
Join Date: May 2010
Location: Magdeburg/Geneva
Posts: 178
Blog Entries: 1
Rep Power: 7
Linse is on a distinguished road
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?

Thanks for any answer in advance!

Cheers,
Bernhard
Attached Images
File Type: jpg contour_forum.jpg (18.0 KB, 10 views)
Linse is offline   Reply With Quote

Old   February 2, 2014, 08:51
Default
  #12
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,312
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
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:
  1. Open your case.
  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
wyldckat is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
TimeVaryingMappedFixedValue irishdave OpenFOAM Running, Solving & CFD 28 May 28, 2015 13:37
Simulation of varying contact angles for a large droplet of water on a surface cp703 CFX 5 July 20, 2013 06:08
velocity vs time plot in paraFoam raagh77 OpenFOAM Paraview & paraFoam 5 February 8, 2011 11:18
On the damBreak4phaseFine cases paean OpenFOAM Running, Solving & CFD 0 November 14, 2008 22:14
Could anybody help me see this error and give help liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 19:07


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