CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

temperature negative occurred in rhoCentralFoam at high M

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

Like Tree5Likes
  • 1 Post By backscatter
  • 2 Post By TheMadHungarian
  • 1 Post By chemak
  • 1 Post By chc

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 29, 2018, 08:06
Cool temperature negative occurred in rhoCentralFoam at high M
  #1
New Member
 
FENG LM
Join Date: Aug 2018
Posts: 1
Rep Power: 0
longming is on a distinguished road
Hi,guys

When I use rhocentralFoam to solve flow over wedge or other simple shape( using RAS model), negative temperature occurred easily when M>5, even dt and maxco are set to very small value.
I followed the example in tutorial, it works when computing grid is course. I only refined the grid in boundary layer and the problem just occurred.
Is the slover unsteady at high M?
Who knows how to slove the problem? Please Help
longming is offline   Reply With Quote

Old   October 22, 2018, 21:19
Default
  #2
Member
 
Join Date: Nov 2014
Posts: 92
Rep Power: 11
hokhay is on a distinguished road
Hi Longming,

I am encountering the same problem. Have you found a solution yet?

Jason
hokhay is offline   Reply With Quote

Old   October 22, 2018, 23:37
Default
  #3
Member
 
Anonymous
Join Date: Aug 2016
Posts: 75
Rep Power: 9
backscatter is on a distinguished road
Quote:
Originally Posted by longming View Post
Hi,guys

When I use rhocentralFoam to solve flow over wedge or other simple shape( using RAS model), negative temperature occurred easily when M>5, even dt and maxco are set to very small value.
I followed the example in tutorial, it works when computing grid is course. I only refined the grid in boundary layer and the problem just occurred.
Is the slover unsteady at high M?
Who knows how to slove the problem? Please Help

I've had such kind of issues in passive scalar transport in incompressible solvers though. Usual practice is to try to use a bounded scheme (div and grad) for your energy/TEqn. You can start with upwind which is more stable as it incurs numerical dissipation which stablizes the run, but it could be less accurate. Relaxing the equation can also help in some cases. In my case, the culprits were high-aspect ratio cells away from the boundary layer- When I removed those high aspect cells, my problem was solved.

Here's the link to my post:
TEqn (passive scalar) diverges all of a sudden
hogsonik likes this.
backscatter is offline   Reply With Quote

Old   October 23, 2018, 15:40
Default
  #4
New Member
 
Andy S.
Join Date: Jun 2018
Posts: 17
Rep Power: 7
TheMadHungarian is on a distinguished road
Usually setting deltaT to a very small number (1e-15 for the 1st time step) will fix this, the solver will adjust the timestep to a larger value automatically.
hogsonik and swainwc like this.
TheMadHungarian is offline   Reply With Quote

Old   January 21, 2024, 15:00
Default
  #5
chc
New Member
 
Join Date: Nov 2023
Posts: 11
Rep Power: 2
chc is on a distinguished road
Quote:
Originally Posted by longming View Post
Hi,guys

When I use rhocentralFoam to solve flow over wedge or other simple shape( using RAS model), negative temperature occurred easily when M>5, even dt and maxco are set to very small value.
I followed the example in tutorial, it works when computing grid is course. I only refined the grid in boundary layer and the problem just occurred.
Is the slover unsteady at high M?
Who knows how to slove the problem? Please Help
Hello,
I'm currently experiencing similar issues. I'm new to OpenFOAM still and was wondering if you found a solution to this and where? Thank you!.
chc is offline   Reply With Quote

Old   January 22, 2024, 03:51
Default
  #6
New Member
 
Join Date: Nov 2017
Posts: 6
Rep Power: 8
chemak is on a distinguished road
Hi,
I think that the cause of negative temerature in rhoCentralFoam is rather physical than numerical. Check your ground energy in "thermophysicalProperties" (Cp, Tref and Href), setting more physical values will generally prevent this problem.
hogsonik likes this.
chemak is offline   Reply With Quote

Old   January 22, 2024, 20:05
Default
  #7
chc
New Member
 
Join Date: Nov 2023
Posts: 11
Rep Power: 2
chc is on a distinguished road
My initial set up uses the settings below for that file. I've taken them from relevant articles that reference sea level values for air. I'm solving using dimensional initial values for my velocity, temperature, and pressure, so I'm not sure where to set Tref or Href. If its relevant, I'm setting the outlet to be zeroGradient for each inital value.

thermoType
type hePsiThermo;
mixture pureMixture;
transport const;
thermo hConst;
equationOfState perfectGas;
specie specie;
energy sensibleInternalEnergy;

mixture
specie

nMoles 1;
molWeight 28.96;

thermodynamics

Cp 1004.5;
Hf 0; // 2.544e+06;

transport

mu 18e-6;
Pr .71;

I appreciate your help here.
chc is offline   Reply With Quote

Old   January 23, 2024, 03:30
Default
  #8
New Member
 
Join Date: Nov 2017
Posts: 6
Rep Power: 8
chemak is on a distinguished road
You can add Tref and Href in this way:


thermodynamics
{
Cp 1004.5;
Hf 0;
Tref 250;
Href 250750;
}


Let me know if it solves your problem.
chemak is offline   Reply With Quote

Old   January 23, 2024, 11:57
Default
  #9
chc
New Member
 
Join Date: Nov 2023
Posts: 11
Rep Power: 2
chc is on a distinguished road
I see what you mean. These unfortunately don't change the overall solution. I did simplify the geometry, as I initially had a bump at the outlet location to emulate a the start of a compressor which caused the propagation of a shock upwind. It eventually spills out of my main inlet, at which point the error occurred. When I remove that bump, everything runs smoothly for now, although it takes extremely long. I need to run a type of mesh study to see what resolution is needed.
hogsonik likes this.
chc is offline   Reply With Quote

Old   February 25, 2024, 22:51
Default
  #10
chc
New Member
 
Join Date: Nov 2023
Posts: 11
Rep Power: 2
chc is on a distinguished road
For anyone still searching for this, I still need to validate the results but what I wound up doing was using the schemes presented in this tutorial:
http://www.wolfdynamics.com/training..._tutorials.pdf
It's only for laminar flow so you still need to include your turbulent schemes if you don't already have a default to a specific one. I also found that there is a delicate balance between having a small enough maxCellSize and a large enough minCellSize so the results don't blow up or just take forever to complete and it took some time playing around with those to get a simulation to run to completion.
I can post my files here later once I figure out how to do the code format thing.
chc is offline   Reply With Quote

Old   February 25, 2024, 23:46
Default
  #11
chc
New Member
 
Join Date: Nov 2023
Posts: 11
Rep Power: 2
chc is on a distinguished road
U:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2306                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volVectorField;
    object      U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 1 -1 0 0 0 0];  // kg m s K mol A cd

internalField   uniform (0 0 0);

boundaryField
{
    inlet1
    {
        type            fixedValue;
        value           uniform (680 0 0); // Mach 2 at sea Level

    }

    outlet1
    {
        type            zeroGradient;

    }

    wall1
    {
        type            noSlip;
    }

    top
    {
        type            supersonicFreestream;
        pInf            101325;
        TInf            300;
        UInf            (680 0 0);
        gamma           1.4;
        value           uniform (680 0 0);
    };
    

    bottomEmptyFaces
    {
        type            empty;
    }
    topEmptyFaces
    {
        type            empty;
    }
}

// ************************************************************************* //
T:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2306                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    object      T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 0 0 1 0 0 0];  // kg m s K mol A cd

internalField   uniform 300;

boundaryField
{
    inlet1
    {
        type            fixedValue;
        value           uniform 300;

    }

    outlet1
    {
        type            zeroGradient;

    }

    wall1
    {
        type            zeroGradient;
    }

    top
    {
        type            inletOutlet;
        inletValue      uniform 300;
        value           uniform 300;
    }

    bottomEmptyFaces
    {
        type            empty;
    }
    topEmptyFaces
    {
        type            empty;
    }
}


// ************************************************************************* //

p:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2306                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    object      p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [1 -1 -2 0 0 0 0]; // kg m s K mol A cd

internalField   uniform 101325; // initially atmospheric

boundaryField
{
    inlet1
    {
        type            zeroGradient;
    }

    outlet1
    {
        type            zeroGradient;

    }

    wall1
    {
        type            zeroGradient; // As a result of noSlip used for velocity
    }

    top
    {
        type            zeroGradient;
    }

    bottomEmptyFaces
    {
        type            empty;
    }
    topEmptyFaces
    {
        type            empty;
    }
}


// ************************************************************************* //
omega:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2306                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    object      omega;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 0 -1 0 0 0 0]; // kg m s K mol A cd
// calculated from https://www.cfd-online.com/Tools/turbulence.php
internalField   uniform 8; // epsilon/Cmu/k 

boundaryField
{
    "(wall1)"
    {
        type            omegaWallFunction;
        value           $internalField;
    }

    "(inlet1|outlet1|top)"
    {
        type            zeroGradient;
    }

    "(bottomEmptyFaces|topEmptyFaces)"
    {
        type            empty;
    }
}


// ************************************************************************* //
nut:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2306                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    object      nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 2 -1 0 0 0 0];

internalField   uniform 0;

boundaryField
{
    "(inlet1|outlet1|top)"
    {
        type            calculated;
        value           uniform 0;
    }

    wall1
    {
        type            nutkWallFunction;
        type            nutkWallFunction;
        value           uniform 0;
    }

    "(topEmptyFaces|bottomEmptyFaces)"
    {
        type            empty;
    }
}

// ************************************************************************* //
k:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2306                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    object      k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 2 -2 0 0 0 0];
// calculated from https://www.cfd-online.com/Tools/turbulence.php
internalField   uniform .007; // 

boundaryField
{
    wall1
    {
        type            fixedValue;
        value           uniform .007;
    }

    "(inlet1|outlet1|top)"
    {
        type            zeroGradient;
    }

    "(topEmptyFaces|bottomEmptyFaces)"
    {
        type            empty;
    }
}


// ************************************************************************* //

alphat:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2306                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    location    "0";
    object      alphat;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [1 -1 -1 0 0 0 0];

internalField   uniform 0;

boundaryField
{
    "(inlet1|outlet1|top).*"
    {
        type            calculated;
        value           uniform 0;
    }

    "(bottomEmptyFaces|topEmptyFaces).*"
    {
        type            empty;
    }

    "wall1.*"
    {
        type            compressible::alphatWallFunction;
        Prt             0.85;
        value           uniform 0;
    }
}


// ************************************************************************* //



turbulenceProperties:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2306                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

simulationType RAS;

RAS
{
    RASModel        kOmegaSST; // test more models
    turbulence      on;
    printCoeffs     on;
}

// ************************************************************************* //

thermophysicalProperties:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2306                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      thermophysicalProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

thermoType
{
    type            hePsiThermo; // Specifies the type of thermophysical model to be used.
                                 // In this case, it's hePsiThermo. This model is a combination 
                                 // of the h (enthalpy) and psi (specific internal energy) models, 
                                 //and it's often used for compressible flows.
    mixture         pureMixture; // Defines the mixture type. pureMixture indicates that the fluid
                                 // is a pure substance (not a mixture of different species).
    transport       const;       // Specifies the type of transport model to be used. 
                                 // Here, it's set to const, indicating constant transport properties.
    thermo          hConst;      // Indicates the thermo model used for determining thermodynamic 
                                 // properties. hConst specifies that the specific enthalpy (h) will be held constant.
    equationOfState perfectGas;  // Specifies the equation of state to be used. In this case, 
                                 // it's set to perfectGas, indicating that the fluid behaves as an ideal gas.
    specie          specie;      // Indicates the species model. Here, it's set to specie, which
                                 // implies a single-species model (no chemical reactions are considered).
    energy          sensibleInternalEnergy; // Specifies the energy model. sensibleInternalEnergy indicates 
                                            // that the sensible internal energy will be used as the energy variable.
}

// as a tendency: In the source code, typically upper case letters 
// (e.g. Ha) indicate [J/kg] and lower case (e.g. ha) [J/kmol].

mixture

{
    // normalised gas
    specie
    {
        nMoles          1;
        molWeight       28.96; // molar weight of air kg/kmol 
    }
    thermodynamics
    {
        Cp              1004.5; // specific heat J/kg K
        Hf                0; // specific enthalpy
fluid type
    }
    transport
    {
        mu              18e-6; // dynamic viscosity - N s/m^2 or kg/m s, rhoCentralFoam is 0 for inviscid
        Pr              0.71; // prandtl number
        Tref            300;
        Href            250750;
    }
}


// ************************************************************************* //
controlDict:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2306                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application     rhoCentralFoam;

startFrom       startTime;

startTime       0;

stopAt          endTime;

endTime         0.5;

deltaT          1e-8;

writeControl    adjustable;

writeInterval   .01;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

graphFormat     raw;

runTimeModifiable true;

adjustTimeStep  yes;

maxCo           0.15;

maxDeltaT       1;


// ************************************************************************* //
fvSolutions:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2306                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version 2.0;
    format ascii;
    class dictionary;
    location "system";
    object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

solvers
{
    "(rho|rhoU|rhoE)"
    {
        solver          diagonal;
    }

    "(rho|U|h|k|e|omega)"
    {
        solver          GAMG;
        smoother        GaussSeidel;
        nSweeps         10;
        tolerance       1e-06;
        relTol          0.01;
    }



/*"(U|p|k|nuTilda|omega)"
    {
        solver          GAMG;
        smoother        GaussSeidel;
        nSweeps         10;
        tolerance       1e-6;
        relTol          0.1;
    }
}





PIMPLE
{
    momentumPredictor yes;
    nOuterCorrectors 2;
    nCorrectors      2;
    nNonOrthogonalCorrectors 2;
    transonic   yes;
   // rhoMax    10;
}
fvSchemes:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2306                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

fluxScheme          Kurganov;

ddtSchemes
{
    default         Euler; 

}

gradSchemes
{
    default         cellLimited Gauss linear 0.333 ;

}

divSchemes
{
    default         Gauss linear;
    div(phi,U) 	    Gauss limitedLinearV 1;
    div(phi,nuTilda)  Gauss limitedLinear 1;
    div((nuEff*dev2(T(grad(U))))) Gauss linear;

    // turbulence      Gauss linearUpwind limited; 
    // div(phi,k)      $turbulence;
    // div(phi,omega)  $turbulence;

}

laplacianSchemes
{
    default         Gauss linear corrected;
}

interpolationSchemes
{
    default         linear;

    reconstruct(rho) vanLeer;
    reconstruct(U)  vanLeerV;
    reconstruct(T)  vanLeer;

   }

snGradSchemes
{
    default         corrected;
}

wallDist
{
    method  meshWave;
}

// ************************************************************************* //
meshDict:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2306                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      meshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// used in conjunction with the cfMesh, this case, cartesian2DMesh

surfaceFile "Combined.fms"

// minCellSize .0001;
minCellSize .0001;


// maxCellSize .0005;
maxCellSize .006;



// boundaryCellSize .0001;

// ************************************************************************* //
If anyone has any comments, let me know your opinions.
chc is offline   Reply With Quote

Reply

Tags
high mach number, rhocentralfoam;

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Negative initial temperature Lexe OpenFOAM Running, Solving & CFD 33 November 5, 2022 10:49
[Other] mesh airfoil NACA0012 anand_30 OpenFOAM Meshing & Mesh Conversion 13 March 7, 2022 17:22
channelFoam for a 3D pipe AlmostSurelyRob OpenFOAM 3 June 24, 2011 13:06
[blockMesh] BlockMesh FOAM warning gaottino OpenFOAM Meshing & Mesh Conversion 7 July 19, 2010 14:11
[blockMesh] Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Meshing & Mesh Conversion 10 April 2, 2007 14:00


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