# How does the operation in surfaceFieldValue exactly work?

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

 January 19, 2023, 11:14 How does the operation in surfaceFieldValue exactly work? #1 New Member   Turhan Join Date: Sep 2022 Posts: 16 Rep Power: 3 Dear all, I'm running a code that shows a flow through a pipeline In order to see what the mass flow is through the pipe I've written the following code: MassFlow { type surfaceFieldValue; libs (fieldFunctionObjects); enabled true; writeControl writeTime; log true; writeFields false; regionType patch; name inlet; operation average; fields ( phi U p ); } Here I've written average at the operation. But what is it exactly taking the average of? Is it summing the phi, U and p on each point of the patch I've chosen? Or is it averaging the variables at each timestep? To compare results, I had rerunned the simulation with "operation none;" instead, but that gave me a blank page.

 January 19, 2023, 12:02 #2 Senior Member   Yann Join Date: Apr 2012 Location: France Posts: 1,053 Rep Power: 26 Hello, Your current definition is computing the average value of all faces on your patch for Phi, U and p. More details here: https://www.openfoam.com/documentati...ieldValue.html If you want to compute the flowrate you should use operation sum on phi (which is the flux on each face of the patch). Regards, Yann

February 21, 2023, 10:00
#3
New Member

Turhan
Join Date: Sep 2022
Posts: 16
Rep Power: 3
Quote:
 Originally Posted by Yann Hello, Your current definition is computing the average value of all faces on your patch for Phi, U and p. More details here: https://www.openfoam.com/documentati...ieldValue.html If you want to compute the flowrate you should use operation sum on phi (which is the flux on each face of the patch). Regards, Yann
I see, with faces I assume you mean the faces of the grid cells at the patch.
So for the total flow rate it makes sense to sum the flow rate through all faces.
But would that not mean that for data such as the pressure and velocity I should get the average value of all faces in order to know what velocity/pressure occurs at the patch?

 February 21, 2023, 10:17 #4 Senior Member   Yann Join Date: Apr 2012 Location: France Posts: 1,053 Rep Power: 26 Yes exactly, if you want to know the average velocity or average pressure on your patch you can use average or areaAverage. For the flowrate you can use sum(phi) since phi is the local flux at the face. If you are using an incompressible solver, you will get a volume flow rate. If you are using a compressible solver you will get a mass flow rate. You can also compute areaNormalIntegrate(U) which will also give a volume flow rate. I hope this helps. Yann

 Tags post process, surfacefieldvalue