|
[Sponsors] |
Minimal hacking to interFoam to add funny gravity |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 9, 2016, 17:08 |
Minimal hacking to interFoam to add funny gravity
|
#1 |
New Member
Daniel Duque
Join Date: Jan 2011
Location: ETSIN, Madrid
Posts: 28
Rep Power: 15 |
Hi,
I had this idea to model a Rayleigh-Taylor instability for the simplest possible case. I needed a funny gravity field that would pull up on one of the phases, and down on the other. I hacked the interFoam solver minimally, and I think I have got correct results. My first trial was actually succesful. UEqn.H was changed to: Code:
MRF.correctBoundaryVelocity(U); fvVectorMatrix UEqn ( fvm::ddt(rho, U) + fvm::div(rhoPhi, U) + MRF.DDt(rho, U) + turbulence->divDevRhoReff(rho, U) == fvOptions(rho, U) // fake gravity field + (2*alpha1-1) * rho * g ); UEqn.relax(); fvOptions.constrain(UEqn); if (pimple.momentumPredictor()) { solve ( UEqn == fvc::reconstruct ( ( mixture.surfaceTensionForce() - ghf*fvc::snGrad(rho) // - fvc::snGrad(p_rgh) - fvc::snGrad(p) ) * mesh.magSf() ) ); fvOptions.correct(U); } But then I thought adding the gravity on the right-hand side of the equation would be more correct: Code:
MRF.correctBoundaryVelocity(U); fvVectorMatrix UEqn ( fvm::ddt(rho, U) + fvm::div(rhoPhi, U) + MRF.DDt(rho, U) + turbulence->divDevRhoReff(rho, U) == fvOptions(rho, U) ); UEqn.relax(); fvOptions.constrain(UEqn); if (pimple.momentumPredictor()) { solve ( UEqn == fvc::reconstruct ( ( mixture.surfaceTensionForce() - ghf*fvc::snGrad(rho) // - fvc::snGrad(p_rgh) - fvc::snGrad(p) ) * mesh.magSf() ) // fake gravity field + (2*alpha1-1) * rho * g ); fvOptions.correct(U); } comparison_step_60.jpg Thanks in advance for any help! |
|
March 9, 2016, 21:54 |
|
#2 |
Senior Member
Pablo Higuera
Join Date: Jan 2011
Location: Auckland
Posts: 627
Rep Power: 19 |
Hi Daniel,
probably you have not switched on the momentum predictor in fvSolution, it is usually switched off by default. Best, Pablo |
|
March 10, 2016, 06:09 |
|
#3 | |
New Member
Daniel Duque
Join Date: Jan 2011
Location: ETSIN, Madrid
Posts: 28
Rep Power: 15 |
Quote:
You are right, it would seem that " if (pimple.momentumPredictor()) " would require the momentum predictor step. However, I have tried enabling it and now the velocity seems to evolve ... but not the pressure, which does not change, or the color field. Aside from " momentumPredictor yes;" at the PIMPLE section, I had to add the following to fvSolutions. Code:
UFinal { $U; solver smoothSolver; smoother symGaussSeidel; tolerance 1e-06; relTol 0; } [It's actually grad( p - rho g z ) + rho z grad(rho), but it's the same ] |
||
March 10, 2016, 08:12 |
|
#4 |
Senior Member
Pablo Higuera
Join Date: Jan 2011
Location: Auckland
Posts: 627
Rep Power: 19 |
Hi again,
not really, you should always include it in the first one (to assemble the system of equations properly), and if you want a momentum predictor, also in the second equation. Momentum predictor just solves an intermediate step and updates U. Then it applies that value to obtain the independent terms (explicit) and solve the PPE. Otherwise, the U used is the one from the beginning of the time step. Best, Pablo |
|
March 10, 2016, 09:03 |
|
#5 |
New Member
Daniel Duque
Join Date: Jan 2011
Location: ETSIN, Madrid
Posts: 28
Rep Power: 15 |
Thanks, that seems to work. I find little difference with the previous results, but that may be ok. To check incompressibility, I am running foamCalc div phi, and the resulting field is between about -3e-4 and 3e-4. I guess that's small. Perhaps all this could go in another thread.
|
|
Tags |
interfoam;ueqn, rayleigh-taylor |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
InterFoam: Add an equation to only one phase | voingiappone | OpenFOAM Programming & Development | 41 | June 7, 2022 10:04 |
InterFoam: add a source term in alpha eq. | Alucard | OpenFOAM Programming & Development | 12 | November 5, 2017 20:16 |
Add source term in alphaEqn.H of interFoam | tayo | OpenFOAM | 1 | October 23, 2013 04:40 |
how to add source-term in momentum equation for interFoam? | anon_g | OpenFOAM | 9 | October 18, 2011 13:47 |
add temperature equation to interFoam | nygbook | OpenFOAM Running, Solving & CFD | 3 | September 4, 2011 08:28 |