CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Add temperature to pisoFoam (http://www.cfd-online.com/Forums/openfoam-programming-development/98828-add-temperature-pisofoam.html)

danvica March 20, 2012 07:15

Add temperature to pisoFoam
 
I'm trying to add temperature field to pisoFoam.

I followed the icoFoam tutorial, applied to pisoFoam files, and everything seems fine but the turbolence models. It let me work with laminar model only.

Some notes:
- I'm using BlueCape windows porting.
- Compiling the new solver returns me lots of warning concerning missing header files (but developer guide says it's ok)
- Following the Developer guide you have to edit the solver changing CourantNo.H into CourantNo.T.H. But I miss this file. Leaving the original name let the solver be compiled.

My creteFields.h is as following:
Code:

Info<< "Reading transportProperties\n" << endl;
IOdictionary transportProperties
(
    IOobject
    (
        "transportProperties",
        runTime.constant(),
        mesh,
        IOobject::MUST_READ,
        IOobject::NO_WRITE
    )
);
dimensionedScalar DT
(
    transportProperties.lookup("DT")
);
 
    Info<< "Reading field p\n" << endl;
    volScalarField p
    (
        IOobject
        (
            "p",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        mesh
    );
    Info<< "Reading field U\n" << endl;
    volVectorField U
    (
        IOobject
        (
            "U",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        mesh
    );
Info<< "Reading field T\n" <<endl;
volScalarField T
(
    IOobject
    (
        "T",
        runTime.timeName(),
        mesh,
        IOobject::MUST_READ,
        IOobject::AUTO_WRITE
    ),
    mesh
);
#  include "createPhi.H"
 
    label pRefCell = 0;
    scalar pRefValue = 0.0;
    setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue);
 
    singlePhaseTransportModel laminarTransport(U, phi);
    autoPtr<incompressible::turbulenceModel> turbulence
    (
        incompressible::turbulenceModel::New(U, phi, laminarTransport)
    );

Just newbie questions:

- why in the original pisoFoam file the transportProperties Dict was missing ?
- why in the very last lines turbolence is specified using just laminarTransport ?


I tested a case with the laminar model and the result seems ok.

Any help is really appreciated.

Daniele

danvica March 21, 2012 01:57

I tried to follow the guideline of this thread: http://www.cfd-online.com/Forums/ope...implefoam.html

but the problem still remains. I've just the laminar turbolence model.

I think I'm missing something very stupid but I don't know where since I compiled a modified version of pisoFoam.

BTW, now I don't have any missing headers compiling problem.

I'll try to compile an exact copy of original pisoFoam solver and see whether the problem is there too.

Daniele

danvica March 21, 2012 03:15

Strange... even the original pisoFoam solver has the same problem, no other turbolence models than laminar.

The exact error is:

--> FOAM FATAL ERROR:
Unknow turbolenceModel type RASModel

Valid turbolenceModel types:

1
(
laminar
)

From function turbolenceModel::New(&const volVectorField&, const surfaceScalarField&, transportModel&, const word&) in file turbolenceModel.C at line 111.


Any help ?


Daniele

wyldckat March 21, 2012 09:09

Hi Daniele,

I've already replied to you via email. For other forum readers, the latest problem is fixed on blueCFD by running:
Code:

wmake
wmakeVerifyExeDependencies ./
wmake

Where the second command looks for missing DLLs that have to be loaded by force and the third command rebuilds with the necessary forced loads.

Keep in mind that wmakeVerifyExeDependencies is available only on blueCFD's modifications to OpenFOAM source code and this script can be found via Google as well ;)

Best regards,
Bruno

danvica March 21, 2012 14:07

It works ! (well, what else ? ;))

Thanks for the fast support.

Daniele

Mojtaba.a July 30, 2012 20:27

Quote:

Originally Posted by danvica (Post 350394)
I'm trying to add temperature field to pisoFoam.

I followed the icoFoam tutorial, applied to pisoFoam files, and everything seems fine but the turbolence models. It let me work with laminar model only.

Some notes:
- I'm using BlueCape windows porting.
- Compiling the new solver returns me lots of warning concerning missing header files (but developer guide says it's ok)
- Following the Developer guide you have to edit the solver changing CourantNo.H into CourantNo.T.H. But I miss this file. Leaving the original name let the solver be compiled.

My creteFields.h is as following:
Code:

Info<< "Reading transportProperties\n" << endl;
IOdictionary transportProperties
(
    IOobject
    (
        "transportProperties",
        runTime.constant(),
        mesh,
        IOobject::MUST_READ,
        IOobject::NO_WRITE
    )
);
dimensionedScalar DT
(
    transportProperties.lookup("DT")
);
 
    Info<< "Reading field p\n" << endl;
    volScalarField p
    (
        IOobject
        (
            "p",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        mesh
    );
    Info<< "Reading field U\n" << endl;
    volVectorField U
    (
        IOobject
        (
            "U",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        mesh
    );
Info<< "Reading field T\n" <<endl;
volScalarField T
(
    IOobject
    (
        "T",
        runTime.timeName(),
        mesh,
        IOobject::MUST_READ,
        IOobject::AUTO_WRITE
    ),
    mesh
);
#  include "createPhi.H"
 
    label pRefCell = 0;
    scalar pRefValue = 0.0;
    setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue);
 
    singlePhaseTransportModel laminarTransport(U, phi);
    autoPtr<incompressible::turbulenceModel> turbulence
    (
        incompressible::turbulenceModel::New(U, phi, laminarTransport)
    );

Just newbie questions:

- why in the original pisoFoam file the transportProperties Dict was missing ?
- why in the very last lines turbolence is specified using just laminarTransport ?


I tested a case with the laminar model and the result seems ok.

Any help is really appreciated.

Daniele

Hi Danvica. I have implemented temperature field into pisoFoam, too. but i got some problems. I have no idea what is CourantNo.T.H. have you used it in your solver?my problem is when i run the case everything seems to work fine. but after I check my results in paraview there is no change in T field in time. i have added the same equation which was added to icoFoam in tutorial. I wonder if i have put TEqn.H into the source of the solver in correct place. i did it just like icoFoam tutorial. whats wrong?
Regards
Mojtaba

Mojtaba.a July 30, 2012 21:42

I found the solution myself. I was putting TEqn.h in the wrong place in source code. I was putting TEqn after PISO loop, mentioned in this link:

http://openfoamwiki.net/index.php/Ho...ure_to_icoFoam

I put it at the first of the PISO loop which was mentioned in here:

http://www.tfd.chalmers.se/~hani/kurser/OS_CFD_2009/programmingTutorial.pdf

And problem solved.

Matt_B August 27, 2012 04:27

Troubles to add temperature to pisoFoam
 
Hi you all,
I found this thread which is as closer as possible to my current case.
I managed to add temperature to pisoFoam and I followed hints found on the forum and even on the wikipage "How to add temperature to icoFoam". The steps are the following:

SOLVER FOLDER
1) I created a new solver called "pisoFoamT" copying and pasting from the already available "pisoFoam".
2) I added in createFields.H the code for reading new T volScalarField and a new dictionary called "thermophysicalProperties" in the "constant" folder of the new case.
3) I created new "TEqn.H" for the temperature transport equation.
4) In "Make" first I changed in "files" reference from "pisoFoam.C" to "pisoFomT.C", then in "options" I added the address and the new libraries to manage T transport ("specie" and "basicThermophysicalModels").

CASE FOLDER
1) Added T in "0" folder.
2) Added "thermophysicalProperties" in the "constant" folder with the thermo type.
3) In "System/ fvSchemes" I added correct operators to solve T equation and in "System/fvSolution" I added T with the proper solving method.

After that I reached the solver directory on the bash terminal, then I typed "wclean" to delete all the previous dependancies and then "wmake". The binary file seems generated correctly even because the wmake operation report an error in TEqn.H which to me is not very important at this stage, because it just says that one paramether is not declared, which I already knew.
The problem is that, running the case, the T equation is not calculated, is like ignored by the solver and of course the T has not changed at all along time steps. Going deeper and debugging by means of gdb, seems "pisoFoamT" wasn't recognized and was run "pisoFoam" instead, because the lines I added are completely ignored. So, if I added in "pisoFoamT.C" the line #include "TEqn.H", this is like skipped; the same if I enter createFields.H, here is correctly read p, U but T is skipped as well.
Doesn't anybody have any clue on what is happening here?

Thank you.

Matteo

wyldckat August 27, 2012 06:14

Hi Matteo,

Quote:

Originally Posted by Matt_B (Post 378829)
The binary file seems generated correctly even because the wmake operation report an error in TEqn.H which to me is not very important at this stage, because it just says that one paramether is not declared, which I already knew.

Without having access to the code or at least show some of the changes you've actually made, I'll have to assume that the conclusion you've made above is incorrect, since you're expecting something to work, even when it didn't compile properly or as expected ;)

Either way, have you done the other tutorial first? The one to add temperature to icoFoam?

Best regards,
Bruno

Matt_B August 27, 2012 12:09

Quote:

Originally Posted by wyldckat (Post 378850)
Hi Matteo,


Without having access to the code or at least show some of the changes you've actually made, I'll have to assume that the conclusion you've made above is incorrect, since you're expecting something to work, even when it didn't compile properly or as expected ;)

Either way, have you done the other tutorial first? The one to add temperature to icoFoam?

Best regards,
Bruno

You are right Bruno, but my intention was just to find out if I forgot or did wrong the simpler steps....without posting the code. Anyway, I found that when I compile with wmake, it doesn't yield the expected file "pisoFoamT.o" reporting one error. I think that't the origin of my troubles. Maybe I have to work it out better to understand how to avoid this error.
By the way, I already made step by step the "How to add temperature to icoFoam" without any big deal.
Thank you Bruno, if I keep having troubles I'll post it ;)

uli September 3, 2012 17:08

hi Matt

I also modified pisoFoam to solve for temperature. I did not introduce "thermophysicalProperties" nor "TEqn.H" but just added the code to solve energy equation to the pisoFoamT.C file. Except that I did the same you did and so far it works.

Have you found a solution to your problem yet? What comes to my mind are two points:

Did you change "pisoFoam" to "pisoFoamT" in your controldict file?
Did you call pisoFoamT instead of pisoFoam when starting your simulation?

Uli

Matt_B September 5, 2012 05:30

Hi uli,
thanks for your reply and to try to help me ;) I appreciate that.
By the way, I made lots of progress and now I'm able to run my code with temperature equation and thermophysical properties, which was my goal actually. I suggest you to read the following thread I opened after this:

http://www.cfd-online.com/Forums/ope...cal-model.html

I will post on this thread the latest version of my pisoFoamT solver files.

See ya!


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