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

interFoam: trying to understand the equation terms

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By danny123

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 29, 2015, 08:21
Default interFoam: trying to understand the equation terms
  #1
Senior Member
 
Saideep
Join Date: Apr 2015
Location: INDIA
Posts: 203
Rep Power: 12
Saideep is on a distinguished road
Hi guys!!

I am using interFOAM solver and trying to modify the code to reduce the spurious currents. I have a few questions in the alphaEqn.H file.

1. Why is phir calculated and used as the relative velocity and not phic? As far as I see phic is the real relative velocity.

2. What is 'rhoPhi'. Where is it being used?
rhoPhi = tphiAlpha()*(rho1 - rho2) + phi*rho2;

Thanks and sorry of this is an easy one.

Saideep
Saideep is offline   Reply With Quote

Old   June 2, 2015, 06:20
Default
  #2
Senior Member
 
Daniel Witte
Join Date: Nov 2011
Posts: 148
Rep Power: 14
danny123 is on a distinguished road
Hi,

To 1) Within the code it is said

Code:
    // Standard face-flux compression coefficient
    surfaceScalarField phic(mixture.cAlpha()*mag(phi/mesh.magSf()));
So this seems to be a coefficient, not really a flux. But maybe somebody else can answer that question.

To 2) This is easy:

rhophi is the mass flux. This is the sum of volumetric flux of specy 1 (= phi x alpha1 = phiAlpha) by its density (rho1) and specy 2 respectivily. Since alpha2 = 1 - alpha1, you get the expression you see in the code.

Regards,
Daniel
danny123 is offline   Reply With Quote

Old   June 2, 2015, 09:30
Default
  #3
Member
 
ali alkebsi
Join Date: Jan 2012
Location: Strasbourg, France
Posts: 82
Rep Power: 14
kebsiali is on a distinguished road
Hi,

I'm also interested in understanding interFoam cuz i need to force it to solve for a variable density of one of the phases.
Problem is i dont know the basics of VOF (alpha equation) and i find it very difficult to understand through the code itself.
Could you please shed a light of where i can find the basics of the method and how it is coupled with the pimple.

the rhoPhi is needed in the UEqn and the problem is that it must be calculated at the faces so a mere interpolation (for alpha) does not work (I lost 2 weeks to understand why) and it is being calculated in that way that i dont fully understand.
kebsiali is offline   Reply With Quote

Old   June 2, 2015, 10:21
Default
  #4
Senior Member
 
Saideep
Join Date: Apr 2015
Location: INDIA
Posts: 203
Rep Power: 12
Saideep is on a distinguished road
Hi Ali;

As far as I see you have a problem with the UEqn term of rhoPhi. As the previous comment specifies it is just obtained by rearrangement of the alpha term with respective phase densities.
For clarification use these:
(I don't know how to add equations in image so adding in attachments.)

The rhoPhi[units: kg/m3 * m3/s = kg/s] represents the quantity of inflow into a specific cell.
Attached Images
File Type: gif form1.gif (1.6 KB, 104 views)
File Type: gif form2.gif (1.6 KB, 123 views)
File Type: gif form3.gif (799 Bytes, 68 views)
Saideep is offline   Reply With Quote

Old   June 2, 2015, 11:08
Default
  #5
Senior Member
 
Daniel Witte
Join Date: Nov 2011
Posts: 148
Rep Power: 14
danny123 is on a distinguished road
Hi,

For variable density, you should not use interFoam since this an incompressible solver. Just looking into applications, there is a solver called compressibleMultiphaseInterFoam. If you have a compressible fluid, interFoam will lead to a wrong mass balance. The compressible behavior is likely some kind of thermodynamic law (ideal gas law).

Regards,

Daniel
danny123 is offline   Reply With Quote

Old   June 2, 2015, 16:22
Default
  #6
Member
 
ali alkebsi
Join Date: Jan 2012
Location: Strasbourg, France
Posts: 82
Rep Power: 14
kebsiali is on a distinguished road
Dear Daniel,

In my case I have many species reacting in phase 1, reaction and species being modeled by passive scalar transport.
so the density law i have is a function of many scalars and normally the density will drop 50 times its initial value and it is the change in density that should drive the free surface by generating a pressure gradient and thus movement. otherwise all boundary conditions are (walls) which incurs no movement except atmo at top.

I tried to go through compressibleMultiphaseInterFoam a couple of times but couldn't understand how the density of each phase is defined (law of state or ideal gas law).
Any suggestions?
kebsiali is offline   Reply With Quote

Old   June 3, 2015, 08:53
Default
  #7
Senior Member
 
Daniel Witte
Join Date: Nov 2011
Posts: 148
Rep Power: 14
danny123 is on a distinguished road
Hello Ali,

The compressible models couple an equation of state (and there are many) with the fluid movement, in particular pressure fluctuations. You can do similar modelling using temperature as well, if you have a significant change of temperature within the fluid. It is the coupling, which counts. If you have a reaction that leads to a change in density, but is uniform within the domain (no change of density due to the fluid movement and no impact of fluid movement on reaction rate) you propably are correct using the interFoam solver since your fluid is incompressible in space, but you likely need some additional terms describing change of density in time (which is function of reaction rate).

I would suggest you to describe the relationship reaction rate and density in a one dimensional model and plot density as function of time by that model. Then use this function density over time and add this to the interFoam solver. You will need to open up the domain at the top side to compensate for the shrinking required space.

Make a balance over a fluid element putting in your changing desity and develop the additional terms you need in alpha1Eq and p_rghEq, maybe UEq, compile that solver and use it. I can not tell you which terms to add, but this is the main work to do.

In order to understand interFoam better, you can use this:

http://infofich.unl.edu.ar/upload/3b...7523c8ea52.pdf

Regards,

Daniel
sabiru likes this.
danny123 is offline   Reply With Quote

Old   June 3, 2015, 09:32
Default
  #8
Member
 
ali alkebsi
Join Date: Jan 2012
Location: Strasbourg, France
Posts: 82
Rep Power: 14
kebsiali is on a distinguished road
Dear Daniel,

Thank you very much, I've been feeling stupid when i explain to others that i dont need compressibelity even though the density can change.
Thanks for the link too.

I'll try to fully grasp how the alpha equation and pressure correction are done, and then will try to develop the extra term for the variable density.

Thank you very much
kebsiali is offline   Reply With Quote

Old   June 3, 2015, 11:03
Default
  #9
Senior Member
 
Daniel Witte
Join Date: Nov 2011
Posts: 148
Rep Power: 14
danny123 is on a distinguished road
Hello Ali,

Your are welcome: just a tip: do start with the balance of species for both components and use the alpha2 = 1 - alpha1. The mass balance has to be zero, meaning div rho phi = 0. This is the starting point for the pressure equation.

Regards,

Daniel
danny123 is offline   Reply With Quote

Old   June 3, 2015, 12:02
Default
  #10
Senior Member
 
Saideep
Join Date: Apr 2015
Location: INDIA
Posts: 203
Rep Power: 12
Saideep is on a distinguished road
Hi Dan;

Firstly thanks for keeping this post alive.

I am confused over here hope you could help me. When you say interFoam is an incompressible solver, the densities of both the phases are constant as rho1 and rho2.

But when you consider VOF approach both the phases are merged together as a single phase and analysis is done such as, the rho in N-S equation is now the average of both phase densities and the weight is given by the quantity of the specific phase by the interface function alpha. As long as I have rho1 and rho2 as constant in my case I am good to use interfoam. Once I am out of this limitation I am no longer eligible to use this. similar technique is used to relate with the viscosity values.

However when you consider compressibility (to be fair I never worked over it.) the density of individual phase is subjected to change by any of the physical quantity such as Mach's number or so on.

Just correct me incase if I am wrong.

Saideep
Saideep is offline   Reply With Quote

Old   June 4, 2015, 03:51
Default
  #11
Senior Member
 
Daniel Witte
Join Date: Nov 2011
Posts: 148
Rep Power: 14
danny123 is on a distinguished road
Hi Saideep,

As you stated correctly, interFoam is a solver for 2 incompressible fluids, which each occupy a fraction of the space within one given cell. They shall not mix together, there is no mixing effect on density considered. The density in a cell is not the sum of both densities rho1 and rho2, but rho = alpha1 x rho1 + alpha2 x rho2, which is a simple "mixing" rule (there is an equally simple one for viscosity). That being said, density is not constant for a cell, but changes with composition. This is why you need an additional therm in UEq using the gradient of rho, which do not have in single phase incompressible solver such as icoFoam, pimpleFoam etc.

The relevant code is hidden within the turbulence section, which makes it very hard to get access to it (divDevRhoReff).

Regards,

Daniel
danny123 is offline   Reply With Quote

Reply


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
add heat equation to interFoam masoudpaktinat OpenFOAM Programming & Development 4 February 19, 2015 07:24
Calculation of the Governing Equations Mihail CFX 7 September 7, 2014 06:27
Estimate convection and diffusion terms in transport equation Lance CFX 0 April 4, 2011 11:16
interFoam + a scalar transport equation CYMa OpenFOAM 1 May 11, 2010 03:50
Question in definition of terms in solve titio OpenFOAM Running, Solving & CFD 0 March 19, 2009 16:02


All times are GMT -4. The time now is 05:54.