CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

Time-average of a patch (wallHeatFlux)

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By milabvieira
  • 1 Post By wyldckat

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 22, 2016, 19:17
Default Time-average of a patch (wallHeatFlux)
  #1
New Member
 
Camila Braga Vieira
Join Date: Apr 2012
Posts: 9
Rep Power: 14
milabvieira is on a distinguished road
Dear Foamers,

I would like to know if someone could help me to get the time-average of a variable defined on the patches (in my case, wallHeatFlux), by using the fieldAverage function?

The fieldAverage works well when I define it (in the controlDict) for Temperature of Velocity, which are internal fields (fieldI, according to the .C document).

Nevertheless, I am interested in obtaining the average on time of the wallHeatFlux (that are calculated over the patches), so when writing this variable inside the fields brackets, I get an error informing that I don't have the wallHeatFlux database, but I have that file with my results from the previous time-step.

If someone knows how to modify the libfunctionObjects.so to a libfunctionObjectsCustom.so (for instance), so that I could time-average the wallHeatFlux exactly as it is done to the Temperature field, I will be very glad to receive your suggestions.

Thank you very much for your help.

Camila
jadidi.cfd likes this.

Last edited by milabvieira; February 23, 2016 at 16:27.
milabvieira is offline   Reply With Quote

Old   March 28, 2016, 16:11
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings Camila,

Please find in attachment the case "hotRoom_wallHeatFlux.tar.gz", tested on OpenFOAM 3.0.x, but the case set-up can be used as a basis for other versions.

The case was modified from "heatTransfer/buoyantPimpleFoam/hotRoom" and the following steps were added:
  1. Added in Allrun the following two lines:
    Code:
    runApplication wallHeatFlux 
    runApplication execFlowFunctionObjects -noFlow -dict system/execDict
  2. The file "system/execDict" has the function object for the field averaging over time, namely:
    Code:
    functions
    {
        fieldAverage1
        {
            type            fieldAverage;
            functionObjectLibs ("libfieldFunctionObjects.so");
            enabled         true;
            outputControl       timeStep;
            outputInterval      1;
            resetOnRestart  false;
            resetOnOutput   false;
    
            fields
            (
                wallHeatFlux
                {
                    mean        on;
                    prime2Mean  on;
                    base        time;
                }
            );
        }
    }
This is a quick solution that I could come up with, but this averaging is only taking into account the time snapshots that were saved. It's not exactly what you wanted, but as I said, it's a quick fix.




If you need this done during the simulation, then the following source code folders can be used as a basis:
  • "$FOAM_SRC/postProcessing/functionObjects/utilities/wallShearStress"
  • "$FOAM_APP/utilities/postProcessing/wall/wallHeatFlux"
Best regards,
Bruno
Attached Files
File Type: gz hotRoom_wallHeatFlux.tar.gz (3.4 KB, 64 views)
yueyun likes this.
__________________
wyldckat is offline   Reply With Quote

Old   April 29, 2016, 05:57
Default
  #3
New Member
 
Nestor Rueda
Join Date: Apr 2016
Posts: 3
Rep Power: 10
ruedanestor is on a distinguished road
Thank you Bruno, it works perfectly.

It used to work a bit different in OF 2.1, more like:

patchAverage -latestTime wallHeatFlux <patch_here>

What was the change between versions so we now have to include it in an external dictionary?

Nestor,
ruedanestor is offline   Reply With Quote

Old   May 1, 2016, 20:03
Default
  #4
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Nestor,

patchAverage still exists in OpenFOAM 3.0 and it should still work. But the original question was about the "fieldAverage" function object, so I replied to that specific question. And honestly, I didn't remember about patchAverage.

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   December 21, 2018, 00:37
Default
  #5
Member
 
Ramana
Join Date: Jul 2017
Location: India
Posts: 58
Rep Power: 9
svramana is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Greetings Camila,

Please find in attachment the case "hotRoom_wallHeatFlux.tar.gz", tested on OpenFOAM 3.0.x, but the case set-up can be used as a basis for other versions.

The case was modified from "heatTransfer/buoyantPimpleFoam/hotRoom" and the following steps were added:
  1. Added in Allrun the following two lines:
    Code:
    runApplication wallHeatFlux 
    runApplication execFlowFunctionObjects -noFlow -dict system/execDict
  2. The file "system/execDict" has the function object for the field averaging over time, namely:
    Code:
    functions
    {
        fieldAverage1
        {
            type            fieldAverage;
            functionObjectLibs ("libfieldFunctionObjects.so");
            enabled         true;
            outputControl       timeStep;
            outputInterval      1;
            resetOnRestart  false;
            resetOnOutput   false;
    
            fields
            (
                wallHeatFlux
                {
                    mean        on;
                    prime2Mean  on;
                    base        time;
                }
            );
        }
    }
This is a quick solution that I could come up with, but this averaging is only taking into account the time snapshots that were saved. It's not exactly what you wanted, but as I said, it's a quick fix.




If you need this done during the simulation, then the following source code folders can be used as a basis:
  • "$FOAM_SRC/postProcessing/functionObjects/utilities/wallShearStress"
  • "$FOAM_APP/utilities/postProcessing/wall/wallHeatFlux"
Best regards,
Bruno
Hi Bruno,
you have explained very well for averaging the wallHeatFlux for the time directories we have saved. But I want to take average while simulation is running. How can do this ? I'm using OF-4.1.
svramana is offline   Reply With Quote

Old   December 22, 2018, 11:24
Default
  #6
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quote:
Originally Posted by svramana View Post
Hi Bruno,
you have explained very well for averaging the wallHeatFlux for the time directories we have saved. But I want to take average while simulation is running. How can do this ? I'm using OF-4.1.
Quick answer: I'm sorry to say that wallHeatFlux was not yet a function object in OpenFOAM 4.1, it was only available as an application: https://github.com/OpenFOAM/OpenFOAM...wallHeatFlux.C - if you really want to do this, you will have to upgrade to OpenFOAM 5 or newer. Either that, or try to compile the function object from OpenFOAM 5 with OpenFOAM 4... for which I don't have time right now explain how.
__________________
wyldckat is offline   Reply With Quote

Old   December 23, 2018, 04:10
Default
  #7
Member
 
Ramana
Join Date: Jul 2017
Location: India
Posts: 58
Rep Power: 9
svramana is on a distinguished road
Thank you Sir.
I'll try out this. Time average of WallHeatFlux is must for me.

Last edited by svramana; December 27, 2018 at 06:46. Reason: I have upgraded to OpenFOAM-5.0. Thank you for your suggestion.
svramana is offline   Reply With Quote

Old   January 15, 2019, 08:35
Default Calculation of wrong heat flux using wallHeatFlux utiity
  #8
Member
 
Ramana
Join Date: Jul 2017
Location: India
Posts: 58
Rep Power: 9
svramana is on a distinguished road
Hi everyone,
I'm simulating heat transfer problem for compressible flow over cylinder using buoyantPimpleFoam. I want to calculate Nusslet number over cylinder, for that I'm taking time average of wall heat flux with help of wallHeatFlux utility available in OF5.0.
But problem is that I'm getting wrong values of heat flux as shown in attached picture. Value must be highest at stagnation point as boundary layer is thickeness is lowest there and then it should gradually decrease as BL thickeness increase. But I'm getting results opposite to it.
I'm not able to figure out what is wrong with my simulation or it is bug. Can someone help me please ?

In figure stagnation point is along plane.
WHF.png
Thanks
svramana is offline   Reply With Quote

Old   January 20, 2019, 17:10
Default
  #9
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quick answer: Not enough information to try and deduce what the problem is. Please follow the instructions given at: How to give enough info to get help

My best guess is that the non-uniform boundary mesh is giving you problems in discretizing the heat transfer. If the adjacent cells near the walls have different thicknesses along the surface of those walls, that will give you disproportionate energy and temperature values, given that it's calculating in function of the volume of the cell.
__________________
wyldckat is offline   Reply With Quote

Old   January 23, 2019, 08:58
Default
  #10
Member
 
Ramana
Join Date: Jul 2017
Location: India
Posts: 58
Rep Power: 9
svramana is on a distinguished road
Hello Bruno sir,
Thank you for reply.
Adjacent mesh near to wall have uniform thickness along the surface but are non uniform in radial direction, but I don't think this could be a problem. For reference I have attached picture of mesh near cylinder.
In the graph we can see that, heat flux is initially increasing and then decreasing whereas, it must continuously decrease from stagnation point onward fir the reason stated in my previous post.
Still I'm struggling to figure out the reason.

Mesh.jpg WallHeatFluxGraph.jpg

If you have time please have look at caseSetup.tar.gz. Please use Allrun script for case initialisation, I'm using buoyantPimpleFoam solver.

I have tried with extracting a temperature of first cell from wall using plot over intersection filter in paraview. Then I subtracted this from wall temperature and divided difference with cell centre distance from wall to get gradient.
i.e grad = (T - T_wall) / dy, where dy is first cell centre distance from wall.
Then used this gradient to calculate Nusslet number = (grad * L) / (T_wall - T_inf), where L is characteristic length and T_inf is free stream temperature.
This way I'm getting exact curve what I want, i.e. matching with experimental data. But not getting with OF utility. I think problem is with snGrad() calculation in OF.
Following picture shows comparison of both the curves.
Nu.jpg


Thank you.

Last edited by svramana; January 25, 2019 at 12:50.
svramana is offline   Reply With Quote

Old   February 21, 2019, 12:22
Default
  #11
Member
 
Ramana
Join Date: Jul 2017
Location: India
Posts: 58
Rep Power: 9
svramana is on a distinguished road
Hi all
Still I'm struggling for the answer. Can any one give some hint please ?
svramana is offline   Reply With Quote

Old   February 21, 2019, 13:06
Default
  #12
Member
 
W. Schuyler Hinman
Join Date: Apr 2013
Location: Calgary, Alberta, Canada
Posts: 38
Rep Power: 13
schuyler is on a distinguished road
How refined is your mesh at the stagnation point? It is possible you do not have enough refinement. The cell Reynolds number requirement for high-speed compressible flows is ReCell<5.

Since you get the right answer using a manual calculation though, I think you may be right about the utility. Something you could try: (1) Use a different version of OpenFOAM, (2) Calculate just the wall gradient of T using the grad() command, and see how that works.
__________________
Schuyler

Last edited by schuyler; February 21, 2019 at 13:11. Reason: added more
schuyler is offline   Reply With Quote

Old   February 22, 2019, 09:11
Default
  #13
Member
 
Ramana
Join Date: Jul 2017
Location: India
Posts: 58
Rep Power: 9
svramana is on a distinguished road
Hi Schuyler,
Thank you for reply.
My mesh resolution near wall is such that y+ < 1. As per your suggestion
(1) I was using OF4.x but I want to take time average of heat flux to calculate average Nusselt number, for which wallHeatFlux must be functionObject, which is not available in OF4. So I installed OF5 and later I tried with OF6 also, but got same results.
(2) Before using wallHeatFlux utility, I was using grad() to calculate Nusselt number but the solution was not correct.

I want to confirm whether I'm using correct formula or not.
The way I'm calculating Nusselt number is Nu = ( q * D) / ( alphaEff * rho * Cp * (Tw - Tinf) )
Where,
q = Heat flux
alphaEff = Effective thermal diffusivity
D = Characteristic length, which is dia in this case
rho = density
Cp = Specific heat capacity
Tw = Wall Temperature
Tinf = Inlet Temperature.

Is this a Correct way ?

Thank you
svramana is offline   Reply With Quote

Old   February 26, 2019, 22:54
Default
  #14
New Member
 
machao
Join Date: Mar 2018
Posts: 3
Rep Power: 8
machao is on a distinguished road
Quote:
Originally Posted by svramana View Post
Hi everyone,
I'm simulating heat transfer problem for compressible flow over cylinder using buoyantPimpleFoam. I want to calculate Nusslet number over cylinder, for that I'm taking time average of wall heat flux with help of wallHeatFlux utility available in OF5.0.
But problem is that I'm getting wrong values of heat flux as shown in attached picture. Value must be highest at stagnation point as boundary layer is thickeness is lowest there and then it should gradually decrease as BL thickeness increase. But I'm getting results opposite to it.
I'm not able to figure out what is wrong with my simulation or it is bug. Can someone help me please ?

In figure stagnation point is along plane.
Attachment 67776
Thanks
Dear svramana

I wonder how you take time average of wall heat flux with help of wallHeatFlux utility available in OF5.0.I want to obtain the average field of wallshearstress.Could you give me some suggestions?

Thanks
machao is offline   Reply With Quote

Old   February 27, 2019, 13:18
Default
  #15
Member
 
Ramana
Join Date: Jul 2017
Location: India
Posts: 58
Rep Power: 9
svramana is on a distinguished road
Hi machao,
I'm taking time average of wallHeatFlux, whether you want time average or surface average?
If you want to take time average, in controlDict you have to call functionObject 'wallShearStress' before you call functionObject 'fieldAverage'. Then again call 'wallShearStress' in field average. This is shown below
Code:
functions
{
   wallShearStress
   {
      type wallShearStress;
      libs ("libfieldFunctionObjects.so");
      patches ("*.wall");
      enabled true;
      timeStart 1; //time from which you want to start averaging
      timeEnd 2; // End time for averaging
      outputControl writeTime;
      resetOnOutput false;
   }

   fieldAverage1
   {
      type fieldAverage;
      libs ("libfieldFunctionObjects.so");
      enabled true;
      timeStart 1; //same as above
      timeEnd 2; // same as above
      outputControl writeTime;
      resetOnOutput false;

      fields
      (
         wallShearStress
         {
            mean on;
            prime2Mean on;
            base time;
         }
       );
   }
}
Thanks
svramana is offline   Reply With Quote

Old   February 27, 2019, 20:05
Default
  #16
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quote:
Originally Posted by svramana View Post
I want to confirm whether I'm using correct formula or not.
The way I'm calculating Nusselt number is Nu = ( q * D) / ( alphaEff * rho * Cp * (Tw - Tinf) )
Where,
q = Heat flux
alphaEff = Effective thermal diffusivity
D = Characteristic length, which is dia in this case
rho = density
Cp = Specific heat capacity
Tw = Wall Temperature
Tinf = Inlet Temperature.

Is this a Correct way ?

Thank you
Quick answer: Questions about Nusselt number calculations with OpenFOAM have been asked several times here on the OpenFOAM forums... after a quick search online, start reading from post #3 on this thread: Calculating Nusselt Number
wyldckat is offline   Reply With Quote

Old   February 28, 2019, 02:03
Default
  #17
Member
 
Ramana
Join Date: Jul 2017
Location: India
Posts: 58
Rep Power: 9
svramana is on a distinguished road
Thank you sir for reply,
I have seen that post and have tried that way also, but actual question was about post #10 of this thread. I have tried different possible ways but I didn't got the correct answer yet.

Thank you
svramana is offline   Reply With Quote

Reply

Tags
fieldaverage, functionobjects, post-processing


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
[Other] Contribution a new utility: refine wall layer mesh based on yPlus field lakeat OpenFOAM Community Contributions 58 December 23, 2021 03:36
Floating point exception error Alan OpenFOAM Running, Solving & CFD 11 July 1, 2021 22:51
Floating point exception error lpz_michele OpenFOAM Running, Solving & CFD 53 October 19, 2015 03:50
Could anybody help me see this error and give help liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 19:07
[Gmsh] Import gmsh msh to Foam adorean OpenFOAM Meshing & Mesh Conversion 24 April 27, 2005 09:19


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