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/)
-   -   OpenFoam 2.2 fvOptions temperature limits (http://www.cfd-online.com/Forums/openfoam-solving/117348-openfoam-2-2-fvoptions-temperature-limits.html)

fredo490 May 7, 2013 01:28

OpenFoam 2.2 fvOptions temperature limits
 
Dear all,
As some of you know, OF 2.2 introduce a new system of "fvOptions" files where we can set the porosity and so on...
There is another interesting command that is "temperatureLimitsConstraint". As its name says, it is used to constraint the temperature to a minimum and maximum value.

Because I didn't find any example online, here is my file:
You have to put it into the "fvOptions" file located in system
Code:

source1
{
    type            temperatureLimitsConstraint;
    selectionMode  all;
    active          true;

        temperatureLimitsConstraintCoeffs
        {
            Tmin    220;
            Tmax    270;
        }
}

This command will bound the temperature between 220K and 270K in all the domain. It is useful in some cases if your compressible solver can't catch the value temperature value during the first iterations.

Edit: the page description come from here: http://www.openfoam.org/version2.2.0/fvOptions.php

hsmao July 11, 2013 14:39

Thanks for the tip!

Does this work for all compressible solvers? I tried adding this to sonicFoam and it seems to get ignored.

fredo490 July 11, 2013 17:49

As I remember, sonic foam is mostly hard coded so it might not work.
To check, find the thermo equation in the source code and check if you can find a line with "+ fvoptions" or something similar.

ksv July 11, 2013 21:10

Hi Fredo,
Thanks for your tip. May i know whether there exists similar options to control turbulent kinetic energy k and epsilon?
ksv

fredo490 July 12, 2013 04:11

For k, omega et epsilon, you can add a simple code such as:
Code:

        k= max(k, kMin);
        k= min(k, kMax);

where kMin and kMax can be defined in the code or by a dimensionedScalar and a IOdictionary.

We must use fOption for T because T is not a variable used by OpenFoam. The function "fOption" actually modify the thermo equation (enthalpy) to correct the temperature.

vkrastev April 30, 2014 06:19

Hi all,

sorry for re-opening this thread but I'm using the temperatureLimitsConstraint in conjunction with chtMultiRegionFoam (OF-2.2.x, latest available update) and it actually doesn't seem to me it's working as it is supposed to. The fvOptions dict appears to be read properly, but when the enthalpy equation is solved the temperature violates the imposed bounds, even if all the discretization schemes should be bounded/limited. Here there are my fvSchemes and fvOptions dictionaries (there is only one fluid region at this stage), together with an extract of runtime output log.

fvSchemes:
Code:

ddtSchemes
{
    default        Euler;
}

gradSchemes
{
    default        cellMDLimited Gauss linear 1;
    grad(U)        cellMDLimited Gauss linear 0.5;
    //grad(h)        faceLimited Gauss linear 1;
   
}

divSchemes
{
    default        none;
    div(phi,U)      bounded Gauss linearUpwindV grad(U);
    div(phi,K)      bounded Gauss linear;
    div(phi,h)      bounded Gauss limitedGamma 1 264157 294289;
    div(phi,k)      bounded Gauss upwind;
    div(phi,epsilon) bounded Gauss upwind;
    div(R)          Gauss linear;
    div((muEff*dev2(T(grad(U))))) Gauss linear;
}

laplacianSchemes
{
    default        none;
    laplacian(muEff,U) Gauss linear limited 0.333;
    laplacian(Dp,p_rgh) Gauss linear limited 0.333;
    laplacian(alphaEff,h) Gauss linear limited 0.333;
    laplacian(DkEff,k) Gauss linear limited 0.333;
    laplacian(DepsilonEff,epsilon) Gauss linear limited 0.333;
}

interpolationSchemes
{
    default        linear;
}

snGradSchemes
{
    default        limited 0.333;
}

fluxRequired
{
    default        no;
    p_rgh;
}

fvOptions:
Code:

temperature_constraints
{
    type          temperatureLimitsConstraint;
    active        yes;
    selectionMode cellZone;
    cellZone      fluid;
   
        temperatureLimitsConstraintCoeffs
        {
            Tmin    263;
            Tmax    293;
        }
       
}

log:
Code:

Region: fluid Courant Number mean: 1.4132369e-05 max: 0.98128545
deltaT = 2.381967e-05
Time = 0.000100306


Solving for fluid region fluid
diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
DILUPBiCG:  Solving for Ux, Initial residual = 0.00081227894, Final residual = 1.6049071e-07, No Iterations 1
DILUPBiCG:  Solving for Uy, Initial residual = 0.07792845, Final residual = 1.8250737e-05, No Iterations 1
DILUPBiCG:  Solving for Uz, Initial residual = 0.0014009406, Final residual = 3.9984243e-07, No Iterations 1
DILUPBiCG:  Solving for h, Initial residual = 0.000399081, Final residual = 8.990734e-08, No Iterations 1
Min/max T:262.29196 299.81974
Min/max rho:1.1716795 1.347332
GAMG:  Solving for p_rgh, Initial residual = 0.0007644805, Final residual = 1.345729e-05, No Iterations 3
GAMG:  Solving for p_rgh, Initial residual = 6.2938682e-05, Final residual = 1.757067e-06, No Iterations 2
diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors (fluid): sum local = 3.6194871e-09, global = -1.1723455e-09, cumulative = 9.1079573e-09
Min/max rho:1.1709893 1.3499513
GAMG:  Solving for p_rgh, Initial residual = 1.1436979e-05, Final residual = 3.3044886e-07, No Iterations 2
GAMG:  Solving for p_rgh, Initial residual = 2.5426255e-06, Final residual = 4.4810886e-08, No Iterations 2
diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors (fluid): sum local = 9.2017652e-11, global = -1.1644798e-11, cumulative = 9.0963125e-09
DILUPBiCG:  Solving for epsilon, Initial residual = 4.9736441e-05, Final residual = 2.2259148e-08, No Iterations 1
DILUPBiCG:  Solving for k, Initial residual = 8.5244714e-13, Final residual = 1.2977543e-16, No Iterations 1
bounding k, min: 4.9998752e-16 max: 1.15 average: 0.0022126182

Any comments about this?

V.

crmccreary July 15, 2014 15:08

Typically in a CHT analysis, the system directory will have subdirectories for each region. Did you put the fvOptions file in the relevant subdirectory? Also, at the top of the log file, OpenFOAM will tell you what it has read from the fvOptions file.

*UPDATE*
Same behavior here. Doesn't seem to limit the temperature at all.

vkrastev July 15, 2014 15:57

Quote:

Originally Posted by crmccreary (Post 501622)
Did you put the fvOptions file in the relevant subdirectory?

Yes.



Quote:

Originally Posted by crmccreary (Post 501622)
*UPDATE*
Same behavior here. Doesn't seem to limit the temperature at all.

Well, in my case the wrong max/min temperatures in the domain appeared to be related to the externalWallHeatFluxTemperature boundary condition, which is evidently affected by some bad implementation issue in the OF-2.2.x branch and goes always unstable unless an EXTREMELY fine near wall grid is arranged (I've checked this behavior for a simple 2D buoyancy driven cavity flow, see this tread for further details: http://www.cfd-online.com/Forums/ope...tml#post496092 ). Regarding the fvOptions temperature constraint, I haven't investigated it any further so I cannot add more useful information about it.

Best

V.

crmccreary July 15, 2014 16:33

I was using the 2.3.x branch. Temperature in the solid blows up, not obeying the fvOptions limit. I suspect that, for some reason, diffusion at the boundary becomes zero thus zero heat flux at the boundary and the applied heat flux (fixed gradient on the solid) yields a near infinite temperature on the solid. Just a guess.

derekm December 30, 2014 09:27

THis does work in chtMultiRegionSimpleFoam in V2.3.1


in conjunction with scalarSemiImplicitSource
to construct a heat source limited by temperature


the comment in header file gives the wrong names for the coeffs it is Tmin and Tmax
not maximum and minimum.
Code:

  Temperaturelimit1
        {
        type            temperatureLimitsConstraint;
        active          true;
        selectionMode  all;
       
    temperatureLimitsConstraintCoeffs
        {
            Tmin    200;
            Tmax    340;
        }   
       
    }   
    energySource1
    {
        type            scalarSemiImplicitSource;
        active          true;
       
        selectionMode  all;
   
     
        scalarSemiImplicitSourceCoeffs
        {
            volumeMode      specific;
            injectionRateSuSp
            {
                h          (  20000 0 ); // 2e4 = 20w/litre
            }
        }
    }



All times are GMT -4. The time now is 02:06.