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/)
-   -   Negative temperature T0 in sonicFoam OF 5.x (https://www.cfd-online.com/Forums/openfoam-solving/199099-negative-temperature-t0-sonicfoam-5-x.html)

deepbandivadekar February 25, 2018 13:49

Negative temperature T0 in sonicFoam OF 5.x
 
I am trying to understand why this error exists in the first place. I am running sonicFoam in parallel. To initialise the case, for an inlet, knowing only pressure is practical so am trying to implement boundary conditions like pressureInletVelocity, pressureDirectedInletVelocity etc. however with no luck.

I am getting errors on account of negative temperature T0. I'm trying to find the source of this error but am stuck. I as hoping someone could help?

I looked at some of the relevant threads (https://www.cfd-online.com/Forums/op...nicfoam-o.html , https://www.cfd-online.com/Forums/op...e-problem.html) but changing pressure tolerance in fvSolution or changing the fvSchemes to cellLimited Gauss linear 1 and some variations of these do not seem to affect the outcome. According to one more thread, the temperature limits through fvOptions do not seem to affect sonicFoam (Tmax, Tmin), which anyway is sort of meddling with the energy equation which I don't really want to do.

my inlet and outlet conditions are as below:

U:
Code:

inlet1
    {
        type            supersonicFreestream;
        pInf            $pressure;
        TInf            $temperature;
        UInf            $speed;
        gamma          1.4; // Specific heat ratio
        value          $internalField;
    }
    inlet2    //check this again, try variations
    {
        type            pressureDirectedInletVelocity;    //Trial:24 Feb 2018
        phi            phi;
        rho            rho;
        inletDirection  uniform (-1 0 0);
        value          uniform (0 0 0);
    }

corresponding p:
Code:

inlet1
    {
        type            zeroGradient;
    }
    inlet2
    {
//        type            zeroGradient;  //Original condition. fixedValue trial: 20Feb2018
      type        fixedValue;
      value        uniform $pressurePorous;
    }

Error:
Code:

[3] --> FOAM FATAL ERROR:
[3] Negative initial temperature T0: -31.0648
[3]
[3]    From function Foam::scalar Foam::species::thermo<Thermo, Type>::T(Foam::scalar, Foam::scalar, Foam::scalar, Foam::scalar (Foam::species::thermo<Thermo, Type>::*)(Foam::scalar, Foam::scalar) const, Foam::scalar (Foam::species::thermo<Thermo, Type>::*)(Foam::scalar, Foam::scalar) const, Foam::scalar (Foam::species::thermo<Thermo, Type>::*)(Foam::scalar) const) const [with Thermo = Foam::hConstThermo<Foam::perfectGas<Foam::specie> >; Type = Foam::sensibleInternalEnergy; Foam::scalar = double; Foam::species::thermo<Thermo, Type> = Foam::species::thermo<Foam::hConstThermo<Foam::perfectGas<Foam::specie> >, Foam::sensibleInternalEnergy>]
[3]    in file /home/ubuntu/OpenFOAM/OpenFOAM-5.x/src/thermophysicalModels/specie/lnInclude/thermoI.H at line 54.
[3]
FOAM parallel run aborting
[3]
[3] #0  Foam::error::printStack(Foam::Ostream&) at ??:?
[3] #1  Foam::error::abort() at ??:?
[3] #2  Foam::species::thermo<Foam::hConstThermo<Foam::perfectGas<Foam::specie> >, Foam::sensibleInternalEnergy>::TEs(double, double, double) const at ??:?
[3] #3  Foam::hePsiThermo<Foam::psiThermo, Foam::pureMixture<Foam::constTransport<Foam::species::thermo<Foam::hConstThermo<Foam::perfectGas<Foam::specie> >, Foam::sensibleInternalEnergy> > > >::calculate() at ??:?
[3] #4  Foam::hePsiThermo<Foam::psiThermo, Foam::pureMixture<Foam::constTransport<Foam::species::thermo<Foam::hConstThermo<Foam::perfectGas<Foam::specie> >, Foam::sensibleInternalEnergy> > > >::correct() at ??:?
[3] #5  ? at ??:?
[3] #6  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
[3] #7  ? at ??:?

What are the reasons temperature could fall below 0? Where should I look?

piu58 February 26, 2018 02:52

I don't know your boundary and initial conditions of the temperature. But if you work close to 0 K, values below that may be calculated due to numerical effects. If that is the case you may considering to rise the problem to higher temperatures bu correcting the temperature dependant functions.

deepbandivadekar February 26, 2018 06:32

Quote:

Originally Posted by piu58 (Post 682896)
I don't know your boundary and initial conditions of the temperature. But if you work close to 0 K, values below that may be calculated due to numerical effects. If that is the case you may considering to rise the problem to higher temperatures bu correcting the temperature dependant functions.

Thanks Uwe Pilz for your quick reply. OK, it makes sense that if the lower bound is close to zero the numerical method might be causing it to fall below zero. Although, I'm not sure 180K is closer to zero or not. I'm thinking perhaps it isn't that close, so the issue might be with choosing right schemes?

The temperature difference within the initialised domain is rather low: 180 - 300K. The difference is expected to grow high over the next time steps up to 1000K.

piu58 February 26, 2018 08:31

180 K is not such close to 0 K and you should not have the effect.

I recommend starting first with a very simple geometry, but all of the physics. I have seen strange effects with temperature when more complicated geometries are used.

Of course, I don't know your case en détail. If you need more help it would be useful to describe what do you try to calculate. Mey be there exists a slighly or even total different way.

deepbandivadekar February 27, 2018 06:05

Quote:

Originally Posted by piu58 (Post 682948)
180 K is not such close to 0 K and you should not have the effect.

Yes, that's what I felt too. The geometry is simple enough but I have a feeling it has something to do with meshing.

By the way, when it comes to those BCs at inlet (pressureInletVelocity, pressureDirectedInletVelocity,...) what does the value parameter mean? The respective .h definitions clearly indicate a scaler (e.g. uniform 0) and that's logical since we do know pressure at the inlet and that's what we need to supply. But I get error demanding that to be a vector! I figured out after a couple of simulations that it actually is velocity. I'm confused!

Scram_1 August 15, 2018 17:45

Hi Deep!
I'm facing a similar problem as well where my temperature becomes negative. Have you managed to find a work around for this issue?

Best,
Scram_1

SRKR August 17, 2018 02:22

Try changing b.conditions as some fixed pressure and zetoGradient for velocity at inlet and please inform back.

Scram_1 August 18, 2018 13:57

Tried changing the BCs but still doesn't work. I also tried a couple of other things. I noticed that the simulation works if the equationOfState in the thermophysical properties is set to perfectGas instead of incompressiblePerfectGas. I want my bulk fluid to behave like an incompressible gas. The negative temperature occurs with incompressiblePerfectGas when delta t is 1e-8. With delta t = 1e-6, the simulation does not crash. However, I need delta t to be 1e-8 to capture the physics involved. I don't know if perfectGas as thermo will give me the right result though. Also, when the size of the particle is reduced to the order of nanometers (1e-9), the particles tend to flash i.e. the mass change equals the mass introduced. This doesn't happen with micron sized particles. Does anyone have any idea about this?

Best,
Scram_1

deepbandivadekar August 20, 2018 09:40

Quote:

Originally Posted by Scram_1 (Post 702765)
Hi Deep!
I'm facing a similar problem as well where my temperature becomes negative. Have you managed to find a work around for this issue?

Best,
Scram_1

Hello!

No I did not find a reason for that behaviour. However, I got around it by doing this in fvOptions:

Code:

temperatureLimit
{
    type limitTemperature;
    active true;
   
    limitTemperatureCoeffs
    {
        selectionMode all;
        min 150;
        max 6000;
    }
}

This worked very well. But I'm pretty sure this does not tackle the real cause of the error.


All times are GMT -4. The time now is 10:34.