CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

Calculation of mass flow across a boundary

Register Blogs Community New Posts Updated Threads Search

Like Tree12Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 2, 2013, 05:26
Default
  #41
Member
 
Hale
Join Date: May 2013
Posts: 53
Rep Power: 12
Hale is on a distinguished road
Hi Bernhard,

Thanks for your response. I am actually using the code calcMassFlow developed by Philippose, which is also mentioned earlier in this thread. I downloaded the file from http://www.cfd-online.com/Forums/ope...-boundary.html

This code seems to be the same as the one you suggest: http://openfoamwiki.net/index.php/Contrib_calcMassFlow

The thing is that I am very new to C++ and OpenFOAM and I don't know how to extract the information. I tried http://openfoamwiki.net/index.php/Co...e_calcMassFlow

functions
{
patchMassFlow
{
type patchExpression;
accumulations (
sum
);
patches (
inlet
outlet
);
expression "phi";
verbose true;
}

}

but it gives error for the patchExpression

--> FOAM FATAL ERROR:
Unknown function type patchExpression

Table of functionObjects is empty

From function functionObject::New(const word& name, const Time&, const dictionary&)
in file db/functionObjects/functionObject/functionObject.C at line 74.

FOAM exiting


What should I replace with the patchExpression?

And my last question is that will this function written above give me a file with the mass fluxes for the desired patches? Or should I add some sprict to it?

Thank you for your time
Hale is offline   Reply With Quote

Old   July 2, 2013, 07:14
Default
  #42
Member
 
Hale
Join Date: May 2013
Posts: 53
Rep Power: 12
Hale is on a distinguished road
Hi again,

I am now trying to compile the swak4Foam given here http://openfoamwiki.net/index.php/Contrib/swak4Foam

but I cannot execute it by typing wmake all!! It gives the following error:

-bash-4.1$ wmake all
/appl/OpenFOAM/OpenFOAM-2.0.1/wmake/wmake: ./Allwmake: /bin/bash^M: bad interpreter: No such file or directory

What do I do wrong?





Hale is offline   Reply With Quote

Old   July 2, 2013, 10:38
Default
  #43
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Hale View Post
Hi again,

I am now trying to compile the swak4Foam given here http://openfoamwiki.net/index.php/Contrib/swak4Foam

but I cannot execute it by typing wmake all!! It gives the following error:

-bash-4.1$ wmake all
/appl/OpenFOAM/OpenFOAM-2.0.1/wmake/wmake: ./Allwmake: /bin/bash^M: bad interpreter: No such file or directory

What do I do wrong?





Nothing. Your Linux distro is "broken" (not really) ... it doesn't have a bash ... what kind of distro is this?

You can try replacing in the first line of Allwmake /bin/bash witg /bin/sh but in the past this introduced other problems. So the best fix (IMHO) is to install bash on that machine (I'm sure there is a package for compatibility)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   July 5, 2013, 13:01
Default
  #44
New Member
 
Cay Myers
Join Date: Jun 2013
Posts: 14
Rep Power: 12
baila12 is on a distinguished road
Quote:
Originally Posted by Hale View Post
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
Hale,
If you want to write the output given by calcMassFlow to a text file, you can us the command calcMassFlow | tee log. Your output will then appear in the log file located in the case directory. This same command can be used for other solvers and utilities if you just replace calcMassFlow with the name of whichever solver you want information from.
baila12 is offline   Reply With Quote

Old   July 6, 2013, 06:21
Default
  #45
Member
 
Hale
Join Date: May 2013
Posts: 53
Rep Power: 12
Hale is on a distinguished road
Quote:
Originally Posted by gschaider View Post
Nothing. Your Linux distro is "broken" (not really) ... it doesn't have a bash ... what kind of distro is this?

You can try replacing in the first line of Allwmake /bin/bash witg /bin/sh but in the past this introduced other problems. So the best fix (IMHO) is to install bash on that machine (I'm sure there is a package for compatibility)

Thanks a lot for your response. As you said there is no bash installed on the distro. I actually don't know what kind of distro it is. I use linux through my university network, so I have no idea about their distro. I will contact them to hear more about it.
Hale is offline   Reply With Quote

Old   July 6, 2013, 06:28
Default
  #46
Member
 
Hale
Join Date: May 2013
Posts: 53
Rep Power: 12
Hale is on a distinguished road
Quote:
Originally Posted by baila12 View Post
Hale,
If you want to write the output given by calcMassFlow to a text file, you can us the command calcMassFlow | tee log. Your output will then appear in the log file located in the case directory. This same command can be used for other solvers and utilities if you just replace calcMassFlow with the name of whichever solver you want information from.
Thank you for the response baila12. I actually tried with calcMassFlow > log and it worked well. Now I'm having problem reading that file in matlab. This is another issue
Hale is offline   Reply With Quote

Old   July 6, 2013, 18:13
Default
  #47
Member
 
Hale
Join Date: May 2013
Posts: 53
Rep Power: 12
Hale is on a distinguished road
Quote:
Originally Posted by philippose View Post
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,

I have used this utility to calculate the mass flow at the boundaries and it works very well. The only problem I'm facing is that I can't find a way to sort all the information generated by calcMassFlow at each time step. The goal is to plot the fluxes at each time step and monitor the variation as function of time. I tried matlab without any success. Is there any smart way to do this?

Thanks a lot
Hale
Hale is offline   Reply With Quote

Old   July 23, 2013, 02:09
Default Thx
  #48
New Member
 
Johannes Widmann
Join Date: May 2013
Location: University of Stuttgart
Posts: 1
Rep Power: 0
nostra is on a distinguished road
Hi guys,

I try to do it with OF 2.2 and it works well. Thanks a lot
nostra is offline   Reply With Quote

Old   September 17, 2013, 03:00
Default how to get the flux for each cell?
  #49
Member
 
Hale
Join Date: May 2013
Posts: 53
Rep Power: 12
Hale is on a distinguished road
I'm interested in getting the flux at each cell of my boundaries (at each time step) and not the sum of the fluxes at each boundary, is there any solution for my problem? I know that the data for each cell is given in the phi file but since I'm running in parallel it is not possible to find the data for a specific boundary in the that file!
Hale is offline   Reply With Quote

Old   September 17, 2013, 05:03
Default
  #50
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Hale View Post
I'm interested in getting the flux at each cell of my boundaries (at each time step) and not the sum of the fluxes at each boundary, is there any solution for my problem? I know that the data for each cell is given in the phi file but since I'm running in parallel it is not possible to find the data for a specific boundary in the that file!
Yes it is. The thing is: if the boundary doesn't have faces on processorX then the file on processorX won't have that info. You've got to check the other processors. Or reconstruct.

There are ways of getting that data out during the run but you've got to be more specific on how you want to postprocess that (usually I'd say "single values are only interesting during development because they characterize the discretization but have got nothing to do with the physical system")
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   September 17, 2013, 05:38
Default
  #51
Member
 
Hale
Join Date: May 2013
Posts: 53
Rep Power: 12
Hale is on a distinguished road
Thanks for your reply Bernhard.

I thought that the phi file only gives the flux of each cell without stating which boundary they belong to, but after I read your post I looked carefully and I found what I was looking for

But now the problem is that I only need the values that are in the middle of the boundary. Is there any way to check where each mesh cell is located?
Hale is offline   Reply With Quote

Old   October 9, 2013, 00:16
Default Mass flux using paraview
  #52
Member
 
skyinventorbt's Avatar
 
Dr. B T KANNAN
Join Date: Jul 2011
Location: CHENNAI (MADRAS), INDIA
Posts: 55
Rep Power: 14
skyinventorbt is on a distinguished road
Dear Foamers,

If you are simulating incompressible flows,

in Paraview there is an FILTER called "SURFACE FLOW"

Usage:
Create slice and apply surface flow.
Open Spread sheet view and find the value.

(Note: This is only velocity integrated over area, so multiply by rho to get mass flux)

-
KANNAN
mizzou likes this.
skyinventorbt is offline   Reply With Quote

Old   March 17, 2014, 09:02
Default
  #53
Member
 
赵庆良
Join Date: Aug 2013
Posts: 56
Rep Power: 12
zqlhzx is on a distinguished road
Hi philippose,
Thank you for upload your attach.It works well.It is easy to get the mass flow rate at the knowed boundry,e.g,inlet,outlet.But if I want to get the mass flow rate on any patch not only the boundry,how can I do?
For example,Can I give the command like "basePoint(0 0 0);normalVetor(0 0 1)"to define the patch what I want to calculate mass flow rate?
Thanks in advance!
zqlhzx is offline   Reply With Quote

Old   October 18, 2016, 19:40
Default
  #54
New Member
 
Yi Han
Join Date: Oct 2013
Location: Laramie WY
Posts: 15
Rep Power: 12
hy1112006 is on a distinguished road
Very useful utility, thank you very much!!
hy1112006 is offline   Reply With Quote

Old   October 18, 2016, 19:42
Default
  #55
New Member
 
Yi Han
Join Date: Oct 2013
Location: Laramie WY
Posts: 15
Rep Power: 12
hy1112006 is on a distinguished road
Quote:
Originally Posted by zqlhzx View Post
Hi philippose,
Thank you for upload your attach.It works well.It is easy to get the mass flow rate at the knowed boundry,e.g,inlet,outlet.But if I want to get the mass flow rate on any patch not only the boundry,how can I do?
For example,Can I give the command like "basePoint(0 0 0);normalVetor(0 0 1)"to define the patch what I want to calculate mass flow rate?
Thanks in advance!

Hello zqlhzx,

Have you make that work ? I also have same situation as yours.

If you did, could you please tell me how to do it?

Thanks,

Yi Han
hy1112006 is offline   Reply With Quote

Old   April 24, 2017, 03:30
Default
  #56
Member
 
Mukesh Adlak
Join Date: Jun 2016
Posts: 32
Rep Power: 9
Adlak is on a distinguished road
Hi everyone,
I want to calculate mixing efficiency through the formulae attached in a file.

Can anyone help me how to do that ???
Attached Images
File Type: png mixeff.png (9.9 KB, 35 views)
Adlak is offline   Reply With Quote

Old   April 26, 2017, 06:46
Default
  #57
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Adlak View Post
Hi everyone,
I want to calculate mixing efficiency through the formulae attached in a file.

Can anyone help me how to do that ???
A formula is useless if you don't explain what the symbols mean. I think this can be done with swakfoam but I refuse to guess things like where "mass flow of H2" is defined
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   April 26, 2017, 07:50
Default
  #58
Member
 
Mukesh Adlak
Join Date: Jun 2016
Posts: 32
Rep Power: 9
Adlak is on a distinguished road
Quote:
Originally Posted by gschaider View Post
A formula is useless if you don't explain what the symbols mean. I think this can be done with swakfoam but I refuse to guess things like where "mass flow of H2" is defined

Hi,
mass flow of H2 is constant at fuel inlet. Mostly I want to know about the numerator part where I have to do integration. I have to integrate alpha*(density of mixture)*(mass fraction of h2)*(axial velocity) over a cross section in the combustor. I will do the same at many cross sections and plot efficiency graph along length of combustor.
Adlak is offline   Reply With Quote

Old   April 26, 2017, 19:21
Default
  #59
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Adlak View Post
Hi,
mass flow of H2 is constant at fuel inlet. Mostly I want to know about the numerator part where I have to do integration. I have to integrate alpha*(density of mixture)*(mass fraction of h2)*(axial velocity) over a cross section in the combustor. I will do the same at many cross sections and plot efficiency graph along length of combustor.
Are the cross-sections aligned with cell-faces (and have you got faceSets or faceZones for that) or are you planing to use sampledSurfaces.

And what is the phi in the definition of alpha? Surly not the phi-field?

Anyway: is doable in swak4foam
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   April 27, 2017, 01:46
Default
  #60
Member
 
Mukesh Adlak
Join Date: Jun 2016
Posts: 32
Rep Power: 9
Adlak is on a distinguished road
Quote:
Originally Posted by gschaider View Post
Are the cross-sections aligned with cell-faces (and have you got faceSets or faceZones for that) or are you planing to use sampledSurfaces.

And what is the phi in the definition of alpha? Surly not the phi-field?

Anyway: is doable in swak4foam

Hi,

Phi is local equivalence ratio. Yes, cross sections are aligned with cell faces. I dont have any other things.
Adlak is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculate Mass Flow in a faceSet during calculation torvic OpenFOAM Running, Solving & CFD 1 August 11, 2008 19:05
mass flow rate calculation Ahmed CFX 7 June 20, 2008 05:55
Calculation of mass flow rate msrinath80 OpenFOAM Running, Solving & CFD 0 April 18, 2007 14:05
Calculation of added mass in viscous flow kharati Main CFD Forum 2 February 1, 2006 00:28
Mass Flow Rate Calculation Paul FLUENT 9 March 23, 2002 08:37


All times are GMT -4. The time now is 00:50.