foamLog extract min, max, avg
-
can currently only extract min value (EP 690), and foamLog is not sophisticated enough to handle arbitrary parsing.
-
adjust AMI reporting as
min = ... max = ...
instead ofmin/max/average = ...
for easier parsing.
No child items are currently assigned. Use child items to break down this issue into smaller parts.
Link issues together to show that they're related. Learn more.
Activity
- Mark OLESEN mentioned in commit c94b3e01ebbf70b0c5646643fddc7aba6229dfc5
mentioned in commit c94b3e01ebbf70b0c5646643fddc7aba6229dfc5
- Maintainer
Instead of modifying AMI modify foamLog to use regular expressions?
Currently about 3 different ways of reporting min/max/avg:
bound.C:
bounding k, min:XXX max:YYY average:ZZZ
cyclicAMI:
min = XXX
Courant:
Courant Number mean: XXX
- Mattijs Janssens added ~20 label
added ~20 label
- Author Maintainer
Regular expressions are somewhat painful in foamLog. It currently uses fgrep and fixed length substrings in awk.
I'll change the
min = xxx
tomin:xxx
for some consistency with other outputs, but bounding actually outputsmin: xxx
(with an additional space). - Maintainer
It is just a discussion - no need to change yet.
- Mark OLESEN mentioned in commit c6beff51b9edbc7bb0afda003e7f634914927d26
mentioned in commit c6beff51b9edbc7bb0afda003e7f634914927d26
- Mark OLESEN closed
closed
- Developer
There is still some inconsistency
- meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C uses =
- meshTools/AMIInterpolation/patches/cyclicPeriodicAMI/cyclicPeriodicAMIPolyPatch/cyclicPeriodicAMIPolyPatch.C uses :
- Prashant Sonakar reopened
reopened
- Mark OLESEN mentioned in commit 9005f41bfd08e5d2a8a292e5ff75bfc7519993d6
mentioned in commit 9005f41bfd08e5d2a8a292e5ff75bfc7519993d6
- Maintainer
For all previous versions (of all derivatives of OpenFOAM) it has been possible to add a local foamLog.db in the case directory and add new lines for extraction of data generated by user-developed code. It doesn't work any more. Example: Add for one of the time steps in the log file the following:
Inflow = 1.34567 Outflow = 1.34566
Copy foamLog.db to the case directory and add at the end:
Inflow/Inflow/Inflow =
Outflow/Inflow/Outflow =
foamLog does not pick up the addition. I checked, and foamLog from OpenFOAM-v1706 works as expected. I also tried with:
Inflow: 1.34567 Outflow: 1.34566
and
Inflow/Inflow/Inflow:
Outflow/Inflow/Outflow:
It also does not work.
There has not been any problems with foamLog since 2005, until now.
By Håkan on 2018-08-31T06:07:34 (imported from GitLab project)
Edited by Admin - Maintainer
## Reattaching the author to the issue ticket: @Nilsson##
- Please register or sign in to reply
- Maintainer
I've put attached foamLog.db in $HOME/.OpenFOAM/plus/foamLog.db and run on attached log.icoFoam
It produces logs/Inflow_0 with a single entry for time 0.3 (which is the only time I've added the 'Inflow' to). Seems ok.
You can run
foamEtcFile -list foamLog.db
to find the paths the log file gets searched in
- Maintainer
It doesn't work for me. It does indeed pick up the database file in /home/oscfd/.OpenFOAM/v1806/foamLog.db. I can see that from the output of the foamLog command. It also picks it up if I put it in the current case directory (note that the current directory is listed as one possible location for the database file if I do 'foamLog -help', but it is not shown by 'foamEtcFile -list foamLog.db', which leaves room for improvement of the latter). However, wherever I put the database file it actually ignores everything in it. That includes the original location, in the main installation. The output will only be what is hard-coded in foamLog, as seen from the output (here using the database file that comes with the installation):
$ foamLog log.icoFoam Using: case : /home/oscfd/OpenFOAM/oscfd-v1806/run/cavity log : log.icoFoam database : /home/oscfd/OpenFOAM/OpenFOAM-v1806/bin/tools/foamLog.db awk file : logs/foamLog.awk files to : logs Executing: awk -f logs/foamLog.awk log.icoFoam Generated XY files for: p pFinalRes pIters Ux UxFinalRes UxIters Uy UyFinalRes UyIters End
There is not the following, which is stated in the database file:
clockTime contCumulative contGlobal contLocal CourantMax CourantMean executionTime
A note is that the default location for the database, as shown in the output above (/home/oscfd/OpenFOAM/OpenFOAM-v1806/bin/tools/foamLog.db) is not listed by 'foamEtcFile -list foamLog.db'. That command instead lists /home/oscfd/OpenFOAM/OpenFOAM-v1806/etc/foamLog.db. The output from 'foamLog -help' lists /home/oscfd/OpenFOAM/OpenFOAM-v1806/bin/tools. It would be nice if it is consistent. I suggest that you revise the foamEtcFile command.
Now, foamLog is just a bash script. It should be independent of the OpenFOAM version. In fact, the foamLog file taken from v1706 works nicely in the v1806 environment. There must be something in the new script that depends on the shell itself. I am using a quite fresh installation of Ubuntu 18.04.1, installed under VirtualBox 5.2.16 r123759. What are you using?
Output when using the foamLog file copied from v1706 (with /home/oscfd/OpenFOAM/OpenFOAM-v1806/bin/tools/foamLog.db copied to the local case directory, so it can be found by the old foamLog command):
$ /home/oscfd/OpenFOAM/oscfd-v1806/bin/foamLog log.icoFoam Using: log : log.icoFoam database : foamLog.db awk file : ./logs/foamLog.awk files to : ./logs Executing: awk -f ./logs/foamLog.awk log.icoFoam Generated XY files for: clockTime contCumulative contGlobal contLocal CourantMax CourantMean executionTime p pFinalRes pIters Separator Time Ux UxFinalRes UxIters Uy UyFinalRes UyIters End
There is something strange with the new foamLog script.
By Håkan on 2018-09-06T06:56:08 (imported from GitLab project)
- Maintainer
Using
openSUSE Leap 42.3
withGNU bash, version 4.3.42
Are you sure you are using the unmodified foamLog script? I see (in stock v1806)
awk file : logs/foamLog.awk
since the outputDir is
logs
not./logs
- Maintainer
Yes, I am quite sure.
Note that the first output above is when using the unmodified foamLog script of v1806. It gives:
awk file : logs/foamLog.awk
The second output above is when I have copied the foamLog script from v1706 and put it in $WM_PROJECT_USER_DIR/bin (you see that I call that script with the full path). Then I get:
awk file : ./logs/foamLog.awk
In both cases the foamLog.awk file should be located in the logs directory that is located in the current directory, so I think this is just a matter of how the info is written to the terminal window.
I have:
$ bash --version GNU bash, version 4.4.19(1)-release (x86_64-pc-linux-gnu)
By Håkan on 2018-09-06T08:20:33 (imported from GitLab project)
- Maintainer
I moved the foamLog script from v1806 to Ubuntu 16.04, and it doesn't work there either. In that case I am in the v1706 environment, but simply specify that I want to execute the v1806 foamLog script. The output is the same as before.
$ bash --version GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)
By Håkan on 2018-09-06T14:51:15 (imported from GitLab project)
- Author Maintainer
Hi Haakan,
Minor update - seems to be ubuntu-related (reported Mattijs).
/mark
Edited by Mark OLESEN - Maintainer
Making the following change to
bin/foamLog
seems to work for Ubuntu 18.04@@ -241,7 +241,7 @@ getAllQueries() #-- Add ones from database, present in log file # Note: just like awk, line selected with regular expression, # column with string. - local dbQueries=$(getDbQueryList $db) + local dbQueries="$(getDbQueryList $db)" for var in $dbQueries
Can you confirm?
By Andrew Heather on 2018-09-11T14:07:58 (imported from GitLab project)
- Maintainer
## Reattaching the author to the issue ticket: @andy ##
- Maintainer
The database is found and it extracts the correct data with the modification. Thanks! I guess it will be added to coming releases?
The command foamEtcFile -list foamLog.db does still not list the current directory, which is a valid location for the database. I think it would be good if the current directory would also be listed.
By Håkan on 2018-09-12T07:22:22 (imported from GitLab project)
- Author Maintainer
But foamEtcFile should never consider case-local files at all, nor should the
findEtcFiles()
internal function. The additional local file for foamLog is just some special, one-of exception. - Admin mentioned in commit 9b73e29e27a8a8b2212a61a7b8d1334381f370b2
mentioned in commit 9b73e29e27a8a8b2212a61a7b8d1334381f370b2
By Andrew Heather on 2018-09-12T07:42:53 (imported from GitLab project)
- Maintainer
Ok, I do not know exactly how foamEtcFile and findEtcFiles() should work. I only know that foamLog picks up a case-local database file (has always done that, and it is good). The command foamLog -help says that the local directory is one valid location. The reason why I commented on foamEtcFile was because it was suggested in this conversation to use that command to check where the database is picked up. That command does however not show the local directory, which I thought was strange (in the context that I was told that it should list where the database would be picked up). However, this is not something that bothers me, and I understand that the purpose of foamEtcFile may not be exactly for finding all the possible locations of the database file. Just leave it as it is. But do the modification of foamLog. Thanks!
By Håkan on 2018-09-12T07:45:00 (imported from GitLab project)
- Mark OLESEN mentioned in commit fd49e4dd
mentioned in commit fd49e4dd
- Maintainer
assuming resolved considering the reported commits and discussions.
please reopen the ticket if the issue persists.
- Kutalmış Berçin closed
closed