CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Problem: Updating temperature file (https://www.cfd-online.com/Forums/openfoam-programming-development/227379-problem-updating-temperature-file.html)

Phigo90 May 27, 2020 04:53

Problem: Updating temperature file
 
Hi,


I am working with the InterCondensatingEvaporatingFoam. I am trying to do some changes because for my case it is not "physical enough".
My problem is that the Output in the logSolver is not useful.
I am just learning C++, so I am not a Professional for now.


However, in the solver there is a reference for the temperature field in the beginning:
volScalarField& T = thermo->T();

In the eEqn.H the energy-equation is set up and solved. Based on this field, the temperature is calculated by the following line and thus the protected variable T_ is updated:

thermo->correct();

I've added another correct(alCheck,enCheck,Check,nmbrfaces) function, which calculates the temperature field in a different way (the original version leads to negative values for the temperature since the calculation for mixed cells (0<alpha<1) doesnt make sense). In my version T_ is also updated, I just changed the way how it is calculated.

Now to the problem:
If I check the logSolver, for example at Time=0.001 the temperature is not negative but already to low. For later times the log-file says that the min(T) is negative, which is in contrast to my T-Output (No vlaue lower than 76K, which is physical since I am simulating a cryogenic cooling case).


In Paraview the temperature field of the "newVersion" has a minimum value of 76K, which is physical. At later times no negative values can be oberseved. So everything seems to be well. If I check the logSolver-file the Output says:

min/max(T) = 21.6713, 673
GAMG: Solving for p_rgh, Initial residual = 0.01893, Final residual = 0.000186089, No Iterations 9
GAMG: Solving for p_rgh, Initial residual = 0.0123978, Final residual = 9.10196e-05, No Iterations 10
GAMG: Solving for p_rgh, Initial residual = 0.00364705, Final residual = 3.43957e-05, No Iterations 10
GAMG: Solving for p_rgh, Initial residual = 0.00118128, Final residual = 1.14063e-05, No Iterations 10
GAMGPCG: Solving for p_rgh, Initial residual = 0.000417309, Final residual = 8.1684e-10, No Iterations 16
ExecutionTime = 107.56 s ClockTime = 110 s

Courant Number mean: 0.155013 max: 1.04568
deltaT = 1.38462e-06
Time = 0.001

After thermo->correct(alCheck,enCheck,Check,nmbrfaces) the following lines are written in the eEqn.H:
En=thermo->he();
Info<< "min/max(T) = " << min(T).value() << ", "
<< max(T).value() <<endl;

To say it in words: The En is updated based on e_, which is a protected Variable of the class. The Info Variabel is just the Output of the minimum and maximum value of the temperature. I do not understand why the minimum value should be negative at Time=0.001, because the temperature is not negative for all cells.


So I do not understand what is the different between T in eEqn.H and the updated T_ in correct(), because T is just a Reference...Hopefully I have illustrated my problem well. Thanks in advance.


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