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

Declaration of the function TH()

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 1, 2012, 18:15
Default Declaration of the function TH()
  #1
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi all,

I am trying to find the place where the temperature is derived from the enthalpy.

- Solver: rhoSimpleFoam
- thermodynamics: hPsiThermo
- transport: hConstTransport

Therefor I had a look at the solver and the enthalpy equation h:

Code:
{
    fvScalarMatrix hEqn
    (
        fvm::div(phi, h)
      - fvm::Sp(fvc::div(phi), h)
      - fvm::laplacian(turbulence->alphaEff(), h) 
     ==
      - fvc::div(phi, 0.5*magSqr(U), "div(phi,K)")
    );

    hEqn.relax();

    hEqn.solve();

    thermo.correct();
Here I think the step I am searching is in the function "correct".
That leads me to the thermomodel -> hPsiThermo.C.

From the correct() function you get into the calculate() function. And there (I think) you get the temperature derived from the enthalpy. Its described in the *.H file that T is calculated there.

I found that function:

Code:
        TCells[celli] = mixture_.TH(hCells[celli], TCells[celli]);
And would find the definition of that function. With grep I get into the specieThermo.H file. Here I found that:
Code:
        // Energy->temperature  inversion functions

            //- Temperature from Enthalpy given an initial temperature T0
            inline scalar TH(const scalar H, const scalar T0) const;
So I am very sure that I am on the right way. But thats just a function prototype and not a function declaration. I searched everywhere but do not find the definition of that function.

Where can i find it?
Can someone give me an advice?

Thanks in advance
Tobi
Tobi is offline   Reply With Quote

Old   August 1, 2012, 18:30
Default
  #2
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
I should have a look at the specieThermoI.H
So solved Thanks for reading
Tobi is offline   Reply With Quote

Old   August 1, 2012, 18:50
Default
  #3
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28
mturcios777 will become famous soon enough
If you look in specieThermoI.H you will find the function TH. Looking at it you will see that the template is calling another function T and feeding it the proper coefficients (whether its enthalpy or energy you are inverting).

The function T is also in the file, near the very beginning. Here is where temperature is obtained by inverting the enthalpy/energy based on the the species thermo (its a simple Newton's method if I read the code right).

EDIT: Hehe Tobi, you must have been thinking while I was typing ;-)

Last edited by mturcios777; August 1, 2012 at 18:51. Reason: Answered already
mturcios777 is offline   Reply With Quote

Old   August 1, 2012, 18:56
Default
  #4
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hihi,

well, nevertheless thanks for reading and anwering
You are right. After I read the specieThermoI.H file I saw that TH is calling a other function T() and thats defined in the beginning of the thermo model

Wow .. cool ... hihi. I am getting familiar and familiar with OF code.
Tobi is offline   Reply With Quote

Old   August 28, 2013, 04:42
Default
  #5
Senior Member
 
starter
Join Date: Sep 2012
Posts: 125
Rep Power: 16
sihaqqi is on a distinguished road
Quote:
Originally Posted by Tobi View Post
Hihi,

well, nevertheless thanks for reading and anwering
You are right. After I read the specieThermoI.H file I saw that TH is calling a other function T() and thats defined in the beginning of the thermo model

Wow .. cool ... hihi. I am getting familiar and familiar with OF code.
Hello Tobias and Marcos,

I have this same type of problem but like you I am not a very senior CFD specialist. I was trying to follow your comments but I do not understand how to resolve this issue. I have recently enrolled in postgrad by research student this is my first time with CFD and openfoam. I am solving for air flow in a pipe. Air is taken as compressible. So I am using rhoPimpleFoam. Can you please advise how I can get rid of this error.

I have applied following strategies

1. With small number of cells (coarse mesh), as rhoMax increases, number of time steps increase before solution fails.2. As number of cells increase, as rhoMax increases, number of time steps decrease against the same number of rhoMax.



I have tried this strategy on cell size 13000, 26000 and 85000 for 8 trial cases for rhoMax 2, Pressure 100,000 and Temperature 300.

I have tried to increase pressure and temperatures also.

Upon increasing value of pressure to 200,000, error was produced at 0.0184 against 0.0181 at 100,000. The error came after only three more steps. Cell number is 13000. Value of rhoMax was kept as 2.

Upon increasing the value of temperature to 400, error was produced at 0.0458 against 0.0341 at 300. Cell number is 13000. Value of rhoMax was kept as 2.


I shall be very grateful.

Regards




Attached Images
File Type: jpg error.jpg (57.5 KB, 72 views)
sihaqqi is offline   Reply With Quote

Old   August 28, 2013, 04:43
Default
  #6
Senior Member
 
starter
Join Date: Sep 2012
Posts: 125
Rep Power: 16
sihaqqi is on a distinguished road
Quote:
Originally Posted by Tobi View Post
Hihi,

well, nevertheless thanks for reading and anwering
You are right. After I read the specieThermoI.H file I saw that TH is calling a other function T() and thats defined in the beginning of the thermo model

Wow .. cool ... hihi. I am getting familiar and familiar with OF code.
Hello Tobias and Marcos,

I have this same type of problem but like you I am not a very senior CFD specialist. I was trying to follow your comments but I do not understand how to resolve this issue. I have recently enrolled in postgrad by research student this is my first time with CFD and openfoam. I am solving for air flow in a pipe. Air is taken as compressible. So I am using rhoPimpleFoam. Can you please advise how I can get rid of this error.

I have applied following strategies

1. With small number of cells (coarse mesh), as rhoMax increases, number of time steps increase before solution fails.

2. As number of cells increase, as rhoMax increases, number of time steps decrease against the same number of rhoMax.



I have tried this strategy on cell size 13000, 26000 and 85000 for 8 trial cases for rhoMax 2, Pressure 100,000 and Temperature 300.

I have tried to increase pressure and temperatures also.

Upon increasing value of pressure to 200,000, error was produced at 0.0184 against 0.0181 at 100,000. The error came after only three more steps. Cell number is 13000. Value of rhoMax was kept as 2.

Upon increasing the value of temperature to 400, error was produced at 0.0458 against 0.0341 at 300. Cell number is 13000. Value of rhoMax was kept as 2.


I shall be very grateful.

Regards




sihaqqi is offline   Reply With Quote

Old   August 28, 2013, 04:44
Default
  #7
Senior Member
 
starter
Join Date: Sep 2012
Posts: 125
Rep Power: 16
sihaqqi is on a distinguished road
[QUOTE=sihaqqi;448455]

Hello Tobias and Marcos,

I have this same type of problem but like you I am not a very senior CFD specialist. I was trying to follow your comments but I do not understand how to resolve this issue. I have recently enrolled in postgrad by research student this is my first time with CFD and openfoam. I am solving for air flow in a pipe. Air is taken as compressible. So I am using rhoPimpleFoam. Can you please advise how I can get rid of this error.

I have applied following strategies

1. With small number of cells (coarse mesh), as rhoMax increases, number of time steps increase before solution fails.

2. As number of cells increase, as rhoMax increases, number of time steps decrease against the same number of rhoMax.

I have tried this strategy on cell size 13000, 26000 and 85000 for 8 trial cases for rhoMax 2, Pressure 100,000 and Temperature 300.

I have tried to increase pressure and temperatures also.

Upon increasing value of pressure to 200,000, error was produced at 0.0184 against 0.0181 at 100,000. The error came after only three more steps. Cell number is 13000. Value of rhoMax was kept as 2.

Upon increasing the value of temperature to 400, error was produced at 0.0458 against 0.0341 at 300. Cell number is 13000. Value of rhoMax was kept as 2.

I shall be very grateful.

Regards
Attached Images
File Type: jpg error.jpg (57.5 KB, 20 views)
sihaqqi is offline   Reply With Quote

Old   August 28, 2013, 05:18
Default
  #8
Senior Member
 
starter
Join Date: Sep 2012
Posts: 125
Rep Power: 16
sihaqqi is on a distinguished road
Fellows

My image was very vague last time. I have reattached it so you may see the error.

Regards
Attached Images
File Type: jpg error.jpg (57.5 KB, 29 views)
sihaqqi is offline   Reply With Quote

Old   August 28, 2013, 12:57
Default
  #9
New Member
 
Vito Raso
Join Date: Apr 2013
Location: Bari(Italy)
Posts: 7
Rep Power: 13
Vito31388 is on a distinguished road
Hi foamers, I'd like to understand how temperature is calculated in library hhuMixtureThermo.C because as you' ve explained in previous posts temperature is obtained from TH() function. However in hhuMixtureThermo library there are 3 functions to calculate unburnt(Tu) and burnt gas(Tb), mixture(T) temperature. It's clear how Tu and Tb are calculated:
Code:
       TuCells[celli] = this->cellReactants(celli).TH(huCells[celli], TuCells[celli]);
       TbCells[celli] = this->cellProducts(celli).TH(hCells[celli], TCells[celli]);
Is mixture calculated from this function:

Code:
TCells[celli] = mixture_.TH(hCells[celli], TCells[celli]);
or based upon Tu and Tb ?

Thanks in advance, Vito
Vito31388 is offline   Reply With Quote

Old   March 15, 2016, 06:53
Default
  #10
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hello guys,

I do not know why this topic is not tracked anymore... so I am sorry for not replaying. I think your problems solved (2 years ago)...
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   July 5, 2016, 16:17
Default Maximum number of iterations exceeded
  #11
New Member
 
Henry
Join Date: May 2016
Posts: 15
Rep Power: 10
hbrist7 is on a distinguished road
Hi Tobi, I've been having some problems with the "Maximum number of iterations exceeded" error.

I've been pouring through the source code to find where the error is, but to I've got nowhere. Do you have any advice for how to go about solving this?

The case is a wedge that I meshed using snappy Hex Mesh in the middle of a block mesh domain with an inlet, outlet, and symmetry plane on one side.

This is what I got from the log file:

Code:
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  3.0.1                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : 3.0.1-119cac7e8750
Exec   : rhoCentralFoam -parallel
Date   : Jul 01 2016
Time   : 12:54:38
Host   : "bft-01-cfd01"
PID    : 30359
Case   : /home/mpiuser/OpenFOAM/mpiuser-3.0.1/run/henry/wedge/wedge15maxIterError
nProcs : 36
Slaves : 
35
(
"bft-01-cfd01.30360"
"bft-01-cfd01.30361"
"bft-01-cfd01.30362"
"bft-01-cfd01.30363"
"bft-01-cfd01.30364"
"bft-01-cfd01.30365"
"bft-01-cfd01.30366"
"bft-01-cfd01.30367"
"bft-01-cfd01.30368"
"bft-01-cfd01.30369"
"bft-01-cfd01.30370"
"bft-01-cfd02.26571"
"bft-01-cfd02.26572"
"bft-01-cfd02.26573"
"bft-01-cfd02.26574"
"bft-01-cfd02.26575"
"bft-01-cfd02.26576"
"bft-01-cfd02.26577"
"bft-01-cfd02.26578"
"bft-01-cfd02.26579"
"bft-01-cfd02.26580"
"bft-01-cfd02.26581"
"bft-01-cfd02.26582"
"bft-01-cfd03.29133"
"bft-01-cfd03.29134"
"bft-01-cfd03.29135"
"bft-01-cfd03.29136"
"bft-01-cfd03.29137"
"bft-01-cfd03.29138"
"bft-01-cfd03.29139"
"bft-01-cfd03.29140"
"bft-01-cfd03.29141"
"bft-01-cfd03.29142"
"bft-01-cfd03.29143"
"bft-01-cfd03.29144"
)

Pstream initialized with:
    floatTransfer      : 0
    nProcsSimpleSum    : 0
    commsType          : nonBlocking
    polling iterations : 0
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Reading thermophysical properties

Selecting thermodynamics package 
{
    type            hePsiThermo;
    mixture         pureMixture;
    transport       const;
    thermo          hConst;
    equationOfState perfectGas;
    specie          specie;
    energy          sensibleInternalEnergy;
}

Reading field U

Creating turbulence model

Selecting turbulence model type laminar
fluxScheme: Kurganov

Starting time loop

Mean and max Courant Numbers = 0.00521015 0.119072
deltaT = 2.4e-06
Time = 2.4e-06

diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
diagonal:  Solving for rhoUx, Initial residual = 0, Final residual = 0, No Iterations 0
diagonal:  Solving for rhoUy, Initial residual = 0, Final residual = 0, No Iterations 0
diagonal:  Solving for rhoUz, Initial residual = 0, Final residual = 0, No Iterations 0
smoothSolver:  Solving for Ux, Initial residual = 0.999285, Final residual = 0.00389594, No Iterations 5
smoothSolver:  Solving for Uy, Initial residual = 0.999999, Final residual = 8.69665e-17, No Iterations 5
smoothSolver:  Solving for Uz, Initial residual = 1, Final residual = 8.81879e-17, No Iterations 5
diagonal:  Solving for rhoE, Initial residual = 0, Final residual = 0, No Iterations 0
smoothSolver:  Solving for e, Initial residual = 1.46977e-11, Final residual = 1.46977e-11, No Iterations 0
ExecutionTime = 0.68 s  ClockTime = 1 s

Mean and max Courant Numbers = 0.00625242 0.142579
deltaT = 2.88e-06
Time = 5.28e-06

diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
diagonal:  Solving for rhoUx, Initial residual = 0, Final residual = 0, No Iterations 0
diagonal:  Solving for rhoUy, Initial residual = 0, Final residual = 0, No Iterations 0
diagonal:  Solving for rhoUz, Initial residual = 0, Final residual = 0, No Iterations 0
smoothSolver:  Solving for Ux, Initial residual = 6.23273e-10, Final residual = 6.23273e-10, No Iterations 0
smoothSolver:  Solving for Uy, Initial residual = 1.24042e-05, Final residual = 6.5351e-18, No Iterations 5
smoothSolver:  Solving for Uz, Initial residual = 0.00028774, Final residual = 4.85118e-17, No Iterations 5
diagonal:  Solving for rhoE, Initial residual = 0, Final residual = 0, No Iterations 0
smoothSolver:  Solving for e, Initial residual = 5.7298e-12, Final residual = 5.7298e-12, No Iterations 0
[0] [1] 
[1] 
[1] --> FOAM FATAL ERROR: 
[1] Maximum number of iterations exceeded
[1] 
[1]     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>]
[1]     in file /home/openfoam/OpenFOAM/OpenFOAM-3.0.1/src/thermophysicalModels/specie/lnInclude/thermoI.H at line 66.
[1]
My 0 files are here:
p:

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

internalField   uniform 18822.7;

boundaryField
{
    inlet
    {
        type            fixedValue;
        value           uniform 18822.7;
    }

    outlet
    {
        type            zeroGradient;
    }
	
    airplane
    {
	type		zeroGradient;
    }

    bottom
    {
        type            zeroGradient;
    }

    top
    {
        type            zeroGradient;
    }

    symmetry
    {
	type		symmetryPlane;
    }

    left
    {
	type 		zeroGradient;
    }

    defaultFaces
    {
        type            zeroGradient;
    }
}
T:

Code:
dimensions      [0 0 0 1 0 0 0];

internalField   uniform 216.65;

boundaryField
{
    inlet
    {
        type            fixedValue;
        value           uniform 216.65;
    }

    outlet
    {
        type            zeroGradient;
    }

    airplane
    {
	type		zeroGradient;
    }

    bottom
    {
        type            zeroGradient;
    }

    top
    {
        type            zeroGradient;
    }

    left
    {
	type		zeroGradient;
    }

    symmetry
    {
	type		symmetryPlane;
    }

    defaultFaces
    {
        type            zeroGradient;
    }
}
U:

Code:
dimensions      [0 1 -1 0 0 0 0];

internalField   uniform (400 0 0); //(246.933 0 0);

boundaryField
{
    inlet
    {
        type		fixedValue;
        value           uniform (400 0 0); 
    }

    outlet
    {
        type            zeroGradient;
    }

    airplane
    {
	type		slip;
    }

    bottom
    {
        type            zeroGradient; 
    }

    top
    {
        type            zeroGradient; 
    }

    left
    {
	type		zeroGradient;
    }

    symmetry
    {
	type		symmetryPlane;
    }

    defaultFaces
    {
        type            zeroGradient;
    }
}
hbrist7 is offline   Reply With Quote

Reply


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
Compile problem ivanyao OpenFOAM Running, Solving & CFD 1 October 12, 2012 10:31
ParaView for OF-1.6-ext Chrisi1984 OpenFOAM Installation 0 December 31, 2010 07:42
latest OpenFOAM-1.6.x from git failed to compile phsieh2005 OpenFOAM Bugs 25 February 9, 2010 05:37
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 18:51
[blockMesh] Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Meshing & Mesh Conversion 10 April 2, 2007 15:00


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