CFD Online URL
[Sponsors]
Home > Forums > OpenFOAM Post-Processing

Mass Weighted Average

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

Reply
 
LinkBack Thread Tools Display Modes
Old   December 11, 2012, 14:40
Default Mass Weighted Average
  #1
Member
 
Brock Lee
Join Date: Sep 2012
Location: Midwest
Posts: 32
Rep Power: 4
GRAUPS is on a distinguished road
Hey guys, I'm looking to calculate a mass weighted average over a faceZone for pressure using swak4foam. Specifically, this is the equation I'm trying to implement...

Capture.PNG

My question comes when trying to implement. Is it possible in swak4foam to divide a sum by a sum within one expression? Can I do two sums separately and divide them? So far I've only seen expressions that can do one accumulation, such as the one below for mass flow rate...

Code:
mass-in
    {
        type swakExpression;
        valueType faceZone;
        zoneName interior-inlet-1;
        expression "phi*flip()";
        accumulations (
            sum
        );
        verbose true;
	autoInterpolate	true;
    }
Also, (if possible) what is the syntax for getting the absolute value and dot product within a swakExpression? Thanks in advance!
Attached Images
File Type: jpg Capture.jpg (10.7 KB, 14 views)
GRAUPS is offline   Reply With Quote

Old   December 11, 2012, 18:32
Default
  #2
Member
 
Brock Lee
Join Date: Sep 2012
Location: Midwest
Posts: 32
Rep Power: 4
GRAUPS is on a distinguished road
Ok, I think I found an equivalent expression. The following function I believe does what I need it to do...

Code:
p_stat2
    {
        type swakExpression;
        valueType faceZone;
        zoneName interior-inlet-1;
        expression "(p*phi*flip())/sum(phi*flip())";
        accumulations (
            sum
        );
        verbose true;
	autoInterpolate	true;
    }
However, I would still be interested in knowing if you can perform a dot product or an absolute value within a swakExpression?

Also, does anyone know if when you have backflow on a face, does it register as negative mass flow using the phi*flip() formulation?

Last edited by GRAUPS; December 12, 2012 at 13:37.
GRAUPS is offline   Reply With Quote

Old   December 12, 2012, 19:48
Default
  #3
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,889
Rep Power: 38
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by GRAUPS View Post
Ok, I think I found an equivalent expression. The following function I believe does what I need it to do...

Code:
p_stat2
    {
        type swakExpression;
        valueType faceZone;
        zoneName interior-inlet-1;
        expression "(p*phi*flip())/sum(phi*flip())";
        accumulations (
            sum
        );
        verbose true;
	autoInterpolate	true;
    }
However, I would still be interested in knowing if you can perform a dot product or an absolute value within a swakExpression?

Also, does anyone know if when you have backflow on a face, does it register as negative mass flow using the phi*flip() formulation?
Dot product is according to the conventions of OpenFOAM the &-operator.

Yes. You should get the correct backflow if you use flip() (the sign of phi depends on the orientation of the face. Multiplying with flip() "removes" that dependence)
__________________
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   December 12, 2012, 20:34
Default
  #4
Member
 
Brock Lee
Join Date: Sep 2012
Location: Midwest
Posts: 32
Rep Power: 4
GRAUPS is on a distinguished road
Quote:
Originally Posted by gschaider View Post
Dot product is according to the conventions of OpenFOAM the &-operator.
Awesome, thank you. And using the mag() function on a scalar I found is basically the equivalent of taking the absolute value.

Quote:
Originally Posted by gschaider View Post
Yes. You should get the correct backflow if you use flip() (the sign of phi depends on the orientation of the face. Multiplying with flip() "removes" that dependence)
Fantastic, just wanted to make sure. Thanks for your replies.
GRAUPS is offline   Reply With Quote

Reply

Tags
mass weighted average, swak4foam, swakexpression

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
Area weighted or mass weighted average SAM Main CFD Forum 23 March 4, 2014 13:37
Diffference between mass weighted average and Area giogio FLUENT 4 September 25, 2012 02:36
mass weighted average calculation m&s FLUENT 0 April 6, 2010 12:52
Mass Weighted Average Maryam FLUENT 0 November 12, 2008 08:06
Mass Weighted Average Maryam CFX 0 November 12, 2008 08:03


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