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

Sample velocities for a multiphase problem

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

Reply
 
LinkBack Thread Tools Display Modes
Old   January 24, 2013, 05:11
Default Sample velocities for a multiphase problem
  #1
Member
 
Join Date: Sep 2012
Posts: 30
Rep Power: 6
emirust is on a distinguished road
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
File Type: jpg drop.jpg (93.4 KB, 59 views)
emirust is offline   Reply With Quote

Old   January 24, 2013, 06:35
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,934
Rep Power: 41
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by emirust View Post
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
gschaider is offline   Reply With Quote

Old   February 12, 2013, 10:39
Default
  #3
Member
 
Join Date: Sep 2012
Posts: 30
Rep Power: 6
emirust is on a distinguished road
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!
emirust is offline   Reply With Quote

Old   February 12, 2013, 17:00
Default
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,934
Rep Power: 41
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by emirust View Post
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
gschaider is offline   Reply With Quote

Old   July 1, 2015, 22:35
Default
  #5
Member
 
Elham
Join Date: Oct 2009
Posts: 62
Rep Power: 8
Elham is on a distinguished road
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?
Elham is offline   Reply With Quote

Old   July 20, 2015, 21:15
Default
  #6
Member
 
Elham
Join Date: Oct 2009
Posts: 62
Rep Power: 8
Elham is on a distinguished road
Quote:
Originally Posted by emirust View Post
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
Elham 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
multiphase steady problem lionlove0903 OpenFOAM Running, Solving & CFD 0 January 19, 2011 04:49
mass balance problem in multiphase model mdsanij1 FLUENT 0 July 28, 2009 16:01
multiphase UDF, variables for phase velocities Kerem FLUENT 4 March 27, 2006 08:20
Problem of B.C. in Eulerian multiphase model Derek Jing FLUENT 0 May 12, 2002 11:52
CF4 - need advice on setting up multiphase problem Brett Towler CFX 2 August 18, 2000 16:38


All times are GMT -4. The time now is 01:20.