Mass Flow Rate Calculation coding

Hi to everybody,
does anyone now how to compute the flow rate on a given faceZone, without using any function Objects, but by directly implementing in a "solver"?
I have been able to save the field U and phi, the faceZone required, nevertheless I can't figure out how to compute the flow rate...

Thanks in advance

OpenFOAM 04-07-21, 9:55 p.m. Ste07

Could please elaborate on what you meant by 'implementing in a solver'? Are you refering to the approach in section 3.1 in the page below?


06-07-21, 5:23 p.m. ashleymelvin

I'll try to explain better what I would need.
I have to perform the POD on the solutions obtained from a simulation, this algorithm is implemented into a particular solver.
Once this algorithm has been performed I have to compute the errors between the reconstructed case using the POD decomposition and the solution coming from the simulation: in particular I would like to compare the flow rate computed in both cases. I was wondering if there exist a method to directly compute the flow rate inside this kind of solver or the function Object (surfaceFieldValue for instance) is the only option.


06-07-21, 5:45 p.m. Ste07

Hi Stefano,

Thanks for the detailed explanation of the problem you're facing. I haven't tried any of the techniques that could calculate flow rate over a given surface directly from the solver. That being said, since you're already able to extract the phi for the required faceZone, the sum of phi's over that zone divided by the area of the zone should technically be your flow rate over that faceZone isn't it? And I think that could be coded in your solver such that it writes out the above expression during every iteration/time-step.


06-07-21, 6:34 p.m. ashleymelvin

I might have solved the problem, following your suggestion.
I am going to report a piece of code:

scalar flowRate = 0.0;
forAll(faceZone, cellI)
                        flowRate += phiReconstructToWrite[faceZone[cellI]];

phiReconstructToWrite is a surfaceScalarField [kg/s]. I am pretty new to OpenFOAM and I don't know if it is possible to sum all the values of phiReconstructToWrite on the cells belonging to the faceZone selected. 

Ps: I am aware that the reported code is wrong, but I just wanted to give an idea of the procedure.


06-07-21, 7:58 p.m. Ste07

Actually I have just tested the code and it seems working.

Thank you very much for the support in solving this issue!
Have a nice evening!

06-07-21, 9:35 p.m. Ste07

Hi Stefano,

Thanks for posting the part of your code here. I'm sure many would find that extremely helpful.

Glad to have helped.


06-07-21, 9:43 p.m. ashleymelvin

A mass flow rate is the rate at which a certain amount of mass passes through or is carried across a surface. Mass flow rates can be measured in many ways, and the units of measure used are often dependent on the type of measurement being made. Visit https://uk.bestessays.com/buy-assignment-online.html for helpp in essay now. For example, if you are measuring the mass flow rate of a liquid, you might use liters per minute as your unit of measure. If you are measuring solid particles, grams per second might be more appropriate.

02-04-22, 11:40 a.m. TimpsonJos

Login to add comment

You have to spend a lot of effort to write such an impressive io games article. Glad to have visited
23-11-22, 2:19 p.m. malina

Log-in to answer to this question.