|
[Sponsors] |
March 10, 2014, 01:45 |
Accurately calculate boundaryField average
|
#1 |
Member
Ripudaman Manchanda
Join Date: May 2013
Posts: 55
Rep Power: 13 |
Hi fellow Foamers,
I am having some trouble identifying the best way to calculate the boundaryField average on a patch. I have tried three techniques and all of them give me different answers :- Code:
label wallPatch1 = mesh.boundaryMesh().findPatchID("ff"); scalar area1 = gSum(mesh.magSf().boundaryField()[wallPatch1]); if (area1 > 0) { sumW111 = gSum ( mesh.magSf().boundaryField()[wallPatch1] * mag(D.boundaryField()[wallPatch1]) ) / area1; } forAll(D.boundaryField()[wallPatch1], face1) { D1 = D.boundaryField()[wallPatch1][face1]; N1 = mesh.Sf().boundaryField()[wallPatch1][face1] /mesh.magSf().boundaryField()[wallPatch1][face1]; disp1 = -1.0 * (D1.component(vector::X) * N1.component(vector::X)); disp1+= -1.0 * (D1.component(vector::Y) * N1.component(vector::Y)); disp1+= -1.0 * (D1.component(vector::Z) * N1.component(vector::Z)); disp1 = disp1/mag(N1); sumW1+=mag(disp1); sumW11+=mag(D.boundaryField()[wallPatch1][face1]); nF1+=1; } Info<<sumW1/nF1<<nl<<sumW11/nF1<<nl<<sumW111<<nl; FYI, the above snippet is added as a separate .H file in the runTime loop. Foamers please help me here. Thank you. Regards, Ripu |
|
March 10, 2014, 07:32 |
|
#2 |
Senior Member
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 22 |
For OpenFOAM operators see: http://www.foamcfd.org/Nabla/guides/...sGuidese4.html
I guess you want the inner/dot product of the surface vectors of the patch with your field? Then you have to use the operator "&" instead of "*" in your sum for W111. At least for W1 you are calculating the inner product. W11 just sums the unweighted absolute values of your field on the patch to calculate the mean of all these values. So in fact, you calculate three different thing. They would be equal, if all faces of the patch had the same size and the field was parallel to the faces' normal vectors. |
|
March 10, 2014, 21:35 |
|
#3 |
Member
Ripudaman Manchanda
Join Date: May 2013
Posts: 55
Rep Power: 13 |
Joachim,
Thank you very much for the explanation. I highly appreciate it. Regards, Ripu |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to calculate the average of torque in transient Ansys CFX Simulation | xtphgu | CFX | 23 | June 17, 2020 08:17 |
How to calculate a zone Average | subhkirti | OpenFOAM Post-Processing | 36 | October 27, 2015 10:30 |
calculate the average velocity of particles | robert | FLUENT | 0 | August 1, 2008 10:44 |
Average of a UDMI in UDF | milan | FLUENT | 0 | April 15, 2008 13:37 |
Can FLUENT calculate the boundary layer accurately | Bob | FLUENT | 2 | August 25, 2007 02:23 |