# Calculate volume average of volScalarField

 Register Blogs Members List Search Today's Posts Mark Forums Read

 August 21, 2006, 09:21 One easy question. How to calc #1 Member   Dihao Tang Join Date: Mar 2009 Posts: 78 Rep Power: 14 One easy question. How to calculate volume average of a volScalarField? I think the average() is not the function I want. Can somebody tell me? Thanks!

 August 21, 2006, 10:38 That's the problem with easy q #2 Assistant Moderator   Bernhard Gschaider Join Date: Mar 2009 Posts: 4,209 Rep Power: 48 That's the problem with easy questions. Nobody wants to answer them because you can only embarrass yourself by saying somthing stupid. Nevertheless: sum(mesh.V()*myField)/sum(mesh.V()) (weighted average of the cell-values) Luttappy likes this. __________________ Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request

 August 21, 2006, 10:49 volScalarField a = ...; a #3 Senior Member   Hrvoje Jasak Join Date: Mar 2009 Location: London, England Posts: 1,872 Rep Power: 30 volScalarField a = ...; a.weightedAverage(mesh.V()); Hrv __________________ Hrvoje Jasak Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk

May 1, 2013, 13:37
#4
Member

pooyan
Join Date: Nov 2011
Posts: 62
Rep Power: 11
so, what about surface average of a scalar field at specified boundary patch (like inlet)

how can I include that in my source code?

Quote:
 Originally Posted by hjasak volScalarField a = ...; a.weightedAverage(mesh.V()); Hrv