#動機
各領域ごとに残差を確認したいと思ったため
#対象
・chtMultiRegionSimpleFoamやchtMultiRegionFoamなどの流体固体熱連成計算
・CentOS上のOpenFOAM-4.xでの使用を想定
#方法
###(1) logファイルが位置しているディレクトリに移動
$ cd ◯◯
###(2) 以下のスクリプトを実行し、logファイル内のデータを領域ごとに分割
$ ./pre_resPlot
pre_resPlot
for i in (流体領域1) (流体領域2) ・・・
do
grep -A 11 $i log >> res_$i
done
for i in (固体領域1) (固体領域2) ・・・
do
grep -A 3 $i log >> res_$i
done
###(3) gnuplotを起動し以下のファイルを読み込み
$ gnuplot
$ load 'resPlot'
resPlot
set terminal png
set output 'image_(流体領域1)'
set logscale y
set title "Residuals"
set ylabel 'Residual'
set xlabel 'Iteration'
plot "< cat res_(流体領域1) | grep 'Solving for Ux' | cut -d' ' -f9 | tr -d ','" title 'Ux' with lines,\
"< cat res_(流体領域1) | grep 'Solving for Uy' | cut -d' ' -f9 | tr -d ','" title 'Uy' with lines,\
"< cat res_(流体領域1) | grep 'Solving for Uz' | cut -d' ' -f9 | tr -d ','" title 'Uz' with lines,\
"< cat res_(流体領域1) | grep 'Solving for epsilon' | cut -d' ' -f9 | tr -d ','" title 'epsiron' with lines,\
"< cat res_(流体領域1) | grep 'Solving for k' | cut -d' ' -f9 | tr -d ','" title 'k' with lines,\
"< cat res_(流体領域1) | grep 'Solving for p' | cut -d' ' -f9 | tr -d ','" title 'p' with lines
set terminal x11
set output
set terminal png
set output 'image_(固体領域1)'
set logscale y
set title "Residuals"
set ylabel 'Residual'
set xlabel 'Iteration'
plot "< cat res_(固体領域1) | grep 'Solving for h' | cut -d' ' -f9 | tr -d ','" title 'h' with lines
set terminal x11
set output