# Implement simple barotropic relation - derive density field from pressure field

 Register Blogs Members List Search Today's Posts Mark Forums Read

 May 27, 2015, 03:49 Implement simple barotropic relation - derive density field from pressure field #1 New Member   Gert-Jan Meijn Join Date: Apr 2015 Posts: 8 Rep Power: 8 Dear all, For my thesis I want to research cavitation by using barotropic relations (like Delannoy & Kueny in 1990). This has the advantage that I don't necessarily need a complex multiphase solver, but can use a simple compressible solver combined with a barotropic relation to solve the problem. To be more specfic, I want to use a hyperbolic tangent to model the transition from liquid density to vapor density and this function is completely depending on the pressure. I am looking for a quick and dirty way to implement this barotropic equation into a compressible solver. Meaning that I would like to update my density simply by relating it to a curve that gives density as a function of pressure, if you know the pressure field, the density should follow directly. To my understanding most OpenFOAM-solvers get the density field by evaluating the pressure-field, and after this, perform a density update by calling 'thermo.rho()'. Thus far I've been looking at compressible solvers like rhoCentralFoam or rhoSimpleFoam but they all go back to the thermophysical part and perform some kind of method like 'thermo.correct()' to update the density and other properties. I find the thermophysical part of OpenFOAM extremely difficult to comprehend, so I am wondering if there is an easier way to relate the density to the pressure-field, a simple function that takes the pressure-field and directly manipulates it into the density-field without intervention of the thermophysical modules, can anything go wrong with that? Or am I stuck with the thermophysical module and need to insert a new 'equation of state' into the existing files, but where do I start with that? Can anybody help me or send me an example to look at? You would make my day!

 March 4, 2016, 10:06 #2 Senior Member   Sandy Lee Join Date: Mar 2009 Posts: 213 Rep Power: 15 I also have the same question. Why there is no a cavitation model by using barotropic relations (like Delannoy & Kueny in 1998) in OF? I also want to inplement Delannoy's relations into interPhaseChangeFoam solver instead of alpha equation, however, I am failed. Who can help? ---------- Dear all, In the interPhaseChangeFoam solver, there are some cavitation models by using tranport equation, such as kunz's model, merkly's model. However, I want to implement a cavitation model by using barotropic relations, namley Delannon & Kueny's model (1998), into interPhaseChangeFoam solver instead of alpha equation, but I could not get the correct results. I would like to know, who also try it? Please help. Sandy Last edited by wyldckat; March 13, 2016 at 16:18. Reason: merged similar posts

 March 8, 2016, 21:16 #3 Senior Member   Sandy Lee Join Date: Mar 2009 Posts: 213 Rep Power: 15 Code: ```while (pimple.correctNonOrthogonal()) { fvScalarMatrix p_rghEqn ( fvm::ddt(psi, p_rgh) + fvc::div(phiHbyA) - fvm::laplacian(rhorAUf, p_rgh) ); p_rghEqn.setReference(pRefCell, pRefValue); p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter()))); p_rgh.correctBoundaryConditions(); if (pimple.finalNonOrthogonalIter()) { phi = (phiHbyA + p_rghEqn.flux())/rhof; p_rgh.relax(); U = HbyA + rAU*fvc::reconstruct((phig + p_rghEqn.flux())/rhorAUf); U.correctBoundaryConditions(); fvOptions.correct(U); } }``` I use this p_rgh equation, but I don't know why I could not get divergent results. Who can help me to find the problem? Thank you very much! Last edited by wyldckat; March 13, 2016 at 16:19. Reason: Added [CODE][/CODE] markers

 March 13, 2016, 16:26 #4 Retired Super Moderator   Bruno Santos Join Date: Mar 2009 Location: Lisbon, Portugal Posts: 10,962 Blog Entries: 45 Rep Power: 123 Quick question: Doesn't cavitatingFoam do what you're asking for, namely to use barotropic compressibility? There is a thread on this topic here: http://www.cfd-online.com/Forums/ope...equations.html Also see the OpenFOAM User Guide, section "3.7 Standard libraries". edit: And search in this page: http://www.tfd.chalmers.se/~hani/kurser/OS_CFD_2014/ - for this: "Baris Bicer: Implementation of Transport Model into CavitatingFoam to simulate the Cavitation in Diesel Injector Nozzle." __________________ OpenFOAM: FAQ | Getting started Forum: How to get help, to post code/output and forum guide Read this before sending me PM Last edited by wyldckat; March 13, 2016 at 16:27. Reason: see "edit:"

 March 29, 2016, 09:20 how to write pEqn.C #5 Senior Member   Sandy Lee Join Date: Mar 2009 Posts: 213 Rep Power: 15 Hi Bruno, Thanks for the reply. However, I think there are many differences in the barotropic equation between cavitatingFoam and Delannoy & Kueny's . I don't know how to write a pEqn.C for Delannoy & Kueny's model as like as it in cavitatingFoam. Could you help me? Sandy

 May 3, 2016, 05:28 Could not get correct results #6 Senior Member   Sandy Lee Join Date: Mar 2009 Posts: 213 Rep Power: 15 Hi Bruno, I did many tries, but I still could not get convergent results. Do you know the reasons. Please help. Sandy

May 8, 2016, 15:43
#7
Retired Super Moderator

Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,962
Blog Entries: 45
Rep Power: 123
Hi Sandy,

Sorry, but unfortunately this is beyond my level of expertises and currently for these next few months I'm busy beyond my capabilities

Nonetheless:
Quote:
 Originally Posted by sandy I did many tries, but I still could not get convergent results. Do you know the reasons.

In the meantime, good luck and I hope anyone else can step in!

In case you don't get an answer here on the forum, you might want to try and hire someone to assist you, either:
1. Ask for assistance on this forum: http://www.cfd-online.com/Forums/cfd-freelancers/
2. Or contact one or more of the companies listed here: https://openfoamwiki.net/index.php/T...rontpage_Links
Best regards,
Bruno

 Tags barotropic, cavitation, compressible fluids