
[Sponsors] 
June 4, 2012, 09:06 

#21 
Senior Member
Andrea Ferrari
Join Date: Dec 2010
Posts: 303
Rep Power: 8 
Hi,
here is a summary of what i have done: 1i created my own library called forceMultiPhase 2 in forceMultiPhase.C 1) where devRhoReff() is calculated Code:
else if (obr_.foundObject<dictionary>("transportProperties")) { const dictionary& transportProperties = obr_.lookupObject<dictionary>("transportProperties"); const volVectorField& U = obr_.lookupObject<volVectorField>(UName_); // return mu*dev(twoSymm(fvc::grad(U))); return dev(twoSymm(fvc::grad(U))); Code:
const volVectorField& U = obr_.lookupObject<volVectorField>(UName_); const volScalarField& p = obr_.lookupObject<volScalarField>(pName_); const volScalarField& alpha1 = obr_.lookupObject<volScalarField>("alpha1"); const dictionary& transportProperties = obr_.lookupObject<dictionary>("transportProperties"); dimensionedScalar nu1(transportProperties.subDict("phase1").lookup("nu")); dimensionedScalar nu2(transportProperties.subDict("phase2").lookup("nu")); dimensionedScalar rho1(transportProperties.subDict("phase1").lookup("rho")); dimensionedScalar rho2(transportProperties.subDict("phase2").lookup("rho")); //to avoid negative values const volScalarField limitedAlpha1 ( min(max(alpha1, scalar(0)), scalar(1)) ); const fvMesh& mesh = U.mesh(); const surfaceVectorField::GeometricBoundaryField& Sfb = mesh.Sf().boundaryField(); //i changed this part a bit respect to the previous post because it is more consistent with VOF in my opinion but i think that both are not correct at the interface where alpha1 is not zero or one. Maybe you can add your comments on this. The sum of the two viscous contributions gives excatly the same results that you would get without separating the forces. tmp<volSymmTensorField> tdevRhoReff1 = nu1*rho1*devRhoReff(); const volSymmTensorField::GeometricBoundaryField& devRhoReffb1 = tdevRhoReff1().boundaryField(); tmp<volSymmTensorField> tdevRhoReff2 = nu2*rho2*devRhoReff(); const volSymmTensorField::GeometricBoundaryField& devRhoReffb2 = tdevRhoReff2().boundaryField(); scalar pRef = pRef_ forAllConstIter(labelHashSet, patchSet_, iter) { label patchi = iter.key(); vectorField Md ( mesh.C().boundaryField()[patchi]  coordSys_.origin() ); //Pressure Force vectorField pf1(Sfb[patchi]*((p.boundaryField()[patchi]pRef)*limitedAlpha1.boundaryField()[patchi])); vectorField pf2(Sfb[patchi]*((p.boundaryField()[patchi]pRef)*(scalar(1)limitedAlpha1.boundaryField()[patchi]))); fm.first().first() += rho(p)*sum(pf1); fm.second().first() += rho(p)*sum(pf2); //Viscous Force vectorField vf1((Sfb[patchi]*limitedAlpha1.boundaryField()[patchi]) & devRhoReffb1[patchi]); vectorField vf2((Sfb[patchi]*(scalar(1)limitedAlpha1.boundaryField()[patchi])) & devRhoReffb2[patchi]); fm.first().second() += sum(vf1); fm.second().second() += sum(vf2); // i eliminated the moment calculation and i replaced it with force for phase 2. ps if you need the library that compiles with OF 2.1.0 just give me your email best andrea 

September 16, 2012, 19:05 

#22 
New Member
Angelo J. Chaves
Join Date: Aug 2012
Location: Itajubá, Brasil.
Posts: 3
Rep Power: 6 
Hi Andrea,
I am a new user of OF, and I`ve been working with a bubble rising usinng the VOF methods. I need to calculate the drag forces at the bubble. Do you know if your solver could help me? I am using the OF 2.1.0. Thanks. 

September 18, 2012, 03:44 

#23 
Senior Member
Andrea Ferrari
Join Date: Dec 2010
Posts: 303
Rep Power: 8 
Hi,
the lib forces.C calcualtes pressure and viscous force exerted by a fluid on a solid surface. If you take a look at forces.C you will see you have to specify a patch where the force is calculated. My method is the same in case of two phases flow so i guess it is not suitable for your purposes. which solver are you using? interFoam? best andrea 

September 20, 2012, 16:24 

#24 
New Member
Angelo J. Chaves
Join Date: Aug 2012
Location: Itajubá, Brasil.
Posts: 3
Rep Power: 6 
Hi,
I`m using interDyMfoam, to achive a better result in a sorter time. But I guess that everything that works with interFoam also works with interDyMFoam. It is a shame that the solver won`t work in my case. I have been thing that changing the Forces.C, creating a new solver/application to calculate the forces where the VOF is 0.5 or some thing like that instead of calculating it in wall should solve my problem. Do You have any idea if this is possible? If it is, how i could do that? Thanks for your attention. Angelo 

September 2, 2014, 23:25 

#25 
New Member
Francisco Tovar
Join Date: Nov 2011
Location: RMIT. Melbourne, Australia
Posts: 11
Rep Power: 7 
Hello
I also need to calculate the drag/lift forces on a droplet. Currently force calculation needs a "patch" which are solid boundaries. Would it be possible to some how convert an isosurface to a patch? or other way Im thinking, I may need to modify the code so for the calculation of the forces, instead of a patch, uses an isosurface as an input... let me know your thoughts.. Thanks. frantov 

September 17, 2015, 11:24 

#26 
New Member
Daniel Rodriguez Calvete
Join Date: Mar 2012
Location: Ferrol (A Coruña) Spain
Posts: 9
Rep Power: 6 
Hello,
I am running cavitation cases with interPhaseChangeFoam, and the tool explaned by Andrea is very useful to me. I am trying to implement it in OF 2.3, but I have a doubt about it: I see in this code that Pressure Forces is integrated multiplying by rho(p) which is 1 if the pDimensions = Pascals according to this piece of code: Code:
Foam::scalar Foam::forceMultiPhase::rho(const volScalarField& p) const { if (p.dimensions() == dimPressure) { return 1.0; } else { if (rhoName_ != "rhoInf") { FatalErrorIn("forceMultiPhase::rho(const volScalarField& p)") << "Dynamic pressure is expected but kinematic is provided." << exit(FatalError); } return rhoRef_; } } What I propose is the next piece of code in forceMultiPhace.C in calcForcesMoment() class (notice that is for OF2.3): Code:
vectorField fN ( Sfb[patchI]*(p.boundaryField()[patchI]  pRef) * ); // Viscous Forces vectorField fT ( ((Sfb[patchI]*limitedAlpha1.boundaryField()[patchI]) & devRhoReffb1[patchI]) + ((Sfb[patchI]*(scalar(1)limitedAlpha1.boundaryField()[patchI])) & devRhoReffb2[patchI]) ); DRC Last edited by DanielRCalvete; September 17, 2015 at 12:49. 

September 17, 2015, 15:44 

#27 
Senior Member
Andrea Ferrari
Join Date: Dec 2010
Posts: 303
Rep Power: 8 
Hi Daniel,
i made the script a long time ago and i am not using it anymore..it took me a while to figure out what i did . Anyway, as you said the multiplication with rho does not have an influence since rho(p)==1 in all interWhatEverFoam solvers. Rho was there because i adapted the script from singlephase where usually the pressure is defined as p=p/rho. So you have to multiply by rho to get the correct value/dimension of the force. The multiplication with alpha1/(1alpha1) was there because i wanted to separate the contribution in the two phases. If you dont multiply by alpha you get the total pressure force integrated on the surface (in both phases). Hope this help Andrea 

September 18, 2015, 12:32 

#28 
New Member
Daniel Rodriguez Calvete
Join Date: Mar 2012
Location: Ferrol (A Coruña) Spain
Posts: 9
Rep Power: 6 
Thank you Andrea for your fast answer. Aha!, It is question of dimension consistency, so now it is clear to me. I will use this tool in my project, thanks.
Regards, 

October 20, 2015, 18:38 

#29  
New Member
AI
Join Date: Jun 2014
Posts: 17
Rep Power: 4 
Quote:
Is it possible to share the library that compiles with OF 2.3? I'm trying to calculate forces on a cylinder in a 2 phase flow with sharp interface using LES and I'm interested in calculating the forces on the cylinder for each phase separately. Thank you very much. Ahmed 

January 26, 2016, 05:14 

#30 
Member
Giovanni Caramia
Join Date: Mar 2009
Location: Bari, ITALY
Posts: 37
Rep Power: 9 
Hello,
I am using interPhaseChangeFoam OF2.3.1. I am sorry but reading the previous posts I did not understand if the force calculation over a patch, as originally done in OF2.3.1, is correct or not. Thank you! 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Calculation of Drag Force per unit Length  Mohammad Faridul Alam  CFX  4  January 11, 2013 08:19 
Timeaveraged force in CFX  rjmcsherry  CFX  2  October 21, 2010 10:34 
Calculation of Saffman Lift Force  JPBodner  Main CFD Forum  3  August 4, 2010 11:11 
MRF and Heat transfer calculation  Susan YU  FLUENT  0  June 2, 2010 08:46 
Viscous Force Calculation  cwang5  OpenFOAM Programming & Development  1  May 4, 2010 04:59 