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

Formulation in compressibleInterFoam

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

Like Tree28Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 20, 2019, 06:36
Default
  #61
Senior Member
 
Daniel
Join Date: Mar 2013
Location: Noshahr, Iran
Posts: 348
Rep Power: 19
Daniel_Khazaei will become famous soon enough
Quote:
Originally Posted by dduque View Post
Just a quick note to this, dduque, is my usual name. I had to use the previous one, ddcampayo, due to some glitch in the CFD-online user management system.

BTW, I am quite convinced my interpretation is mostly correct, with some technical details that I had wrong. If anyone is interested I can correct those.
Hi,

Well I'm interested
Would you please share your findings?

I'm trying to do the exact same thing.

Regards
EngMec likes this.
Daniel_Khazaei is offline   Reply With Quote

Old   April 17, 2020, 08:49
Default Energy equation
  #62
New Member
 
saeedbd
Join Date: Feb 2015
Posts: 6
Rep Power: 9
saeedbd is on a distinguished road
Hi foamers,

I am working on CompressibleInterFoam. I want to convert the T equation to a general energy conservation equation to remove some assumptions in the solver. Could you finally manage the energy equation?

Assuming the perfectGas and perfectFluid Eos, we have e=Cv*T for each phase where e is internal energy. So, I am replacing T with et/(Cv_water Y_water + Cv_air Y_air) in the solver (et is the total internal energy with et = e1*Y1 + e2*Y2. But it gives me wrong results for bubble collapse case. So in fact, the T equation in original solver is as:

Code:
fvScalarMatrix TEqn                                                                 
    (                                                                                   
        fvm::ddt(rho, T) + fvm::div(rhoPhi, T) - fvm::Sp(contErr, T)                    
      - fvm::laplacian(turbulence.alphaEff(), T)                                        
      + (                                                                               
            fvc::div(fvc::absolute(phi, U), p)()() // - contErr/rho*p                   
          + (fvc::ddt(rho, K) + fvc::div(rhoPhi, K))()() - contErr*K                    
        )                                                                               
       *(                                                                               
           alpha1()/mixture.thermo1().Cv()()                                            
         + alpha2()/mixture.thermo2().Cv()()                                            
        )                                                                               
     ==                                                                                 
        fvOptions(rho, T)                                                               
    );

and now is converted to

Code:
fvm::ddt(rho, et) + fvm::div(rhoPhi, et) - fvm::Sp(contErr, et)
      - fvm::laplacian(turbulence.alphaEff(), et)
      + (
            fvc::div(fvc::absolute(phi, U), p)()()
           // - contErr/rho*p 
          + (fvc::ddt(rho, K) + fvc::div(rhoPhi, K))()() - contErr*K
        )
      *(
           alpha1()/mixture.thermo1().Cv()() + alpha2()/mixture.thermo2().Cv()()
       )
      *(
         Y1*mixture.thermo1().Cv()()+Y2*mixture.thermo2().Cv()()                        
         )
        ==
        fvOptions(rho, et)


where Y is the mass fraction: et=Y1*e1 + Y2*e2 and e1=Cv1*T , e2=Cv2*T.


Also, I tried:

Code:
fvm::ddt(rho, et) + fvm::div(rhoPhi, et) - fvm::Sp(contErr, et)
      - fvm::laplacian(turbulence.alphaEff(), et)
      + (
            fvc::div(fvc::absolute(phi, U), p)()()
           // - contErr/rho*p 
          + (fvc::ddt(rho, K) + fvc::div(rhoPhi, K))()() - contErr*K
        )
        ==
        fvOptions(rho, et)


But it does not work properly as well. The temperature drops at the interface immediately. In more details, I don't know why et in the new energy equation remains constant while I checked that we have velocity and K is NOT zero! (How can it be possible?) Then, after a very small time step 10^-12, since we have Y_water = 0.1 in the gas side of the interface, Temperature drops suddenly according to T = et/(Cv_water*Y_water + Cv_air*Y_air).

The last point, it gives good results for the shock tube case which is not very dependent on temperature and energy.

Do you know how to solve the issue? Thank you for your time.

Saeed,
saeedbd is offline   Reply With Quote

Old   April 17, 2020, 13:19
Default
  #63
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,654
Blog Entries: 6
Rep Power: 48
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi,


so I am not familiar with the solver you are using and I am also not familiar with its equation. However, VOF solves only one question for energy/momentum and so on. Just one question, you are solving for the field et, which is what? An energy right, the total internal energy. So, how do you transform the energy back into the temperature? I cannot see anything here. Because, as you are not solving for T anymore, the T field should stay constant.

So actually, what you have to do is:
  • If possible, introduce a energy equation (maybe the one you have is fine)
  • Furthermore, you need to have the transformation from T -> e and back from e -> T


Hope this might help.
Tobi
saeedbd likes this.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   April 17, 2020, 13:44
Default
  #64
New Member
 
saeedbd
Join Date: Feb 2015
Posts: 6
Rep Power: 9
saeedbd is on a distinguished road
Hi Tobi,

Thank you very much for giving your feedback. Regarding the Temperature, I am obtaining it within the T = et/(Cv_water*Y_water + Cv_air*Y_air) equation which is based on perfectFluid and perfectGas. So to put it into a nutshell, I initialize the system with et=e1Y1+e2*Y2 and then solve the et equation. Then I update the T, based on the new et using the above equation.

Best,
saeedbd is offline   Reply With Quote

Old   April 17, 2020, 14:31
Default
  #65
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,654
Blog Entries: 6
Rep Power: 48
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Okay, got it. Is e = Cv T correct?
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   April 17, 2020, 14:32
Default
  #66
New Member
 
saeedbd
Join Date: Feb 2015
Posts: 6
Rep Power: 9
saeedbd is on a distinguished road
Yes with the considered EoSs.
I found an issue with the defined tolerance for et. So now it is being solved and this problem "I don't know why et in the new energy equation remains constant" is solved.
Tobi likes this.
saeedbd is offline   Reply With Quote

Old   April 29, 2020, 04:26
Post
  #67
New Member
 
Zhongqi Zuo
Join Date: May 2018
Location: China
Posts: 5
Rep Power: 5
MrZZQi is on a distinguished road
Hi openFoamers,

Thanks for your great discussion, it really helps a lot.

However, when I look through the code, I find this term very confusing to me

Code:
p_rghEqnComp1 & p_rgh
This term is explained as 'p_rgh in p_rghEqnComp1' by Richard, and treated as 'Dp/Dt', so did Daniel do in his derivation.

But as I know & is "inner product", the operator is redefined in fvMatrix.C. p_rghEqnComp1 is a fvMatrix, p_rgh is a scalar field, how can the term be interpreted as Dp/Dt?

Anybody can help? Thanks a lot.

Zuo
MrZZQi is offline   Reply With Quote

Old   September 9, 2021, 15:36
Default
  #68
Member
 
Z
Join Date: Feb 2020
Posts: 90
Rep Power: 4
Shibi is on a distinguished road
Hello to all,

I am also trying to understand the formulation of compressibleInterFoam for OpenFOAM ESI. However, the formulation is not clear to me.

I would like to request a further clarification on the formulation of compressibleInterFoam.

From the paper of Miller et al [1], previously referred to in this post, the pressure equation should be:

\left ( \frac{\alpha_1 \psi_1}{\rho1}+\frac{\alpha_2 \psi_2}{\rho2} \right )\left [ \frac{\partial P}{\partial t} + \vec{v} \cdot \nabla P\right ] + \nabla \cdot \vec{v}=0

Or, to better use the divergence theorem:

\left ( \frac{\alpha_1 \psi_1}{\rho1}+\frac{\alpha_2 \psi_2}{\rho2} \right )\left [ \frac{\partial p}{\partial t} + \nabla \cdot \left ( p \vec{v} \right) - p \left ( \nabla \cdot \vec{v} \right)  \right] + \nabla \cdot \vec{v}=0

With the last term on the lefh hand side, \nabla \cdot \vec{v}, we create a incompressiblePEqn and with the remainder terms a compressiblePEqn.

I took a look into the compressibleInterFoam from foam-exted. The pEqn.H has:

An incomplete CompressiblePEqn written as:
Code:
    if (pimple.transonic())
    {
        pEqnComp =
            (fvm::ddt(p) + fvm::div(phi, p) - fvm::Sp(fvc::div(phi), p));
    }
    else
    {
        pEqnComp =
            (fvm::ddt(p) + fvc::div(phi, p) - fvc::Sp(fvc::div(phi), p));
    }
Which should be: \left [ \frac{\partial p}{\partial t} + \nabla \cdot \left ( p \vec{v} \right) - p \left ( \nabla \cdot \vec{v} \right) \right]

The incompressiblePEqn which is derived by substituting the cell center velocity from the momentum equation.

Code:
        fvScalarMatrix pEqnIncomp
        (
            fvc::div(phi)
          - fvm::laplacian(rUAf, p)
        );
Now, the complete pressure Equation is assembled and solved as:

Code:
        solve
        (
            (
                max(alpha1, scalar(0))*(psi1/rho1)
              + max(alpha2, scalar(0))*(psi2/rho2)
            )
           *pEqnComp()
          + pEqnIncomp
        );
\left ( \frac{\alpha_1 \psi_1}{\rho1}+\frac{\alpha_2 \psi_2}{\rho2}  \right )\left [ \frac{\partial p}{\partial t} + \nabla \cdot \left ( p  \vec{v} \right) - p \left ( \nabla \cdot \vec{v} \right)  \right] +  \nabla \cdot \vec{v}=0

After solving the pressure equation, a dgdt term is updated with:
Code:
            dgdt =
                (pos(alpha2)*(psi2/rho2) - pos(alpha1)*(psi1/rho1))
                *(pEqnComp & p);
The volume fraction equation in [1] is written as:

\frac{\partial \alpha_1}{\partial t} + \nabla \cdot \left ( \alpha_1 \vec{v} \right) - \alpha_1 \left ( \nabla \cdot \vec{v} \right) = \alpha_1 \alpha_2\left ( \frac{\psi_1\rho_2 - \psi_2 \rho_1}{\alpha_1 \psi_1 \rho_2 + \alpha_2 \psi_2 \rho_1} \right ) \nabla \cdot \vec{v}

Here are my questions:


1 Is the formulation used in [1], the one in compressibleInterFoam?

2 Is it the same formulation on all branches of OpenFOAM (ESI, ORG and extend)?

3 is dtdg = right and side of the above equation?

4 What is the purpose of doing the dot product (&) between a scalarMatrix and a volScalarField? What is the mathematical representation of this operation?

5 In OpenFOAM(ESI) the compressible part (non-transonic) of the pressure equation we have:

Code:
        p_rghEqnComp1 =
            pos(alpha1)
           *(
                (
                    fvc::ddt(alpha1, rho1) + fvc::div(alphaPhi1*rho1f)
                  - (fvOptions(alpha1, mixture.thermo1().rho())&rho1)
                )/rho1
              - fvc::ddt(alpha1) - fvc::div(alphaPhi1)
              + (alpha1*psi1/rho1)*correction(fvm::ddt(p_rgh))
             );
Could anyone explain the lines:
Code:
                    fvc::ddt(alpha1, rho1) + fvc::div(alphaPhi1*rho1f)
                  - (fvOptions(alpha1, mixture.thermo1().rho())&rho1)
                )/rho1
               - fvc::ddt(alpha1) - fvc::div(alphaPhi1)
Additionally why is it not using the terms: \nabla \cdot \left ( p \vec{v} \right) - p \left ( \nabla \cdot \vec{v} \right) ?

6 Apart from [1] is there any other literature on the formulation of compressibleInterFoam?


Best Regards!


----
[1] -Miller, S. T., Jasak, H., Boger, D. A., Paterson, E. G., & Nedungadi, A. (2013). A pressure-based, compressible, two-phase flowa finite volume method for underwater explosions. Computers and Fluids, 87, 132143. https://doi.org/10.1016/j.compfluid.2013.04.002
Shibi is offline   Reply With Quote

Old   December 30, 2021, 01:04
Default
  #69
Member
 
hari charan
Join Date: Sep 2021
Location: India,hyderabad
Posts: 60
Rep Power: 2
saicharan662000@gmail.com is on a distinguished road
Hi Nat,
I know the post is old. But can you describe the evolution of step 4 mathematically instead of describing it in words?
Thanks in advance.
saicharan662000@gmail.com is offline   Reply With Quote

Old   December 30, 2021, 01:47
Default
  #70
Member
 
hari charan
Join Date: Sep 2021
Location: India,hyderabad
Posts: 60
Rep Power: 2
saicharan662000@gmail.com is on a distinguished road
Hello nat,
Can u explain the evolution of step 3 to step 4 using math instead of words.
Thanks in advance.
saicharan662000@gmail.com is offline   Reply With Quote

Reply

Tags
compressible, compressibleinterfoam, theory

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
Low Reynolds Number k-epsilon formulation CFX 10.0 Chris CFX 4 December 7, 2009 23:51
Immersed Boundary Formulation Rave Main CFD Forum 0 August 11, 2008 14:55
DPM Steady formulation with collisions kulwinder FLUENT 0 May 22, 2004 18:44
energy equation formulation Pedro Phoenics 1 July 5, 2001 12:17
Compressible vs. Incompressible formulations Fernando Velasco Hurtado Main CFD Forum 3 January 7, 2000 16:51


All times are GMT -4. The time now is 08:00.