# Sample velocities for a multiphase problem

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 LinkBack Thread Tools Display Modes
January 24, 2013, 05:11
Sample velocities for a multiphase problem
#1
Member

Join Date: Sep 2012
Posts: 30
Rep Power: 5
Beloved Foamers,

I am simulating the fall of a droplet of water in oil, with interFoam. See the attached picture.

My question is how to procede to extract the terminal velocity of the drop, i.e. where the phase fraction alpha is 1.

The "sample" utility would serve, but I was wondering about the possibility of having an IF statement to only keep certain cells.

Another solution would perhaps be to extract values from a box, and run this if statement in Matlab f.eg, but I was wondering what is the best practice? I would also like to point out that I was thinking about averaging all velocities on all cells to keep out the effect of recirculation inside the drop.

So, if you skipped til the end, my question is: how to extract the terminal velocity of the droplet for this case.

Thank you!
Attached Images
 drop.jpg (93.4 KB, 47 views)

January 24, 2013, 06:35
#2
Assistant Moderator

Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
Quote:
 Originally Posted by emirust Beloved Foamers, I am simulating the fall of a droplet of water in oil, with interFoam. See the attached picture. My question is how to procede to extract the terminal velocity of the drop, i.e. where the phase fraction alpha is 1. The "sample" utility would serve, but I was wondering about the possibility of having an IF statement to only keep certain cells. Another solution would perhaps be to extract values from a box, and run this if statement in Matlab f.eg, but I was wondering what is the best practice? I would also like to point out that I was thinking about averaging all velocities on all cells to keep out the effect of recirculation inside the drop. So, if you skipped til the end, my question is: how to extract the terminal velocity of the droplet for this case. Thank you!
Well the easiest way to circumvent the need for an IF is to let alpha1 act as an IF and base further recipes on something like "alpha1*U" (which should give you 'only' the velocity of the liquid phase. Might of course fail for very high gas velocities in regions that only have a few percent liquid).

I personally use swak4Foam for that kind of calculations and write a function object like this (I'm doing this from the top of my head. There may be syntax errors in that):
Code:
```    liquidVelocity
{
type swakExpression;
valueType internalField;
expression "alpha1*U";
accumulations (
min
max
);
verbose true;
}```
that only gives you the extremes of the liquid velocity. A more elaborate calculation (with volume weighted average and only using the component of the velocity in the down direction) would be
Code:
```    downAverage
{
type swakExpression;
valueType internalField;
variables (
"downDirection=vector(0,-1,0);"
"thres=0.5;"
"liquidVol=sum(alpha1>thres ? vol() : 0);"
"downVel=alpha1>thres ? (U & downDirection) : 0;"
);
expression "downVel*vol()/liquidVol";
accumulations (
sum
);
verbose true;
}```
An alternative that swak offers is to track the surface of the liquid and calculate the velocity of that (for an example see in the swak-distribution Examples/other/capillaryRise).

If you decide to do it this way and it works for you could I ask you to add a recipe to http://openfoamwiki.net/index.php/Co...Usage_examples as this is something that other people might be interested in. Thanks
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request

 February 12, 2013, 10:39 #3 Member   Join Date: Sep 2012 Posts: 30 Rep Power: 5 Hello! I haven't tracked the isosurfaces as suggested previously, but I used the following to track the drop deformation as it falls down. It might not be good enough for the wiki, so I just post it here. This was just added at the end of the controlDict and creates a set of values that can give the horizontal and vertical diameter. This can lead to the position of the center of the drop which can be used to find the fall velocity Code: ```libs ( "libOpenFOAM.so" // OpenFOAM will (probably) crash if this library is not specified "libsimpleSwakFunctionObjects.so" "libswakFunctionObjects.so" ); functions { downAverage { type swakExpression; valueType internalField; variables ( "downDirection=vector(0,-1,0);" "thres=0.5;"//which cells to keep "liquidVol=sum(alpha1>thres ? vol() : 0);" //calculates the volume of the drop "downVel=alpha1>thres ? (U & downDirection) : 0;" //a & b:inner vector product. Keep the y component of U. ); expression "downVel*vol()/liquidVol";//vol():vol of the cell accumulations ( sum ); verbose true; } createInterface { type createSampledSurface; outputControl timeStep; outputInterval 1; surfaceName interface; surface { type isoSurface; isoField alpha1; isoValue 0.5; interpolate true; } } xDiameter { type swakExpression; valueType surface; surfaceName interface; verbose true; expression "pos().x"; accumulations ( min max ); } yDiameter { type swakExpression; valueType surface; surfaceName interface; verbose true; expression "pos().y"; accumulations ( min max ); }``` Good luck!

February 12, 2013, 17:00
#4
Assistant Moderator

Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
Quote:
 Originally Posted by emirust Hello! I haven't tracked the isosurfaces as suggested previously, but I used the following to track the drop deformation as it falls down. It might not be good enough for the wiki, so I just post it here.
Why not? If everything there had to be perfect nothing would get posted. And if somebody doesn't like your solution he can improve it ... it's a Wiki
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request

 July 1, 2015, 22:35 #5 New Member   Elham Join Date: Oct 2009 Posts: 22 Rep Power: 8 I try to use your subroutine at the end of controlDict to calculate droplet velocity but I don't know where I can find the calculated velocity? I mean in Paraview?

July 20, 2015, 21:15
#6
New Member

Elham
Join Date: Oct 2009
Posts: 22
Rep Power: 8
Quote:
 Originally Posted by emirust Hello! I haven't tracked the isosurfaces as suggested previously, but I used the following to track the drop deformation as it falls down. It might not be good enough for the wiki, so I just post it here. This was just added at the end of the controlDict and creates a set of values that can give the horizontal and vertical diameter. This can lead to the position of the center of the drop which can be used to find the fall velocity Code: ```libs ( "libOpenFOAM.so" // OpenFOAM will (probably) crash if this library is not specified "libsimpleSwakFunctionObjects.so" "libswakFunctionObjects.so" ); functions { downAverage { type swakExpression; valueType internalField; variables ( "downDirection=vector(0,-1,0);" "thres=0.5;"//which cells to keep "liquidVol=sum(alpha1>thres ? vol() : 0);" //calculates the volume of the drop "downVel=alpha1>thres ? (U & downDirection) : 0;" //a & b:inner vector product. Keep the y component of U. ); expression "downVel*vol()/liquidVol";//vol():vol of the cell accumulations ( sum ); verbose true; } createInterface { type createSampledSurface; outputControl timeStep; outputInterval 1; surfaceName interface; surface { type isoSurface; isoField alpha1; isoValue 0.5; interpolate true; } } xDiameter { type swakExpression; valueType surface; surfaceName interface; verbose true; expression "pos().x"; accumulations ( min max ); } yDiameter { type swakExpression; valueType surface; surfaceName interface; verbose true; expression "pos().y"; accumulations ( min max ); }``` Good luck!

Hi everyone

I use the above code to calculate drop velocity but I don't know how I can sea the results? in paraFoam?

Thanks

 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 lionlove0903 OpenFOAM Running, Solving & CFD 0 January 19, 2011 04:49 mdsanij1 FLUENT 0 July 28, 2009 16:01 Kerem FLUENT 4 March 27, 2006 08:20 Derek Jing FLUENT 0 May 12, 2002 11:52 Brett Towler CFX 2 August 18, 2000 16:38

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

 Contact Us - CFD Online - Top