CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (https://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   Calculation of mass flow across a boundary (https://www.cfd-online.com/Forums/openfoam-post-processing/61404-calculation-mass-flow-across-boundary.html)

jdk March 6, 2008 08:37

Hi, I want to calculate mass
 
Hi,
I want to calculate mass flow across a BC, which should be a general problem for most people who work with CFD. But I cannot find any standard utility in the 1.4.1 release that can help me. Is it just me ... ?
I have found a utility "calcmassflow" on the openfoam wiki. But that was apperantly created for version 1.2 and after som fiddling with correcting library paths to get wmake to work, I gave up.

Can anyone help?

Regards
Jens

graser March 7, 2008 04:32

Hi Jens OpenFOAM calculates t
 
Hi Jens
OpenFOAM calculates the massflow at every surface in every timeStep. To create a file which contains the flux-data (filename = phi) for every writeInterval you have to tell it OF.
Therefore look at the fvSchemes dictionary in <root>/<case>/system
For more Infomation on fvSchemes read the UserGuide
page: U-104 + U-109 (chapter 4.4.7)

Now you have the flux and need to postprzess it. Therefore you need to integrate phi at your boundary. There is a OF-utility named patchIntegrate.
The Problem is that phi is defined as "surfaceScalarField" and patchIntegrate only integrates "volScalarField". To integrate phi you have to modify the patchIntegrate Tool to read and integrate surfaceScalarFields.

Hf
Max

philippose March 7, 2008 07:05

Hello Jens, A Good day to y
 
Hello Jens,

A Good day to you!

I have been using a modified version of the calcMassFlow utility that you found on the OpenFOAMWiki.

This version of the utility has the following features:
1. Ability to process a decomposed case (detected by the presence of multiple "processor<x>" folders)

2. A dictionary based selection of the patches across which to calculate the Massflow.

3. If a Density value in the dictionary greater than unity is found, it is used to directly calculate the flow in [kg/s], if the density line is commented out in the dictionary, the output is printed in [m^3/s] and [l/min].

4. Works on OpenFOAM 1.4, 1.4.1, 1.4.1-dev, etc..etc...

If you are only going to be working with single processor simulations, I can give you a slightly different version of the code, which is significantly faster (since the code overhead for multiprocessor supoort is not there).

http://www.cfd-online.com/OpenFOAM_D...s/mime_zip.gif calcMassFlow.zip

Have a nice day!

Philippose

gaby March 12, 2008 09:54

Hello! As Jens I need to ca
 
Hello!

As Jens I need to calculate the massFlow through a BC. I've found phi files and the patchIntegrate tool, but I'm not able to modify it :S

Then, I am really interested in the calcMassFlow utility. But I am new in C++ and OpenFoam wmake.

So, it would be great if you could explain me how to use the calcMassFlow utility developed by Philippose. In which folder should I download it?? (applications/bin/linuxGcc4DPOpt ??) Or what tutorial should I read to compile it?? Any help will be appreciated.

Have a nice day !!

Gaby

philippose March 12, 2008 13:38

Hello Gabriela, Good evenin
 
Hello Gabriela,

Good evening to you!

Sooo.... here are the steps you need to follow to compile and use calcMassFlow...

I am assuming that you have a working OpenFOAM installation, and that you are able to compile things using wmake....

1. Unzip the file "calcMassFlow.zip" to the folder: [home]/OpenFOAM/[username]-[OFVersion]/applications

2. Go into the created folder "calcMassFlow"

3. type "wmake"

4. The utility compiles, and installs the executable file in the folder:
[home]/OpenFOAM/[username]-[OFVersion]/applications/bin/linuxGCC4DOpt

The above four steps basically complete the compilation / installation of the utility.

To use it... you need to do the following:

1. In the folder "calcMassFlow" mentioned earlier, there is a sample "calcMassFlowDict" file.... copy this file into the "system" folder of your case.

2. Modify the entries under "patchNames" to the names of the patches through which you want to calculate the massflow.

3. Optionally, you can uncomment the "rho" line, and specify the density of the medium you simulated, in case you want the massflow in units "kg/s" instead of "m^3/s"

4. Go to the root folder of your case, and as usual, type:
calcMassFlow <root> <case> [-time t]

or

calcMassFlow <root> <case> [-latestTime]

or

calcMassFlow <root> <case>


That should be it....

Hope everything works as expected :-)!

Enjoy!

Philippose

gaby March 13, 2008 13:57

Hello Philippose ! Good Eve
 
Hello Philippose !

Good Evening!!

I've followed all your steps and finally it worked very good !!!

Thank you so much! and I hope this would be useful to other Foamers !!! :-)

Gabriela

Rachel July 20, 2009 05:45

Hello Philippose,

Does this utility work with OF-1.5.x?
I have a compressible case so I cannot give a rho value. Do you have suggestion?

I would like to calculate mass flow rate at inlet in kg/s.

I guess I will try it anyways.

Thanks for your time,
Rachel

haghajani August 5, 2009 12:45

Mass flow in a plane into the field
 
Hi all,

Thanks for the posted utility in this thread.

I am interested to calculated mass flow rate in a plane in the field, not patches as inlet/outlet,

do you have any idea, what should i do?

Thanks,
Hamed

CedricVH January 15, 2010 04:58

Hello Philippose,

Thank you for your great utility!

Do you know how I can run it in parallel? When I have a parallel case and run
Code:

calcMassFlow -latestTime
the utility detects all the processor directories and calculates the mass flow rate correctly. However, for big cases, this goes very slow as the program itself only uses 1 CPU.

When I run
Code:

mpirun --hostfile $hosts -np $cpus calcMassFlow -latestTime -parallel
the program does not detect the processor directories anymore, causing it to do nothing.

How can I solve this?

heavy_user February 4, 2010 07:51

steady BC, time dependent flux, density species
 
Hi All,

i have checked out calcMassFLow, nice tool!
But i have encountered some difficutlies...

First I dont understand this (perhaps someone could give me a hand)

Code:


          if(fluxOK)
          {
              if(rho.value() > 1.0)
              {
                Info << "Massflow at "<< bcNames[bcI]
                      << " = " << fluxOut << "kg/s"
                      << endl;
              }
              else
              {             
                Info << "Flux at "<< bcNames[bcI]
                      << " = " << fluxOut << "m^3/s ["
                      << fluxOut*60000 << " l/min]"
                      << endl;
              }
          }

so we have Volume/Time = Area* velocity
mass/Time = Volume/Time * density

so I asume if rho =1 we come out with Volume/Time.
If rho !=1 , we have to multiply with rho and end up with mass/time...ok byt why is the code then
Code:

if(rho.value() > 1.0)
and not if(rho.value() != 1.0) ?????

Second question:

I have two species coming out my inlet.
C3H8 and "air", how can I specify the different densities for each? There is only one entry for density in the dict.

Third question ( migth be slightly off-topic, i apologize for that) :
If I dont specify the density, using an compressible solver, phi needs to be calculated with density.
we have p=rho R T;
My BC are:

Code:

pressure:

    inlet         
    {
        type            fixedValue;
        value          uniform 100000;
    }

T:
    inlet         
    {
        type            fixedValue;
    value        uniform 296;
    }
U:

 inlet
    {
        type            fixedValue;
        value          nonuniform List<vector>
100
(
(0 0 67.552)
(0 0 67.77)
(0 0 67.035)
(0 0 65.8686)
(0 0 64.7974)
(0 0 63.5496)
(0 0 61.7962)
(0 0 59.7163)
(0 0 57.5885)
(0 0 54.9667)
(0 0 50.2231)
(0 0 36.2949)
(0 0 0.315833)
(0 0 6.57834)
(0 0 7.44999)
(0 0 7.96628)
(0 0 8.26225)
(0 0 8.49278)
(0 0 8.65498)
(0 0 8.76455)
(0 0 8.83736)
(0 0 8.88867)
(0 0 8.932)
(0 0 8.97775)
(0 0 9.03216)
(0 0 9.0771)
(0 0 9.2)
(0 0 9.2)
.
.
.
)
;
    }

Species:
C3H8 for r/R<1.
"AIR" for r/R>1.

so NOT time dependent BC.

I am using reactingFOAM and my velocity Field shows eddys from resulting from unsteady BC... :confused:
This goes along with the time depending flow I have:

Code:

uild  : 1.6                                                                                                         
Exec  : calcMassFlow                                                                                               
Date  : Feb 04 2010                                                                                                 
Time  : 13:39:38                                                                                                   
Host  : prandtl                                                                                                     
PID    : 10155                                                                                                       
Case  : /home/itvns/OpenFOAM/OpenFOAM-1.6/OWN/sandia/V6/diffusionflame_propane         
nProcs : 1                                                                                                           
SigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).                                                   

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time                                                                   

Create mesh for time = 0

// using new solver syntax:
rho                       
{                         
    solver          PCG; 
    preconditioner  DIC; 
    tolerance      1e-06;
    relTol          0;   
}                         

// using new solver syntax:
U                         
{                         
    solver          PBiCG;
    preconditioner  DILU; 
    tolerance      1e-06;
    relTol          0;   
}                         

// using new solver syntax:
p                         
{                         
    solver          PCG; 
    preconditioner  DIC; 
    tolerance      1e-09;
    relTol          0;   
}                         

// using new solver syntax:
Yi                       
{                         
    solver          PBiCG;
    preconditioner  DILU; 
    tolerance      1e-06;
    relTol          0;   
}                         

// using new solver syntax:
h                         
{                         
    solver          PBiCG;
    preconditioner  DILU; 
    tolerance      1e-06;
    relTol          0;   
}                         

// using new solver syntax:
k                         
{                         
    solver          PBiCG;
    preconditioner  DILU; 
    tolerance      1e-06;
    relTol          0;   
}                         

// using new solver syntax:
epsilon                   
{                         
    solver          PBiCG;
    preconditioner  DILU; 
    tolerance      1e-06;
    relTol          0;   
}                         

Checking for multiple processor directories....
No processor directories found               

Time = 0

.....                 

No phi for Time = 0 -> Skipping

Error....Patch: inlet not found!

Time = 0.00025

......                     

Patch: inlet found on 1/1 processor(s)
Flux at inlet = -0.00187994m^3/s [-112.796 l/min]

Time = 0.0005

.....                   

Patch: inlet found on 1/1 processor(s)
Flux at inlet = -0.00190881m^3/s [-114.528 l/min]

Time = 0.00075

.....                 

Patch: inlet found on 1/1 processor(s)
Flux at inlet = -0.00194239m^3/s [-116.544 l/min]

Time = 0.001

.....                       

Patch: inlet found on 1/1 processor(s)
Flux at inlet = -0.00198381m^3/s [-119.028 l/min]

Time = 0.00125

....

Patch: inlet found on 1/1 processor(s)
Flux at inlet = -0.00201004m^3/s [-120.602 l/min]

Time = 0.0015
.....                   

Patch: inlet found on 1/1 processor(s)
Flux at inlet = -0.00205286m^3/s [-123.171 l/min]

Time = 0.00175

....                     

Patch: inlet found on 1/1 processor(s)
Flux at inlet = -0.00209103m^3/s [-125.462 l/min]

Time = 0.002

....                       

Patch: inlet found on 1/1 processor(s)
Flux at inlet = -0.00209209m^3/s [-125.525 l/min]

Time = 0.00225

....

Patch: inlet found on 1/1 processor(s)
Flux at inlet = -0.00196443m^3/s [-117.866 l/min]

Time = 0.0025

...                     

Patch: inlet found on 1/1 processor(s)
Flux at inlet = -0.00174933m^3/s [-104.96 l/min]

Time = 0.00275

...                     

Patch: inlet found on 1/1 processor(s)
Flux at inlet = -0.0015123m^3/s [-90.7381 l/min]

Time = 0.003


.....

                       

Patch: inlet found on 1/1 processor(s)
Flux at inlet = -0.00129365m^3/s [-77.6187 l/min]

The flux is oszillating....WHY ???????
I have no clue why this is happening and it messes up everything...

PLZ help!

regards!

Gearb0x February 27, 2010 07:52

Hello

I would like to compare the massflow produced by this utility to the one I get un fluent.

In fluent, when you have a 2D case, it extrudes a third dimension of 1 meter to calculate the massflow.

I would like to know how it works here with this code? What's the value of the third dimension? Where is it created? How to change it?

Thanks for the help

subash June 17, 2010 03:02

[QUOTE=philippose;185787]Hello Gabriela,

Good evening to you!

Sooo.... here are the steps you need to follow to compile and use calcMassFlow...

I am assuming that you have a working OpenFOAM installation, and that you are able to compile things using wmake....

1. Unzip the file "calcMassFlow.zip" to the folder: [home]/OpenFOAM/[username]-[OFVersion]/applications

2. Go into the created folder "calcMassFlow"

3. type "wmake"

4. The utility compiles, and installs the executable file in the folder:
[home]/OpenFOAM/[username]-[OFVersion]/applications/bin/linuxGCC4DOpt

The above four steps basically complete the compilation / installation of the utility.

To use it... you need to do the following:

1. In the folder "calcMassFlow" mentioned earlier, there is a sample "calcMassFlowDict" file.... copy this file into the "system" folder of your case.

2. Modify the entries under "patchNames" to the names of the patches through which you want to calculate the massflow.

3. Optionally, you can uncomment the "rho" line, and specify the density of the medium you simulated, in case you want the massflow in units "kg/s" instead of "m^3/s"

4. Go to the root folder of your case, and as usual, type:
calcMassFlow <root> <case> [-time t]

or

calcMassFlow <root> <case> [-latestTime]

or

calcMassFlow <root> <case>


Hi philippose

I tried to compile(wmake) the file that you had attached but it throws me the following error, can you help me with this


SOURCE=calcMassFlow.C ; g++ -m32 -Dlinux -DWM_DP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -I/home/research/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude -I/home/research/OpenFOAM/OpenFOAM-1.6/src/meshTools/lnInclude -IlnInclude -I. -I/home/research/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude -I/home/research/OpenFOAM/OpenFOAM-1.6/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linuxGccDPOpt/calcMassFlow.o
In file included from calcMassFlow.C:198:
/home/research/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude/createPhi.H: In function ‘int main(int, char**)’:
/home/research/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude/createPhi.H:50: error: ‘U’ was not declared in this scope
make: *** [Make/linuxGccDPOpt/calcMassFlow.o] Error 1


Thanks in advance.

maysmech November 7, 2010 08:30

Hi,

I have OF 1.7.0 and Paraview 3.8.0. How can i calculate flow rate of patches?

Anne Lincke December 1, 2011 08:59

[QUOTE=subash;263350]
Quote:

Originally Posted by philippose (Post 185787)




Hi philippose

I tried to compile(wmake) the file that you had attached but it throws me the following error, can you help me with this


SOURCE=calcMassFlow.C ; g++ -m32 -Dlinux -DWM_DP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -I/home/research/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude -I/home/research/OpenFOAM/OpenFOAM-1.6/src/meshTools/lnInclude -IlnInclude -I. -I/home/research/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude -I/home/research/OpenFOAM/OpenFOAM-1.6/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linuxGccDPOpt/calcMassFlow.o
In file included from calcMassFlow.C:198:
/home/research/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude/createPhi.H: In function ‘int main(int, char**)’:
/home/research/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude/createPhi.H:50: error: ‘U’ was not declared in this scope
make: *** [Make/linuxGccDPOpt/calcMassFlow.o] Error 1


Thanks in advance.

I had the same issue and simply inserted

HTML Code:

        IOobject Uheader
        (
            "U",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ
        );
 Info<< "    Reading U" << endl;
            volVectorField U(Uheader, mesh);
            mesh.readUpdate();

This makes the code to read the velocity field from the solution.
Now I have no compiler errors any more.

shinde.gopal February 15, 2012 23:39

mass flow calculation in OF 1.6
 
Hi Foamers,

I need your help in calculating the mass flow rate in OF 1.6 at the boundary patches.
Plz help.

with rgds,
-Gopal.

Anne Lincke February 16, 2012 03:21

Hey Gopal,
have you tried the utility 'calcMassFlow' yet?

shinde.gopal February 17, 2012 07:10

I have tried the CalcMassFlow utility. It requires compilation of the utility. I am finding it difficult to compile as it is written for the older versions (1.2 or 1.3) I guess. I am using v1.6 for my calculations.

It will help me a lot if somebody can guide me thru.

thanks.

-Gopal.

Anne Lincke February 20, 2012 03:14

Try these instructions

Quote:

1. Unzip the file "calcMassFlow.zip" to the folder: [home]/OpenFOAM/[username]-[OFVersion]/applications

2. Go into the created folder "calcMassFlow"

3. type "wmake"

4. The utility compiles, and installs the executable file in the folder:
[home]/OpenFOAM/[username]-[OFVersion]/applications/bin/linuxGCC4DOpt

The above four steps basically complete the compilation / installation of the utility.

To use it... you need to do the following:

1. In the folder "calcMassFlow" mentioned earlier, there is a sample "calcMassFlowDict" file.... copy this file into the "system" folder of your case.

2. Modify the entries under "patchNames" to the names of the patches through which you want to calculate the massflow.

3. Optionally, you can uncomment the "rho" line, and specify the density of the medium you simulated, in case you want the massflow in units "kg/s" instead of "m^3/s"

4. Go to the root folder of your case, and as usual, type:
calcMassFlow <root> <case> [-time t]

And if you occur any problems, then post the output error.
Be more specific about your problems, otherwise we cannot help you.

shinde.gopal February 20, 2012 07:29

1 Attachment(s)
Hi Anne,

Thanks for the reply.
I have followed the steps. But still there are lot of errors. Plz see the attached log file.

with rgds,
-Gopal.

Anne Lincke February 20, 2012 07:47

Okay. Basically the first error is the most important.
The compiler does not find the file fvCFD.H
Which version are you using exactly?

Please check if there is the file fvCFD.H in OpenFOAM-1.6/src/finiteVolume/lnInclude.

shinde.gopal February 20, 2012 23:57

Hi thr,

I am using version 1.6.
I have included the path in the program calcMassFlow.C.
But still I am getting this error. Plz help.

================================================== ====================
[shindg2@cd80si0017 calcMassFlow]$ wmake
SOURCE=calcMassFlow.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-40 -I/home/edm/shindg2/.PKG/OpenFOAM/OpenFOAM-1.6/src/cfdTools/lnInclude -I/home/edm/shindg2/.PKG/OpenFOAM/OpenFOAM-1.6/src/cfdTools/general/lnInclude -I/home/edm/shindg2/.PKG/OpenFOAM/OpenFOAM-1.6/src/meshTools/lnInclude -I/home/edm/shindg2/OpenFOAM/shindg2-1.6/Libraries/cellFaceSetUtilities/lnInclude -IlnInclude -I. -I/home/edm/shindg2/.PKG/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude -I/home/edm/shindg2/.PKG/OpenFOAM/OpenFOAM-1.6/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/calcMassFlow.o
calcMassFlow.C:36:30: error: FaceSetUtilities.H: No such file or directory
calcMassFlow.C:37: error: ‘FaceSetUtilities’ is not a namespace-name
calcMassFlow.C:37: error: expected namespace-name before ‘;’ token
calcMassFlow.C: In function ‘int main(int, char**)’:
calcMassFlow.C:105: error: ‘flipSet’ was not declared in this scope
calcMassFlow.C:105: error: template argument 1 is invalid
calcMassFlow.C:105: error: invalid type in declaration before ‘=’ token
calcMassFlow.C:105: error: ‘checkFaceSetSides’ was not declared in this scope
calcMassFlow.C:111: error: ‘flips’ cannot be used as a function
make: *** [Make/linux64GccDPOpt/calcMassFlow.o] Error 1
[shindg2@cd80si0017 calcMassFlow]$
================================================== =====================

with rgds,
-Gopal.

shinde.gopal February 20, 2012 23:58

Hi thr,

I am using version 1.6.
I have included the path in the program calcMassFlow.C.
But still I am getting this error. Plz help.

================================================== ====================
[shindg2@cd80si0017 calcMassFlow]$ wmake
SOURCE=calcMassFlow.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-40 -I/home/edm/shindg2/.PKG/OpenFOAM/OpenFOAM-1.6/src/cfdTools/lnInclude -I/home/edm/shindg2/.PKG/OpenFOAM/OpenFOAM-1.6/src/cfdTools/general/lnInclude -I/home/edm/shindg2/.PKG/OpenFOAM/OpenFOAM-1.6/src/meshTools/lnInclude -I/home/edm/shindg2/OpenFOAM/shindg2-1.6/Libraries/cellFaceSetUtilities/lnInclude -IlnInclude -I. -I/home/edm/shindg2/.PKG/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude -I/home/edm/shindg2/.PKG/OpenFOAM/OpenFOAM-1.6/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/calcMassFlow.o
calcMassFlow.C:36:30: error: FaceSetUtilities.H: No such file or directory
calcMassFlow.C:37: error: ‘FaceSetUtilities’ is not a namespace-name
calcMassFlow.C:37: error: expected namespace-name before ‘;’ token
calcMassFlow.C: In function ‘int main(int, char**)’:
calcMassFlow.C:105: error: ‘flipSet’ was not declared in this scope
calcMassFlow.C:105: error: template argument 1 is invalid
calcMassFlow.C:105: error: invalid type in declaration before ‘=’ token
calcMassFlow.C:105: error: ‘checkFaceSetSides’ was not declared in this scope
calcMassFlow.C:111: error: ‘flips’ cannot be used as a function
make: *** [Make/linux64GccDPOpt/calcMassFlow.o] Error 1
[shindg2@cd80si0017 calcMassFlow]$
================================================== =====================

with rgds,
-Gopal.

Anne Lincke February 21, 2012 08:52

Hey Gopal,

you are missing a library which is needed for the utility.
Look at this post, they have the same problems:

http://www.cfd-online.com/Forums/ope...massflowc.html

Here you can download the libraries:
http://openfoamwiki.net/index.php/Contrib_calcMassFlow

Follow the instructions which are neccessary for inserting the libraries. Then try it again :)

Anne

shinde.gopal February 21, 2012 23:54

Hi Anne,

I have downloaded the required files /libraries. Thanks for the info.
I will give it a try and come back on this forum for some more help.

with rgds,
-Gopal.

Deshaka_Kottage April 11, 2012 14:48

Thanx philippose...
 
Thanx philippose....It works..really nice work....

curiosity November 21, 2012 09:28

Quote:

Originally Posted by philippose (Post 185787)
Hello Gabriela,

Good evening to you!

Sooo.... here are the steps you need to follow to compile and use calcMassFlow...

I am assuming that you have a working OpenFOAM installation, and that you are able to compile things using wmake....

1. Unzip the file "calcMassFlow.zip" to the folder: [home]/OpenFOAM/[username]-[OFVersion]/applications

2. Go into the created folder "calcMassFlow"

3. type "wmake"

4. The utility compiles, and installs the executable file in the folder:
[home]/OpenFOAM/[username]-[OFVersion]/applications/bin/linuxGCC4DOpt

The above four steps basically complete the compilation / installation of the utility.

To use it... you need to do the following:

1. In the folder "calcMassFlow" mentioned earlier, there is a sample "calcMassFlowDict" file.... copy this file into the "system" folder of your case.

2. Modify the entries under "patchNames" to the names of the patches through which you want to calculate the massflow.

3. Optionally, you can uncomment the "rho" line, and specify the density of the medium you simulated, in case you want the massflow in units "kg/s" instead of "m^3/s"

4. Go to the root folder of your case, and as usual, type:
calcMassFlow <root> <case> [-time t]

or

calcMassFlow <root> <case> [-latestTime]

or

calcMassFlow <root> <case>


That should be it....

Hope everything works as expected :-)!

Enjoy!

Philippose


Hi all,

I´ve made what Philippose told and I´ve been able to compile it, but when I execute de command calcMassFlowDic I´ve got a message error related with the variable phi:

Error... Patch: Name_of_my_Boundary not found
No phi for Time=4000 -> Skipping

Can anyone help me, please?

curiosity November 21, 2012 10:29

Quote:

Originally Posted by graser (Post 185784)
Hi Jens

Now you have the flux and need to postprzess it. Therefore you need to integrate phi at your boundary. There is a OF-utility named patchIntegrate.
The Problem is that phi is defined as "surfaceScalarField" and patchIntegrate only integrates "volScalarField". To integrate phi you have to modify the patchIntegrate Tool to read and integrate surfaceScalarFields.

Hf
Max

I understand, but... how??

gschaider November 21, 2012 14:14

Quote:

Originally Posted by curiosity (Post 393447)
Hi all,

I´ve made what Philippose told and I´ve been able to compile it, but when I execute de command calcMassFlowDic I´ve got a message error related with the variable phi:

Error... Patch: Name_of_my_Boundary not found
No phi for Time=4000 -> Skipping

Can anyone help me, please?

Well. Is there a patch named Name_of_my_Boundary in your geometry? If yes: check the case (that is a favourite). The missing phi is more of a showstopper. Without it no mass flow will be calculated ... for that timestep (assuming this calcMassFlow is the utility I wrote and published http://openfoamwiki.net/index.php/Contrib_calcMassFlow year ago and haven't maintained for a long time. But maybe there is another utility of the same name floating around)

gschaider November 21, 2012 14:18

Quote:

Originally Posted by curiosity (Post 393457)
I understand, but... how??

By copying and adapting the sources of the utility.

Personally I'd do that with swak4Foam. Either by using a patchExpression-function-Object during the simulation or the funkyDoCalc-utility afterwards (swak4Foam is one of the reasons why I don't maintain calcMassFlow anymore)

curiosity November 26, 2012 06:40

I´ll try

Thanks!

mulfal December 8, 2012 05:45

Dear Foamers,
I am trying to calculate the mass flow and/or the pressure force at any field or any section of the domain, which is not pre-defined patch like the inlet/outlet patch. This question has been asked back in 2009 by haghajani in this thread though it seems no one has tried to answer it or may be I couldn’t come across any other posts related to this issue

Would be great help if some one has done or modified the patchNames in order to calculate the mass flow at any section of the domain and lend me a hand on it.

Have a nice day!

curiosity December 8, 2012 06:26

Hi Mulualem,

I´m not so sure if I´m the adecuate person to help you. Anyway, I´ll try ^^

In ParaView, click Filters-->Slice and enter the coordenates of the plane you want to calculate the mass flow into the tab Properties.

Then, Filters--->Calculator and in Scalars choose U_X or U_Y depending on the direction of the mass flow you want to calculate.

Continue with: Filters--->Integrate Variables... You´ll see a chart in wich the U_X is, in fact, the mass flow in the x-direction. This is because when you apply the filter Integrate Variables, ParaView is multiplying each area of cell of the slice you´ve chosen for the variable U_X in this cell.

That´s all, hope it´s useful for you

mulfal December 8, 2012 06:34

Hi Paula,
Thank you very much for your quick reply. I will definately try your method and hope it works. I am still at my desk so will come back to you if I have encountered any problem.

This means I can even calculate the pressure forces at the same faces using using the p_rgh, am I right?

Thanks a lot!

mulfal December 8, 2012 07:28

Quote:

Originally Posted by curiosity (Post 396404)
Hi Mulualem,

I´m not so sure if I´m the adecuate person to help you. Anyway, I´ll try ^^

In ParaView, click Filters-->Slice and enter the coordenates of the plane you want to calculate the mass flow into the tab Properties.

Then, Filters--->Calculator and in Scalars choose U_X or U_Y depending on the direction of the mass flow you want to calculate.

Continue with: Filters--->Integrate Variables... You´ll see a chart in wich the U_X is, in fact, the mass flow in the x-direction. This is because when you apply the filter Integrate Variables, ParaView is multiplying each area of cell of the slice you´ve chosen for the variable U_X in this cell.

That´s all, hope it´s useful for you

Hi Paula,
I have been trying the steps you gave me to calculate the mass flow rate and it works fine. At least I can now work out to calculate the integral of the pressure at a chosen cross-section to obtain the pressure forces at that section.

Just I have one question though, If I want to calculate the flow rate at a small section of the face area (say a sum of cells in the domain face area), is paraView capable of choosing such kind of certain cells from the total face area of the domain?

Thanks!

Mulualem

curiosity December 8, 2012 08:03

Hi Mulualem,

Happy to know It worked :)

I don´t know the exact answer to your new question but I think there´s a filter called Select Extract Cells or something like that. Try it as the same way you used the other filter... and let me know if it works too ;)

Regards,

Paula

mulfal December 8, 2012 08:57

Quote:

Originally Posted by curiosity (Post 396415)
Hi Mulualem,

Happy to know It worked :)

I don´t know the exact answer to your new question but I think there´s a filter called Select Extract Cells or something like that. Try it as the same way you used the other filter... and let me know if it works too ;)

Regards,

Paula

Hi Paula,
It works great.
Steps: After slice...go to filters>ExtractCellsByRegion
In the properties tab under the intersect with list, you can choose plane if you want to cut only one side of the face and set the coordinate but if you want to cut more than one side, you can choose box and work out with the translate, rotate and scale data in order to extract the exact surface area you want.

It has been great to talk to you and you saved a lot of my time. I have been looking the codes developed for this kind of post processing jobs but now I will put them aside for the time being and post-process my data using the paraView.

Thank you and have a nice weekend!

Best Wishes,

Mulualem

curiosity December 8, 2012 11:13

Great! It´s nice having been useful

Thanks for your reply !

Good luck! :D

GeoKNL March 22, 2013 08:07

Hi.
Have you finally found why was your flux oscillating?
Because i have the same problem (with steady boundary conditions).
Thanks
George

Hale July 1, 2013 08:22

Mass flux output in a file
 
Hi,

Is there any body who knows how to write the fluxes given by calcMassFlow in a text file and not on the terminal where it normally does?

I want to plot the values on a graph but I don't know how to write them in a file!

NB. calcMassFlow is a ultility that gives the mass flux through patches.

Thank a lot

gschaider July 1, 2013 18:21

Quote:

Originally Posted by Hale (Post 437061)
Hi,

Is there any body who knows how to write the fluxes given by calcMassFlow in a text file and not on the terminal where it normally does?

I want to plot the values on a graph but I don't know how to write them in a file!

NB. calcMassFlow is a ultility that gives the mass flux through patches.

Thank a lot

You're talking about http://openfoamwiki.net/index.php/Contrib_calcMassFlow ? Either use a script to extract that information from the output (I use for some strange reasons PyFoam) or use swak4Foam http://openfoamwiki.net/index.php/Co...e_calcMassFlow (that does output into a file too)


All times are GMT -4. The time now is 08:29.