|
[Sponsors] |
January 24, 2013, 05:11 |
Sample velocities for a multiphase problem
|
#1 |
Member
Join Date: Sep 2012
Posts: 30
Rep Power: 14 |
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! |
|
January 24, 2013, 06:35 |
|
#2 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
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; } 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; } 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: 14 |
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 ); } |
|
February 12, 2013, 17:00 |
|
#4 |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
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, 23:35 |
|
#5 |
Senior Member
Elham
Join Date: Oct 2009
Posts: 184
Rep Power: 17 |
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, 22:15 |
|
#6 | |
Senior Member
Elham
Join Date: Oct 2009
Posts: 184
Rep Power: 17 |
Quote:
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 |
||
December 15, 2016, 07:13 |
|
#7 | |
Member
Ramin
Join Date: Oct 2015
Posts: 33
Rep Power: 11 |
Quote:
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 |
||
December 18, 2016, 23:00 |
|
#8 |
Senior Member
Elham
Join Date: Oct 2009
Posts: 184
Rep Power: 17 |
This is an old post. Anyway, thanks.
|
|
November 9, 2020, 11:06 |
can this be used with -postProcess?
|
#9 |
Member
Join Date: Apr 2018
Location: UK
Posts: 78
Rep Power: 8 |
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 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 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. |
|
November 12, 2020, 09:14 |
|
#10 |
Member
Join Date: Apr 2018
Location: UK
Posts: 78
Rep Power: 8 |
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.
|
|
|
|
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 |