CFD Online URL
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

Efficient run-time postprocessing: combination of swak4foam and solver modification?

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

Reply
 
LinkBack Thread Tools Display Modes
Old   October 21, 2013, 13:16
Default Efficient run-time postprocessing: combination of swak4foam and solver modification?
  #1
Member
 
Marcus Letzel
Join Date: Sep 2012
Location: Karlsruhe
Posts: 35
Rep Power: 4
letzel is on a distinguished road
Dear Foamers,

similar to this thread on how to calculate a turbulent heat flux <u'T'>, where <...> denotes a local time average, I plan to calculate the vertical turbulent momentum fluxes <w'u'> and <w'v'>. Plus, the vertical total momentum fluxes <wu> and <wv>. This is in order to monitor OpenFOAM LES of the atmospheric boundary layer.

I want to output these data not for the total domain but only as one-dimensional vertical profiles at say ten or twenty locations within the simulation domain, e.g. for postprocessing with XmGrace.

My question is which is the best way to efficiently calculate and output these data.

Since I have a modified solver anyway, it would be possible to code the time averaging according to this post for U as well as the products wu and wv. The time-averages <w'u'> and <w'v'> could be calculated in a similar manner in the solver. But I would expect that this wastes CPU time as well as RAM since the output is actually only needed for ten to twenty one-dimensional vertical profiles.

So, is there a way to calculate these data more efficiently only where output is needed? I have a vague feeling that swak4foam may accomplish this. If so, how?

And is there any elegant way to combine the definition of ten, twenty vertical profiles? If I use ten, twenty different sampledSet, my controlDict would become quite long.

Looking forward to hear your advices,
Marcus
letzel is offline   Reply With Quote

Old   October 21, 2013, 20:21
Default
  #2
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 letzel View Post
Dear Foamers,

similar to this thread on how to calculate a turbulent heat flux <u'T'>, where <...> denotes a local time average, I plan to calculate the vertical turbulent momentum fluxes <w'u'> and <w'v'>. Plus, the vertical total momentum fluxes <wu> and <wv>. This is in order to monitor OpenFOAM LES of the atmospheric boundary layer.

I want to output these data not for the total domain but only as one-dimensional vertical profiles at say ten or twenty locations within the simulation domain, e.g. for postprocessing with XmGrace.

My question is which is the best way to efficiently calculate and output these data.

Since I have a modified solver anyway, it would be possible to code the time averaging according to this post for U as well as the products wu and wv. The time-averages <w'u'> and <w'v'> could be calculated in a similar manner in the solver. But I would expect that this wastes CPU time as well as RAM since the output is actually only needed for ten to twenty one-dimensional vertical profiles.

So, is there a way to calculate these data more efficiently only where output is needed? I have a vague feeling that swak4foam may accomplish this. If so, how?

And is there any elegant way to combine the definition of ten, twenty vertical profiles? If I use ten, twenty different sampledSet, my controlDict would become quite long.

Looking forward to hear your advices,
Marcus
"10 or 20 points" screams "sampledSet". With the swakExpression-FunctionObject and the valueType "set" you can do calculations on such a sampledSet (see the examples for ...aeh ... examples). The only "problem" is that swakExpression wants to condense the result to single values (sum, average, etc). There is a functionObject dumpSwakExpression that dumps all the values. Have a look at it: the file format is a bit ... well ... you'll have to find out which column is which point for instance (that FO was only done as a quick fix)
__________________
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   October 22, 2013, 07:57
Default
  #3
Member
 
Marcus Letzel
Join Date: Sep 2012
Location: Karlsruhe
Posts: 35
Rep Power: 4
letzel is on a distinguished road
Quote:
Originally Posted by gschaider View Post
"10 or 20 points" screams "sampledSet". With the swakExpression-FunctionObject and the valueType "set" you can do calculations on such a sampledSet (see the examples for ...aeh ... examples). The only "problem" is that swakExpression wants to condense the result to single values (sum, average, etc). There is a functionObject dumpSwakExpression that dumps all the values. Have a look at it: the file format is a bit ... well ... you'll have to find out which column is which point for instance (that FO was only done as a quick fix)
Thank you, Bernhard.

Is there any chance that the compulsory condensation of swakExpression results to single values could become optional at some point in the future?

I must admit that I am a bit hesitant regarding the dumpSwakExpression approach. IMHO, if the columns in the output file are not labelled, it seems to be prone to human errors during further postprocessing. For example, columns may get mixed up later.

So, I am now considering to resort to the computationally less efficient combination of solver modifications (averaging and flux calculation) and the native OpenFOAM sampling functionality by declaring ten, twenty sampledSets.
letzel is offline   Reply With Quote

Old   October 22, 2013, 11:06
Default
  #4
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 letzel View Post
Thank you, Bernhard.

Is there any chance that the compulsory condensation of swakExpression results to single values could become optional at some point in the future?
No. One of the policies I have is to change semantics of things after the release only if there has been a bug or if it is a major improvement for the majority of the cases. Don't want to break existing cases by changes of swak (they already get broken by OF-releases)

Also having the "dump" as the default functionality is asking for trouble. Approx 2.7 days after release somebody will use it on an internalField, write it every timestep and complain that swak filled up his disk
Quote:
Originally Posted by letzel View Post
I must admit that I am a bit hesitant regarding the dumpSwakExpression approach. IMHO, if the columns in the output file are not labelled, it seems to be prone to human errors during further postprocessing. For example, columns may get mixed up later.

So, I am now considering to resort to the computationally less efficient combination of solver modifications (averaging and flux calculation) and the native OpenFOAM sampling functionality by declaring ten, twenty sampledSets.
If you have a static mesh then the order of the columns will not change. One thing you can do is have a "parallel" FO with the expression "pos()". That has the same order as your data and you can use that as the labels.

One of the reasons why there are no labels with dump is
a) that this must be implemented for every valueType separately
b) What should the label be? Position? Cell number?
c) the hardest part: what should be done if the entity changes its size, ordering? (for instance due to mesh motion or a sampledSurface of type isoSurface) Start a new file? Just write a new heading?
__________________
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

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
I have warning in use swak4Foam seju OpenFOAM Post-Processing 35 January 27, 2014 06:09


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