- **OpenFOAM Running, Solving & CFD**
(*http://www.cfd-online.com/Forums/openfoam-solving/*)

- - **Nonconservative gammaEqn**
(*http://www.cfd-online.com/Forums/openfoam-solving/57810-nonconservative-gammaeqn.html*)

Hi all OpenFOAMers,
I want Hi all OpenFOAMers,
I want to deal with density currents (water/water with salt) simulations and, to do so, I depart from the twoLiquidMixingFoam and, as a first step, include the RANS libraries (OF-1.5.x). If turbulence has to be taken into account, the gamma equation has to be modified including the turbulent diffusion coefficient, obtained from the turbulent viscosity. The new form of the gammaEqn is then: fvScalarMatrix gammaEqn ( fvm::ddt(gamma) + fvm::div(phi, gamma) - fvm::laplacian(Deff, gamma) - (fvc::grad(gamma) & fvc::grad(Deff)) //turbulence ); where Deff=Dab + turbulence->nut()/Prc; where Prc (or particle Schmidt number) has to be defined by the user). The surprising thing is that, during the simulations, the total salt concentration (gamma.weightedAverage(mesh.V()).value()) increases, let's say, 5%. However, when I delete from gammaEqn the new term corresponding to variable diffusivity, the total salt mass is conserved. I tried to modify the numerical schemes for gammaEqn, the default ones are: grad(gamma) Gauss linear; grad(Deff) Gauss linear; div(phi,gamma) Gauss vanLeer; but OF only allows me to modify the div scheme. I tested also limitedLinear01 but the imbalance was worst, of about 11% of mass increase. The mesh is structured and orthogonal. Has anyone any idea of what's going on? elisabet |

Hi Elisabet
I did a similarHi Elisabet
I did a similar exercise some time ago, thus I went into my implementation. Apparently the only difference is that I didn't have - (fvc::grad(gamma) & fvc::grad(Deff)) in my gamma equation, as I took the programmersguide quite literally (correct, I do not know), but I had mass conservation nevertheless. Adding the above made it becomes non-conserving. Good luck, Niels |

Hi Niels,
Thanks for your aHi Niels,
Thanks for your answer. I cannot omit this term as, when you develop the equations taking into account that Deff is not constant, this new term (or other similar expressions) appears. Any suggestion? elisabet |

Just for a clarification, so wJust for a clarification, so when the programmers guide states, that
laplacian(gamma,U) = Nab dot (gamma Nab U) then the implementation does only return gamma laplace U which is why one have to manually add Nab U dot Nab gamma? If that is the case, I have to re-visit the implementation my-self. Thanks and I will keep my head spinninghttp://www.cfd-online.com/OpenFOAM_D...part/happy.gif Niels |

Hi Niels,
I guess I'm wrongHi Niels,
I guess I'm wrong. Ok, in momentum equation and for incompressible fluids you have: div(tau) = div(nu_eff grad(u)) + grad(nu_eff):grad(u) hence, I just implemented the same procedure for gammaEqn, what I guess it's not correct. I've found some references for these kinds of flows and no one says anything of this extra term. However, the diffusion coefficient is not constant and takes the form Deff = D_laminar + nu/Sc, where Sc is around 0.7-0.9 If I keep this notation, then, the algorithm is conservative. Sorry for the confusion and thanks for making me think more about it. Tell me, please, if I'm missing anything. elisabet |

Hi Elisabet
Well, you have Hi Elisabet
Well, you have made me unsure, thus I went into the source, and at least for fvc:laplacian, see http://foam.sourceforge.net/doc/Doxy...8C-source.html l. 114, it is calculated by considering the diffusion as constant, however I have a hard time understanding whether or not the fvm:laplacian does that as well. For something quite different: You say that Sc = 0.7-0.9, but since you are dividing nu_t with this value, you state that the diffusion of the agent is more effective than the diffusion of the water. For turbulent flows it seems counter-intuitive to me? I considering a small test, as my company needs to clearify the above, thus I will come back on the question of the laplacian. /Niels |

Hi Niels,
Check in src/finiHi Niels,
Check in src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplaci anScheme.C About the particle Sc number, it is defined as: Sc=nu_t/D_t, where subscript t stands for turbulent. And the same occurs with the thermal Prandtl number in the thermal diffusion coefficient of energy equation. However, in momentum equation your effective viscosity is directly: nu_eff=nu_lam + nu_t. All this comes from the Eddy Viscosity Model (or Boussinesq assumption). elisabet |

Here are a few thoughts for thHere are a few thoughts for the above discussion.
After using the version of twoLiquidMixingFoam modified to include the RANS libraries by Niels I have been wondering why the gammeEqn should be modified to include the turbulent diffusivity? As I see it, when mixing fresh and salt water the diffusion between the two phases is far most dominated by the turbulent spreading. If you imagine a tank with still water and a dense bottom layer and a light top layer I would believe that the mixing of the two phases would be very small. Therefore when the turbulence model is included this should take care of the spreading/mixing of the two phases through the UEqn. At this point I see the gamma field as a passive scalar used to specify the combined density of the two phases thus any additional diffusion (beside the turbulence diffusion in the UEqn) is not included. If more diffusion is needed i.e. due to molecular diffusion between the two phases a value can be assigned to the Dab factor in the gammaEqn. Niels, you mention that the only difference is that your version didn't have -(fvc::grad(gamma)&fvc::grad(Deff)) If you remember after testing your version we realized that the diffusion between the two phases was significantly too high. A simple lock-exchange test ended up with total mixing of the two phases. Based on the thoughts about where to include the turbulence diffusivity I removed the turbulent diffusivity from the gammaEqn and thereby having the original formulation (setting the Dab factor = 0) and including the turbulence as turbulence->nut() only in the UEqn. This gave a remarkable improvement of the mixing results. Elisabeth, have you tried to make a test (lock-exchange or similar) with the version where you have deleted the line: -(fvc::grad(gamma)&fvc::grad(Deff)) It would be interesting to see if you will experience the same over predicted mixing as we have, as that was what made me think about the issue of including turbulence diffusivity in both gammaEqn and UEqn. Bjarne |

Hi
I have revisited the abHi
I have revisited the above problem. I have run a lock-flow which measures 2 times 10 m i 2D. The densities of the two liquids are 1000 and 990 respectively. The initial setup is two identically sized columns which are released. The problem is solved as a test to look at the mixing rate with a k-epsilon model on a structured and uniformly distributed mesh, thus the effect of boundaries is neglected at present. I have solved it without the additional term discussed above as it should not be there (one can show that the term in the momentum equation shows up because it is a vector field). Further the eddy viscosity is present in the gamma equations, as it needs to be there to mimic the turbulent mixing. The results look rather encouraging with a nice lockflow, see figure, where the above is discretized using 112*512 cells and the one below is discretized using 56*256 cells. So, apparently the mixing seems to be qualitatively correct and I think the chosen way of implementing the mixing of two liquids is the correct way to go. http://www.cfd-online.com/OpenFOAM_D...your_image.gif Best regards, Niels |

Hmmm, it didn't work. Though tHmmm, it didn't work. Though this does:
http://www.student.dtu.dk/~ngja/lockFlow.png Best regards, Niels |

Hi Niels,
I did a similar rHi Niels,
I did a similar run some weeks ago and I got also nice results. However, we are planning to compare them with experimental data and see exactly how accurate it is. Moreover, I would need to have a correct interface tracking in the top, and I still have to learn more about it. Oh! and don't forget about a new turbulence model that includes the Richardson number! So.... still lots of pendent work... Best regards, elisabet |

Hi Elisabet
So what you basHi Elisabet
So what you basically need to do is couple this advection-diffusion problem with a VOF-method or the interTrackFoam and let the solution from the advection-diffusion effect the density? However dangerous a word like basic might behttp://www.cfd-online.com/OpenFOAM_D...part/happy.gif I am not working on it myself, but I now that those who do have had a problem finding experimental data regarding stratified flows, thus do you have any references you wish to share, or are you going to do the experiments by yourself? Good luck, Niels P.S. From Milan, I recall you talked about fusion reactors ... isn't a large step to begin looking at stratified flow due to salt and I assume significantly smaller temperatures? |

Hi Niels,
As you've said deHi Niels,
As you've said density currents is not my field, but I know some people working on it in Barcelona and Rome and I'm trying to collaborate with them, at least in a long term. They are planning to do some experiments and to analyze some experimental results, but still anything is published, sorry. By the way, you remember well: my research field is MHD applied to fusion. About interTrackFoam I experienced some stability problems for unstructured meshes when the Froude number is very low (in version 1.4.1-dev) so I will repeat the same calculations (not right now) with the new version. Also, the implementation of the Richardson approximation in k-epsilon turbulence model is not straight forward and I should spend more time on it. If you have any experience in one of these two fields, please, do not hesitate sharing it! Best regards, elisabet |

Hi Elisabet
Just a quick quHi Elisabet
Just a quick question / comment regarding the turbulence modeling: 1. With respect to the momentum equation, you need the uncorrected eddy viscosity (un-corrected meaning no effect of Richardson number). 2. With respect to the gamma-equation, you need the corrected eddy viscosity. So why is it you want to change the turbulence model and not simply modify the eddy viscosity before applying it to the gamma-equation (i.e. outside the turbulence library), as you need the non-corrected for the momentum?!? I am not strong in mixing, thus I might be on the wrong track. By the way, is the modification of the eddy viscosity based on a local Richardson number or a global one? And how do you define the turbulent diffusion coefficient D_t, if Sc is local and thereby unknown? Does it imply the use of an additional equation? I was at a seminar this Friday, where Håkan Nilsson noted that the standard kOmegaSST does not give reasonable results for swirling flows. The comparison I have made with the same model for mixing does produce to much mixing (to large nu_t I guess in the interior of the domain), thus Håkan introduced a filtered version and achieved significantly better results. It might be interesting with respect to the present problem!?! Have a nice weekend, Niels |

P.S. Send me an email as I havP.S. Send me an email as I have some information on the filtered version, I can forward to you.
/Niels |

Hi Niels,
Sorry for the delHi Niels,
Sorry for the delay, I was quite busy with other things. First of all, there are some nowadays public experimental results with density currents. Take a look at: Quote:
Quote:
Regards, elisabet |

Additional Term in Turbulence FormulationHi and good-morning
I have read the second reference by now, and I agree that one need to modify the turbulence formulation. Thanks for shedding some light on it. I do not fully understand the thermodynamic approximations / relations in the appendix and "T" is left undefined (I am guessing temperature?). However it is merely details. What I am thinking is that one need to decide whether to model turbulence generation due to the density fluctuations or the temperature (?) fluctuations. This is because I can easily imagine flows where T is constant and the density is varying, and one wants to make the implementation as generic as possible!? Enjoy your day, Niels |

Hi Elisabet
Thank you for the thorough explanation. Have a nice weekend, Niels |

Hi Elisabeth, Niels
The explanation about boussinesq assumption was really interesting... Im a new foamers and im a little confused about the equations... Indeed i work with buoyantSimpleFoam solver and i though that the boussinesq assumption was considered but i saw on the forum that there is a "special" boussinesq-approximation solver. So I guess this approximation is not used in buoyantSimpleFoam. If im right, i would like to know which density approximation or density law is used in buoyantSimpleFoam to solve the equations It's maybe a stupid question... Sorry |

All times are GMT -4. The time now is 04:24. |