|
[Sponsors] |
February 22, 2016, 19:17 |
Time-average of a patch (wallHeatFlux)
|
#1 |
New Member
Camila Braga Vieira
Join Date: Apr 2012
Posts: 9
Rep Power: 14 |
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 Last edited by milabvieira; February 23, 2016 at 16:27. |
|
March 28, 2016, 16:11 |
|
#2 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
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:
If you need this done during the simulation, then the following source code folders can be used as a basis:
Bruno
__________________
|
|
April 29, 2016, 05:57 |
|
#3 |
New Member
Nestor Rueda
Join Date: Apr 2016
Posts: 3
Rep Power: 10 |
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, |
|
May 1, 2016, 20:03 |
|
#4 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
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
__________________
|
|
December 21, 2018, 00:37 |
|
#5 | |
Member
Ramana
Join Date: Jul 2017
Location: India
Posts: 58
Rep Power: 9 |
Quote:
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. |
||
December 22, 2018, 11:24 |
|
#6 | |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Quote:
__________________
|
||
December 23, 2018, 04:10 |
|
#7 |
Member
Ramana
Join Date: Jul 2017
Location: India
Posts: 58
Rep Power: 9 |
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. |
|
January 15, 2019, 08:35 |
Calculation of wrong heat flux using wallHeatFlux utiity
|
#8 |
Member
Ramana
Join Date: Jul 2017
Location: India
Posts: 58
Rep Power: 9 |
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 |
|
January 20, 2019, 17:10 |
|
#9 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
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.
__________________
|
|
January 23, 2019, 08:58 |
|
#10 |
Member
Ramana
Join Date: Jul 2017
Location: India
Posts: 58
Rep Power: 9 |
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. |
|
February 21, 2019, 12:22 |
|
#11 |
Member
Ramana
Join Date: Jul 2017
Location: India
Posts: 58
Rep Power: 9 |
Hi all
Still I'm struggling for the answer. Can any one give some hint please ? |
|
February 21, 2019, 13:06 |
|
#12 |
Member
W. Schuyler Hinman
Join Date: Apr 2013
Location: Calgary, Alberta, Canada
Posts: 38
Rep Power: 13 |
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 |
|
February 22, 2019, 09:11 |
|
#13 |
Member
Ramana
Join Date: Jul 2017
Location: India
Posts: 58
Rep Power: 9 |
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 |
|
February 26, 2019, 22:54 |
|
#14 | |
New Member
machao
Join Date: Mar 2018
Posts: 3
Rep Power: 8 |
Quote:
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 |
||
February 27, 2019, 13:18 |
|
#15 |
Member
Ramana
Join Date: Jul 2017
Location: India
Posts: 58
Rep Power: 9 |
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; } ); } } |
|
February 27, 2019, 20:05 |
|
#16 | |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Quote:
|
||
February 28, 2019, 02:03 |
|
#17 |
Member
Ramana
Join Date: Jul 2017
Location: India
Posts: 58
Rep Power: 9 |
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 |
|
Tags |
fieldaverage, functionobjects, post-processing |
|
|
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 |