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

rhoSimpleFoam Negative initial temperature T0 error

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 24, 2020, 05:22
Default rhoSimpleFoam Negative initial temperature T0 error
  #1
New Member
 
Join Date: Mar 2020
Posts: 18
Rep Power: 6
maike151 is on a distinguished road
Hello everyone,


I know there are several threads about this topic, but none of them helped me.


I am trying to simulate a rather simple air flow with two inlets with two different temperatures and I want to see what the temperature field at the outlet looks like.


In the second timestep I get the following error:


[6]
[6]
[6] --> FOAM FATAL ERROR:
[6] Negative initial temperature T0: -24430.2
[6]
[6] 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, bool) const [with Thermo = Foam::hPolynomialThermo<Foam::icoPolynomial<Foam:: specie> >; Type = Foam::sensibleEnthalpy; Foam::scalar = double; Foam::species::thermo<Thermo, Type> = Foam::species::thermo<Foam::hPolynomialThermo<Foam ::icoPolynomial<Foam::specie> >, Foam::sensibleEnthalpy>]
[6] in file /opt/OpenFOAM/OpenFOAM-7/src/thermophysicalModels/specie/lnInclude/thermoI.H at line 56.
[6]


The mesh is only a block mesh, so nothing fancy and can (probably) be excluded as a cause of error.


Maybe I am totally mistaken with my BCs or thermophysical properties and just don't notice. I've tried tons of things and would appreciate any help.


The case is attached here: https://www.dropbox.com/sh/28zkn83n2...y3DEyriFa?dl=0




Thanks in advance,


Maike
maike151 is offline   Reply With Quote

Old   November 24, 2020, 10:56
Default
  #2
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 802
Blog Entries: 1
Rep Power: 18
dlahaye is on a distinguished road
1/ on short term: negative temperatures might arise due to (too) high temperatures in others parts of the domain. In that case it might be valuable to use a limiter on the temperature as suggested in post #7 by HPE in this thread: Why is it difficult to get rhoSimpleFoam solver running correctly ? ;

2/ on long term: in might be valuable to list all the options you have tried along with the outcome. This overview might be valuable to you. It might be valuable to post this overview, allowing others to think along. I will be interested in giving this overview a look.

Good luck.
dlahaye is offline   Reply With Quote

Old   November 25, 2020, 04:18
Default
  #3
New Member
 
Join Date: Mar 2020
Posts: 18
Rep Power: 6
maike151 is on a distinguished road
Hello dlahaye,


thank you for your answer!


I tried limitTemperature (as in constant/fvOptions.backup) but the error still occurs. It's like this is just ignored even though it is recognized in initialization:


"Selecting finite volume options model type limitTemperature
Source: limitT
- selecting all cells
- selected 13248 cell(s) with volume 6.4e-05".


What else did I try..


1. Simplifying the mesh/make it coarser/finer


2. In fvSolution SIMPLE options put
-rhoMin/rhoMax or rhoMin [ 1 -3 0 0 0 ]/rhoMax [ 1 -3 0 0 0 ] gives this:


--> FOAM Warning :
From function Foam:ressureControl:ressureControl(const volScalarField&, const volScalarField&, const Foam::dictionary&, bool)
in file cfdTools/general/pressureControl/pressureControl.C at line 125
Reading "/home/schick/OpenFOAM/schick-7/run/2020-10-05_Schlebusch_SolarInstitutJuelich_Mischelement/TestCase4/skaliert_vollaufgeloest/schneller/ohneGewebe/system/fvSolution.SIMPLE" from line 83 to line 98
'rhoMax' specified rather than 'pMax' or 'pMaxFactor'
This is supported for backward-compatibility but 'pMax' or 'pMaxFactor' are more reliable.
--> FOAM Warning :
From function Foam:ressureControl:ressureControl(const volScalarField&, const volScalarField&, const Foam::dictionary&, bool)
in file cfdTools/general/pressureControl/pressureControl.C at line 182
Reading "/home/schick/OpenFOAM/schick-7/run/2020-10-05_Schlebusch_SolarInstitutJuelich_Mischelement/TestCase4/skaliert_vollaufgeloest/schneller/ohneGewebe/system/fvSolution.SIMPLE" from line 83 to line 98
'rhoMin' specified rather than 'pMin' or 'pMinFactor'
This is supported for backward-compatibility but'pMin' or 'pMinFactor' are more reliable.
pressureControl
pMax 319989
pMin 24614.5



-pMin/pMax or pMinFactor/pMaxFactor: still same error


3. Try thousands of combinations of relaxationFactors, even about 0.0001 for every field and equation: still same error


4. Try all upwind schemes: still same error


5. Try different BCs:
-For U: Try smaller mass flow rates
-For p: Try fixedValue and totalPressure at the outlet
-For T: Try zeroGradient and inletOutlet at the outlet
-For k and epsilon: Try different possible values


That's all I can think of right now.
maike151 is offline   Reply With Quote

Old   November 25, 2020, 05:49
Default
  #4
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 802
Blog Entries: 1
Rep Power: 18
dlahaye is on a distinguished road
It might be the case that OpenFoam prints T values before limiting them. Does limiting T have no influence whatsoever on the convergence?

Does it make sense to try an isothermal case using simpleFoam first?
dlahaye is offline   Reply With Quote

Old   November 25, 2020, 06:11
Default
  #5
New Member
 
Join Date: Mar 2020
Posts: 18
Rep Power: 6
maike151 is on a distinguished road
No, there is no difference at all.


Sure, I can try that.
maike151 is offline   Reply With Quote

Old   November 25, 2020, 06:33
Default
  #6
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 802
Blog Entries: 1
Rep Power: 18
dlahaye is on a distinguished road
edit:

The fact that your T explodes after one iteration is likely to explain why limitT does not work. What is your domain like? What are your boundary conditions? What is your initial condition for temperature do you impose?

Let us try simpleFoam first.
dlahaye is offline   Reply With Quote

Old   November 25, 2020, 07:58
Default
  #7
New Member
 
Join Date: Mar 2020
Posts: 18
Rep Power: 6
maike151 is on a distinguished road
So I did some changes in order to use simpleFoam


-delete thermopyhsical properties
-delete everything related to T, rho, h,...

-changed U inlet BC back to fixedValue
-changed p outlet BC back to fixedValue 0 and dimension of p back to [0 2 -2 0 0 0 0];

-changed kinematic velocity in transport properties to the average of the kinematic velocities the air at the two inlet temperatures had (not sure about this)


Then, in order to achieve my convergence criteria, refined the mesh by factor 1.5. Started running with

Code:
relaxationFactors
{

    fields
    {
    p        0.1;
    }    

    equations
    {
        U               0.7;
        k               0.1;
        omega           0.1;
        epsilon        0.1;
    }
}
Then, after about 1000 timesteps, changed to
Code:
relaxationFactors
{

    fields
    {
    p        0.5;
    }    

    equations
    {
        U               0.8;
        k               0.3;
        omega           0.3;
        epsilon        0.3;
    }
}
and the solution converged in about 1900 iterations. You can find the case here: https://www.dropbox.com/sh/vfj9fm0g4...1Hc-cSg9a?dl=0
maike151 is offline   Reply With Quote

Old   November 25, 2020, 08:01
Default
  #8
New Member
 
Join Date: Mar 2020
Posts: 18
Rep Power: 6
maike151 is on a distinguished road
Quote:
Originally Posted by dlahaye View Post
edit:

The fact that your T explodes after one iteration is likely to explain why limitT does not work. What is your domain like? What are your boundary conditions? What is your initial condition for temperature do you impose?

Let us try simpleFoam first.

You may find all the files in the first post
maike151 is offline   Reply With Quote

Old   November 25, 2020, 09:21
Default
  #9
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 802
Blog Entries: 1
Rep Power: 18
dlahaye is on a distinguished road
Looks wonderful.

Do I understand it correctly that your mesh does not include boundary layer refinements?

What happens when increasing the inlet velocities? Would you need boundary layer refinement to capture the gradient in the velocity profile on the boundary?
dlahaye is offline   Reply With Quote

Old   November 25, 2020, 09:43
Default
  #10
New Member
 
Join Date: Mar 2020
Posts: 18
Rep Power: 6
maike151 is on a distinguished road
No, it does not include boundary layer refinements.


How could I tell that I needed it? (I'm sorry, I'm obviously not a CFD expert)
maike151 is offline   Reply With Quote

Old   November 25, 2020, 09:50
Default
  #11
Senior Member
 
Join Date: Dec 2019
Posts: 215
Rep Power: 7
shock77 is on a distinguished road
Hi,


if the simulation crashes after the first iteration, in most cases the BCs are wrong. I would try running a laminar simulation with slip walls to reduce the potential error sources. After that try using a fixedValue for U that matches your flowrate and see whether it works with that.



What are your min and max values for T?


I am not familiar with rhoSimpleFoam, but usually the temperature is basically calculated by subtracting the kinitec energie from the total internal energy. That means, that you are getting really high velocites in some locations.
shock77 is offline   Reply With Quote

Old   November 25, 2020, 10:01
Default
  #12
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 802
Blog Entries: 1
Rep Power: 18
dlahaye is on a distinguished road
No worries.

You can make line plots of the main velocity component on line perpendicular to the flow.

You can compute yplus values in postprocessing stage using -postprocess yplus

You can include insert boundary layers in the mesh and see what the effect is on the convergence.

Your choice ;-)
dlahaye is offline   Reply With Quote

Old   November 25, 2020, 10:04
Default
  #13
New Member
 
Join Date: Mar 2020
Posts: 18
Rep Power: 6
maike151 is on a distinguished road
Hi shock77, thanks for your input!


I will try out your suggestions.



Tmin is 274 K and Tmax 1400 K, because T at one inlet is 1223.15 K.


Quote:
I am not familiar with rhoSimpleFoam, but usually the temperature is basically calculated by subtracting the kinitec energie from the total internal energy. That means, that you are getting really high velocites in some locations.
That makes sense. Maybe I should try limitVelocity instead of limitTemperature then?
maike151 is offline   Reply With Quote

Old   November 25, 2020, 10:15
Default
  #14
New Member
 
Join Date: Mar 2020
Posts: 18
Rep Power: 6
maike151 is on a distinguished road
Thank you dlahaye! I will try all of that!
maike151 is offline   Reply With Quote

Old   November 26, 2020, 07:15
Default
  #15
Senior Member
 
Join Date: Dec 2019
Posts: 215
Rep Power: 7
shock77 is on a distinguished road
When I have some troubles with negative Temperatures, I usually set Tmax to like 10000 and Tmin to 10 to ensure the correctness of the result. I would not try to limit the velocity, because I think your BCs are the problem. Ofc you can limit everything do that point, where you make it work, but what benefit does that give you? You cant say wheter your results are trustworthy or not.
shock77 is offline   Reply With Quote

Old   November 30, 2020, 05:06
Default
  #16
New Member
 
Join Date: Mar 2020
Posts: 18
Rep Power: 6
maike151 is on a distinguished road
Sorry that it took me so long to answer.


I first tried out dlahayes suggestions.



The yPlus value for my mesh without boundary layer refinement was:
min 27.57 max 173.92 average 89.6


Then I used the refineWallLayer function first with factor 0.5 and I got
min 16.19 max 157.08 average 46.13


With factor 0.4 I got
min 11.58 max 150.69 average 37.61


When I got any smaller I got convergence problems. I also attached the pictures of the velocity profile line plot. It does not really change from 0.5 to 0.4.


So then I tried my rhoSimpleFoam case with refinement 0.5 but still got the error. What yPlus value is desirable?
Attached Images
File Type: jpeg VelocityProfile_withRefinement05.jpeg (39.7 KB, 25 views)
File Type: jpeg VelocityProfile_withoutRefinement.jpeg (28.8 KB, 17 views)
File Type: jpeg VelocityProfile_withRefinement04.jpeg (54.2 KB, 11 views)
maike151 is offline   Reply With Quote

Old   November 30, 2020, 08:10
Default
  #17
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 802
Blog Entries: 1
Rep Power: 18
dlahaye is on a distinguished road
Not sure what good values of yplus are. Possibly you want to reduce the max value of yplus. Possibly it helps to visualize yplus in paraview.

In case that non-convergence persists, it might be valuable to look into the residual field and refine the mesh where the residual remains large.
dlahaye is offline   Reply With Quote

Old   December 2, 2020, 05:35
Default
  #18
New Member
 
Join Date: Mar 2020
Posts: 18
Rep Power: 6
maike151 is on a distinguished road
I visualized yPlus in Paraview and yPlus was the largest along the edges parallel to flow direction. So in addition to refineWallLayer I refined the Mesh at those edges by defining those cells as a cellSet with topoSet and use refineMesh there. It reduced yPlus: min = 8.84904, max = 85.9036, average = 35.7021

A picture of the resulting mesh is attached.



For the simpleFoam case the residuals got down to 1e-4, but then it started diverging. A picture is also attached. I don't know if I am happy with that because something must still be wrong, right?


How can I visualize the residual field in paraView? I tried using postProcess -func residuals, but this only generates the dat-files in the postPorcessing folder.



Tried the rhoSimpleFoam case with this mesh, still same error :-(
Attached Images
File Type: jpg yPlus.jpg (92.8 KB, 35 views)
File Type: jpg Residuals.jpg (63.7 KB, 16 views)
maike151 is offline   Reply With Quote

Old   December 2, 2020, 08:14
Default
  #19
New Member
 
Join Date: Mar 2020
Posts: 18
Rep Power: 6
maike151 is on a distinguished road
Quote:
Originally Posted by shock77 View Post
Hi,


if the simulation crashes after the first iteration, in most cases the BCs are wrong. I would try running a laminar simulation with slip walls to reduce the potential error sources. After that try using a fixedValue for U that matches your flowrate and see whether it works with that.



What are your min and max values for T?


I am not familiar with rhoSimpleFoam, but usually the temperature is basically calculated by subtracting the kinitec energie from the total internal energy. That means, that you are getting really high velocites in some locations.

Hello shock77,


I finally tried out your suggestions. What I did was:
-use the mesh I did with dlahayes help

-change turbulenceProperties back to laminar
-delete everything related to k, epsilon,...
-change wall BC for U to slip


But the error still occured. The negative initial temperature didn't even change a bit.


Then I put fixedValue for U inlet BC with the velocity that matches my flow rate - still same error. I also tried really small mass flow rates and velocities - no change at all.
maike151 is offline   Reply With Quote

Old   April 21, 2021, 08:15
Default
  #20
New Member
 
Han Yuxuan
Join Date: Apr 2021
Location: China
Posts: 1
Rep Power: 0
NaiveYoung is on a distinguished road
hi,maike
I 've just met the same problem as you do.
I drew my mesh by NUMECA, which uses millimetre as scale, but OpenFoam uses meter as scale.

And I changed my scale to meter, and it works well.
NaiveYoung is offline   Reply With Quote

Reply

Tags
compressible air, multiple inlets, rhosimplefoam, temperature bc


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
Building OpenFOAM1.7.0 from source ata OpenFOAM Installation 46 March 6, 2022 14:21
simpleFoam error - "Floating point exception" mbcx4jc2 OpenFOAM Running, Solving & CFD 12 August 4, 2015 03:20
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 07:20
SLTS+rhoPisoFoam: what is rDeltaT??? nileshjrane OpenFOAM Running, Solving & CFD 4 February 25, 2013 05:13
pisoFoam with k-epsilon turb blows up - Some questions Heroic OpenFOAM Running, Solving & CFD 26 December 17, 2012 04:34


All times are GMT -4. The time now is 13:55.