CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   what is the purpose of rhoMin and rhoMax in fvsolution (http://www.cfd-online.com/Forums/openfoam-solving/103941-what-purpose-rhomin-rhomax-fvsolution.html)

mihaipruna June 29, 2012 10:09

what is the purpose of rhoMin and rhoMax in fvsolution
 
I noticed the simulation aborts if the limits are breached, but why are units specified there as well?
rhoMin rhoMin [1 -3 0 0 0] 0.01;
rhoMax rhoMax [1 -3 0 0 0] 100.0;

wyldckat June 30, 2012 07:12

Hi Mihai,

The units are probably supplied for the sake of completeness, while also making it easier to access when reading the dictionary file.
This way it's not necessary to first read the value to a "scalar" variable and then add dimensions by creating a "dimensionedScalar" based on the first one. These dimensions are necessary for field operations, since the "rho" field has dimensions itself.

Best regards,
Bruno

mihaipruna July 2, 2012 09:06

I think I understand. Is it because rho is derived?

wyldckat July 2, 2012 09:19

Example: https://github.com/OpenFOAM/OpenFOAM...createFields.H

Code:

autoPtr<basicPsiThermo> pThermo
    (
        basicPsiThermo::New(mesh)
    );
    basicPsiThermo& thermo = pThermo();

    volScalarField rho
    (
        IOobject
        (
            "rho",
            runTime.timeName(),
            mesh,
            IOobject::READ_IF_PRESENT,
            IOobject::AUTO_WRITE
        ),
        thermo.rho()
    );

//....

    dimensionedScalar rhoMax(simple.dict().lookup("rhoMax"));
    dimensionedScalar rhoMin(simple.dict().lookup("rhoMin"));

As you can see, this makes it easier to read from the dictionary file. As for the "rho" field, it's initialized with the "basicPsiThermo" based structure... which I'll leave to you as an exercise: http://foam.sourceforge.net/docs/cpp/index.html

edit: forgot to mention: rho is used here: https://github.com/OpenFOAM/OpenFOAM...pleFoam/pEqn.H


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