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

swak4Foam - Possible to sum across different patches?

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

Reply
 
LinkBack Thread Tools Display Modes
Old   September 16, 2013, 09:35
Default swak4Foam - Possible to sum across different patches?
  #1
Senior Member
 
Anne Gerdes
Join Date: Aug 2010
Location: Hamburg
Posts: 161
Rep Power: 7
Anne Lincke is on a distinguished road
Dear Foamers,

I hope this question doesn't already exist in the forum.
I would like to calculate an average value which should be evaluated over different patches.
Is it possible to do this with swak4foam?

Furthermore I would like to compute the difference on each patch to this (global) average value.

So far I am able to evaluate the expressions seperately, i.e. I am computing the average value on patch1, compute the difference of my variable (temperature) to this value on patch 1, and I am doing the same for the other patches.

It would be great if I could compute an expression like this
HTML Code:
gAv= \sum_{Outlet j} \sum{i \in Outlet_j} T_i A_i /A(Outlet j)
and compute the difference at each patch seperately
HTML Code:
\sum_{i \in Outlet j} (T_i A_i - gAv)
I hope that this is understandable.

Thank you very much in advance for an answer or sharing your experiences.

Kind Regards
Anne
Anne Lincke is offline   Reply With Quote

Old   September 16, 2013, 15:41
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,920
Rep Power: 41
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Anne Lincke View Post
Dear Foamers,

I hope this question doesn't already exist in the forum.
I would like to calculate an average value which should be evaluated over different patches.
Is it possible to do this with swak4foam?

Furthermore I would like to compute the difference on each patch to this (global) average value.

So far I am able to evaluate the expressions seperately, i.e. I am computing the average value on patch1, compute the difference of my variable (temperature) to this value on patch 1, and I am doing the same for the other patches.

It would be great if I could compute an expression like this
HTML Code:
gAv= \sum_{Outlet j} \sum{i \in Outlet_j} T_i A_i /A(Outlet j)
and compute the difference at each patch seperately
HTML Code:
\sum_{i \in Outlet j} (T_i A_i - gAv)
I hope that this is understandable.

Thank you very much in advance for an answer or sharing your experiences.

Kind Regards
Anne
Yep. It is possible with external variables. Assuming you have tow patches called here and there
Code:
variables (
  "sumHere{here}=sum(T*area());"
  "sumThere{there}=sum(T*area());"
  "areaHere{here}=sum(area());"
  "areaThere{there}=sum(area());"
  "totalAverage=(sumHere+sumThere)/(areaHere+areaThere);"
);
then use the totalAverage in the expression you're actually calculating. If you're only working on patch here you could leave out the {here} but the way it is written above it should work for both patches and you can save yourself some typing with the dictionary-include.
__________________
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, 03:27
Default
  #3
Senior Member
 
Anne Gerdes
Join Date: Aug 2010
Location: Hamburg
Posts: 161
Rep Power: 7
Anne Lincke is on a distinguished road
Dear Bernhard,
thank you very much for the fast reply!
I will try to make this evaluation run with your instructions as soon as possible.

Best Regards
Anne
Anne Lincke 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
AMI interDyMFoam for mixer nu problem danny123 OpenFOAM Programming & Development 8 September 6, 2013 02:34
How to write k and epsilon before the abnormal end xiuying OpenFOAM Running, Solving & CFD 8 August 27, 2013 15:33
Upgraded from Karmic Koala 9.10 to Lucid Lynx10.04.3 bookie56 OpenFOAM Installation 8 August 13, 2011 04:03
IcoFoam parallel woes msrinath80 OpenFOAM Running, Solving & CFD 9 July 22, 2007 02:58
Could anybody help me see this error and give help liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 19:07


All times are GMT -4. The time now is 07:35.