CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (https://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   wrong calculation of wallHeatFlux utility in solid patches (https://www.cfd-online.com/Forums/openfoam-post-processing/147539-wrong-calculation-wallheatflux-utility-solid-patches.html)

zfaraday January 23, 2015 08:12

wrong calculation of wallHeatFlux utility in solid patches
 
Dear foamers,

I'm currently working on a multi region case with chtMultiRegionFoam solver. In this case I only work with solids and my purpose is to calculate the heat balance in one of the solids in every time step. To do so, I implemented the following function objects in the controlDict file:
Code:

    energyVariationFasana
    {
        type swakExpression;
        region fasana;
        outputControlMode timeStep;
        outputInterval 1;
        aliases {
            rho thermo:rho;
        }
        expression "rho*vol()*(h-oldTime(h))/deltaT()";
        accumulations ( sum );
        valueType internalField;
        verbose true;
    }
    energyAbsorbedFasana
    {
        type patchExpression;
        outputControlMode timeStep;
        outputInterval 1;
        accumulations (
            sum
        );
        patches (".*");
        region fasana;
        variables ("k=0.5;"
                  );
        expression "k*(snGrad(T))*area()";
        verbose true;
    }

The first one computes the thermal power gained by the solid in the current time step while the second one computes the heat flux in all patches of the same solids (the same that wallHeatFlux utility does).

So far, one may think that only one of the methods to compute heat flux at patches should be used because it's a waste of time to use both. Well, I have used both and I found something surprising. Both methods give exactly the same result in regular patches (as it was expected), but very different one in patches of type mappedWall (those named solid1_to_solid2 that connect two solids). Here you can see an example of such difference:
Code:

wallHeatFlux          function object            wHF/fo 
-0.0382378                -0.01433923                2,6666564383
-0.044291812                -0.014763784                3,0000311573
0.013526612                0.0099961003                1,3531889031
-0.034700336                -0.013012907                2,6666090828
-0.044298687                -0.014766133                3,0000195041

I cannot figure out the reason of this big difference, but taking into account the physics of the problem I guess that the correct result is the one given by the function object since the equation used is the heat conduction equation (Fourier's Law).

My guess is that the wrong values have something to do with the contact area between solids because the bigger values of the third column belong to the patches that have bigger area that transfers heat from one solid to another.

Maybe there's some bug in the wallHeatFlux utility or maybe I am doing something wrong. Can anybody give me a hint on what is the correct value? In my case it's not a big deal because the contact surfaces between solids are not much big ant the heat transmitted between them is practically 0, but it may cause a big confussion in other cases where heat flux between different solids is an important point.

Note: Another point I don't understand is why I have to define the Fourire's Law in the function object as "k*(snGrad(T))*area()" instead of "-k*(snGrad(T))*area()" which is the correct formulation... If I use the correct one I get the opposite fluxes!:confused:

Thanks in advance.

Regards,

Alex

zfaraday January 30, 2015 10:38

Isn't there anyone who can shed some light on it? It seems that something doesn't work as expected with wallHeatFlux utility... Does no one really faced this problem before?

coccone March 17, 2015 04:17

I am a newbie with OF, so I won't be of any help yet, but I am very interested in this topic as I need to calculate the heat transfer between solids in a chtMultiRegion case.

I agree with you there should be a minus in front of K*snGrad(T)*area() since heat flows in the opposite direction of temperature gradient vector indeed (positive direction pointing from cold to hot), though it can be a matter of sign convention. It seems to me that OF works with a coherent sign system (also when fixed gradients need to be imposed I use the opposite of what I would naturally use) so sign is not really a big deal for me, I am more concerned with magnitude.

One thing I would like to know is how to read out energyAbsorbed and energyVariation after calculation stopped and why does wallHeatFlux work only on walls (or how do I get heat fluxes from other kind of boundaries)...

Thanks for your effort!

coccone March 19, 2015 04:26

Quote:

Originally Posted by coccone (Post 536684)
One thing I would like to know is how to read out energyAbsorbed and energyVariation after calculation stopped

Ok, that I figured out. Had to compile swak4Foam for OF 2.3.1, and seems to work fine on all patches...

One thing is puzzling me is that energy variation is always null even though the region is heating up!

coccone April 3, 2015 04:25

Quote:

Originally Posted by zfaraday (Post 528776)

Code:

wallHeatFlux          function object            wHF/fo 
-0.0382378        -0.01433923        2,6666564383
-0.044291812        -0.014763784        3,0000311573
0.013526612        0.0099961003        1,3531889031
-0.034700336        -0.013012907        2,6666090828
-0.044298687        -0.014766133        3,0000195041

My guess is that the wrong values have something to do with the contact area between solids because the bigger values of the third column belong to the patches that have bigger area that transfers heat from one solid to another.

As I dug more into it, I understood wallHF computes a sum of conductive and turbulent diffusion. Since wHF/fo is greater than one I suspect it is somehow computing some turbulent contribuition on a solid region, which should even be related to area... :confused:

Could it be?

Quote:

Originally Posted by zfaraday (Post 528776)
In my case it's not a big deal because the contact surfaces between solids are not much big ant the heat transmitted between them is practically 0, but it may cause a big confussion in other cases where heat flux between different solids is an important point.

that's exactly my case :eek:

Anyway I'd go on (or, better, I do go on) with function obj since I have a grasp on what they actually do.

hcl734 January 12, 2016 07:41

Did you made any progress here?

coccone January 12, 2016 16:39

Quote:

Originally Posted by hcl734 (Post 580622)
Did you made any progress here?

I completely ditched wallHF, so far I've been using only function objects to calculate it. The formulation here above works fine for solid regions so I sticked to it, you just get slightly different values at opposite sides of a coupled patch that eventually tend to converge.

If you have the same issues with wallHF, my advice is to just switch to function objects and if you need to calculate heat flux at a solid-fluid coupled interface just use them on the solid side!:cool:

Enjoy!


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