|
[Sponsors] |
December 11, 2012, 14:40 |
Mass Weighted Average
|
#1 |
Member
Brock Lee
Join Date: Sep 2012
Location: Midwest
Posts: 40
Rep Power: 14 |
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; } |
|
December 11, 2012, 18:32 |
|
#2 |
Member
Brock Lee
Join Date: Sep 2012
Location: Midwest
Posts: 40
Rep Power: 14 |
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; } 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. |
|
December 12, 2012, 19:48 |
|
#3 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
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 |
||
December 12, 2012, 20:34 |
|
#4 | |
Member
Brock Lee
Join Date: Sep 2012
Location: Midwest
Posts: 40
Rep Power: 14 |
Quote:
Fantastic, just wanted to make sure. Thanks for your replies. |
||
November 26, 2015, 05:51 |
|
#5 |
New Member
Join Date: Jul 2013
Posts: 8
Rep Power: 13 |
Dear Foamers,
I want to use groovybc, in order to create a T bc for a reciculation device. To do this I have do calculate the mass-flux-weighted temperature of a face. I use the following code: PHP Code:
Thank's in advance |
|
May 3, 2019, 09:28 |
Mass averaged weighted kinetic energy
|
#6 |
New Member
@moon
Join Date: Apr 2019
Posts: 8
Rep Power: 7 |
Hi guys
I am trying to calculate mass average weighted kinetic energy for Tank sloshing case. The equation is similar to the one discussed in this thread. (summation(mass*0.5*U*U)/ summation (mass)) Can someone help me with the syntax to write this expression using swak4Foam ? Iam new to openFoam. any help will be highly apreciated. Thank you. |
|
May 3, 2019, 10:34 |
|
#7 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
The expression for the total mass would be (assuming you have the denisty in a field rho) "sum(vol()*rho)". The sum of the kinetic energy would be "sum(vol()*rho*0.5*(U&U))" (using & for the scalar product). Now with swakExpression you could write the complete expression as "(vol()*rho*0.5*(U&U))/sum(vol()*rho)" (without the sum) and in the accumulations-list use "sum". Or you write the equation with the sum and in the accumulations use one of "min", "max", "average". But the first option needs a little less computation
__________________
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 |
||
May 6, 2019, 06:38 |
|
#8 | |
New Member
@moon
Join Date: Apr 2019
Posts: 8
Rep Power: 7 |
Quote:
The equation is writing results perfectly. But I dont understand the logic behind using summation in the numerator for calculating max, min, average and not using summation for calculating sum (accumulation). the equation calculates mass average weighted kinetic energy for each cell in the domain for each timestep and calculates sum. where is the difference coming by introducing the summation in the numerator ? There is something that I am missing out in understanding here. Can u please explain this?? Thanks in advance |
||
March 16, 2021, 15:41 |
|
#9 |
New Member
Join Date: Oct 2019
Posts: 13
Rep Power: 7 |
Hello Foamers,
I'm new in OF, I'm studying compressible flows and for post-processing, I just want to have confirmation. I'm not sure about syntax, but I would like to calculate the mass-weighted average of one variable, defines as at my "r1-outblock-outflow" (patch name)' so is it correct to write in my controlDict (OpenFOAM v2006) Code:
weightAvgOut { #includeEtc "caseDicts/postProcessing/surfaceFieldValue/surfaceRegion.cfg" regionType patch; name "r1-outblock-outflow"; operation weightedAverage; weightField phi; fields (p T Ma total(p)); writeInterval 5; log true; } Also, does anyone know if OF can provide the total temperature? |
|
Tags |
mass weighted average, swak4foam, swakexpression |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Area weighted or mass weighted average | SAM | Main CFD Forum | 31 | April 30, 2018 05:12 |
Diffference between mass weighted average and Area | giogio | FLUENT | 9 | March 6, 2018 09:24 |
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 |