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

how to calculate mass flow rate on patches and summation of that during the run?

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

Like Tree19Likes

Reply
 
LinkBack Thread Tools Display Modes
Old   September 1, 2013, 14:10
Default
  #81
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,635
Blog Entries: 39
Rep Power: 99
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
About this discussion from back in April:
Quote:
Originally Posted by gschaider View Post
As I said above: there's a bit of ballast involved with having functionObjects.

Thing is that EFFO preloads certain fields for functionObjects that need them. The problem with using swak-functionObjects is the same: they assume that fields are already in memory (but that is a solvable problem)
Quote:
Originally Posted by wyldckat View Post
And as I said (er, wrote), I'm interested in doing #3 myself... a funkyDoFunctionObjects seems to be a very interesting topic I'll try to look into it in my next vacation...
I've finally done it today: execFunctionObjects: Minimalistic variant of execFlowFunctionObjects utility
Thing is that it was embarrassingly simple to do... because I only had to remove excess code from execFlowFunctionObjects.

Best regards,
Bruno
immortality likes this.
__________________
wyldckat is online now   Reply With Quote

Old   May 13, 2014, 04:37
Default
  #82
Member
 
adarsh tiwari's Avatar
 
adarsh tiwari
Join Date: Feb 2014
Location: Bangalore
Posts: 42
Blog Entries: 5
Rep Power: 4
adarsh tiwari is on a distinguished road
hi all,

I used the same thing as explained by Bruno, but i got the following message
Code:
--> FOAM FATAL IO ERROR: 
Istream not OK for reading dictionary 

file: fdcMassFlow at line 1.

    From function dictionary::read(Istream&, bool)
    in file db/dictionary/dictionaryIO.C at line 91.

FOAM exiting
Also, one more thing I would like to ask, I read so many threads dedicated to mass flow one i found interesting which says simply by using
Code:
patchIntegrate phi <patch name>
will give the mass flow rate, but as per my observations it is giving the integrated values

I am more interested in average value, so please suggest me the correct way (i am using OpenFOAM version 2.2.2 )

Thanks and Regards,
Adarsh
adarsh tiwari is offline   Reply With Quote

Old   November 25, 2014, 14:16
Default
  #83
New Member
 
Lourenšo SM
Join Date: Jul 2014
Location: Lisboa, Portugal
Posts: 21
Rep Power: 4
lourencosm is on a distinguished road
Hello Adarsh,

have you tried "patchAverage"?
lourencosm is offline   Reply With Quote

Old   August 15, 2016, 11:05
Default
  #84
Member
 
Manu Chakkingal
Join Date: Feb 2016
Location: Delft, Netherlands
Posts: 50
Rep Power: 2
manuc is on a distinguished road
Hello

I have n issue with snGrad usage with funkydocalc.

With swak4foam

I gave :

functions(

NusseltNumber_hot
{
type patchExpression;
outputControl timeStep;
outputInterval 1;
patches (
w_l
);
verbose true;
variables (
"Tsat=300.1;"
"ln2D=3.065;" //length(.08)/k(.0261)
);
expression "ln2D*snGrad(T)/(T-Tsat)";
accumulations (
average
);
}
);

------------------------------------------------------

This gave me a Nusselt No. of 56.02 (neglect scaling)
.

With all data in disk I tried to obtian the same using funkyDoCalc as:

NusseltNumber_hot
{
valueType patch;
patchName w_l;
variables (
"Tsat=300.1;"
"ln2D=3.065;" //length(.08)/k(.0261)
);
expression "ln2D*snGrad(T)/(T-Tsat)";
accumulations (
max
);
}
-----------------------------------------------------------
Which is giving me 0 as output for max/min/average

I read in:
https://sourceforge.net/p/openfoam-e...2.1_v2.x/tree/

that the snGrad doesnt work when data is in disc and needs to be temporarily loaded. Could anyone explain on what to be done
__________________
Regards
Manu
manuc is offline   Reply With Quote

Old   August 17, 2016, 12:01
Default
  #85
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 manuc View Post
Hello

I have n issue with snGrad usage with funkydocalc.

With swak4foam

I gave :

functions(

NusseltNumber_hot
{
type patchExpression;
outputControl timeStep;
outputInterval 1;
patches (
w_l
);
verbose true;
variables (
"Tsat=300.1;"
"ln2D=3.065;" //length(.08)/k(.0261)
);
expression "ln2D*snGrad(T)/(T-Tsat)";
accumulations (
average
);
}
);

------------------------------------------------------

This gave me a Nusselt No. of 56.02 (neglect scaling)
.

With all data in disk I tried to obtian the same using funkyDoCalc as:

NusseltNumber_hot
{
valueType patch;
patchName w_l;
variables (
"Tsat=300.1;"
"ln2D=3.065;" //length(.08)/k(.0261)
);
expression "ln2D*snGrad(T)/(T-Tsat)";
accumulations (
max
);
}
-----------------------------------------------------------
Which is giving me 0 as output for max/min/average

I read in:
https://sourceforge.net/p/openfoam-e...2.1_v2.x/tree/

that the snGrad doesnt work when data is in disc and needs to be temporarily loaded. Could anyone explain on what to be done
Hmm. Looks like a problem in the code. I'll have a look. What MIGHT help is using a variable "snGradT=(T-internalField())/mag(delta())" as a variable. Emphasis on MIGHT as I haven't tried it and even then the sign might be wrong
__________________
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   August 17, 2016, 12:20
Default
  #86
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 gschaider View Post
Hmm. Looks like a problem in the code. I'll have a look. What MIGHT help is using a variable "snGradT=(T-internalField())/mag(delta())" as a variable. Emphasis on MIGHT as I haven't tried it and even then the sign might be wrong
Should be "(T-internalField(T))/mag(delta())".

I just checked it with a case here and this gives the same value as snGrad in funkyDoCalc. So I can't reproduce. But one possible issue could be that the boundary condition I did it for was fixedValue. So I'll need a bit more info:

- OF-version
- swakVersion
- the boundary condition of w_l
__________________
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   August 17, 2016, 12:26
Default
  #87
Member
 
Manu Chakkingal
Join Date: Feb 2016
Location: Delft, Netherlands
Posts: 50
Rep Power: 2
manuc is on a distinguished road
Hello

I used the latest swak4foam version and OF 2.3.0. W_l has a B.C of constant wall temp.
__________________
Regards
Manu
manuc is offline   Reply With Quote

Old   August 18, 2016, 05:36
Default
  #88
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 manuc View Post
Hello

I used the latest swak4foam version and OF 2.3.0. W_l has a B.C of constant wall temp.
With "constant wall temp" you mean "type fixedValue"? (when looking for bugs the physical meaning is irrelevant. The important information is the type. If you set the fixed temperature with a "type mixed" then it is a completely different ball game)
__________________
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   August 18, 2016, 05:38
Default
  #89
Member
 
Manu Chakkingal
Join Date: Feb 2016
Location: Delft, Netherlands
Posts: 50
Rep Power: 2
manuc is on a distinguished road
Hello Bernhard

w_l
{
type fixedValue;
value uniform 300.2;
}



I have set it fixed value
__________________
Regards
Manu
manuc is offline   Reply With Quote

Old   August 18, 2016, 11:21
Default
  #90
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 manuc View Post
Hello Bernhard

w_l
{
type fixedValue;
value uniform 300.2;
}



I have set it fixed value
Hmm. That is strange. That boundary condition should be no problem
__________________
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   August 18, 2016, 11:38
Default
  #91
Member
 
Manu Chakkingal
Join Date: Feb 2016
Location: Delft, Netherlands
Posts: 50
Rep Power: 2
manuc is on a distinguished road
Hello Bernhard

Is there anything to do with the mesh as I get the message highlighted in bold

manuchakkingal@tud278038:/net/users/manuchakkingal/data/2016/2d_NC_porous_4_by_4_Ra_10_4_coarse> funkyDoCalc system/trialDict -time 60120


---------------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
Build : 2.3.0-f5222ca19ce6
Exec : funkyDoCalc system/trialDict -time 60120
Date : Aug 18 2016
Time : 17:36:08
Host : "tud278038"
PID : 4472
Case : /net/users/manuchakkingal/data/2016/2d_NC_porous_4_by_4_Ra_10_4_coarse
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
swakVersion: 0.4.0 (Release date: 2016-07-17)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 60120

No information about foreign meshes in "system/trialDict.NusseltNumber_hot"


Time = 60120
NusseltNumber_hot : swak4Foam: Setting default mesh
swak4Foam: Allocating new repository for sampledGlobalVariables
average=0

End
---------------------------------------------------------------------------

My triadict is:

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/



NusseltNumber_hot
{
valueType patch;
patchName w_l;
variables (
"Tsat=300.1;"
"ln2D=3.065;" //length(.08)/k(.0261)
"snGradT=(T-internalField(T))/mag(delta());"
);
expression "ln2D*snGradT/(T-Tsat)";
accumulations (
average
);
}



// ************************************************** *********************** //
__________________
Regards
Manu
manuc is offline   Reply With Quote

Old   August 18, 2016, 12:08
Default
  #92
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 manuc View Post
Hello Bernhard

Is there anything to do with the mesh as I get the message highlighted in bold

manuchakkingal@tud278038:/net/users/manuchakkingal/data/2016/2d_NC_porous_4_by_4_Ra_10_4_coarse> funkyDoCalc system/trialDict -time 60120


---------------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
Build : 2.3.0-f5222ca19ce6
Exec : funkyDoCalc system/trialDict -time 60120
Date : Aug 18 2016
Time : 17:36:08
Host : "tud278038"
PID : 4472
Case : /net/users/manuchakkingal/data/2016/2d_NC_porous_4_by_4_Ra_10_4_coarse
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
swakVersion: 0.4.0 (Release date: 2016-07-17)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 60120

No information about foreign meshes in "system/trialDict.NusseltNumber_hot"


Time = 60120
NusseltNumber_hot : swak4Foam: Setting default mesh
swak4Foam: Allocating new repository for sampledGlobalVariables
average=0

End
---------------------------------------------------------------------------

My triadict is:

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/



NusseltNumber_hot
{
valueType patch;
patchName w_l;
variables (
"Tsat=300.1;"
"ln2D=3.065;" //length(.08)/k(.0261)
"snGradT=(T-internalField(T))/mag(delta());"
);
expression "ln2D*snGradT/(T-Tsat)";
accumulations (
average
);
}



// ************************************************** *********************** //
The message in bold is only relevant if you had a mcase with two meshes (for instance a cht-case).

Anyway. What is the output of
Code:
fieldReport -doBoundary T -time 60120
__________________
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   August 19, 2016, 04:13
Default
  #93
Member
 
Manu Chakkingal
Join Date: Feb 2016
Location: Delft, Netherlands
Posts: 50
Rep Power: 2
manuc is on a distinguished road
Dear Berhard,

I got the below:


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
swakVersion: 0.4.0 (Release date: 2016-07-17)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 60120


Time = 60120

Reading Field T of type volScalarField

Internal field:
swak4Foam: Allocating new repository for sampledMeshes
swak4Foam: Allocating new repository for sampledGlobalVariables
Size | Weight Sum 4554 | 1.17025e-05
Range (min-max) 300 | 300.2
Average | weighted 300.1 | 300.1
Sum | weighted 1.36666e+06 | 0.00351192
Median | weighted 300.101 | 300.101

Patch field: w_l
Size | Weight Sum 44 | 0.000181019
Range (min-max) 300.2 | 300.2
Average | weighted 300.2 | 300.2
Sum | weighted 13208.8 | 0.054342
Median | weighted 300.2 | 300.2

Patch field: w_r
Size | Weight Sum 44 | 0.000181019
Range (min-max) 300 | 300
Average | weighted 300 | 300
Sum | weighted 13200 | 0.0543058
Median | weighted 300 | 300

Patch field: w_t
Size | Weight Sum 44 | 0.000181019
Range (min-max) 300.004 | 300.198
Average | weighted 300.115 | 300.115
Sum | weighted 13205.1 | 0.0543266
Median | weighted 300.122 | 300.122

Patch field: w_b
Size | Weight Sum 44 | 0.000181019
Range (min-max) 300.002 | 300.196
Average | weighted 300.085 | 300.085
Sum | weighted 13203.7 | 0.0543212
Median | weighted 300.076 | 300.076

Patch field: cyl
Size | Weight Sum 272 | 0.0011309
Range (min-max) 300.003 | 300.197
Average | weighted 300.1 | 300.1
Sum | weighted 81627.2 | 0.339384
Median | weighted 300.101 | 300.101

End
__________________
Regards
Manu
manuc is offline   Reply With Quote

Old   August 19, 2016, 06:18
Default
  #94
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 manuc View Post
Dear Berhard,

I got the below:

Code:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
swakVersion: 0.4.0 (Release date: 2016-07-17)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 60120


Time = 60120

 Reading Field T of type volScalarField

Internal field:
swak4Foam: Allocating new repository for sampledMeshes
swak4Foam: Allocating new repository for sampledGlobalVariables
Size | Weight Sum                 4554 |   1.17025e-05
Range (min-max)                    300 |         300.2
Average | weighted               300.1 |         300.1
Sum | weighted             1.36666e+06 |    0.00351192
Median | weighted              300.101 |       300.101

Patch field: w_l
Size | Weight Sum                   44 |   0.000181019
Range (min-max)                  300.2 |         300.2
Average | weighted               300.2 |         300.2
Sum | weighted                 13208.8 |      0.054342
Median | weighted                300.2 |         300.2
OK. At first I was a bit amazed by the small range of the temperature in your simulation (0.2 degrees). But I guess that is OK. And probably your problem. My guess is that the cells near your boundary are VERY similar to the boundary temperature. Something like 300.2001 . As long as this happens in memory everything is OK. But when it gets written to disk the writePrecision kicks in. This is usually 6 digits. So the value becomes 300.2 and that is all that funkyDoCalc gets to see. And it says: "same as on boundary. snGrad is 0"

Solution: either set the writePrecision to a higher value or set the writeMode from ascii to binary (that will write out the full precision)
__________________
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   August 19, 2016, 08:14
Default
  #95
Member
 
Manu Chakkingal
Join Date: Feb 2016
Location: Delft, Netherlands
Posts: 50
Rep Power: 2
manuc is on a distinguished road
Dear Berhard

I tried setting the write precision to 10 and it worked. Thanks for the support.
---------------------------------------------------------------------------------------------
Summary:
Initiallly the system control dict had write precision-6
funkydoCalc was used to calculate snGrad(T) and was compared with results with run time postprocessing calculating the same .

Result obtained: snGrad(T) with funkydocalc : absurd value (0)
snGrad(T) runtime swak4foam --as expected

Reason:

the write precision was less which treated low values difference in temperature with wall (my case) close to wall temp and thus gave gradient zero.

Solution tried:
Increased write precision which worked

and gave results as expected.


-------------------------------------------------------------------------------------
__________________
Regards
Manu
manuc 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



All times are GMT -4. The time now is 17:46.