0
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
Regards


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

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?

https://openfoamwiki.net/index.php/Tip_Function_Object_writeRegisteredObject

Regards,
Ashley
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.

Regards,
Stefano


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.

Regards,
Ashley


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.

Regards, 
Stefano


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!
Stefano


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.

Regards,
Ashley


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

Login to add comment


0
I have read your article; it is very informative and helpful for me. I admire the valuable information you offer in your articles. Thanks for posting it. Resurge Supplement geometry dash
Oops! Looks like spam! Waiting for moderator approval.
08-07-21, 7:26 a.m. geometrydash

Login to add comment
Oops! Looks like spam! Waiting for moderator approval


Log-in to answer to this question.