Force calculation in multiphase simulations
HI all,
Does force calculation work for multiphase cases?. If i try to add these lines below to my controldict in damBreak example: functions ( forceA { type forces; functionObjectLibs ("libforces.so"); patches (leftWall); rhoInf 1000; CofR (0 0 0); outputControl timeStep; outputInterval 1; pName p; UName U; rhoName rho; log true; } i got the following error: keyword nu is undefined in dictionary "/home/aferrari/OpenFOAM/OpenFOAM2.1.0/tutorials/multiphase/interFoam/laminar/damBreak/constant/transportProperties" file: /home/aferrari/OpenFOAM/OpenFOAM2.1.0/tutorials/multiphase/interFoam/laminar/damBreak/constant/transportProperties from line 20 to line 62. From function dictionary::lookupEntry(const word&, bool, bool) const in file db/dictionary/dictionary.C at line 400. FOAM exiting I have already serched the forum and found how to get around the problem, but the question is if force calculation is suitable for multiphase simulations or not. What does it mean for example rhoInf in this case? rho is not constant in space. Even the viscosity is the viscosity of the mixture calculated in twoPhaseMixture.C, not simply mu_1 or mu_2. Can someone explain this? regards andrea 
dear andrea
if you look at force calculation you can find it. it is not suitable for this purpose. you should develop a code to save nu as mixed of two phase and convert it to single phase. 
Thanks niaz,
I thought it was not suitable for this, just to be sure. Now what i want to do is try to calculate pressure and viscous forces separately in both phases (maybe based on alpha). Does it make sense in your opinion? regards andrea 
Quote:
cuz pressure is just the normal forces and viscous the tangential ones if this does not make sense i'm sry and pls correct me as far as the application goes i guess it should be straightforward if ur familiar with C++ regards /calim 
Andrea
if you look at base file for force and forcecoeff you can find that both are for singlephase flow. but in interdyfoam tut, a sample used it for floating object and it has answered well. i recommend to use it for a standard test case to be sure about it. 
Hi Niaz and Calim,
thanks for your suggestions. This is what i've done: in forces.C where devRhoReff() is calculated i added: Code:
dimensionedScalar nu1(transportProperties.subDict("phase1").lookup("nu")); Code:
const volVectorField& U = obr_.lookupObject<volVectorField>(UName_); What do you think? best andrea 
Andrea,
I think you may be double accounting in the case of turbulence models because the effects of variations of nu are captured in the devReff of the individual turbulence models (see kOmega.C for example). The variations in density should be accounted for by the volScalarField rho() if the rhoName is set to the name of rho for that solver (typically just "rho"). Setting rhoName to rhoInf will result in the use of a uniform density volScalarField. Your approach may be necessary for laminar cases, and/or where a breakdown of forces in each phase is desired. Your approach also has the effect of treating faces as either completely one phase or the other which may underpredict forces for flows with large mixture regions. Dave 
Hi Dave,
you are right but i'm working with multiphase flow and my cases are always laminar (0.01<Re<1), for turbulence cases the approach has to be corrected. What i have done is basically create a new "forcesMultiPhase" dir in which i have only what i need. Why you are saying that i'm treating faces "as either completely one phase or the other"?. the face area vectors are multiplied by alpha so if alpha=1 the face belongs to phase 1, if alpha=0 the face belongs to phase2 and at the intereface the face belongs to both depending on alpha. Can you please explain this? best andrea 
Andrea,
I was mistaken reading the setting of limitedAlpha1 and the ordering of the min and max used (I thought it was forcing intermediary alphas to be 0). Since you are working with exclusively laminar flow your approach makes more sense now. I thought of this issue myself, but since I work with fully turbulent flow I concluded it wasn't necessary for my own flow type (ships). Dave 
1 Attachment(s)
Hi again,
i would like to share my test case. I finally decided to test force calculation on this case: a slug in a vertical capillary tube with fixed contact angle that moves under gravity. The falling velocity is constant (after an initial acceleration) and the forces acting on the slug should be gravity and viscous forces only (pressure and capillary forces should be zero for symmetry). I tested 2 cases: one in which the gravity is set to (0 0.1 0) and the other one in which gravity is set to its normal value (0 9,81 0). the case is 2D. The calculated viscous forces balances the gravity force only in the first case, when the gravity is lower. In case of higher gravity the curves do not overlap (maybe there are other effects due to time derivative..:confused:). The calculated viscous force on phase 1 is oscillating a lot (also the total viscous force is oscillating, so i think is not a problem of my implementation) and i do not know exactly why. In the plot attached the black curve is what i called in the previous post "fmViscousPhase1" and the blue line is the gravity force acting on the slug. Any comments will be appreciated. best regards andrea 
maybe the higher gravity is changing your flow pattern and the slug pattern is no longer physically possible/expected.. try increasing your volumetric flux, but you might have to deal with turbulence :rolleyes:

Hi mauricio
that's what I thought. The Re is around 1600 for the higher gravity case and maybe this could cause the shift. and what's your opinion about the oscillation? The velocity field is more or less constant through the domain except in the region of the interface and i noticed that using a lower courant number i can reduce the magnitude of these oscillations so it might be related to spurios currents.:confused: best andrea 
about parasitic currents.. i'm not that familiar with these cuz i havent rly tried to simulate these flow patterns in cfd.. there dimensionless numbers to check..like capilarity, laplace number..weber's....and i've only had some work with 1d models. but maybe this (http://www.google.com.br/url?sa=t&rct=j&q=spurious+currents+cfd&source=web& cd=4&ved=0CEwQFjAD&url=http%3A%2F%2Fpages.csam.mon tclair.edu%2F~yecko%2Ficodes%2FScardoZaleski_ARFM. pdf&ei=qGRnT4fBK8iN4gSj_mMCA&usg=AFQjCNGL9JUHaInCbgwZEBAHplLYEiWiMQ) pdf can help you out since you're more into the subject than me... it has some interesting stuff, at least for me.
about the oscillations... it's kinda hard to tell cuz i dont rly know how you're modeling the slug.. i mean..there are a few flow conditions to make it stable. Like for instance the distance from the inlet. you know that a slug only develops at a certain distance from the inlet..say 8 or 16D..so maybe you need a longer/higher tube to get the slug.. plus idk how realistic is the shape of your slug...morever your running a 2d.. i take it's a 2d in cartesian coordinates? anyway i kinda need more time, and this is sth we all lack these days, but if sth comes to mind i'll post it here :) 
1 Attachment(s)
HI again mauricio,
I'm really familiar with that paper but i think, at moment, spurios current in interFoam is something you have to "live with". Anyway i uploaded the case if you want to give a try. I checked all forces and found they are all oscillating. Normally i work with bigger domain and the effect of spurios current are only in the time step of sim, they usually do not affect my results. So i do not want to spend much time on this, i was just curios about the reason behind these oscillations. ps. if you want to try this case just type blockMesh, setField, interFoam, as usual. The sim is a little bit slow, maybe it is better to switch to GAMG. best andrea 
hi andrea!
thx 4 sharing! i'll give it a try and let you know if sth comes up :) 
hey andrea i gave it a try but i remembered i dont have your code for force calc.
but i did change sth in your case i did this to your p_rgh file: Code:
inlet plus i've set gravity to 9.81/m/s2 the slugs seems go down quite smoothly ..so far im unable to tell where to oscillations come from EDIT: have you tried refining your mesh? The oscilation is very consistent, the case is stable and the slug has a ,say, expected behavior. Then pressure and velocity variations along the wall might be varying too fast for your force calculation due to the higher gravity force.. if you havent tried refining your mesh i rly would like to see the force calculation for a finer one. if the oscillations decrease then it could have been it..idk then i guess that running it with a lower Co, say, .2 might decrease the oscillations EDIT2:i've checked the wallstress with oF's appl, assuming air, and i see ripples on the walls that also seem to slide down the walls, but in a oscillating fashion.. even with a finer mesh..that might be the source of the oscillations here's a pic http://s13.postimage.org/5r93roi03/error.jpg 1) assuming it's a physical behavior, maybe the system's rly become too dynamic and it's damping is not enough to make things stable.. 2) if it's a numeric error i can't tell where it is coming from :( 
1 Attachment(s)
Hi mauricio,
thanks for your interest in my post. Yes, i tried to refine the mesh but with no succes in reduce the oscillation. Even use totalPressure instead of fixedPressure bc does not seem to solve the problem. Running the simulation with gravity sets to 9.81 m/s^2 produces a much more smooth curve for viscous force: the oscillation are still there but some order of magnitude lower than the force itself. My guess is that with small velocities the calculated force has the same order of magnitude of the oscillations and you can not filter them out. Looking at your picture one thingh that comes in my mind is that this behaviour might be related to the formation of a thin flim along the wall, which is an expected/physical behavior. I attacched the "rescaled" color function in which the film is well visible. best andrea 
Quote:
as for the force maybe you cannot scape the scale issue when using a higher gravity. then i guess that in the end there's nothing wrong with the oscillations? it's just physics (?) :D i was interested in this case cuz as i told b4 i recently been through this topic and it's always nice to learn sth new! :) 
1 Attachment(s)
Dear all.
I don't know if this helps but I was also confused that the solver did not recognize nu,rho or transportModel from my transportProperties. I'm using v.1.7.1 and, looking at the code, this does not seem to matter. I simply defined those three keywords outside of the phasedictionaries in transportProperties to make it run without crashing and it works fine. To verify that it is actually recognizing the difference in rho and nu, I made the forcelibrary print out the values on the entire patch for plotting instead of just summing them up. See the attached image, same results for pressure force. //Björn 
Dear Andrea
can you send your library for me? Quote:

All times are GMT 4. The time now is 22:48. 