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/)
-   -   turbFoam solver with heat-transfer? (https://www.cfd-online.com/Forums/openfoam-solving/66072-turbfoam-solver-heat-transfer.html)

svens July 4, 2009 22:38

turbFoam solver with heat-transfer?
 
Hallo out there.

I would like to set up a case of incomp. turbulent channel flow with heat-transfer.

Is there a way of implementing the energy equation in the standard turbFoam solver?

Has anyone experiences with this topic? Is there another better way to compute an incomp. turbulent flow with heat-transfer?

Thanks so much - svens

henrik July 6, 2009 10:53

Dear Sven,

please have a look here

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

Henrik

svens July 8, 2009 22:34

Hello together & hello Henrik - thanks for your reply.

I did what you said and it works - at least without adding the turbulent thermal diffusivity.

And exactly here is my present problem which also shows me my huge lack of C++ knowledge (I'll promise I am going to work on that issue)...
But so far I would be really greatful about some inspiration on this topic:

I added an energy equation to the turbFoam.C code-file like this:
Code:

        fvScalarMatrix TEqn
        (
            fvm::ddt(T)
            + fvm::div(phi, T)
            - fvm::laplacian(DTEff, T)
        );

      TEqn.solve();

DTEff is my formulation for the turbulent thermal diffusivity (= nut/Pr_t+nu/Pr).
I had a look where the other diffusivities had been implemented and found out that they are initialed in the respective turbulence model which is in my case a k-epsilon-model.
Orientated at the DkEff and DepsilonEff I added:
Code:

        tmp<volScalarField> DTEff() const
        {
            return tmp<volScalarField>
            (
                new volScalarField("DTEff", 1/0.85 * nut_ + nu())
            );
        }

to a copied kEpsilon.H header-file (0.85 is the value of the turbulent Prandtle-Number Pr_t).
At the moment I am trying to connect this new turbulent thermal diffusivity via the RASModel files (-.C & -.H) to the modified turbFoam.C code-file where I want to use DTEff.

Sadly all my attempts failed so far.

How do I have to formulate DTEff to use it in my turbFoam.C file?

I would be so thankful if someone could help me with this problem.

Regards - Sven

henrik July 9, 2009 04:14

Dear Sven,

there is no need to change the turbulence model to solve your problem. But if you go that route, it is essential to change the base class (RASmodel.H) to give access to the effective turbulent thermal diffusivity.

Basically you need this line in RASmodel.H:
Code:

virtual tmp<volScalarField> DTEff() const = 0;
You would then call turbulence.DTEff() when constructing the temperature equation.

However, this changes the library and you need to keep it up-to-date with future releases to OF. Alternatively, I would simply add the following line to your version of turbFoam.C
Code:

volScalarField DTEff =
    turbulence.nut()/0.85 + laminarTransport.nu();

It would be great if you could you add this wisdom to the Wiki for future generations ;-)

Henrik

svens July 9, 2009 14:26

Hello Henrik - thanks for your reply.

Your alternative seems to be much better than my attempts!

I implemented your suggestion and received directly the next error massage while compiling the new turbFoam.C file with wmake:
Code:

error: 'class Foam::autoPtr<FOAM::incompressible::RASModel>' has no member named 'nut'
Did I something wrong? Is there another way to call the nut() values then by turbulence.nut()?

Thanks for your help - Sven

henrik July 9, 2009 14:34

Dear Sven,

sorry my fault.

The turbulence model is hooked onto an autoPtr (see createFields.H) so we must dereference:

turbulence->DTEff()

Just like in the momentum predictor.

Henrik

svens July 9, 2009 14:43

...just had the same awareness!

Thanks Henrik - your advices had been of huge value!

Well to add this in the OF Wiki would be really great. But I guess at the moment there is still a lack of backround knowledge in my case. My next step is to run the code with an modified RAS model. I guess and hope after that I will have enough knowledge to write an reasonable Wiki article.

Thanks so much Henrik! Greeting - Sven

henrik July 9, 2009 18:11

Dear Sven,

thanks for the flowers :rolleyes:

What most people on the learning curve often forget is that they have a vivid experience where they went wrong, where they needed help and what actually was the missing piece that made them struggle - and this is exactly what they could contribute. More experienced users can then correct the little mistakes and fill in the background information at a later stage.

So (everybody) please use the Wiki and fill the FAQ.

Henrik

svens July 13, 2009 12:09

Your are right Henrik - I going to do this the next days.

Regards - Sven


All times are GMT -4. The time now is 07:48.