CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Community Contributions

[swak4Foam] funkyDoCalc

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 9, 2011, 20:29
Default funkyDoCalc
  #1
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28
mturcios777 will become famous soon enough
I haven't been able to find mention of this, but does anyone know if you can get funkyDoCalc to output to a file like a functionObject? It seems like I need to modify the utility but I'd like to know if anyone has played with it.
mturcios777 is offline   Reply With Quote

Old   November 10, 2011, 20:24
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by mturcios777 View Post
I haven't been able to find mention of this, but does anyone know if you can get funkyDoCalc to output to a file like a functionObject?
To my knowledge no. But as I usually say: I only wrote that thing. This doesn't know that I know all its capabilities (I'm not even sure if I use it properly)

No. It can't. Until know it was sufficient for my needs to parse the output with a script. But of course I see the usefulness of writing files

Quote:
Originally Posted by mturcios777 View Post
It seems like I need to modify the utility but I'd like to know if anyone has played with it.
I know of no such effort. And I currently have enough on my plate so I won't be doing anything in this direction in the immediate future.

Should you successfully add the capability to write files it would be nice if you shared it. Preferably through mercurial-bundles (that way all the attributions are preserved). Have a look at the Development section in the README
gschaider is offline   Reply With Quote

Old   November 18, 2011, 17:39
Default
  #3
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28
mturcios777 will become famous soon enough
I've made some mods that allow filenames to be written. Right now I have it requiring the post processing dictionary (named postProcDict in this example) begin referenced in the controlDict like:
Code:
functions
(
   #include"postProcDict"
);

libs
(
*list of required libraries*
);
This may not be the most elegant way of doing this but works for me. postProcDict is formatted as the usual function objects. The utility (creatively named funkyDoCalcWrite for development purposes) is then called in much the same way:

Code:
funkyDoCalcWrite <options> postProcDict
I haven't used mercurial to make any changes, I downloaded the SVN version as per the instructions on the wiki to get the release version. Would you like a copy of my version to see if its something you would like include?
mturcios777 is offline   Reply With Quote

Old   November 19, 2011, 10:37
Default
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by mturcios777 View Post
I've made some mods that allow filenames to be written. Right now I have it requiring the post processing dictionary (named postProcDict in this example) begin referenced in the controlDict like:
Code:
functions
(
   #include"postProcDict"
);

libs
(
*list of required libraries*
);
This may not be the most elegant way of doing this but works for me. postProcDict is formatted as the usual function objects. The utility (creatively named funkyDoCalcWrite for development purposes) is then called in much the same way:

Code:
funkyDoCalcWrite <options> postProcDict
That sounds a bit like execFlowFunctionObjects that comes with OpenFOAM (or did I misunderstand the description?)

Could you check that?

Quote:
Originally Posted by mturcios777 View Post
I haven't used mercurial to make any changes, I downloaded the SVN version as per the instructions on the wiki to get the release version. Would you like a copy of my version to see if its something you would like include?
Usually I'd say " 'svn diff' against the downloaded version", but yours is a separate, new utility so the relevant files would be OK (just don't want to go through the whole sources to find differences. Preferred is still "hg bundle" (as described in the README) as it helps me keeping track of the contributors
gschaider is offline   Reply With Quote

Old   November 21, 2011, 12:45
Default
  #5
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28
mturcios777 will become famous soon enough
Ha, I wasn't even aware of execFlowFunctionObjects! I tried it but it doesn't support my thermophysical model by default (but that modification is trivial), so having a duplicate utility doesn't seem to be a good idea. I'll just keep this to myself.
mturcios777 is offline   Reply With Quote

Old   November 21, 2011, 17:37
Default
  #6
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by mturcios777 View Post
Ha, I wasn't even aware of execFlowFunctionObjects! I tried it but it doesn't support my thermophysical model by default (but that modification is trivial), so having a duplicate utility doesn't seem to be a good idea. I'll just keep this to myself.
Didn't want to discourage anyone from contributing.

BTW: if your termophysical-model is in a separate library you could try loading it by adding it to the libs-list in the controlDict
gschaider is offline   Reply With Quote

Old   November 21, 2011, 17:56
Default
  #7
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28
mturcios777 will become famous soon enough
Thanks for the advice! One last question that is related to the nuances. I am running my utility on cases solved by dieselFoam and dieselEngineFoam. I've noticed that the files written for the dieselFoam case show entries for all the time directories, while the dieselEngineFoam case only has output for the last time directory.

All my expressions are swakExpressions, and I'm using my funkyDoCalcWrite which builds on funkyDoCalc. Looking at the code, it appears that there is something going on in this snippet:
Code:
functionObjectList objects(runTime,true);
Info << "Read status: " << objects.start();
...
Foam::Info << "\nTime = " << runTime.timeName() << Foam::endl;
Info << mesh.readUpdate(); //Problem occurs in this space
Info << "Writing objects: " << objects.execute(true) << Foam::endl;
This isn't much different than the execFlowObjects code. The mesh for the dieselEngineFoam is changing in time (compression and expansion) using various types of engineMesh. When using funkyDoCalc the output is given for all time directories. Any help in determining how I can get proper output to files?
mturcios777 is offline   Reply With Quote

Old   November 22, 2011, 13:35
Default
  #8
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by mturcios777 View Post
Thanks for the advice! One last question that is related to the nuances. I am running my utility on cases solved by dieselFoam and dieselEngineFoam. I've noticed that the files written for the dieselFoam case show entries for all the time directories, while the dieselEngineFoam case only has output for the last time directory.

All my expressions are swakExpressions, and I'm using my funkyDoCalcWrite which builds on funkyDoCalc. Looking at the code, it appears that there is something going on in this snippet:
Code:
functionObjectList objects(runTime,true);
Info << "Read status: " << objects.start();
...
Foam::Info << "\nTime = " << runTime.timeName() << Foam::endl;
Info << mesh.readUpdate(); //Problem occurs in this space
Info << "Writing objects: " << objects.execute(true) << Foam::endl;
This isn't much different than the execFlowObjects code. The mesh for the dieselEngineFoam is changing in time (compression and expansion) using various types of engineMesh. When using funkyDoCalc the output is given for all time directories. Any help in determining how I can get proper output to files?
No idea. My first guess is that the news about the changed mesh doesn't reach the functionObjects.

Some questions come to mind:
- how does "no output" manifest itself? The time-loop runs through, no errors but also no output?
- what kinds of functionObjects do you have? Only swak-ones? And if yes: which ones? Could you try it with standard-functionObjects (like the one the samples) to see if this is a general problem or just my stuff?
gschaider is offline   Reply With Quote

Old   November 22, 2011, 14:21
Default
  #9
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28
mturcios777 will become famous soon enough
Quote:
Originally Posted by gschaider View Post
No idea. My first guess is that the news about the changed mesh doesn't reach the functionObjects.

Some questions come to mind:
- how does "no output" manifest itself? The time-loop runs through, no errors but also no output?
- what kinds of functionObjects do you have? Only swak-ones? And if yes: which ones? Could you try it with standard-functionObjects (like the one the samples) to see if this is a general problem or just my stuff?
In answer to your questions:

1) "No output" means the utility runs fine through all the time directories and I get results output to the screen. In this case I am calculating the mass average of a particular species in the domain. For all time directories except the last one, I see this type of output:

Code:
SpeciesSum = /*some number*/
When processing the last time directory, I get an additional output

Code:
Expression SpeciesSum = 1.13559684e-06
SpeciesSum = 1.13559684e-06
The numbers are correct. When I look at the file created in $FOAM_CASE/swakExpression_SpeciesSum/$FIRST_TIME/SpeciesSum, I get a formatted file:

Code:
#           Time  average
             390   1.13559684e-06
390 is the last time directory in the series. Essentially only the information from the last time directory is being written to the file.

2) I am currently only using swakExpressions, where
Code:
expression "sum(rho*vol()*CO2)"
and using all accumulators (while I'm still testing)

I also tried just running execFlowFunctionObjects (with both swak and regular function objects) and I was greeted by the error:

Code:
fatal flex scanner internal error--no action found
Right after the thermophysical models are loaded (I am using libreactionThermophysicalModels.so). I'm trying to find a regular function object I can compare output with; once I find something I'll post it.

EDIT: It seems this isn't strictly isolated to swak objects, as I ran execFlowFunctionObjects on the icoFoam/cavity case with libFieldFunctionObject and I got a result similar to the above: only the information from the last time directory is output.

I probably should have asked the following: is there a way to control the interval that swak objects will output to file when they are used at runTime? This won't help with old cases I need to post-process, but will at least let me run new cases and have the information I need.

Thanks for looking into this!

Last edited by mturcios777; November 22, 2011 at 14:40. Reason: Updated with more information
mturcios777 is offline   Reply With Quote

Old   November 22, 2011, 19:24
Default Solution wasn't what I expected
  #10
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28
mturcios777 will become famous soon enough
So it turns out there was one additional difference between the two cases. In system/controlDict:
Code:
startFrom startTime;
should be used, not
Code:
startFrom latestTime;
In retrospect, only having the last timestep's data written out was a huge clue I initially overlooked. Since I'm executing a funtionObjectList, it will use the parameters supplied in controlDict, which dictacte when execution should start.
mturcios777 is offline   Reply With Quote

Old   April 5, 2013, 16:56
Default
  #11
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
hi
how to use funkyDoCalc command?
I typed it as:funkyDoCalc flowInlet
but it gives an error:
Code:
--> FOAM FATAL IO ERROR: 
Istream not OK for reading dictionary 

file: flowInlet at line 1.

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

FOAM exiting
what is wrong?
immortality is offline   Reply With Quote

Old   July 11, 2013, 08:11
Default
  #12
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 22
Bernhard is on a distinguished road
Examples can be found here:

swak4Foam/Examples/other/angledDuctImplicitTransient/testCalculations
Bernhard is offline   Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[swak4Foam] funkyDoCalc with OF2.3 massflow NiFl OpenFOAM Community Contributions 14 November 25, 2020 04:30
[swak4Foam] funkydoCalc issue with snGrad manuc OpenFOAM Community Contributions 2 January 2, 2018 12:00
[swak4Foam] funkyDoCalc in cyclic system S choi OpenFOAM Community Contributions 1 November 7, 2016 17:41
[swak4Foam] funkyDoCalc write fields Astrodan OpenFOAM Community Contributions 0 March 24, 2016 07:44
[swak4Foam] funkyDoCalc mass flow over stl surface? lourencosm OpenFOAM Community Contributions 0 November 28, 2014 08:50


All times are GMT -4. The time now is 19:34.