LoginSignup
0
2

More than 5 years have passed since last update.

OpenFOAMのcht計算で各領域ごとの残差を別々に確認する方法

Last updated at Posted at 2017-12-17

動機

各領域ごとに残差を確認したいと思ったため

対象

・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
0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2