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

Sample velocities for a multiphase problem

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

Like Tree3Likes
  • 2 Post By emirust
  • 1 Post By Elham

Reply
 
LinkBack Thread Tools Search this Thread 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: 13
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, 104 views)
emirust is offline   Reply With Quote

Old   January 24, 2013, 06:35
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
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: 13
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!
Elham and BlnPhoenix like this.
emirust is offline   Reply With Quote

Old   February 12, 2013, 17:00
Default
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
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, 23:35
Default
  #5
Senior Member
 
Elham
Join Date: Oct 2009
Posts: 184
Rep Power: 16
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, 22:15
Default
  #6
Senior Member
 
Elham
Join Date: Oct 2009
Posts: 184
Rep Power: 16
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

Old   December 15, 2016, 07:13
Default
  #7
Member
 
Ramin
Join Date: Oct 2015
Posts: 33
Rep Power: 10
rmn_990 is on a distinguished road
Quote:
Originally Posted by Elham View Post
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
Hi
Please open Postprocessing Folder and there you can see the result.
you can plot the data with excel etc.
your output is a 2D chart and is not a contour.

Goodluck !
Ramin
rmn_990 is offline   Reply With Quote

Old   December 18, 2016, 23:00
Default
  #8
Senior Member
 
Elham
Join Date: Oct 2009
Posts: 184
Rep Power: 16
Elham is on a distinguished road
This is an old post. Anyway, thanks.
arashma likes this.
Elham is offline   Reply With Quote

Old   November 9, 2020, 11:06
Question can this be used with -postProcess?
  #9
Member
 
Join Date: Apr 2018
Location: UK
Posts: 78
Rep Power: 7
JM27 is on a distinguished road
Hello,

I have added this functionObject to the controlDict in an existing case file. The simulation has already been computed and I would like to extract some of the data, I therefore try to use the -postProcess functionality in OF for this swak functionObject, but I can't seem to get it to work.

I have tried:

Code:
mpirun -np 2 compressibleInterFoam -parallel -postProcess -func liquidVelocity
but I get

Code:
--> FOAM Warning :
    From function static bool Foam::functionObjectList::readFunctionObject(const Foam::string &, Foam::dictionary &, Foam::HashSet<Foam::word, Foam::string::hash> &, const Foam::word &)
    in file db/functionObjects/functionObjectList/functionObjectList.C at line 246
    Cannot find functionObject file liquidVelocity
I don't quite understand why the file cannot be found since -postProcess defaults to system/controlDict unless otherwise specified. I have also tried coding similar using a coded functionObject but with no success using the -postProcess functionality.

I feel this should be straightforward, but I wanted to ask if anyone had similar issues and how I can solve this? I can't seem to find any other posts describing similar issues.
JM27 is offline   Reply With Quote

Old   November 12, 2020, 09:14
Default
  #10
Member
 
Join Date: Apr 2018
Location: UK
Posts: 78
Rep Power: 7
JM27 is on a distinguished road
Update -- I've managed to find a workaround for this by using postProcess without specifying the name of the desired functionObject. It works fine in this case but it will compute ALL functionObjects in the controlDict rather than ONLY the newly introduced one.
JM27 is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
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 17:01
multiphase UDF, variables for phase velocities Kerem FLUENT 4 March 27, 2006 09:20
Problem of B.C. in Eulerian multiphase model Derek Jing FLUENT 0 May 12, 2002 12:52
CF4 - need advice on setting up multiphase problem Brett Towler CFX 2 August 18, 2000 17:38


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