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/)
-   -   Cell-wise heatFlux? (https://www.cfd-online.com/Forums/openfoam-programming-development/149145-cell-wise-heatflux.html)

Linse February 26, 2015 12:04

Cell-wise heatFlux?
 
Dear all,

I would like to analyse the integral heatflux into or from cells within flow domains within rhoReactingBuoyantFoam. This would allow to find out if and where the flow is surpassing a certain activation energy.

While this seems well possible for walls (wallHeatFlux-condition), I did not yet find a way to implement it for internal cells...

I guess the problem is divided in two:
1. How does one read the heatflux across an internal face?
2. How does one sum up all of the heatfluxes across the faces of one cell?

Thanks for any answers already in advance!

Cheers,
Bernhard

ssss February 27, 2015 04:31

You can access each cell faces, and then calculate the heatFlux as in the wallHeatFlux app, with some modifications :

Code:

surfaceScalarField heatFlux
(
    fvc::interpolate
    (
        (
            turbulence.valid()
            ? turbulence->alphaEff()()
            : thermo->alpha()
          )
      )*fvc::snGrad(h)
);


        forAll (mesh.cells(),cellI)
        {
            const cell& faces = mesh.cells()[cellI];
            scalar sumHeatFlux=0;
            forAll( faces, i )        // loop over all faces in cellI
            {
              sumHeatFlux+=mesh.magSf()[i]*heatFlux[i];
            }
        }

Let me know if it works I'm not sure of how you want to calculate the heatFlux

Linse February 27, 2015 10:09

Dear ssss,

Thanks a lot for that quick reply!
I just tried to implement that. While compilation works, it does not provide anything different from 0 - which is kind of unrealistic in a flow where - just for test purposes - I put a temperature gradient of over 200 Kelvin.

So it seems somehow the value is not computed correctly - if at all.
Although I had to drop out the alphaEff for turbulence-model reasons, there should be a heat flux nevertheless.

At the moment I am trying to get a grasp on the different geometric fields in use via the Programmers' Guide, but any hints are welcome!

Cheers,
Bernhard

ssss February 27, 2015 10:11

Could you provide me a testcase to try it?

It may be 0 every where because I initizalized the variable inside a for-loop and thus it will be 0 outside.

Linse February 27, 2015 10:34

Simple testcase in preparation...

Linse March 13, 2015 07:31

Testcase and Solver
 
Okay, it took longer than expected (the flu didn't help, either), but now there are a minimal testcase for the question as well as a minimal solver based on rhoReactingBuoyantFoam. Unfortunately the file is too big, so you will have to download it from
http://blinseis.web.cern.ch/blinseis...luxFoam.tar.gz (approx. 3.3 Mb)
Afterwards just compile from within reactingFoam/rhoReactingBuoyantFoam and the solver should be available as rhoReactingBuoyantFoam_heatFlux_1 .

The strange thing for the moment:
Different heatFluxes are computed for the different cells. Too big to be negligible/numerical noise. This is expected.
Nevertheless the heatFluxes are in places where they are not expected at all, while other places with a definite heatFlux are very lowlevel.

Any Ideas? Thanks for your thoughts in advance!


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