# Calculation of Volumetric Flow Rate and ACH with Butterfly and Openfoam

After simulating airflow through the openings of a geometry (inlet and outlet have the same area, the geometry is tilted 45deg from the wind direction), I’ve been trying to calculate the Volumetric Flow Rate (and later the ACH) for the indoor volume in 2 ways:

1. Loading probe values in butterfly, multiplying each vector by the area of the face it’s associated with. I obtain 25 m3/s for the inlet and 18 m3/s for the outlet. Which is incoherent.

2. On Openfoam directly, creating a file in the system folder called volFlowRateSurface (find further below the content, it refers to the inlet surface stl exported from rhino into /constant/triSurface) and running the command [postProcess -func “volFlowRateSurface” -latestTime]. I obtain -13.834 m3/s for the inlet and 12.990 m3/s for the outlet. Which is roughly equal ( difference should reduce with better meshing) and coherent.

Do you know how to consider these?

Best,
Olivier

/--------------------------------- C++ -----------------------------------**

• ========= |*
• \ / F ield | OpenFOAM: The Open Source CFD Toolbox*
• \ / O peration | Website: https://openfoam.org*
• \ / A nd | Version: 6*
• ``````\\/     M anipulation  |*
``````

-------------------------------------------------------------------------------
Description

• Calculates volumetric flow rate through a specified triangulated surface*
• by interpolating velocity onto the triangles and integrating over the*
• surface area. Triangles need to be small (<= cell size) for an accurate*
• result.*

*---------------------------------------------------------------------------/*

regionType sampledSurface;
name mySurface;

sampledSurfaceDict
{

• type sampledTriSurfaceMesh;*
• surface in.stl;*
• source cells;*
• interpolate true;*
• fields*
• (*
• ``````   p*
``````
• ``````   phi*
``````
• ``````   U*
``````
• );*
}

#includeEtc “caseDicts/postProcessing/flowRate/volFlowRateSurface.cfg”

// ************************************************************************* //

the postprocessing function

Hi Olivier,

The OF postprocessing is definitely the way to go since it is more accurate and kind of out of the box. I do think however that it will integrate every single velocity vector on the surface without caring much about direction. In this case this is fine, since it’s clear how the wind is moving, in more complex cases there might be some error.

Kind regards,
Theodore.

@TheodorosGalanos

Indeed this leads to what you mention, if through the same openings the air moves in and also out.
In butterfly /grasshopper I used a Dot product to test the vector and dispatch if going in or out.

Have no idea how can OF deal with this. If I find something , I’ll update here.

Best,
Olivier

I forget the name of the function object right now but I think the way to deal with this is to create two faceSets, one slave and one master, one infront of the other, denoting the direction you’re mass flow should be calculated for (master -> slave). It’s been a while since I was looking into this, I’ll try and rediscover the function object that uses those faceSets for calculation.

I’m Takeru, architecure student.
Now I’m struggling with Olivier’s 2nd way with openFOAM directly to check the air flow volume.

Can I ask you to check or give some advice if you have time?

I have already created the file “volFlowRateSurface” as you mentioned in your post.

Then I open the Blue CFD terminal and run the command [postProcess -func “volFlowRateSurface” -latestTime].

But I can’t find the number of Air Flow.
I’m not sure where I have a problem.

That’s all
Thank you and best regards
Takeru

You need to move to the case directory.

``````cd "C:\Users\yourname\butterfly\casename"
postProcess -func “volFlowRateSurface” -latestTime
``````

Hi, @kinonotofu
Thank you for the reply for this post and the other one!!

I moved to the case file “nowind” and wrote the command [postProcess -func “volFlowRateSurface” -latestTime].

Then I have a new error below.
But I can’t find the file “meshParas” in ~nowind/system/…

What should I do next?

Thank you and best regards.
Takeru

I don’t know the cause of that error, could you please share the volFlowRateSurface file?
Also, do you have the following in your controlDict?

``````functions{
#includeFunc volFlowRateSurface;
}
``````

I forgot to add the “#includeFunc volFlowRateSurface;” to “butterfly control dict”.

Then I got the following results in BlueCFD.

Maybe I have not set the surface to calculate the airflow yet…

What sholud i do?

Kind regards
Takeru

You have entered the wrong command.
The correct command is `postProcess -func 'volFlowRateSurface' -latestTime`, not `postProcess -'volFlowRateSurface' -latestTime`

Oh！
Thank you for finding my mistake.

But I can’t get some results with the correct command.
So, I tried another way which @kinonotofu mentioned.
I set the following comand in “Butterfly_controldict”

And I got the results about air volume of inlet/outlet.