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

Calculation of mass flow across a boundary

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree6Likes

Reply
 
LinkBack Thread Tools Display Modes
Old   July 2, 2013, 05:26
Default
  #41
Member
 
Hale
Join Date: May 2013
Posts: 53
Rep Power: 5
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 Calculation of mass flow across a boundary

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: 5
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: 3,931
Rep Power: 41
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: 5
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: 5
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: 5
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: 5
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: 5
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: 3,931
Rep Power: 41
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: 5
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
 
B T KANNAN
Join Date: Jul 2011
Location: CHENNAI (MADRAS), INDIA
Posts: 54
Rep Power: 7
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
skyinventorbt is offline   Reply With Quote

Old   March 17, 2014, 10:02
Default
  #53
Member
 
赵庆良
Join Date: Aug 2013
Posts: 56
Rep Power: 5
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

Reply

Thread Tools
Display Modes

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 On
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 01:28
Mass Flow Rate Calculation Paul FLUENT 9 March 23, 2002 09:37


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