CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Force calculation in multiphase simulations

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

Like Tree8Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 4, 2012, 09:06
Default
  #21
Senior Member
 
Andrea Ferrari
Join Date: Dec 2010
Posts: 319
Rep Power: 15
Andrea_85 is on a distinguished road
Hi,
here is a summary of what i have done:

1-i 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)));
2) in calcForceMoment()

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.
Any comments on this will be appreciated.
ps if you need the library that compiles with OF 2.1.0 just give me your e-mail


best
andrea
piaston likes this.
Andrea_85 is offline   Reply With Quote

Old   September 16, 2012, 19:05
Default
  #22
New Member
 
Angelo J. Chaves
Join Date: Aug 2012
Location: Itajubá, Brasil.
Posts: 3
Rep Power: 13
A.J.Chaves is on a distinguished road
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.
A.J.Chaves is offline   Reply With Quote

Old   September 18, 2012, 03:44
Default
  #23
Senior Member
 
Andrea Ferrari
Join Date: Dec 2010
Posts: 319
Rep Power: 15
Andrea_85 is on a distinguished road
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
frantov likes this.
Andrea_85 is offline   Reply With Quote

Old   September 20, 2012, 16:24
Default
  #24
New Member
 
Angelo J. Chaves
Join Date: Aug 2012
Location: Itajubá, Brasil.
Posts: 3
Rep Power: 13
A.J.Chaves is on a distinguished road
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
frantov likes this.
A.J.Chaves is offline   Reply With Quote

Old   September 2, 2014, 23:25
Default
  #25
Member
 
Francisco T
Join Date: Nov 2011
Location: Melbourne, Australia
Posts: 64
Blog Entries: 1
Rep Power: 13
frantov is on a distinguished road
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
frantov is offline   Reply With Quote

Old   September 17, 2015, 11:24
Default
  #26
New Member
 
Daniel Rodriguez Calvete
Join Date: Mar 2012
Location: Ferrol (A Coruña) Spain
Posts: 10
Rep Power: 13
DanielRCalvete is on a distinguished road
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_;
    }
}
Maybe I am missunderstanding something in the code of Andrea, but since the pressure forces is the integration of pressure through the surface, I think it has not sense to multiply by rho*alpha or rho*(1- alpha) to obtain this forces.

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]) 
	
	    );
I will appreciate a lot your comments about. Thank you in advance.

DRC

Last edited by DanielRCalvete; September 17, 2015 at 12:49.
DanielRCalvete is offline   Reply With Quote

Old   September 17, 2015, 15:44
Default
  #27
Senior Member
 
Andrea Ferrari
Join Date: Dec 2010
Posts: 319
Rep Power: 15
Andrea_85 is on a distinguished road
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 single-phase 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/(1-alpha1) 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
Andrea_85 is offline   Reply With Quote

Old   September 18, 2015, 12:32
Default
  #28
New Member
 
Daniel Rodriguez Calvete
Join Date: Mar 2012
Location: Ferrol (A Coruña) Spain
Posts: 10
Rep Power: 13
DanielRCalvete is on a distinguished road
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,
sherif35 likes this.
DanielRCalvete is offline   Reply With Quote

Old   October 20, 2015, 18:38
Default
  #29
New Member
 
AI
Join Date: Jun 2014
Posts: 17
Rep Power: 11
sherif35 is on a distinguished road
Quote:
Originally Posted by DanielRCalvete View Post
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,
Daniel or Andrea,

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
sherif35 is offline   Reply With Quote

Old   January 26, 2016, 04:14
Default
  #30
Member
 
Giovanni Caramia
Join Date: Mar 2009
Location: Bari, ITALY
Posts: 58
Rep Power: 16
karamiag is on a distinguished road
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!
karamiag is offline   Reply With Quote

Old   November 5, 2019, 07:32
Default
  #31
New Member
 
Nguyen Minh Quan
Join Date: Feb 2019
Posts: 2
Rep Power: 0
mqnguyen is on a distinguished road
Hi Andrea,


I post this because I'm interested in calculating wave force (2 phases flow) exerted on a structure. It's seem a very classical problem and the original post was 7 years old, so I'm wondering if the functionality is already implemented in official release?



Actually I'm using the libforce but the force was underestimated, and when I look into force.C there are no lookup for alpha value? My wild guest was the library is still not intended to be used for multi-phase flow (which is strange?) or I'm making some mistake by setting the rhoInf = 998.8?



Could you please share me your code (thichdore@gmail.com)?



Thank you in advance.

Quan
mqnguyen is offline   Reply With Quote

Old   January 4, 2021, 08:13
Smile
  #32
New Member
 
Join Date: Oct 2016
Posts: 4
Rep Power: 8
Adq4 is on a distinguished road
Hello everyone,

It has been ages since this thread was created but it seems that the tool for analysing forces in multiphase simulations still has not been implemented.

Does anyone have a custom library and would be able to share it? I can give you my email in PM. Any help would be greatly appreciated.

Cheers!
Adq4 is offline   Reply With Quote

Old   January 5, 2021, 02:55
Default
  #33
Senior Member
 
Join Date: Dec 2019
Location: Cologne, Germany
Posts: 326
Rep Power: 7
geth03 is on a distinguished road
Quote:
Originally Posted by Adq4 View Post
Hello everyone,

It has been ages since this thread was created but it seems that the tool for analysing forces in multiphase simulations still has not been implemented.

Does anyone have a custom library and would be able to share it? I can give you my email in PM. Any help would be greatly appreciated.

Cheers!
hi,
in fact, that is not true anymore. you can output forces for multiphase simulations.

in controlDict you need to add these lines:
from phaseForces.H in OF 7:
Example of function object specification:
\verbatim
phaseForces.water
{
type phaseForces;
libs ("libreactingEulerFoamFunctionObjects.so");
writeControl writeTime;
writeInterval 1;

...

phaseName water;
}
\endverbatim
geth03 is offline   Reply With Quote

Old   January 5, 2021, 08:08
Post
  #34
New Member
 
Join Date: Oct 2016
Posts: 4
Rep Power: 8
Adq4 is on a distinguished road
Hi geth03,

thanks for your response. This is what I found about phaseForces in the API Guide for v2006:

Quote:
This function object calculates and outputs the blended interfacial forces acting on a given phase, i.e. drag, virtual mass, lift, wall-lubrication and turbulent dispersion. Note that it works only in run-time processing mode and in combination with the reactingEulerFoam solvers.
However, I am dealing with air-oil simulation using interFoam and I am interested in forces acting on a specific patch - solid wall. Despite that, I attempted to implement phaseForces into my controlDict but it does not seem to be recognized at all no matter what I change...

Do you think this feature is applicable to such case?

Many thanks.
Adq4 is offline   Reply With Quote

Old   January 5, 2021, 13:15
Default
  #35
Senior Member
 
Join Date: Dec 2019
Location: Cologne, Germany
Posts: 326
Rep Power: 7
geth03 is on a distinguished road
Quote:
Originally Posted by Adq4 View Post
Hi geth03,

thanks for your response. This is what I found about phaseForces in the API Guide for v2006:



However, I am dealing with air-oil simulation using interFoam and I am interested in forces acting on a specific patch - solid wall. Despite that, I attempted to implement phaseForces into my controlDict but it does not seem to be recognized at all no matter what I change...

Do you think this feature is applicable to such case?

Many thanks.
No its not, bc it is implemented for phase pairs.

What exactly do you want to compute and where exactly? Do you have any equations that need to be solved? Is it enough if you write out only a single value into a txt file or do you want to output cell data to open with paraview?

If you provide more information, we could think about a smart solution .
geth03 is offline   Reply With Quote

Old   January 7, 2021, 10:13
Post
  #36
New Member
 
Join Date: Oct 2016
Posts: 4
Rep Power: 8
Adq4 is on a distinguished road
Hi geth03,

Ideally, I would like to track a convergence of forces acting on a specific set of patches in my multi-phase simulations as one does with forces function object in single-phase cases.
One time step - one line of data into postProcessing folder:

Quote:
# Moment
# CofR : (0.000000e+00 0.000000e+00 0.000000e+00)
#
# Time (total_x total_y total_z) (pressure_x pressure_y pressure_z) (viscous_x viscous_y viscous_z)
...
127 (-2.1e-06 1.2e-06 2.3e-04) (-1.9e-06 3.1e-06 0.0e+00) (-2.2e-07 -1.9e-06 2.3e-04)
...
My cases are 3D and laminar and employ interFoam solver. For simplicity, we can discuss a tutorial case such as mixerVessel2D. How would you track forces acting on the rotor? I know it's possible to extract forces using ParaView but that's just too cumbersome if you have more than a single case and it doesn't allow you to follow the development at every single time step...

Any suggestions on this?

Cheers.
Adq4 is offline   Reply With Quote

Old   January 8, 2021, 03:28
Default
  #37
Senior Member
 
Join Date: Dec 2019
Location: Cologne, Germany
Posts: 326
Rep Power: 7
geth03 is on a distinguished road
ok,

first of all you need a postProcessing utility like the one you gave as an example, so basically you could look at the source code and figure out the syntax and make changes according to your needs.

you can either extend it or even delete the stuff you don't need and just keep the stuff you need.

either way, you should be able to reach your goal, it is not a big task.
i hope you have some basic c++ programming skills.
geth03 is offline   Reply With Quote

Old   January 8, 2021, 04:46
Post
  #38
New Member
 
Join Date: Oct 2016
Posts: 4
Rep Power: 8
Adq4 is on a distinguished road
Hi geth03,

I understand it's possible to create a custom function object for this. However, my understanding of the source code is limited and my experience with C++ is 0 as of today. I hoped that someone might be able to share with me a sample library or something similar so I wouldn't need to start from scratch. Otherwise, I'll do it myself but it'll surely take more time than I would like.

Cheers.
Adq4 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
Calculation of Drag Force per unit Length Mohammad Faridul Alam CFX 4 January 11, 2013 07:19
Time-averaged 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


All times are GMT -4. The time now is 17:49.