|
[Sponsors] |
January 6, 2012, 01:53 |
extraxt T_min out of log.sim
|
#1 |
Member
Stefan
Join Date: Jun 2009
Posts: 67
Rep Power: 16 |
Hallo,
I pipe the openFoam output from the shell in a file called log.sim. To plot some date I use awk like: Code:
awk -f logs/foamLog.awk log.sim Code:
# Extraction of T_min fluid or solid /Min.max.T:/ { extract($0, "Min/max T:", val) file="./logs/T_min_" T_minCnt print Time " " val[1] > file T_minCnt++ } Min/max T:283.05995 283.15 |
|
January 7, 2012, 17:24 |
|
#2 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
|
||
January 11, 2012, 05:23 |
|
#3 |
Member
Stefan
Join Date: Jun 2009
Posts: 67
Rep Power: 16 |
Thanks for your help, but it do not work.
A possibitity is to read bouth variables and use only the second. Another is to read the last Variable in the line. Has anybody an Idea?? |
|
January 11, 2012, 05:56 |
|
#4 |
Senior Member
Aurelien Thinat
Join Date: Jul 2010
Posts: 165
Rep Power: 15 |
Hi,
To extract values from output, with awk I use something like : "cat log.out |grep 'Tmin/max ='|awk '{print $i}' > Tmin.dat" replacing i by the number I want. In your case it should be something like 3 for Tmin and 4 for Tmax In another case, for extracting density rho max/min : 2.14 3.16 I used : "cat log.out |grep 'rho max/min' | cut -d' ' -f5|tr -d ',' > rhomin.dat" |
|
January 11, 2012, 06:22 |
|
#5 |
Member
Stefan
Join Date: Jun 2009
Posts: 67
Rep Power: 16 |
Thanks for your idea! it runs with this :
Code:
/Min.max.T:/ { file="./logs/T_max_" T_maxCnt print Time " " $3 > file T_maxCnt++ } |
|
May 17, 2017, 01:33 |
|
#6 |
Senior Member
|
Just for the records. I have been able to plot using bash scripting only, as I don't know awk...
Code:
cp -f postProcessing/domain2/minMax/0/field* minMax.dat sed -i -e '/p/d' minMax.dat sed -i -e '/U/d' minMax.dat gnuplot.exe //.exe --> I'm running openfoam with MySYS2 on windows set title "Max Temperatures" set autoscale xy set grid set ylabel "T [K]" set xlabel "Iterations" plot ' path to the file minMax.dat' using 1:8 w l title "T max" |
|
|
|