
[Sponsors] 
June 6, 2013, 02:58 

#41  
New Member
NaiXian Leslie Lu
Join Date: Jun 2009
Location: France
Posts: 26
Rep Power: 8 
Quote:
Have a good day. Leslie
__________________
Cheers, Leslie LU 

July 2, 2014, 06:08 

#42  
New Member
Cong Gu
Join Date: Jun 2013
Posts: 7
Rep Power: 4 
Quote:
dgdt = (psi2 / rho2  psi1 / rho1) *DDt(p  rho * g * h). But in the derivation, it is dgdt = (psi2 / rho2  psi1 / rho1) * DDt(p). They are not equivalent, are they? 

July 2, 2014, 11:55 

#43 
Member
Richard Kenny
Join Date: Mar 2009
Posts: 64
Rep Power: 10 
Hello Gucong,
the expression looks like a variation on the original (circa OF17) but I think the same reasoning/derivation still applies, but now of course it appears the 'dynamic' and 'static' components of the pressure are clearly indicated. Recalling that the static contribution is written as p0 + rho (g . z), and hence the sign. I've just scanned the OF23x version of compressibleInterfoam and it seems a lot more is going on in pEqn these days, possibly with a view to stabilizing the explicit terms. If the latter fails then and the average density is varying considerably I think an alternative approach similar to the old dieselFoam might be more appropriate. But that's getting offtopic. Regards, Richard K. 

July 2, 2014, 15:38 

#44  
New Member
Cong Gu
Join Date: Jun 2013
Posts: 7
Rep Power: 4 
Quote:
Regards, 

July 2, 2014, 21:21 

#45 
Member
Richard Kenny
Join Date: Mar 2009
Posts: 64
Rep Power: 10 
In p(tot) = pd + p0 + rho (g . z),
p0 = 0 and 'vector' g = (0, 0, g), which accounts for the sign. Rgds, Richard K. 

July 2, 2014, 21:42 

#46 
New Member
Cong Gu
Join Date: Jun 2013
Posts: 7
Rep Power: 4 

July 2, 2014, 22:49 

#47 
Member
Richard Kenny
Join Date: Mar 2009
Posts: 64
Rep Power: 10 
Oh right, sorry for the misinterpretation.
But otherwise, DDt(p) != DDt(p_rgh) owing to the spatial cpt of DDt(..), but presumably this latter is assumed to be much smaller than the value of ddt(p). It would be interesting to verify numerically. RGK 

December 11, 2014, 14:30 

#48 
Member
james wilson
Join Date: Aug 2014
Location: Orlando, Fl
Posts: 31
Rep Power: 3 
Kenny,
Thanks for your guidance on this topic. Your reference to: fvScalarMatrix psiConvectionDiffusion ( fvm::ddt(rho, psi) + fv::gaussConvectionScheme<scalar>(mesh, phi, UDs).fvmDiv(phi, psi) // fv::gaussLaplacianScheme<scalar, scalar>(mesh, CDs, snGrads) //.fvmLaplacian(Dpsif, psi)  fvm::Sp(Sp, psi)  Su ); Is found in "IMULESTemplates.C" for a call to Foam::MULES::implicitSolve. We however are using a call to Foam::MULES::explicitSolve found in MULESTemplates.C (as youve specified) where the structure of the fvScalarMatrix is less clear: " template<class RhoType, class SpType, class SuType> void Foam::MULES::explicitSolve ( const RhoType& rho, volScalarField& psi, const surfaceScalarField& phi, surfaceScalarField& phiPsi, const SpType& Sp, const SuType& Su, const scalar psiMax, const scalar psiMin ) { const fvMesh& mesh = psi.mesh(); const scalar rDeltaT = 1.0/mesh.time().deltaTValue(); psi.correctBoundaryConditions(); limit(rDeltaT, rho, psi, phi, phiPsi, Sp, Su, psiMax, psiMin, 3, false); explicitSolve(rDeltaT, rho, psi, phiPsi, Sp, Su); } " Could you comment on this portion of the code and extend your explanation to cover this specific template the compressibleInterFoam solver uses? Your explanation of the source term implementation using "fvScalarMatrix psiConvectionDiffusion (...)" makes sense but THIS template is not being used. I am assuming MULES::explicitSolve operates the same way as MULES::implicitSolve in terms of how the source terms are passed using the template where the solution of course is different. Using this style of source term distribution in openFoam, I have been able to validate analytic Stefan type problems, so I do not doubt it's validity one bit. I would however, like to gain a deeper understanding of the form of the FV equations such that I can get creative with new source terms. I've modified the compressibleInterFoam solver to output Su, Sp and divU (=alpha1*divU). I have a line plot along the centerline at y and a surface plot of Su and Sp at the instant the line plots are shown in the attached images. I hope this helps with visualization. Looking at the surface plot of Sp, there are portions of the gaseous phase where Sp is non zero. I would assume that this non zero contribution in the alpha equation would lead to unbounding of alpha in the gasseous phase. If the solver does take the form described by kenny where Sp > Sp*alpha1 however, this non zero portion would have no contribution since alpha = 0 in this region and therefore would support Kenny's argument. One final note, The images shown here correspond to expanding gas.. when the gas cools due to convection and diffusion of thermal energy, the sign of the source terms change since the gas is now contracting and the interface must move inward, and as a result, the assignment of divU should change as well divU > Su (expand) vs. divU > Sp (contract) to promote diagonal dominance. It is not treated intuitively in this manner in the default solver. Food for thought ; ) James Su: Screenshot from 20141212 08:59:22.jpg; Sp: Screenshot from 20141212 09:03:51.jpg Last edited by jameswilson620; December 12, 2014 at 10:17. Reason: adding result data 

December 28, 2014, 05:32 

#49  
Senior Member
Dongyue Li
Join Date: Jun 2012
Location: Torino, Italy
Posts: 738
Rep Power: 8 
Quote:
DDt( rho1 ) = DDt( rho1_0 ) + (psi1 / rho1) DDt( p ) If Im wrong correct it pls. 

January 5, 2015, 18:51 

#50 
Member
james wilson
Join Date: Aug 2014
Location: Orlando, Fl
Posts: 31
Rep Power: 3 
So in case anyone is interested..
a call to MULES::explicitSolve(geometricOneField(), alpha1, phi, tphiAlpha(),Sp,Su, 1, 0); references this template in MULESTemplates.C for OF2.3 Code:
template<class RhoType, class SpType, class SuType> void Foam::MULES::explicitSolve ( const RhoType& rho, volScalarField& psi, // Note the use of the pointer, I believe this is how psi is updated without explicitly defining a "return psi" const surfaceScalarField& phi, surfaceScalarField& phiPsi, const SpType& Sp, const SuType& Su, const scalar psiMax, const scalar psiMin ) { const fvMesh& mesh = psi.mesh(); const scalar rDeltaT = 1.0/mesh.time().deltaTValue(); psi.correctBoundaryConditions(); limit(rDeltaT, rho, psi, phi, phiPsi, Sp, Su, psiMax, psiMin, 3, false); //I haven't looked much into this explicitSolve(rDeltaT, rho, psi, phiPsi, Sp, Su); //CALL TO ANOTHER TEMPLATE WHERE PSI IS SOLVED FOR THE NEXT TIME STEP } Code:
template<class RdeltaTType, class RhoType, class SpType, class SuType> void Foam::MULES::explicitSolve ( const RdeltaTType& rDeltaT, const RhoType& rho, volScalarField& psi, const surfaceScalarField& phiPsi, const SpType& Sp, const SuType& Su ) { Info<< "MULES: Solving for " << psi.name() << endl; const fvMesh& mesh = psi.mesh(); scalarField& psiIf = psi; // initialize psiIf const scalarField& psi0 = psi.oldTime(); // Store old values of psi for solution psiIf = 0.0; // Set psiIf to zero fvc::surfaceIntegrate(psiIf, phiPsi); // Calculate divergence of phiPsi; update psiIf as result //NOTE: psiIf is utilized for two purposes here. It is used to advance psi in time (what were after) and also as a temporary dummy variable to store the value of the divergence of phiPsi if (mesh.moving()) { psiIf = ( mesh.Vsc0()().field()*rho.oldTime().field() *psi0*rDeltaT/mesh.Vsc()().field() + Su.field()  psiIf )/(rho.field()*rDeltaT  Sp.field()); } else { // VOF EQUATION // (psiIf(unknown)  psi0)/dt + psiIf(known dummy place holder for divergence of phiPsi) = psiIf(unknown)*Sp + Su // OR // ddt(psi) + div(phiPsi) = psi*Sp + Su // Now solve for psiIf, the unknown value of psiIf at t+dt by re arranging the above expression psiIf = ( rho.oldTime().field()*psi0*rDeltaT + Su.field()  psiIf // Divergence )/(rho.field()*rDeltaT  Sp.field()); }//NOTE rho.field() is geometricOneField() (simply = 1) psi.correctBoundaryConditions(); } Can anyone comment on limit(rDeltaT, rho, psi, phi, phiPsi, Sp, Su, psiMax, psiMin, 3, false) from the first template? James 

March 30, 2015, 02:36 

#51 
New Member
Sasa Goran
Join Date: Feb 2015
Location: Japan
Posts: 23
Rep Power: 3 
OK, i've been looking at this transportationProperties file for a couple of days now, and i'm none the wiser. I guess i figured out how to set rho0 (initial density, i guess, and equals 0 for compressible fluids) and pMin (i guess it's the minimum pressure, and should be above 0) but this psi thing bother me to death. It's compresibity, but i've never seen such a formulation, all the data i can get for psi is for the [1/MPa] unit, not the [s^2/m^2] as specified in the file.
I would grealty appreciate it if someone could help me out in finding the values for psi (ATM i need water and air) or tell me where a good database is. Also culd you clarify my guesses about rho0 and pMin, or explain what they are indeed. Thank you guys in advance. Edit: OK found out. The 1/MPa formulation comes from \beta = ( d_rho / d_p ) / rho So multiplying beta by rho should give psi Last edited by Supersale; March 31, 2015 at 01:03. 

May 2, 2015, 11:39 

#52  
New Member
Francis Lee
Join Date: Jul 2013
Location: Jiangsu, China
Posts: 20
Rep Power: 4 
Quote:
I saw three expressions for rho: rho1 = rho1_0 + psi1 * p rho1 = rho1_0 + psi1 * (p  p_0) rho1 = psi1 * p In all cases, rho1_0 and p_0 are constants, their material derivative should be zero. From its definition, psi1 is isothermal compressibility, aka, be a constant when temperature fixed. So, DDt(rho1) = psi1 * DDt(p) 

May 2, 2015, 11:42 
temperature equation in compressibleInterFoam

#53  
New Member
Francis Lee
Join Date: Jul 2013
Location: Jiangsu, China
Posts: 20
Rep Power: 4 
Hi guys,
Recently I'm learning the solver compressibleInterFoam in OpenFOAM2.3.x. From the discussion above, I've already figure out the pressure equation and alpha equation, What bothers me is the temperature equation, which seems to be derived from specific total internal energy equation: ddt(rho * e) + div(rho * U * e) + ddt(rho * K) + div(rho * U * K) = div(U * p) + laplacian((Cp/Cv) * (kappa / Cp), e) where e = Cv * T, e has dimension J/kg, and Cv has dimension J/kg/K. For a multiphase flow, and in solver's description: Quote:
But for specific total internal energy, the equation is derived based on the conservation of energy in a control volume (cell). I think the total energy in a computation cell should be taken as mass average of both phases. Let us use Y1, Y2 denote mass fraction and alpha1, alpha2 denote the volume fraction of two phases. And Cv denotes the specific heat capacity at constant volume of the mixture, Cv1 and Cv2 for each phase. In my opinion, Cv = Y1*Cv1 + Y2*Cv2, so let the energy equation be devided by Cv, we get ddt(rho * T) + div(rho * U * T)  laplacian((Cp/Cv) * (kappa / Cp), T) + (ddt(rho * K) + div(rho * U * K) + div(U * p))/Cv = 0 but in the TEqn: Code:
fvScalarMatrix TEqn ( fvm::ddt(rho, T) + fvm::div(rhoPhi, T)  fvm::laplacian(twoPhaseProperties.alphaEff(turbulence>mut()), T) + ( fvc::div(fvc::absolute(phi, U), p) + fvc::ddt(rho, K) + fvc::div(rhoPhi, K) ) *( alpha1/twoPhaseProperties.thermo1().Cv() + alpha2/twoPhaseProperties.thermo2().Cv() ) ); Also I think the term twoPhaseProperties.alphaEff(turbulence>mut()) should be twoPhaseProperties.alphaEff(turbulence>alphat()) or turbulence>alphaEff(), note that the last two expression are equivalent. The only difference is that in OpenFOAM alphat = mut / Prt. Can anybody help me with these? 

October 10, 2015, 17:24 

#54  
New Member
Cong Gu
Join Date: Jun 2013
Posts: 7
Rep Power: 4 
Quote:
http://www.sciencedirect.com/science...45793013001229 

October 10, 2015, 18:36 

#55  
New Member
Cong Gu
Join Date: Jun 2013
Posts: 7
Rep Power: 4 
Quote:
ddt( alpha_1 * rho_1 * (Cv_1 * T + K) ) + div( alpha_1 * rho_1 * U * (Cv_1 * T + K) )  laplacian(kappa_1 , T ) * alpha_1 * rho_1 / rho + div( p * U ) * alpha_1 * rho_1 / rho + alpha_1 * rho_1 * g dot U = 0 Note that the thermal diffusion and mechanical work are distributed to the phases in proportion to the mass. Then expand the first two terms by product rule and apply conservation of phase mass ddt(alpha_1 * rho1) + div(alpha_1 * rho_1 * U) = 0 Should get alpha_1 * rho_1 * ddt(Cv_1 * T + K) + alpha_1 * rho_1 * U dot grad(Cv_1 * T + K) for the first two terms. And let alpha_Eff = (alpha_1 * kappa_1 / Cv_1) + (alpha_2 * kappa_2 / Cv_2) Divide the whole equation by (rho_1 * Cv_1), maybe assuming constant Cv_1. Then sum it with the similar equation for phase 2. Finaly multiply the sum with rho. You should arrive at similar things in the code, except some small deviations in the work of gravity. They use p_rgh instead of p, which should take care of work by gravity. But it gets complicated if rho is changing. Last edited by gucong; October 11, 2015 at 04:33. 

November 12, 2015, 03:07 

#56  
New Member
Francis Lee
Join Date: Jul 2013
Location: Jiangsu, China
Posts: 20
Rep Power: 4 
Quote:
It's more clear now. But I don't understand the div( p * U ) * alpha_1 * rho_1 / rho term, should it be div( p * U ) * alpha_1? 

Tags 
compressible, compressibleinterfoam, theory 
Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Low Reynolds Number kepsilon formulation CFX 10.0  Chris  CFX  4  December 8, 2009 00: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 17:51 