|
[Sponsors] |
single phase, incompressible, flow with gravity |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
February 28, 2017, 12:20 |
single phase, incompressible, flow with gravity
|
#1 |
New Member
rik houthuys
Join Date: Jan 2017
Posts: 27
Rep Power: 9 |
Hi All,
I've read several discussions in this forum about including the gravity body force in pisoFoam or similar solvers. The most successful approach seems to be the one implemented in interFoam, i.e. using the following term in UEqn: Code:
ghf*fvc::grad(rho) So, I tried to get through this problem and I've modified icoFoam using two approaches and I want to discuss them here and see if there's any better approach or if we can modify them to get better. In the first approach I've just add the gravity body force to the UEqn and I didn't change any other parts in the code. The new UEqn will be like: Code:
fvVectorMatrix UEqn ( fvm::ddt(U) + fvm::div(phi, U) - fvm::laplacian(nu, U)==fvc::grad(gh) ); The results for the pressure was almost like the analytical solution (hydro-static pressure distribution) while unfortunately I get some velocities near the upper and lower walls while velocities should be zero everywhere. You can see the results in the attachment. In the second approach I just combined the gravity force with pressure and called it p_gh where: Code:
p_gh = p-gh -grad(p)+grad(gh) = -grad(p-gh)=-fvc::grad(p_gh) Code:
while (runTime.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; #include "CourantNo.H" // Momentum predictor fvVectorMatrix UEqn ( fvm::ddt(U) + fvm::div(phi, U) - fvm::laplacian(nu, U) ); if (piso.momentumPredictor()) { solve(UEqn == -fvc::grad(p_gh)); } // --- PISO loop starts here while (piso.correct()) { volScalarField rAU(1.0/UEqn.A()); volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_gh)); surfaceScalarField phiHbyA ( "phiHbyA", fvc::flux(HbyA) + fvc::interpolate(rAU)*fvc::ddtCorr(U, phi) ); adjustPhi(phiHbyA, U, p_gh); // Update the pressure BCs to ensure flux consistency constrainPressure(p_gh, U, phiHbyA, rAU); // Non-orthogonal pressure corrector loop while (piso.correctNonOrthogonal()) { // Pressure corrector fvScalarMatrix pEqn ( fvm::laplacian(rAU, p_gh) == fvc::div(phiHbyA) ); pEqn.setReference(pRefCell, pRefValue); pEqn.solve(mesh.solver(p.select(piso.finalInnerIter()))); if (piso.finalNonOrthogonalIter()) { phi = phiHbyA - pEqn.flux(); } } #include "continuityErrs.H" U = HbyA - rAU*fvc::grad(p_gh); U.correctBoundaryConditions(); p = p_gh + gh; } The only problem with this approach is that you have to set the pressure b.c carefully for p_gh. So, in your opinion, is the second approach is suitable in general? does it need improvement? or should we use totally different approach? |
|
March 1, 2017, 14:05 |
|
#2 |
Senior Member
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 22 |
Did you look at the implementation of buoyantBoussinesqSimpleFoam (buoyantBoussinesqPimpleFoam)? This should do what you want. Or perhaps twoLiquidMixingFoam.
|
|
March 6, 2017, 11:40 |
|
#3 | |
New Member
rik houthuys
Join Date: Jan 2017
Posts: 27
Rep Power: 9 |
Quote:
Actually both solvers use density gradient to introduce the gravity body force, e.g.: Code:
- ghf*fvc::snGrad(rho) |
||
March 16, 2017, 08:55 |
|
#4 |
Senior Member
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 22 |
Sorry for the late reply. But if you have constant density, what should be the effect of gravity?
|
|
March 17, 2017, 12:08 |
|
#5 |
Senior Member
Santiago Lopez Castano
Join Date: Nov 2012
Posts: 354
Rep Power: 16 |
I don't see the point of putting gravity if you are not solving a variable density, or buoyancy-driven, flow
Sent from my GT-I8190L using CFD Online Forum mobile app |
|
January 4, 2018, 22:42 |
|
#6 |
Member
Federico Zabaleta
Join Date: May 2016
Posts: 47
Rep Power: 10 |
Hi rick,
I've been trying to do the same. I don't really understand what do you mean by "gh". Is it only g? is g*z (if z is your vertical direction)? I have implemented g in icoFoam adding g to transport properties as a vector and in the U equation as follows, Code:
fvVectorMatrix UEqn ( fvm::ddt(U) + fvm::div(phi, U) - fvm::laplacian(nu, U) - g ); if (piso.momentumPredictor()) { solve(UEqn == -fvc::grad(p)); } Where you able to solve this problem? Could you please explain me what did you mean by gh and how did you defined it in the case? (Sorry for the silly questions, first time trying to programming in OF) Best, |
|
February 9, 2018, 17:57 |
|
#7 | |
Senior Member
Santiago Lopez Castano
Join Date: Nov 2012
Posts: 354
Rep Power: 16 |
Quote:
|
||
June 18, 2022, 05:57 |
|
#8 |
Member
Mahmoud
Join Date: Nov 2020
Location: United Kingdom
Posts: 43
Rep Power: 6 |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
mass flow in is not equal to mass flow out | saii | CFX | 12 | March 19, 2018 06:21 |
Turbulence model for two phase incompressible flow | SailorLiu | OpenFOAM Running, Solving & CFD | 2 | April 4, 2016 08:53 |
two-phase flow with a single phase simulation | caunima | Fluent Multiphase | 0 | October 28, 2013 03:42 |
Mass flow rate of phase in post | mat_cfd | CFX | 0 | September 3, 2013 08:55 |
Incompressible single phase mixing of two fluids | phinallydone | OpenFOAM Running, Solving & CFD | 4 | August 2, 2010 00:28 |