CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Community Contributions (https://www.cfd-online.com/Forums/openfoam-community-contributions/)
-   -   [swak4Foam] funkyDoCalc (https://www.cfd-online.com/Forums/openfoam-community-contributions/94232-funkydocalc.html)

mturcios777 November 9, 2011 19:29

funkyDoCalc
 
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.

gschaider November 10, 2011 19:24

Quote:

Originally Posted by mturcios777 (Post 331447)
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 (Post 331447)
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

mturcios777 November 18, 2011 16:39

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?

gschaider November 19, 2011 09:37

Quote:

Originally Posted by mturcios777 (Post 332726)
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 (Post 332726)
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

mturcios777 November 21, 2011 11:45

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.

gschaider November 21, 2011 16:37

Quote:

Originally Posted by mturcios777 (Post 332951)
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

mturcios777 November 21, 2011 16:56

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?

gschaider November 22, 2011 12:35

Quote:

Originally Posted by mturcios777 (Post 332983)
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?

mturcios777 November 22, 2011 13:21

Quote:

Originally Posted by gschaider (Post 333130)
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!

mturcios777 November 22, 2011 18:24

Solution wasn't what I expected
 
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.

immortality April 5, 2013 15:56

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?

Bernhard July 11, 2013 07:11

Examples can be found here:

swak4Foam/Examples/other/angledDuctImplicitTransient/testCalculations


All times are GMT -4. The time now is 09:28.