
[Sponsors] 
September 27, 2011, 07:04 
compressibilty effect in alphaEqn.H

#1 
Senior Member
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,265
Blog Entries: 1
Rep Power: 23 
i have two compressible flow , i would like to track interface between them
i can not use compressibleInterFoam , because the flow is self expanding due to pressure and temperature , and reaction conversion now my question is related to VOF method for compressible flow Code:
11) ddt (rho1*alpha1) + div(rho1*alpha1*U1) = 0 12)ddt (rho2*alpha2) + div(rho2*alpha2*U2) = 0 by simplifying 11 we have ddt (alpha1) + div (alpha1*U1) =alpha1(ddt (rho1) + U & grad (rho1) ) /rho1 now we add and subtract div (rho1 U) in the LS of above equation, so 2) ddt (alpha1) + div (alpha1*U1) = alpha1*div(U1); now we consider U = U1*alpha1* + U2*alpha2; and Ur = U1  U2; so U1 = U + Ur*alpha2; we rearange equation 2 to reach equation 3 : 3) ddt (alpha1) + div (alpha1*U)+div(Ur*alpha1*alpha2) = alpha1*div(U1); the LS of above euqation is what solved with interFoam, for interFoam which is for incompressible flows div(U1) is zero! so alpha1*div(U1) is the effect of compressibility of phase A) div(U1) =  (ddt(rho1) + u & grad (rho1))/rho1 or B) div(U1) = div (U) + div(Ur*alpha2) and none of them work wells, A) the interface is moving but the alpha gets unbounded after several iteration B) nothing happens, interface is fixed any hint or idea how to consider compressibilty effect in alphaEqn ? 

May 16, 2012, 12:05 

#2 
Senior Member
Illya Shevchuk
Join Date: Aug 2009
Location: Darmstadt, Germany
Posts: 176
Rep Power: 15 
Hi Nima,
I'm working on the same problem, but I have only thermal expansivity and no compressibility. First I wold like to ask, what is your status? Did you find a proper solution? Second question, which form of the pressure correction equation do you have? Generally I see two way to solve the VOF and the pressure correction equation (the similarity is that both of them have to ensure mass conservation): not conservative and conservative form, like I posted here The conservative form converges poorly and as far as I know becomes unstable for density ratio between both phases. The nonconservative converges much better, but then there is the question "how to obtain velocity divergence". This is exact the question you asked here. Mathematically, the RHS of your simplified eqn. 11 is equal to: so I use Code:
alpha1Su = alpha1/rho1*fvc::DDt(phi1,rho1) 

May 16, 2012, 13:00 

#3 
Senior Member
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,265
Blog Entries: 1
Rep Power: 23 
i calculate the source terms like below:
Code:
vDotP1 = fvc::ddt(rho1) + fvc::div(phi,rho1)  rho1*fvc:: div(phi); vDotP2 = fvc::ddt(rho2) + fvc::div(phi,rho2) rho2*fvc::div(phi); vDotAlpha = (pos(alpha2)*(vDotP2/rho2) + pos(alpha1)*(vDotP1/rho1)); 

May 16, 2012, 13:41 

#4 
Senior Member
Illya Shevchuk
Join Date: Aug 2009
Location: Darmstadt, Germany
Posts: 176
Rep Power: 15 
And you don't experience any problems with mass balance? I'll try your implementation, thanks a lot.


May 16, 2012, 13:49 

#5 
Senior Member
Illya Shevchuk
Join Date: Aug 2009
Location: Darmstadt, Germany
Posts: 176
Rep Power: 15 
in your implementation, vDotP1 is equal to fvc:Dt(phi,rho1), and vDotP2 to DDt(phi,rho2) respectively.
The third line looks like velocity divergence for entire flow, and not for a single phase, and this confuses me a little. Is your vDotAlpha an explicit source term for alpha1? Could you please tell me, how your MULES looks like? 

May 16, 2012, 14:17 

#7 
Senior Member
Illya Shevchuk
Join Date: Aug 2009
Location: Darmstadt, Germany
Posts: 176
Rep Power: 15 
Thanks again.
In you code I find this even more strage: Code:
Sp[celli] = vDotAlpha[celli]*alpha1[celli]; Su[celli] += vDotAlpha[celli]*alpha1[celli]; Due to my logic Code:
Sp[celli] = vDotAlpha[celli]; Su[celli] += vDotAlpha[celli]*alpha1[celli]; Last edited by linch; May 18, 2012 at 04:35. 

May 21, 2012, 08:38 

#9 
Senior Member
Illya Shevchuk
Join Date: Aug 2009
Location: Darmstadt, Germany
Posts: 176
Rep Power: 15 
Hi Nima,
me again here Sry, we had a long weekend here in Germany. Back to the topic:  I read again the thread you linked, but it is still not 100% clear for me, how can Sp and Su have the same form?  In the compressibleInterFoam our EOS reads rho1 = rho10 + psi1*p, so we can recast DDt(rho1) into psi1*DDt(p). But since you have temperature & pressure dependency of the density, means your EOS reads rho=rho(p,T), you have to modify the pEqn. May I ask how did you do it? Where do you update the density and what is the RHS of your pressure correction eqn.?  is your vDotAlpha the same as divU ? Best, Illya Last edited by linch; May 21, 2012 at 12:26. 

May 22, 2012, 01:28 

#10 
Senior Member
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,265
Blog Entries: 1
Rep Power: 23 
Hi Illya
psi is somehow (1/RT), so after temperature calculation, i update rho, then i calculate source term in pEqn from rho not p!, so it became an explicit source term for pressure equation 

May 22, 2012, 04:13 

#11 
Senior Member
Illya Shevchuk
Join Date: Aug 2009
Location: Darmstadt, Germany
Posts: 176
Rep Power: 15 
Hi Nima.
Explicit source term in pEqn means div(U), right? Do you have something like Code:
// update density // update vDotP1 & vDotP2 divU = alpha1*vDotP1/rho1 + alpha2*vDotP2/rho2; fvScalarMatrix p_rghEqnIncomp ( divU + fvc::div(phi)  fvm::laplacian(rUAf, p_rgh) ); Last edited by linch; May 22, 2012 at 04:36. 

May 22, 2012, 08:40 

#12 
Senior Member
Illya Shevchuk
Join Date: Aug 2009
Location: Darmstadt, Germany
Posts: 176
Rep Power: 15 
I've implemented the pressure correction like above, but the simple loop doesn't converge. Could you take a look and say, what do you think about it?
In expandableInterFoam.C: Code:
while (pimple.loop()) { #include "updateSinglePhaseProperties.H" // rho1, rho2 updated here Drho1Dt = fvc::ddt(rho1) + fvc::div(phi,rho1)  fvc::div(phi)*rho1; Drho2Dt = fvc::ddt(rho2) + fvc::div(phi,rho2)  fvc::div(phi)*rho2; rho == alpha1*rho1 + (scalar(1)  alpha1)*rho2; // update rhofield (changes due to temperature transport) divU = (alpha1*Drho1Dt/rho1 + (scalar(1)alpha1)*Drho2Dt/rho2); #include "UEqn.H" //  Pressure corrector loop while (pimple.correct()) { #include "pEqn.H" } #include "alphaEqnSubCycle.H" // rho, alpha1, phiAlpha updated here #include "updateFluxes.H" // rhoPhi1, rhoPhi, rhoCpPhi updated here #include "TEqn.H" } { /*************** continuity check ***************************/ volScalarField rhoAlpha1 = rho1*alpha1; rhoAlpha1.oldTime() = rho1.oldTime()*alpha1.oldTime(); volScalarField rhoAlpha2 = rho2*(scalar(1)alpha1); rhoAlpha2.oldTime() = rho2.oldTime()*(scalar(1)alpha1.oldTime()); contErr = fvc::ddt(rho)+fvc::div(rhoPhi); contErr1 = fvc::ddt(rhoAlpha1)+fvc::div(rhoPhi1); /***********************************************************/ } Code:
while (pimple.correctNonOrthogonal()) { fvScalarMatrix p_rghEqn ( fvm::laplacian(rAUf, p_rgh) == fvc::div(phi) + divU ); p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell)); p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter()))); if (pimple.finalNonOrthogonalIter()) { phi = p_rghEqn.flux(); } } Code:
for (int aCorr=0; aCorr<nAlphaCorr; aCorr++) { volScalarField dgdt ( IOobject ( "dgdt", runTime.timeName(), mesh ), (pos(scalar(1.0)  alpha1)*(Drho2Dt/rho2)  pos(alpha1)*(Drho1Dt/rho1)) ); divU = fvc::div(phi); alpha1Sp = dimensionedScalar("Sp",dimensionSet(0,0,1,0,0,0,0),0); alpha1Su = divU*alpha1; forAll(dgdt, celli) { if (dgdt[celli] > 0.0 && alpha1[celli] > 0.0) { alpha1Sp[celli] = dgdt[celli]*alpha1[celli]; alpha1Su[celli] += dgdt[celli]*alpha1[celli]; } else if (dgdt[celli] < 0.0 && alpha1[celli] < 1.0) { alpha1Sp[celli] += dgdt[celli]*(1.0  alpha1[celli]); } } phiAlpha = fvc::flux ( phi, alpha1, alphaScheme ) + fvc::flux ( fvc::flux(phir, scalar(1)  alpha1, alpharScheme), alpha1, alpharScheme ); MULES::explicitSolve(geometricOneField(), alpha1, phi, phiAlpha, alpha1Sp, alpha1Su, 1, 0); } Code:
div(phi,rho1) Gauss linear; div(phi,rho2) Gauss linear; 

May 22, 2012, 09:03 

#13 
Senior Member
Illya Shevchuk
Join Date: Aug 2009
Location: Darmstadt, Germany
Posts: 176
Rep Power: 15 
update: I had a small typo, it converges. But the mass conservation is still poor. I get local error in the order of 1e+02 and not 1e05


May 24, 2012, 07:40 

#14 
Senior Member
Illya Shevchuk
Join Date: Aug 2009
Location: Darmstadt, Germany
Posts: 176
Rep Power: 15 
Hi Nima,
is my procedure the same as yours, or do you have different pressure correction eqn.? Best regards, Illya 

May 24, 2012, 10:16 

#15 
Senior Member
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,265
Blog Entries: 1
Rep Power: 23 
hi dear Illya
sorry4 late answer, take a quick look on your code, it seems look a like, ofcourse i implemented it for PISO loop in OpenFOAM1.6, however i suggest you play with algorithm i prefer for example in each loop first update alpha1, then i have rhoPhi, then update rho from rhoEqn (rhoPhi), and so on .... keep the structure of compressibleInterFoam 

May 24, 2012, 11:18 

#16 
Senior Member
Illya Shevchuk
Join Date: Aug 2009
Location: Darmstadt, Germany
Posts: 176
Rep Power: 15 
Hi Nima,
thanks for the reply. On my opinion the order of equations doesn't really matter for me, since I have an outer (SIMPLE) loop over all equations till the solution converges. The reason to solve the alphaEqn after the pressure correction is following: alphaEqn needs volumetric fluxes "phi" coming from the momentum equation, so the fluxes of the alpha1phase "phiAlpha" are consistent with the volumetric fluxes "phi" in this way. What really wracks my brain is the mass imbalance. If I understood you write, you additionally solve the rhoEqn to ensure the continuity is satisfied I think this could be the solution of my problem. I'm sorry to terrorize you with my endless questions :), but I have a couple of them again: 1) Do you solve the rhoEqn twice, for each phase? 2) Do you solve the rhoEqn after the PISO loop, means at the end of your time step? A lot of thanks and best regards, Illya 

May 25, 2012, 04:52 

#18 
Senior Member
Illya Shevchuk
Join Date: Aug 2009
Location: Darmstadt, Germany
Posts: 176
Rep Power: 15 
Thank you Nima,
apparently I'm to dumb to get it 1) solving the continuity eqn. for rho could ensure the overall continuity, but not the continuity of each phase 2) solving rhoEqn in between doesn't ensure the mass balance, because of the density update following in the end of the timestep 3) we also implicitly include conti in alphaEqn and pEqn, but in a nonconservative form, what means only if the source terms in these equations are derived consistently with other equations and their discretization, mass conservation can be achieved 4) I use the same source term as you. Your mass balance is good, my not. Why? Do you use ideal gas law for the gas phase? Which EOS do you use for the liquid? How high are your temperature caused density variations beneath each phase (in %)? There must be a reasonable reason Best regards, Illya 

May 25, 2012, 05:18 

#19  
Senior Member
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,265
Blog Entries: 1
Rep Power: 23 
Quote:
Quote:
in each iteration, update rho total, based on continuity in end of iteration update rho based on mixture equation ( i guess this help each phase mass conservation) Quote:
Quote:
Quote:


May 25, 2012, 05:28 

#20 
Senior Member
Illya Shevchuk
Join Date: Aug 2009
Location: Darmstadt, Germany
Posts: 176
Rep Power: 15 
3) I mean, the source terms in alphaEqn and pEqn are based on single phase continuity equations.
If you have already published your results, would you mind giving me the whole solver to examine it carefully? 

Tags 
alpha1, compressibility, continuty, interfoam, mass balance, vof 
Thread Tools  Search this Thread 
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
alphaEqn.H in twoPhaseEulerFoam  cheng1988sjtu  OpenFOAM Bugs  15  May 1, 2016 16:12 
Can Flow3D solve the JouleThomson effect?  seasoul  FLOW3D  8  December 21, 2011 00:01 
Can 'shock waves' occur in viscous fluid flows?  diaw  Main CFD Forum  104  February 16, 2006 05:44 
VOF and strong surface tension effect  phsieh2005  Main CFD Forum  1  August 30, 2005 06:56 
Iclude particle diameter effect in wall?  yueroo  FLUENT  0  April 14, 2001 03:56 