CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   rhoInf value, postProcess (https://www.cfd-online.com/Forums/openfoam/207972-rhoinf-value-postprocess.html)

ms123 October 7, 2018 15:06

rhoInf value, postProcess
 
Hello FOAMers,

I'm new in OF and I'm a little confused about the value of "rhoInf". I'm using the interDyMFoam solver (which means that my fluids are incompressible) and I want to calculate the forces and the moments on a patch of my simulation model. In the "system" file I've already copied the "forcesIncompressible" file. Now, in order to run
Code:

interDyMFOAM -postProcess -func forcesIncompressible
I have to define a "rhoInf" in the "forcesIncompressible" file. I have a two phase model and my transportPoperties file looks like this:
Code:

phases (water air);

water // oil ISOVG150

{ transportModel  Newtonian;

nu            nu  [0 2 -1 0 0 0 0] 2.280290891e-05;
rho            rho [1 -3 0 0 0 0 0] 811.3; }

air

{ transportModel Newtonian;

nu            nu    [0 2 -1 0 0 0 0] 213.5e-07 ;
rho            rho  [1 -3 0 0 0 0 0] 0.9859;  }

sigma          sigma [1 0 -2 0 0 0 0] 0.02843192;

I've read many discussions but nowhere was it clearly explained. I've tried to set as rhoInf the density of my oil, but the results aren't physically right.
Is there someone who could help me?

Tobi October 8, 2018 10:29

Hi, as far as I know, the force calculation can only be used for single phase flows. You should be able to use the functionality for your case too but I am not sure if the result will be fine (if the object is in both fluids, I would expect that the result is wrong). However, the keyword rhoInf is used for incompressible calculations because the functionObject does not know the density. Thus, the keyword has to be used to tell the application which value has to be used for the calculation, cf. https://cpp.openfoam.org/v6/forces_8C_source.html

Code:

    if (directForceDensity_)
    {
        // Optional entry for fDName
        fDName_ = dict.lookupOrDefault<word>("fD", "fD");
    }
    else
    {
        // Optional entries U and p
        pName_ = dict.lookupOrDefault<word>("p", "p");
        UName_ = dict.lookupOrDefault<word>("U", "U");
        rhoName_ = dict.lookupOrDefault<word>("rho", "rho");
 
        // Reference density needed for incompressible calculations
        if (rhoName_ == "rhoInf")
        {
            dict.lookup("rhoInf") >> rhoRef_;
        }
 
        // Reference pressure, 0 by default
        pRef_ = dict.lookupOrDefault<scalar>("pRef", 0.0);
    }

As you already said:
Quote:

I have to define a "rhoInf" in the "forcesIncompressible" file.
, you have to add the rhoInf keyword to the forcesIncompressible file. However,
Quote:

I've tried to set as rhoInf the density of my oil, but the results aren't physically right.
tells me that you already did it with wrong results. So either you did something wrong or the lib cannot be used for your purpose.

wdx_cfd November 1, 2018 01:12

Quote:

Originally Posted by Tobi (Post 709323)
Hi, as far as I know, the force calculation can only be used for single phase flows. You should be able to use the functionality for your case too but I am not sure if the result will be fine (if the object is in both fluids, I would expect that the result is wrong). However, the keyword rhoInf is used for incompressible calculations because the functionObject does not know the density. Thus, the keyword has to be used to tell the application which value has to be used for the calculation, cf. https://cpp.openfoam.org/v6/forces_8C_source.html

Code:

    if (directForceDensity_)
    {
        // Optional entry for fDName
        fDName_ = dict.lookupOrDefault<word>("fD", "fD");
    }
    else
    {
        // Optional entries U and p
        pName_ = dict.lookupOrDefault<word>("p", "p");
        UName_ = dict.lookupOrDefault<word>("U", "U");
        rhoName_ = dict.lookupOrDefault<word>("rho", "rho");
 
        // Reference density needed for incompressible calculations
        if (rhoName_ == "rhoInf")
        {
            dict.lookup("rhoInf") >> rhoRef_;
        }
 
        // Reference pressure, 0 by default
        pRef_ = dict.lookupOrDefault<scalar>("pRef", 0.0);
    }

As you already said:

, you have to add the rhoInf keyword to the forcesIncompressible file. However,

tells me that you already did it with wrong results. So either you did something wrong or the lib cannot be used for your purpose.

Hi Tobi,

I have a similar problem.

I also used interDyMFoam to simulate the wave-sturcture interaction. I wanted to calculate the total force of the structure in my numerical wave tank and I adopted this force functions in my controlDict:

forceOFcaisson
{
type forces;
libs ("libforces.so");

writeControl timeStep;
writeInterval 1;

rho rhoInf; // Incompressible solver
rhoInf 1000;
log off;

patches (caisson);
CofR (0 0 0);
}

The structure (patch) is fixed and named with "caisson", and the simulation is three-demensional so the structure is a little complicated. The pressure obtained by function "Probes" agrees good with that obtained by sensors in the experiment. The shape of the two curves of the total force (vertical and horizontal) seems good. However, the value seems not right. We believe that the kinematic pressure is greater than it should be.

My question is:

Is there a way to obtain the total force of a complicated structure (patch) when using interFoam?

Thank you very much!

D.X. Wang


All times are GMT -4. The time now is 23:40.