CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   varying rho value in interfoam (https://www.cfd-online.com/Forums/openfoam-solving/105549-varying-rho-value-interfoam.html)

shash August 2, 2012 06:39

varying rho value in interfoam
 
hi all openfoamers,

i have been trying to inculcate a variable rho for one of the phases in openfoam but could not do it , rho has been defined as dimensionedscalar in interfoam for both phases but i want volscalarfield for at least one of the phases, can someone help me with this :)

kmooney August 2, 2012 23:24

interFoam calculates rho with a color function (alpha) weight. Off the top of my head, for a particular cell the density rho=rho1*(alpha)+(1-alpha)*rho2. If you are trying to alter one of the density fields you might have to get fancy with the density treatment.

kmooney August 2, 2012 23:38

In order to make this change you'll need to declare a density field (volScalarField) and change out the density and viscosity computation in /src/transportModels/incompressible/incompressibleTwoPhaseMixture

To perform the computations in the two phase mixture library you might have to do a database look up to grab the density field you made above. I'll try to find some syntax to make that easy.

kmooney August 2, 2012 23:47

Assuming you declared the density field correctly, you could try this in the twoPhaseTransportProperties library,:

const volScalarField& rho =
mesh().lookupObject<volScalarField>("myRhoField");

shash August 4, 2012 03:29

thanks kyle for ur detailed answer , i already tried creating volscalarfield for rho2 but didn't really know where else changes need to be done , i will try ur changes :).

nimasam August 4, 2012 06:57

look at compressibleInterFoam, it gives you the idea how to implement a varialbe rho! in that solver rho is varying by pressure!

shash August 11, 2012 14:51

@nimasam : can i just change p from the rho eqn. and replace with a new scalarfield may be s1 , since most of the strategies used in compressibleinterfoam are same as in interfoam , can you plaese tell me what are the differences in these two.
thanks :)

shash August 11, 2012 14:55

@kyle : i tried ur method but didn't work , may be i did something work
"Assuming you declared the density field correctly, you could try this in the twoPhaseTransportProperties library,:

const volScalarField& rho =
mesh().lookupObject<volScalarField>("myRhoField");
"

this part was not clear to me , please detail it a little.
thanks :)

nimasam August 11, 2012 20:45

Hi shashank
its better you define your question better, how rho changes?
but about your question, as you said the main part of interFoam and compressilbeInterFoam are the same! however interFoam solve for constant rho and it is for incompressilbe flow, but compressibleInterFoam defines rho as function of pressure, actually it considers both phase as isothermal perfect gas which
rho=rho0+si*p and si is 1/RT ,
also check pEqn.H and alphaEqn.H to see how to consider compressibility in Equations

shash August 12, 2012 05:03

hi nimasam,

i am trying to implement rho=rho0+k*s1; k=constant and s1 is a volscalarfield , so i was thinking if just replacing p with s1 will do the job

nimasam August 12, 2012 16:15

not exactly!
as i said before its better to compare interFoam and compressibleInterFoam to see how rho dependency to pressure has effect in equations specially in pEqn.H and alphaEqn.H

kebsiali April 14, 2015 05:02

dear shiv

Sorry for bringing this post up from the grave
but did you succeed in implementing a variable density (for one of the phases)
if yes can you please help my showing how

my density is a function of T,P, and some other passive scalars but first i want to know how to turn it into volScalarField, what and where to make changes so everything adapts with it.

Thanks in advance


All times are GMT -4. The time now is 13:12.